W<=0)){var H,q;const W=(((H=i.flip)==null?void 0:H.index)||0)+1,Z=O[W];if(Z)return{data:{index:W,overflows:M},reset:{placement:Z}};let j=(q=M.filter(G=>G.overflows[0]<=0).sort((G,B)=>G.overflows[1]-B.overflows[1])[0])==null?void 0:q.placement;if(!j)switch(m){case"bestFit":{var P;const G=(P=M.filter(B=>{if(_){const X=vo(B.placement);return X===x||X==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(X=>X>0).reduce((X,D)=>X+D,0)]).sort((B,X)=>B[1]-X[1])[0])==null?void 0:P[0];G&&(j=G);break}case"initialPlacement":j=u;break}if(a!==j)return{reset:{placement:j}}}return{}}}};function BR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function UR(e){return J7.some(t=>e[t]>=0)}const cV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=Da(e,t);switch(r){case"referenceHidden":{const i=await eu(t,{...a,elementContext:"reference"}),l=BR(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:UR(l)}}}case"escaped":{const i=await eu(t,{...a,altBoundary:!0}),l=BR(i,n.floating);return{data:{escapedOffsets:l,escaped:UR(l)}}}default:return{}}}}};async function dV(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=Ia(n),u=Rl(n),c=vo(n)==="y",f=["left","top"].includes(l)?-1:1,p=i&&c?-1:1,g=Da(t,e);let{mainAxis:b,crossAxis:m,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(m=u==="end"?S*-1:S),c?{x:m*p,y:b*f}:{x:b*f,y:m*p}}const fV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:l,middlewareData:u}=t,c=await dV(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:l}}}}},pV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:u={fn:A=>{let{x:R,y:x}=A;return{x:R,y:x}}},...c}=Da(e,t),f={x:n,y:r},p=await eu(t,c),g=vo(Ia(a)),b=$k(g);let m=f[b],S=f[g];if(i){const A=b==="y"?"top":"left",R=b==="y"?"bottom":"right",x=m+p[A],T=m-p[R];m=Tx(x,m,T)}if(l){const A=g==="y"?"top":"left",R=g==="y"?"bottom":"right",x=S+p[A],T=S-p[R];S=Tx(x,S,T)}const v=u.fn({...t,[b]:m,[g]:S});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[b]:i,[g]:l}}}}}},gV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:l}=t,{offset:u=0,mainAxis:c=!0,crossAxis:f=!0}=Da(e,t),p={x:n,y:r},g=vo(a),b=$k(g);let m=p[b],S=p[g];const v=Da(u,t),A=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const T=b==="y"?"height":"width",C=i.reference[b]-i.floating[T]+A.mainAxis,N=i.reference[b]+i.reference[T]-A.mainAxis;mN&&(m=N)}if(f){var R,x;const T=b==="y"?"width":"height",C=["top","left"].includes(Ia(a)),N=i.reference[g]-i.floating[T]+(C&&((R=l.offset)==null?void 0:R[g])||0)+(C?0:A.crossAxis),_=i.reference[g]+i.reference[T]+(C?0:((x=l.offset)==null?void 0:x[g])||0)-(C?A.crossAxis:0);S _&&(S=_)}return{[b]:m,[g]:S}}}},hV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:l,elements:u}=t,{apply:c=()=>{},...f}=Da(e,t),p=await eu(t,f),g=Ia(a),b=Rl(a),m=vo(a)==="y",{width:S,height:v}=i.floating;let A,R;g==="top"||g==="bottom"?(A=g,R=b===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(R=g,A=b==="end"?"top":"bottom");const x=v-p.top-p.bottom,T=S-p.left-p.right,C=yo(v-p[A],x),N=yo(S-p[R],T),_=!t.middlewareData.shift;let O=C,z=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(z=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=x),_&&!b){const M=Kn(p.left,0),H=Kn(p.right,0),q=Kn(p.top,0),P=Kn(p.bottom,0);m?z=S-2*(M!==0||H!==0?M+H:Kn(p.left,p.right)):O=v-2*(q!==0||P!==0?q+P:Kn(p.top,p.bottom))}await c({...t,availableWidth:z,availableHeight:O});const I=await l.getDimensions(u.floating);return S!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function mf(){return typeof window<"u"}function Cl(e){return sB(e)?(e.nodeName||"").toLowerCase():"#document"}function Zn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zr(e){var t;return(t=(sB(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sB(e){return mf()?e instanceof Node||e instanceof Zn(e).Node:!1}function Dr(e){return mf()?e instanceof Element||e instanceof Zn(e).Element:!1}function Xr(e){return mf()?e instanceof HTMLElement||e instanceof Zn(e).HTMLElement:!1}function jR(e){return!mf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Zn(e).ShadowRoot}function mu(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ir(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(a)}function mV(e){return["table","td","th"].includes(Cl(e))}function bf(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Wk(e){const t=Yk(),n=Dr(e)?Ir(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function bV(e){let t=So(e);for(;Xr(t)&&!ml(t);){if(Wk(t))return t;if(bf(t))return null;t=So(t)}return null}function Yk(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ml(e){return["html","body","#document"].includes(Cl(e))}function Ir(e){return Zn(e).getComputedStyle(e)}function yf(e){return Dr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function So(e){if(Cl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jR(e)&&e.host||Zr(e);return jR(t)?t.host:t}function uB(e){const t=So(e);return ml(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xr(t)&&mu(t)?t:uB(t)}function tu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=uB(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),l=Zn(a);if(i){const u=Rx(l);return t.concat(l,l.visualViewport||[],mu(a)?a:[],u&&n?tu(u):[])}return t.concat(a,tu(a,[],n))}function Rx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cB(e){const t=Ir(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Xr(e),i=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=Id(n)!==i||Id(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Kk(e){return Dr(e)?e:e.contextElement}function fl(e){const t=Kk(e);if(!Xr(t))return Kr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=cB(t);let l=(i?Id(n.width):n.width)/r,u=(i?Id(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const yV=Kr(0);function dB(e){const t=Zn(e);return!Yk()||!t.visualViewport?yV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vV(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Zn(e)?!1:t}function oi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=Kk(e);let l=Kr(1);t&&(r?Dr(r)&&(l=fl(r)):l=fl(e));const u=vV(i,n,r)?dB(i):Kr(0);let c=(a.left+u.x)/l.x,f=(a.top+u.y)/l.y,p=a.width/l.x,g=a.height/l.y;if(i){const b=Zn(i),m=r&&Dr(r)?Zn(r):r;let S=b,v=Rx(S);for(;v&&r&&m!==S;){const A=fl(v),R=v.getBoundingClientRect(),x=Ir(v),T=R.left+(v.clientLeft+parseFloat(x.paddingLeft))*A.x,C=R.top+(v.clientTop+parseFloat(x.paddingTop))*A.y;c*=A.x,f*=A.y,p*=A.x,g*=A.y,c+=T,f+=C,S=Zn(v),v=Rx(S)}}return Md({width:p,height:g,x:c,y:f})}function Xk(e,t){const n=yf(e).scrollLeft;return t?t.left+n:oi(Zr(e)).left+n}function fB(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-(n?0:Xk(e,r)),i=r.top+t.scrollTop;return{x:a,y:i}}function SV(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",l=Zr(r),u=t?bf(t.floating):!1;if(r===l||u&&i)return n;let c={scrollLeft:0,scrollTop:0},f=Kr(1);const p=Kr(0),g=Xr(r);if((g||!g&&!i)&&((Cl(r)!=="body"||mu(l))&&(c=yf(r)),Xr(r))){const m=oi(r);f=fl(r),p.x=m.x+r.clientLeft,p.y=m.y+r.clientTop}const b=l&&!g&&!i?fB(l,c,!0):Kr(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+p.x+b.x,y:n.y*f.y-c.scrollTop*f.y+p.y+b.y}}function EV(e){return Array.from(e.getClientRects())}function wV(e){const t=Zr(e),n=yf(e),r=e.ownerDocument.body,a=Kn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Kn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Xk(e);const u=-n.scrollTop;return Ir(r).direction==="rtl"&&(l+=Kn(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:l,y:u}}function xV(e,t){const n=Zn(e),r=Zr(e),a=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,c=0;if(a){i=a.width,l=a.height;const f=Yk();(!f||f&&t==="fixed")&&(u=a.offsetLeft,c=a.offsetTop)}return{width:i,height:l,x:u,y:c}}function kV(e,t){const n=oi(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Xr(e)?fl(e):Kr(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,c=a*i.x,f=r*i.y;return{width:l,height:u,x:c,y:f}}function GR(e,t,n){let r;if(t==="viewport")r=xV(e,n);else if(t==="document")r=wV(Zr(e));else if(Dr(t))r=kV(t,n);else{const a=dB(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Md(r)}function pB(e,t){const n=So(e);return n===t||!Dr(n)||ml(n)?!1:Ir(n).position==="fixed"||pB(n,t)}function AV(e,t){const n=t.get(e);if(n)return n;let r=tu(e,[],!1).filter(u=>Dr(u)&&Cl(u)!=="body"),a=null;const i=Ir(e).position==="fixed";let l=i?So(e):e;for(;Dr(l)&&!ml(l);){const u=Ir(l),c=Wk(l);!c&&u.position==="fixed"&&(a=null),(i?!c&&!a:!c&&u.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||mu(l)&&!c&&pB(e,l))?r=r.filter(p=>p!==l):a=u,l=So(l)}return t.set(e,r),r}function TV(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?bf(t)?[]:AV(t,this._c):[].concat(n),r],u=l[0],c=l.reduce((f,p)=>{const g=GR(t,p,a);return f.top=Kn(g.top,f.top),f.right=yo(g.right,f.right),f.bottom=yo(g.bottom,f.bottom),f.left=Kn(g.left,f.left),f},GR(t,u,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function _V(e){const{width:t,height:n}=cB(e);return{width:t,height:n}}function RV(e,t,n){const r=Xr(t),a=Zr(t),i=n==="fixed",l=oi(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const c=Kr(0);if(r||!r&&!i)if((Cl(t)!=="body"||mu(a))&&(u=yf(t)),r){const b=oi(t,!0,i,t);c.x=b.x+t.clientLeft,c.y=b.y+t.clientTop}else a&&(c.x=Xk(a));const f=a&&!r&&!i?fB(a,u):Kr(0),p=l.left+u.scrollLeft-c.x-f.x,g=l.top+u.scrollTop-c.y-f.y;return{x:p,y:g,width:l.width,height:l.height}}function Sh(e){return Ir(e).position==="static"}function HR(e,t){if(!Xr(e)||Ir(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zr(e)===n&&(n=n.ownerDocument.body),n}function gB(e,t){const n=Zn(e);if(bf(e))return n;if(!Xr(e)){let a=So(e);for(;a&&!ml(a);){if(Dr(a)&&!Sh(a))return a;a=So(a)}return n}let r=HR(e,t);for(;r&&mV(r)&&Sh(r);)r=HR(r,t);return r&&ml(r)&&Sh(r)&&!Wk(r)?n:r||bV(e)||n}const CV=async function(e){const t=this.getOffsetParent||gB,n=this.getDimensions,r=await n(e.floating);return{reference:RV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NV(e){return Ir(e).direction==="rtl"}const OV={convertOffsetParentRelativeRectToViewportRelativeRect:SV,getDocumentElement:Zr,getClippingRect:TV,getOffsetParent:gB,getElementRects:CV,getClientRects:EV,getDimensions:_V,getScale:fl,isElement:Dr,isRTL:NV};function hB(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function DV(e,t){let n=null,r;const a=Zr(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),i();const f=e.getBoundingClientRect(),{left:p,top:g,width:b,height:m}=f;if(u||t(),!b||!m)return;const S=Hc(g),v=Hc(a.clientWidth-(p+b)),A=Hc(a.clientHeight-(g+m)),R=Hc(p),T={rootMargin:-S+"px "+-v+"px "+-A+"px "+-R+"px",threshold:Kn(0,yo(1,c))||1};let C=!0;function N(_){const O=_[0].intersectionRatio;if(O!==c){if(!C)return l();O?l(!1,O):r=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!hB(f,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(N,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(N,T)}n.observe(e)}return l(!0),i}function IV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,f=Kk(e),p=a||i?[...f?tu(f):[],...tu(t)]:[];p.forEach(R=>{a&&R.addEventListener("scroll",n,{passive:!0}),i&&R.addEventListener("resize",n)});const g=f&&u?DV(f,n):null;let b=-1,m=null;l&&(m=new ResizeObserver(R=>{let[x]=R;x&&x.target===f&&m&&(m.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=m)==null||T.observe(t)})),n()}),f&&!c&&m.observe(f),m.observe(t));let S,v=c?oi(e):null;c&&A();function A(){const R=oi(e);v&&!hB(v,R)&&n(),v=R,S=requestAnimationFrame(A)}return n(),()=>{var R;p.forEach(x=>{a&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),g==null||g(),(R=m)==null||R.disconnect(),m=null,c&&cancelAnimationFrame(S)}}const LV=fV,MV=pV,FV=uV,zV=hV,PV=cV,$R=sV,BV=gV,UV=(e,t,n)=>{const r=new Map,a={platform:OV,...n},i={...a.platform,_c:r};return lV(e,t,{...a,platform:i})};var bd=typeof document<"u"?k.useLayoutEffect:k.useEffect;function Fd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fd(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Fd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function mB(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qR(e,t){const n=mB(e);return Math.round(t*n)/n}function Eh(e){const t=k.useRef(e);return bd(()=>{t.current=e}),t}function jV(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:c,open:f}=e,[p,g]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,m]=k.useState(r);Fd(b,r)||m(r);const[S,v]=k.useState(null),[A,R]=k.useState(null),x=k.useCallback(B=>{B!==_.current&&(_.current=B,v(B))},[]),T=k.useCallback(B=>{B!==O.current&&(O.current=B,R(B))},[]),C=i||S,N=l||A,_=k.useRef(null),O=k.useRef(null),z=k.useRef(p),I=c!=null,M=Eh(c),H=Eh(a),q=Eh(f),P=k.useCallback(()=>{if(!_.current||!O.current)return;const B={placement:t,strategy:n,middleware:b};H.current&&(B.platform=H.current),UV(_.current,O.current,B).then(X=>{const D={...X,isPositioned:q.current!==!1};W.current&&!Fd(z.current,D)&&(z.current=D,gu.flushSync(()=>{g(D)}))})},[b,t,n,H,q]);bd(()=>{f===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,g(B=>({...B,isPositioned:!1})))},[f]);const W=k.useRef(!1);bd(()=>(W.current=!0,()=>{W.current=!1}),[]),bd(()=>{if(C&&(_.current=C),N&&(O.current=N),C&&N){if(M.current)return M.current(C,N,P);P()}},[C,N,P,M,I]);const Z=k.useMemo(()=>({reference:_,floating:O,setReference:x,setFloating:T}),[x,T]),j=k.useMemo(()=>({reference:C,floating:N}),[C,N]),G=k.useMemo(()=>{const B={position:n,left:0,top:0};if(!j.floating)return B;const X=qR(j.floating,p.x),D=qR(j.floating,p.y);return u?{...B,transform:"translate("+X+"px, "+D+"px)",...mB(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:D}},[n,u,j.floating,p.x,p.y]);return k.useMemo(()=>({...p,update:P,refs:Z,elements:j,floatingStyles:G}),[p,P,Z,j,G])}const GV=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?$R({element:r.current,padding:a}).fn(n):{}:r?$R({element:r,padding:a}).fn(n):{}}}},HV=(e,t)=>({...LV(e),options:[e,t]}),$V=(e,t)=>({...MV(e),options:[e,t]}),qV=(e,t)=>({...BV(e),options:[e,t]}),VV=(e,t)=>({...FV(e),options:[e,t]}),WV=(e,t)=>({...zV(e),options:[e,t]}),YV=(e,t)=>({...PV(e),options:[e,t]}),KV=(e,t)=>({...GV(e),options:[e,t]});var XV="Arrow",bB=k.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return w.jsx(Xe.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});bB.displayName=XV;var ZV=bB;function yB(e){const[t,n]=k.useState(void 0);return wn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let l,u;if("borderBoxSize"in i){const c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Zk="Popper",[vB,Nl]=mr(Zk),[QV,SB]=vB(Zk),EB=e=>{const{__scopePopper:t,children:n}=e,[r,a]=k.useState(null);return w.jsx(QV,{scope:t,anchor:r,onAnchorChange:a,children:n})};EB.displayName=Zk;var wB="PopperAnchor",xB=k.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=SB(wB,n),l=k.useRef(null),u=ft(t,l);return k.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:w.jsx(Xe.div,{...a,ref:u})});xB.displayName=wB;var Qk="PopperContent",[JV,eW]=vB(Qk),kB=k.forwardRef((e,t)=>{var re,le,Ae,ae,we,xe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:b=!1,updatePositionStrategy:m="optimized",onPlaced:S,...v}=e,A=SB(Qk,n),[R,x]=k.useState(null),T=ft(t,Ie=>x(Ie)),[C,N]=k.useState(null),_=yB(C),O=(_==null?void 0:_.width)??0,z=(_==null?void 0:_.height)??0,I=r+(i!=="center"?"-"+i:""),M=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},H=Array.isArray(f)?f:[f],q=H.length>0,P={padding:M,boundary:H.filter(nW),altBoundary:q},{refs:W,floatingStyles:Z,placement:j,isPositioned:G,middlewareData:B}=jV({strategy:"fixed",placement:I,whileElementsMounted:(...Ie)=>IV(...Ie,{animationFrame:m==="always"}),elements:{reference:A.anchor},middleware:[HV({mainAxis:a+z,alignmentAxis:l}),c&&$V({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?qV():void 0,...P}),c&&VV({...P}),WV({...P,apply:({elements:Ie,rects:Ce,availableWidth:Ee,availableHeight:J})=>{const{width:fe,height:ke}=Ce.reference,me=Ie.floating.style;me.setProperty("--radix-popper-available-width",`${Ee}px`),me.setProperty("--radix-popper-available-height",`${J}px`),me.setProperty("--radix-popper-anchor-width",`${fe}px`),me.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),C&&KV({element:C,padding:u}),rW({arrowWidth:O,arrowHeight:z}),b&&YV({strategy:"referenceHidden",...P})]}),[X,D]=_B(j),V=pn(S);wn(()=>{G&&(V==null||V())},[G,V]);const U=(re=B.arrow)==null?void 0:re.x,L=(le=B.arrow)==null?void 0:le.y,Y=((Ae=B.arrow)==null?void 0:Ae.centerOffset)!==0,[Q,se]=k.useState();return wn(()=>{R&&se(window.getComputedStyle(R).zIndex)},[R]),w.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:G?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ae=B.transformOrigin)==null?void 0:ae.x,(we=B.transformOrigin)==null?void 0:we.y].join(" "),...((xe=B.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(JV,{scope:n,placedSide:X,onArrowChange:N,arrowX:U,arrowY:L,shouldHideArrow:Y,children:w.jsx(Xe.div,{"data-side":X,"data-align":D,...v,ref:T,style:{...v.style,animation:G?void 0:"none"}})})})});kB.displayName=Qk;var AB="PopperArrow",tW={top:"bottom",right:"left",bottom:"top",left:"right"},TB=k.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=eW(AB,r),l=tW[i.placedSide];return w.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:w.jsx(ZV,{...a,ref:n,style:{...a.style,display:"block"}})})});TB.displayName=AB;function nW(e){return e!==null}var rW=e=>({name:"transformOrigin",options:e,fn(t){var A,R,x;const{placement:n,rects:r,middlewareData:a}=t,l=((A=a.arrow)==null?void 0:A.centerOffset)!==0,u=l?0:e.arrowWidth,c=l?0:e.arrowHeight,[f,p]=_B(n),g={start:"0%",center:"50%",end:"100%"}[p],b=(((R=a.arrow)==null?void 0:R.x)??0)+u/2,m=(((x=a.arrow)==null?void 0:x.y)??0)+c/2;let S="",v="";return f==="bottom"?(S=l?g:`${b}px`,v=`${-c}px`):f==="top"?(S=l?g:`${b}px`,v=`${r.floating.height+c}px`):f==="right"?(S=`${-c}px`,v=l?g:`${m}px`):f==="left"&&(S=`${r.floating.width+c}px`,v=l?g:`${m}px`),{data:{x:S,y:v}}}});function _B(e){const[t,n="center"]=e.split("-");return[t,n]}var Jk=EB,vf=xB,e0=kB,t0=TB,aW="VisuallyHidden",n0=k.forwardRef((e,t)=>w.jsx(Xe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));n0.displayName=aW;var oW=n0,[Sf,Jye]=mr("Tooltip",[Nl]),Ef=Nl(),RB="TooltipProvider",iW=700,Cx="tooltip.open",[lW,r0]=Sf(RB),CB=e=>{const{__scopeTooltip:t,delayDuration:n=iW,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,[l,u]=k.useState(!0),c=k.useRef(!1),f=k.useRef(0);return k.useEffect(()=>{const p=f.current;return()=>window.clearTimeout(p)},[]),w.jsx(lW,{scope:t,isOpenDelayed:l,delayDuration:n,onOpen:k.useCallback(()=>{window.clearTimeout(f.current),u(!1)},[]),onClose:k.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:k.useCallback(p=>{c.current=p},[]),disableHoverableContent:a,children:i})};CB.displayName=RB;var wf="Tooltip",[sW,xf]=Sf(wf),NB=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a=!1,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,c=r0(wf,e.__scopeTooltip),f=Ef(t),[p,g]=k.useState(null),b=En(),m=k.useRef(0),S=l??c.disableHoverableContent,v=u??c.delayDuration,A=k.useRef(!1),[R=!1,x]=Oa({prop:r,defaultProp:a,onChange:O=>{O?(c.onOpen(),document.dispatchEvent(new CustomEvent(Cx))):c.onClose(),i==null||i(O)}}),T=k.useMemo(()=>R?A.current?"delayed-open":"instant-open":"closed",[R]),C=k.useCallback(()=>{window.clearTimeout(m.current),m.current=0,A.current=!1,x(!0)},[x]),N=k.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x(!1)},[x]),_=k.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{A.current=!0,x(!0),m.current=0},v)},[v,x]);return k.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),w.jsx(Jk,{...f,children:w.jsx(sW,{scope:t,contentId:b,open:R,stateAttribute:T,trigger:p,onTriggerChange:g,onTriggerEnter:k.useCallback(()=>{c.isOpenDelayed?_():C()},[c.isOpenDelayed,_,C]),onTriggerLeave:k.useCallback(()=>{S?N():(window.clearTimeout(m.current),m.current=0)},[N,S]),onOpen:C,onClose:N,disableHoverableContent:S,children:n})})};NB.displayName=wf;var Nx="TooltipTrigger",OB=k.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=xf(Nx,n),i=r0(Nx,n),l=Ef(n),u=k.useRef(null),c=ft(t,u,a.onTriggerChange),f=k.useRef(!1),p=k.useRef(!1),g=k.useCallback(()=>f.current=!1,[]);return k.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),w.jsx(vf,{asChild:!0,...l,children:w.jsx(Xe.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:Ye(e.onPointerMove,b=>{b.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ye(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:Ye(e.onPointerDown,()=>{f.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Ye(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:Ye(e.onBlur,a.onClose),onClick:Ye(e.onClick,a.onClose)})})});OB.displayName=Nx;var uW="TooltipPortal",[eve,cW]=Sf(uW,{forceMount:void 0}),bl="TooltipContent",DB=k.forwardRef((e,t)=>{const n=cW(bl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,l=xf(bl,e.__scopeTooltip);return w.jsx(Jn,{present:r||l.open,children:l.disableHoverableContent?w.jsx(IB,{side:a,...i,ref:t}):w.jsx(dW,{side:a,...i,ref:t})})}),dW=k.forwardRef((e,t)=>{const n=xf(bl,e.__scopeTooltip),r=r0(bl,e.__scopeTooltip),a=k.useRef(null),i=ft(t,a),[l,u]=k.useState(null),{trigger:c,onClose:f}=n,p=a.current,{onPointerInTransitChange:g}=r,b=k.useCallback(()=>{u(null),g(!1)},[g]),m=k.useCallback((S,v)=>{const A=S.currentTarget,R={x:S.clientX,y:S.clientY},x=hW(R,A.getBoundingClientRect()),T=mW(R,x),C=bW(v.getBoundingClientRect()),N=vW([...T,...C]);u(N),g(!0)},[g]);return k.useEffect(()=>()=>b(),[b]),k.useEffect(()=>{if(c&&p){const S=A=>m(A,p),v=A=>m(A,c);return c.addEventListener("pointerleave",S),p.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",S),p.removeEventListener("pointerleave",v)}}},[c,p,m,b]),k.useEffect(()=>{if(l){const S=v=>{const A=v.target,R={x:v.clientX,y:v.clientY},x=(c==null?void 0:c.contains(A))||(p==null?void 0:p.contains(A)),T=!yW(R,l);x?b():T&&(b(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[c,p,l,f,b]),w.jsx(IB,{...e,ref:i})}),[fW,pW]=Sf(wf,{isInside:!1}),IB=k.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:l,...u}=e,c=xf(bl,n),f=Ef(n),{onClose:p}=c;return k.useEffect(()=>(document.addEventListener(Cx,p),()=>document.removeEventListener(Cx,p)),[p]),k.useEffect(()=>{if(c.trigger){const g=b=>{const m=b.target;m!=null&&m.contains(c.trigger)&&p()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[c.trigger,p]),w.jsx(hu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:g=>g.preventDefault(),onDismiss:p,children:w.jsxs(e0,{"data-state":c.stateAttribute,...f,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[w.jsx(Dk,{children:r}),w.jsx(fW,{scope:n,isInside:!0,children:w.jsx(oW,{id:c.contentId,role:"tooltip",children:a||r})})]})})});DB.displayName=bl;var LB="TooltipArrow",gW=k.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Ef(n);return pW(LB,n).isInside?null:w.jsx(t0,{...a,...r,ref:t})});gW.displayName=LB;function hW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function mW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function bW(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function yW(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,l=t.length-1;i r!=p>r&&n<(f-u)*(r-c)/(p-c)+u&&(a=!a)}return a}function vW(e){const t=e.slice();return t.sort((n,r)=>n.x r.x?1:n.y r.y?1:0),SW(t)}function SW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r =2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(a.y-l.y)>=(i.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var EW=CB,wW=NB,xW=OB,MB=DB;const FB=EW,zB=wW,PB=xW,kW=e=>typeof e!="string"?e:e.split("\\n").map((t,n)=>w.jsxs(k.Fragment,{children:[t,n w.jsx(MB,{ref:a,sideOffset:t,className:Me("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 mx-1 max-w-sm overflow-hidden rounded-md border px-3 py-2 text-sm shadow-md",e),...r,children:typeof n=="string"?kW(n):n}));a0.displayName=MB.displayName;const zd=Nz("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-8"}},defaultVariants:{variant:"default",size:"default"}}),Lt=k.forwardRef(({className:e,variant:t,tooltip:n,size:r,side:a="right",asChild:i=!1,...l},u)=>{const c=i?bo:"button";return n?w.jsx(FB,{children:w.jsxs(zB,{children:[w.jsx(PB,{asChild:!0,children:w.jsx(c,{className:Me(zd({variant:t,size:r,className:e}),"cursor-pointer"),ref:u,...l})}),w.jsx(a0,{side:a,children:n})]})}):w.jsx(c,{className:Me(zd({variant:t,size:r,className:e}),"cursor-pointer"),ref:u,...l})});Lt.displayName="Button";const AW=Z7,TW=Q7,BB=k.forwardRef(({className:e,...t},n)=>w.jsx(tB,{className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...t,ref:n}));BB.displayName=tB.displayName;const UB=k.forwardRef(({className:e,...t},n)=>w.jsxs(TW,{children:[w.jsx(BB,{}),w.jsx(nB,{ref:n,className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...t})]}));UB.displayName=nB.displayName;const jB=({className:e,...t})=>w.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});jB.displayName="AlertDialogHeader";const GB=k.forwardRef(({className:e,...t},n)=>w.jsx(oB,{ref:n,className:Me("text-lg font-semibold",e),...t}));GB.displayName=oB.displayName;const HB=k.forwardRef(({className:e,...t},n)=>w.jsx(iB,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));HB.displayName=iB.displayName;const _W=k.forwardRef(({className:e,...t},n)=>w.jsx(rB,{ref:n,className:Me(zd(),e),...t}));_W.displayName=rB.displayName;const RW=k.forwardRef(({className:e,...t},n)=>w.jsx(aB,{ref:n,className:Me(zd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));RW.displayName=aB.displayName;const Eo=k.forwardRef(({className:e,type:t,...n},r)=>w.jsx("input",{type:t,className:Me("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 rounded-md border bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm [&::-webkit-inner-spin-button]:opacity-100 [&::-webkit-outer-spin-button]:opacity-100",e),ref:r,...n}));Eo.displayName="Input";var CW=e=>{switch(e){case"success":return DW;case"info":return LW;case"warning":return IW;case"error":return MW;default:return null}},NW=Array(12).fill(0),OW=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},NW.map((n,r)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),DW=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),IW=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),LW=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),MW=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),FW=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),zW=()=>{let[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Ox=1,PW=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Ox++,i=this.toasts.find(u=>u.id===a),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(u=>u.id===a?(this.publish({...u,...e,id:a,title:n}),{...u,...e,id:a,dismissible:l,title:n}):u):this.addToast({title:n,...r,dismissible:l,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,i,l=r.then(async c=>{if(i=["resolve",c],ye.isValidElement(c))a=!1,this.create({id:n,type:"default",message:c});else if(UW(c)&&!c.ok){a=!1;let f=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:f,description:p})}else if(t.success!==void 0){a=!1;let f=typeof t.success=="function"?await t.success(c):t.success,p=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:f,description:p})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){a=!1;let f=typeof t.error=="function"?await t.error(c):t.error,p=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:f,description:p})}}).finally(()=>{var c;a&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),u=()=>new Promise((c,f)=>l.then(()=>i[0]==="reject"?f(i[1]):c(i[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:u}:Object.assign(n,{unwrap:u})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Ox++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Fn=new PW,BW=(e,t)=>{let n=(t==null?void 0:t.id)||Ox++;return Fn.addToast({title:e,...t,id:n}),n},UW=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",jW=BW,GW=()=>Fn.toasts,HW=()=>Fn.getActiveToasts(),vn=Object.assign(jW,{success:Fn.success,info:Fn.info,warning:Fn.warning,error:Fn.error,custom:Fn.custom,message:Fn.message,promise:Fn.promise,dismiss:Fn.dismiss,loading:Fn.loading},{getHistory:GW,getToasts:HW});function $W(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}$W(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function $c(e){return e.label!==void 0}var qW=3,VW="32px",WW="16px",VR=4e3,YW=356,KW=14,XW=20,ZW=200;function Ar(...e){return e.filter(Boolean).join(" ")}function QW(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var JW=e=>{var t,n,r,a,i,l,u,c,f,p,g;let{invert:b,toast:m,unstyled:S,interacting:v,setHeights:A,visibleToasts:R,heights:x,index:T,toasts:C,expanded:N,removeToast:_,defaultRichColors:O,closeButton:z,style:I,cancelButtonStyle:M,actionButtonStyle:H,className:q="",descriptionClassName:P="",duration:W,position:Z,gap:j,loadingIcon:G,expandByDefault:B,classNames:X,icons:D,closeButtonAriaLabel:V="Close toast",pauseWhenPageIsHidden:U}=e,[L,Y]=ye.useState(null),[Q,se]=ye.useState(null),[re,le]=ye.useState(!1),[Ae,ae]=ye.useState(!1),[we,xe]=ye.useState(!1),[Ie,Ce]=ye.useState(!1),[Ee,J]=ye.useState(!1),[fe,ke]=ye.useState(0),[me,ve]=ye.useState(0),ie=ye.useRef(m.duration||W||VR),ze=ye.useRef(null),Pe=ye.useRef(null),he=T===0,Ne=T+1<=R,ee=m.type,ce=m.dismissible!==!1,Re=m.className||"",Fe=m.descriptionClassName||"",qe=ye.useMemo(()=>x.findIndex(Ke=>Ke.toastId===m.id)||0,[x,m.id]),mt=ye.useMemo(()=>{var Ke;return(Ke=m.closeButton)!=null?Ke:z},[m.closeButton,z]),St=ye.useMemo(()=>m.duration||W||VR,[m.duration,W]),pt=ye.useRef(0),Je=ye.useRef(0),wt=ye.useRef(0),rt=ye.useRef(null),[bt,Bt]=Z.split("-"),sn=ye.useMemo(()=>x.reduce((Ke,gt,_t)=>_t>=qe?Ke:Ke+gt.height,0),[x,qe]),Mt=zW(),er=m.invert||b,zr=ee==="loading";Je.current=ye.useMemo(()=>qe*j+sn,[qe,sn]),ye.useEffect(()=>{ie.current=St},[St]),ye.useEffect(()=>{le(!0)},[]),ye.useEffect(()=>{let Ke=Pe.current;if(Ke){let gt=Ke.getBoundingClientRect().height;return ve(gt),A(_t=>[{toastId:m.id,height:gt,position:m.position},..._t]),()=>A(_t=>_t.filter(Rn=>Rn.toastId!==m.id))}},[A,m.id]),ye.useLayoutEffect(()=>{if(!re)return;let Ke=Pe.current,gt=Ke.style.height;Ke.style.height="auto";let _t=Ke.getBoundingClientRect().height;Ke.style.height=gt,ve(_t),A(Rn=>Rn.find(kn=>kn.toastId===m.id)?Rn.map(kn=>kn.toastId===m.id?{...kn,height:_t}:kn):[{toastId:m.id,height:_t,position:m.position},...Rn])},[re,m.title,m.description,A,m.id]);let Kt=ye.useCallback(()=>{ae(!0),ke(Je.current),A(Ke=>Ke.filter(gt=>gt.toastId!==m.id)),setTimeout(()=>{_(m)},ZW)},[m,_,A,Je]);ye.useEffect(()=>{if(m.promise&&ee==="loading"||m.duration===1/0||m.type==="loading")return;let Ke;return N||v||U&&Mt?(()=>{if(wt.current {var gt;(gt=m.onAutoClose)==null||gt.call(m,m),Kt()},ie.current)),()=>clearTimeout(Ke)},[N,v,m,ee,U,Mt,Kt]),ye.useEffect(()=>{m.delete&&Kt()},[Kt,m.delete]);function na(){var Ke,gt,_t;return D!=null&&D.loading?ye.createElement("div",{className:Ar(X==null?void 0:X.loader,(Ke=m==null?void 0:m.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":ee==="loading"},D.loading):G?ye.createElement("div",{className:Ar(X==null?void 0:X.loader,(gt=m==null?void 0:m.classNames)==null?void 0:gt.loader,"sonner-loader"),"data-visible":ee==="loading"},G):ye.createElement(OW,{className:Ar(X==null?void 0:X.loader,(_t=m==null?void 0:m.classNames)==null?void 0:_t.loader),visible:ee==="loading"})}return ye.createElement("li",{tabIndex:0,ref:Pe,className:Ar(q,Re,X==null?void 0:X.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,X==null?void 0:X.default,X==null?void 0:X[ee],(n=m==null?void 0:m.classNames)==null?void 0:n[ee]),"data-sonner-toast":"","data-rich-colors":(r=m.richColors)!=null?r:O,"data-styled":!(m.jsx||m.unstyled||S),"data-mounted":re,"data-promise":!!m.promise,"data-swiped":Ee,"data-removed":Ae,"data-visible":Ne,"data-y-position":bt,"data-x-position":Bt,"data-index":T,"data-front":he,"data-swiping":we,"data-dismissible":ce,"data-type":ee,"data-invert":er,"data-swipe-out":Ie,"data-swipe-direction":Q,"data-expanded":!!(N||B&&re),style:{"--index":T,"--toasts-before":T,"--z-index":C.length-T,"--offset":`${Ae?fe:Je.current}px`,"--initial-height":B?"auto":`${me}px`,...I,...m.style},onDragEnd:()=>{xe(!1),Y(null),rt.current=null},onPointerDown:Ke=>{zr||!ce||(ze.current=new Date,ke(Je.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(xe(!0),rt.current={x:Ke.clientX,y:Ke.clientY}))},onPointerUp:()=>{var Ke,gt,_t,Rn;if(Ie||!ce)return;rt.current=null;let kn=Number(((Ke=Pe.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Cn=Number(((gt=Pe.current)==null?void 0:gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ra=new Date().getTime()-((_t=ze.current)==null?void 0:_t.getTime()),Nn=L==="x"?kn:Cn,Sr=Math.abs(Nn)/ra;if(Math.abs(Nn)>=XW||Sr>.11){ke(Je.current),(Rn=m.onDismiss)==null||Rn.call(m,m),se(L==="x"?kn>0?"right":"left":Cn>0?"down":"up"),Kt(),Ce(!0),J(!1);return}xe(!1),Y(null)},onPointerMove:Ke=>{var gt,_t,Rn,kn;if(!rt.current||!ce||((gt=window.getSelection())==null?void 0:gt.toString().length)>0)return;let Cn=Ke.clientY-rt.current.y,ra=Ke.clientX-rt.current.x,Nn=(_t=e.swipeDirections)!=null?_t:QW(Z);!L&&(Math.abs(ra)>1||Math.abs(Cn)>1)&&Y(Math.abs(ra)>Math.abs(Cn)?"x":"y");let Sr={x:0,y:0};L==="y"?(Nn.includes("top")||Nn.includes("bottom"))&&(Nn.includes("top")&&Cn<0||Nn.includes("bottom")&&Cn>0)&&(Sr.y=Cn):L==="x"&&(Nn.includes("left")||Nn.includes("right"))&&(Nn.includes("left")&&ra<0||Nn.includes("right")&&ra>0)&&(Sr.x=ra),(Math.abs(Sr.x)>0||Math.abs(Sr.y)>0)&&J(!0),(Rn=Pe.current)==null||Rn.style.setProperty("--swipe-amount-x",`${Sr.x}px`),(kn=Pe.current)==null||kn.style.setProperty("--swipe-amount-y",`${Sr.y}px`)}},mt&&!m.jsx?ye.createElement("button",{"aria-label":V,"data-disabled":zr,"data-close-button":!0,onClick:zr||!ce?()=>{}:()=>{var Ke;Kt(),(Ke=m.onDismiss)==null||Ke.call(m,m)},className:Ar(X==null?void 0:X.closeButton,(a=m==null?void 0:m.classNames)==null?void 0:a.closeButton)},(i=D==null?void 0:D.close)!=null?i:FW):null,m.jsx||k.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:ye.createElement(ye.Fragment,null,ee||m.icon||m.promise?ye.createElement("div",{"data-icon":"",className:Ar(X==null?void 0:X.icon,(l=m==null?void 0:m.classNames)==null?void 0:l.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||na():null,m.type!=="loading"?m.icon||(D==null?void 0:D[ee])||CW(ee):null):null,ye.createElement("div",{"data-content":"",className:Ar(X==null?void 0:X.content,(u=m==null?void 0:m.classNames)==null?void 0:u.content)},ye.createElement("div",{"data-title":"",className:Ar(X==null?void 0:X.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?ye.createElement("div",{"data-description":"",className:Ar(P,Fe,X==null?void 0:X.description,(f=m==null?void 0:m.classNames)==null?void 0:f.description)},typeof m.description=="function"?m.description():m.description):null),k.isValidElement(m.cancel)?m.cancel:m.cancel&&$c(m.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||M,onClick:Ke=>{var gt,_t;$c(m.cancel)&&ce&&((_t=(gt=m.cancel).onClick)==null||_t.call(gt,Ke),Kt())},className:Ar(X==null?void 0:X.cancelButton,(p=m==null?void 0:m.classNames)==null?void 0:p.cancelButton)},m.cancel.label):null,k.isValidElement(m.action)?m.action:m.action&&$c(m.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||H,onClick:Ke=>{var gt,_t;$c(m.action)&&((_t=(gt=m.action).onClick)==null||_t.call(gt,Ke),!Ke.defaultPrevented&&Kt())},className:Ar(X==null?void 0:X.actionButton,(g=m==null?void 0:m.classNames)==null?void 0:g.actionButton)},m.action.label):null))};function WR(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function eY(e,t){let n={};return[e,t].forEach((r,a)=>{let i=a===1,l=i?"--mobile-offset":"--offset",u=i?WW:VW;function c(f){["top","right","bottom","left"].forEach(p=>{n[`${l}-${p}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${l}-${f}`]=u:n[`${l}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):c(u)}),n}var tY=k.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:l,className:u,offset:c,mobileOffset:f,theme:p="light",richColors:g,duration:b,style:m,visibleToasts:S=qW,toastOptions:v,dir:A=WR(),gap:R=KW,loadingIcon:x,icons:T,containerAriaLabel:C="Notifications",pauseWhenPageIsHidden:N}=e,[_,O]=ye.useState([]),z=ye.useMemo(()=>Array.from(new Set([r].concat(_.filter(U=>U.position).map(U=>U.position)))),[_,r]),[I,M]=ye.useState([]),[H,q]=ye.useState(!1),[P,W]=ye.useState(!1),[Z,j]=ye.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ye.useRef(null),B=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),X=ye.useRef(null),D=ye.useRef(!1),V=ye.useCallback(U=>{O(L=>{var Y;return(Y=L.find(Q=>Q.id===U.id))!=null&&Y.delete||Fn.dismiss(U.id),L.filter(({id:Q})=>Q!==U.id)})},[]);return ye.useEffect(()=>Fn.subscribe(U=>{if(U.dismiss){O(L=>L.map(Y=>Y.id===U.id?{...Y,delete:!0}:Y));return}setTimeout(()=>{pP.flushSync(()=>{O(L=>{let Y=L.findIndex(Q=>Q.id===U.id);return Y!==-1?[...L.slice(0,Y),{...L[Y],...U},...L.slice(Y+1)]:[U,...L]})})})}),[]),ye.useEffect(()=>{if(p!=="system"){j(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?j("dark"):j("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:L})=>{j(L?"dark":"light")})}catch{U.addListener(({matches:Y})=>{try{j(Y?"dark":"light")}catch(Q){console.error(Q)}})}},[p]),ye.useEffect(()=>{_.length<=1&&q(!1)},[_]),ye.useEffect(()=>{let U=L=>{var Y,Q;a.every(se=>L[se]||L.code===se)&&(q(!0),(Y=G.current)==null||Y.focus()),L.code==="Escape"&&(document.activeElement===G.current||(Q=G.current)!=null&&Q.contains(document.activeElement))&&q(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[a]),ye.useEffect(()=>{if(G.current)return()=>{X.current&&(X.current.focus({preventScroll:!0}),X.current=null,D.current=!1)}},[G.current]),ye.createElement("section",{ref:t,"aria-label":`${C} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},z.map((U,L)=>{var Y;let[Q,se]=U.split("-");return _.length?ye.createElement("ol",{key:U,dir:A==="auto"?WR():A,tabIndex:-1,ref:G,className:u,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":Q,"data-lifted":H&&_.length>1&&!i,"data-x-position":se,style:{"--front-toast-height":`${((Y=I[0])==null?void 0:Y.height)||0}px`,"--width":`${YW}px`,"--gap":`${R}px`,...m,...eY(c,f)},onBlur:re=>{D.current&&!re.currentTarget.contains(re.relatedTarget)&&(D.current=!1,X.current&&(X.current.focus({preventScroll:!0}),X.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||D.current||(D.current=!0,X.current=re.relatedTarget)},onMouseEnter:()=>q(!0),onMouseMove:()=>q(!0),onMouseLeave:()=>{P||q(!1)},onDragEnd:()=>q(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},_.filter(re=>!re.position&&L===0||re.position===U).map((re,le)=>{var Ae,ae;return ye.createElement(JW,{key:re.id,icons:T,index:le,toast:re,defaultRichColors:g,duration:(Ae=v==null?void 0:v.duration)!=null?Ae:b,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:n,visibleToasts:S,closeButton:(ae=v==null?void 0:v.closeButton)!=null?ae:l,interacting:P,position:U,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:V,toasts:_.filter(we=>we.position==re.position),heights:I.filter(we=>we.position==re.position),setHeights:M,expandByDefault:i,gap:R,loadingIcon:x,expanded:H,pauseWhenPageIsHidden:N,swipeDirections:e.swipeDirections})})):null}))});const nY=()=>{const[e,t]=k.useState(!0),n=We.use.apiKey(),[r,a]=k.useState(""),i=Pn.use.message();k.useEffect(()=>{a(n||"")},[n,e]),k.useEffect(()=>{i&&(i.includes(oP)||i.includes(iP))&&t(!0)},[i,t]);const l=k.useCallback(async()=>{if(We.setState({apiKey:r||null}),await Pn.getState().check()){t(!1);return}vn.error("API Key is invalid")},[r]),u=k.useCallback(c=>{a(c.target.value)},[a]);return w.jsx(AW,{open:e,onOpenChange:t,children:w.jsxs(UB,{children:[w.jsxs(jB,{children:[w.jsx(GB,{children:"API Key is required"}),w.jsx(HB,{children:"Please enter your API key"})]}),w.jsxs("form",{className:"flex gap-2",onSubmit:c=>c.preventDefault(),children:[w.jsx(Eo,{type:"password",value:r,onChange:u,placeholder:"Enter your API key",className:"max-h-full w-full min-w-0",autoComplete:"off"}),w.jsx(Lt,{onClick:l,variant:"outline",size:"sm",children:"Save"})]})]})})};var o0="Popover",[$B,tve]=mr(o0,[Nl]),bu=Nl(),[rY,wo]=$B(o0),qB=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:l=!1}=e,u=bu(t),c=k.useRef(null),[f,p]=k.useState(!1),[g=!1,b]=Oa({prop:r,defaultProp:a,onChange:i});return w.jsx(Jk,{...u,children:w.jsx(rY,{scope:t,contentId:En(),triggerRef:c,open:g,onOpenChange:b,onOpenToggle:k.useCallback(()=>b(m=>!m),[b]),hasCustomAnchor:f,onCustomAnchorAdd:k.useCallback(()=>p(!0),[]),onCustomAnchorRemove:k.useCallback(()=>p(!1),[]),modal:l,children:n})})};qB.displayName=o0;var VB="PopoverAnchor",aY=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=wo(VB,n),i=bu(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=a;return k.useEffect(()=>(l(),()=>u()),[l,u]),w.jsx(vf,{...i,...r,ref:t})});aY.displayName=VB;var WB="PopoverTrigger",YB=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=wo(WB,n),i=bu(n),l=ft(t,a.triggerRef),u=w.jsx(Xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":JB(a.open),...r,ref:l,onClick:Ye(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:w.jsx(vf,{asChild:!0,...i,children:u})});YB.displayName=WB;var i0="PopoverPortal",[oY,iY]=$B(i0,{forceMount:void 0}),KB=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=wo(i0,t);return w.jsx(oY,{scope:t,forceMount:n,children:w.jsx(Jn,{present:n||i.open,children:w.jsx(df,{asChild:!0,container:a,children:r})})})};KB.displayName=i0;var yl="PopoverContent",XB=k.forwardRef((e,t)=>{const n=iY(yl,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=wo(yl,e.__scopePopover);return w.jsx(Jn,{present:r||i.open,children:i.modal?w.jsx(lY,{...a,ref:t}):w.jsx(sY,{...a,ref:t})})});XB.displayName=yl;var lY=k.forwardRef((e,t)=>{const n=wo(yl,e.__scopePopover),r=k.useRef(null),a=ft(t,r),i=k.useRef(!1);return k.useEffect(()=>{const l=r.current;if(l)return Lk(l)},[]),w.jsx(pf,{as:bo,allowPinchZoom:!0,children:w.jsx(ZB,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(e.onCloseAutoFocus,l=>{var u;l.preventDefault(),i.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Ye(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,f=u.button===2||c;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),sY=k.forwardRef((e,t)=>{const n=wo(yl,e.__scopePopover),r=k.useRef(!1),a=k.useRef(!1);return w.jsx(ZB,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var c,f;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),ZB=k.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:p,...g}=e,b=wo(yl,n),m=bu(n);return Ik(),w.jsx(cf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:w.jsx(hu,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:p,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onDismiss:()=>b.onOpenChange(!1),children:w.jsx(e0,{"data-state":JB(b.open),role:"dialog",id:b.contentId,...m,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),QB="PopoverClose",uY=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=wo(QB,n);return w.jsx(Xe.button,{type:"button",...r,ref:t,onClick:Ye(e.onClick,()=>a.onOpenChange(!1))})});uY.displayName=QB;var cY="PopoverArrow",dY=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=bu(n);return w.jsx(t0,{...a,...r,ref:t})});dY.displayName=cY;function JB(e){return e?"open":"closed"}var fY=qB,pY=YB,gY=KB,eU=XB;const kf=fY,Af=pY,yu=k.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>w.jsx(gY,{children:w.jsx(eU,{ref:a,align:t,sideOffset:n,className:Me("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 rounded-md border p-4 shadow-md outline-none",e),...r})}));yu.displayName=eU.displayName;const hY=({status:e})=>e?w.jsxs("div",{className:"min-w-[300px] space-y-3 text-sm",children:[w.jsxs("div",{className:"space-y-1",children:[w.jsx("h4",{className:"font-medium",children:"Storage Info"}),w.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[w.jsx("span",{children:"Working Directory:"}),w.jsx("span",{className:"truncate",children:e.working_directory}),w.jsx("span",{children:"Input Directory:"}),w.jsx("span",{className:"truncate",children:e.input_directory})]})]}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("h4",{className:"font-medium",children:"LLM Configuration"}),w.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[w.jsx("span",{children:"LLM Binding:"}),w.jsx("span",{children:e.configuration.llm_binding}),w.jsx("span",{children:"LLM Binding Host:"}),w.jsx("span",{children:e.configuration.llm_binding_host}),w.jsx("span",{children:"LLM Model:"}),w.jsx("span",{children:e.configuration.llm_model}),w.jsx("span",{children:"Max Tokens:"}),w.jsx("span",{children:e.configuration.max_tokens})]})]}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("h4",{className:"font-medium",children:"Embedding Configuration"}),w.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[w.jsx("span",{children:"Embedding Binding:"}),w.jsx("span",{children:e.configuration.embedding_binding}),w.jsx("span",{children:"Embedding Binding Host:"}),w.jsx("span",{children:e.configuration.embedding_binding_host}),w.jsx("span",{children:"Embedding Model:"}),w.jsx("span",{children:e.configuration.embedding_model})]})]}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("h4",{className:"font-medium",children:"Storage Configuration"}),w.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[w.jsx("span",{children:"KV Storage:"}),w.jsx("span",{children:e.configuration.kv_storage}),w.jsx("span",{children:"Doc Status Storage:"}),w.jsx("span",{children:e.configuration.doc_status_storage}),w.jsx("span",{children:"Graph Storage:"}),w.jsx("span",{children:e.configuration.graph_storage}),w.jsx("span",{children:"Vector Storage:"}),w.jsx("span",{children:e.configuration.vector_storage})]})]})]}):w.jsx("div",{className:"text-muted-foreground text-sm",children:"Status information unavailable"}),mY=()=>{const e=Pn.use.health(),t=Pn.use.lastCheckTime(),n=Pn.use.status(),[r,a]=k.useState(!1);return k.useEffect(()=>{a(!0);const i=setTimeout(()=>a(!1),300);return()=>clearTimeout(i)},[t]),w.jsx("div",{className:"fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none",children:w.jsxs(kf,{children:[w.jsx(Af,{asChild:!0,children:w.jsxs("div",{className:"flex cursor-help items-center gap-2",children:[w.jsx("div",{className:Me("h-3 w-3 rounded-full transition-all duration-300","shadow-[0_0_8px_rgba(0,0,0,0.2)]",e?"bg-green-500":"bg-red-500",r&&"scale-125",r&&e&&"shadow-[0_0_12px_rgba(34,197,94,0.4)]",r&&!e&&"shadow-[0_0_12px_rgba(239,68,68,0.4)]")}),w.jsx("span",{className:"text-muted-foreground text-xs",children:e?"Connected":"Disconnected"})]})}),w.jsx(yu,{className:"w-auto",side:"top",align:"end",children:w.jsx(hY,{status:n})})]})})},l0=()=>{const e=k.useContext(Cz);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function bY(){const{theme:e,setTheme:t}=l0(),n=k.useCallback(()=>t("light"),[t]),r=k.useCallback(()=>t("dark"),[t]);return e==="dark"?w.jsx(Lt,{onClick:n,variant:Yr,tooltip:"Switch to light theme",size:"icon",side:"bottom",children:w.jsx(Kq,{})}):w.jsx(Lt,{onClick:r,variant:Yr,tooltip:"Switch to dark theme",size:"icon",side:"bottom",children:w.jsx(u8,{})})}function tU(e){const t=e+"CollectionProvider",[n,r]=mr(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=m=>{const{scope:S,children:v}=m,A=ye.useRef(null),R=ye.useRef(new Map).current;return w.jsx(a,{scope:S,itemMap:R,collectionRef:A,children:v})};l.displayName=t;const u=e+"CollectionSlot",c=ye.forwardRef((m,S)=>{const{scope:v,children:A}=m,R=i(u,v),x=ft(S,R.collectionRef);return w.jsx(bo,{ref:x,children:A})});c.displayName=u;const f=e+"CollectionItemSlot",p="data-radix-collection-item",g=ye.forwardRef((m,S)=>{const{scope:v,children:A,...R}=m,x=ye.useRef(null),T=ft(S,x),C=i(f,v);return ye.useEffect(()=>(C.itemMap.set(x,{ref:x,...R}),()=>void C.itemMap.delete(x))),w.jsx(bo,{[p]:"",ref:T,children:A})});g.displayName=f;function b(m){const S=i(e+"CollectionConsumer",m);return ye.useCallback(()=>{const A=S.collectionRef.current;if(!A)return[];const R=Array.from(A.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((C,N)=>R.indexOf(C.ref.current)-R.indexOf(N.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:c,ItemSlot:g},b,r]}var yY=k.createContext(void 0);function Tf(e){const t=k.useContext(yY);return e||t||"ltr"}var wh="rovingFocusGroup.onEntryFocus",vY={bubbles:!1,cancelable:!0},_f="RovingFocusGroup",[Dx,nU,SY]=tU(_f),[EY,rU]=mr(_f,[SY]),[wY,xY]=EY(_f),aU=k.forwardRef((e,t)=>w.jsx(Dx.Provider,{scope:e.__scopeRovingFocusGroup,children:w.jsx(Dx.Slot,{scope:e.__scopeRovingFocusGroup,children:w.jsx(kY,{...e,ref:t})})}));aU.displayName=_f;var kY=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...g}=e,b=k.useRef(null),m=ft(t,b),S=Tf(i),[v=null,A]=Oa({prop:l,defaultProp:u,onChange:c}),[R,x]=k.useState(!1),T=pn(f),C=nU(n),N=k.useRef(!1),[_,O]=k.useState(0);return k.useEffect(()=>{const z=b.current;if(z)return z.addEventListener(wh,T),()=>z.removeEventListener(wh,T)},[T]),w.jsx(wY,{scope:n,orientation:r,dir:S,loop:a,currentTabStopId:v,onItemFocus:k.useCallback(z=>A(z),[A]),onItemShiftTab:k.useCallback(()=>x(!0),[]),onFocusableItemAdd:k.useCallback(()=>O(z=>z+1),[]),onFocusableItemRemove:k.useCallback(()=>O(z=>z-1),[]),children:w.jsx(Xe.div,{tabIndex:R||_===0?-1:0,"data-orientation":r,...g,ref:m,style:{outline:"none",...e.style},onMouseDown:Ye(e.onMouseDown,()=>{N.current=!0}),onFocus:Ye(e.onFocus,z=>{const I=!N.current;if(z.target===z.currentTarget&&I&&!R){const M=new CustomEvent(wh,vY);if(z.currentTarget.dispatchEvent(M),!M.defaultPrevented){const H=C().filter(j=>j.focusable),q=H.find(j=>j.active),P=H.find(j=>j.id===v),Z=[q,P,...H].filter(Boolean).map(j=>j.ref.current);lU(Z,p)}}N.current=!1}),onBlur:Ye(e.onBlur,()=>x(!1))})})}),oU="RovingFocusGroupItem",iU=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,...l}=e,u=En(),c=i||u,f=xY(oU,n),p=f.currentTabStopId===c,g=nU(n),{onFocusableItemAdd:b,onFocusableItemRemove:m}=f;return k.useEffect(()=>{if(r)return b(),()=>m()},[r,b,m]),w.jsx(Dx.ItemSlot,{scope:n,id:c,focusable:r,active:a,children:w.jsx(Xe.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ye(e.onMouseDown,S=>{r?f.onItemFocus(c):S.preventDefault()}),onFocus:Ye(e.onFocus,()=>f.onItemFocus(c)),onKeyDown:Ye(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const v=_Y(S,f.orientation,f.dir);if(v!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=g().filter(x=>x.focusable).map(x=>x.ref.current);if(v==="last")R.reverse();else if(v==="prev"||v==="next"){v==="prev"&&R.reverse();const x=R.indexOf(S.currentTarget);R=f.loop?RY(R,x+1):R.slice(x+1)}setTimeout(()=>lU(R))}})})})});iU.displayName=oU;var AY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function TY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _Y(e,t,n){const r=TY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return AY[r]}function lU(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function RY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var CY=aU,NY=iU,s0="Tabs",[OY,nve]=mr(s0,[rU]),sU=rU(),[DY,u0]=OY(s0),uU=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:l="horizontal",dir:u,activationMode:c="automatic",...f}=e,p=Tf(u),[g,b]=Oa({prop:r,onChange:a,defaultProp:i});return w.jsx(DY,{scope:n,baseId:En(),value:g,onValueChange:b,orientation:l,dir:p,activationMode:c,children:w.jsx(Xe.div,{dir:p,"data-orientation":l,...f,ref:t})})});uU.displayName=s0;var cU="TabsList",dU=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,i=u0(cU,n),l=sU(n);return w.jsx(CY,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:w.jsx(Xe.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});dU.displayName=cU;var fU="TabsTrigger",pU=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=e,l=u0(fU,n),u=sU(n),c=mU(l.baseId,r),f=bU(l.baseId,r),p=r===l.value;return w.jsx(NY,{asChild:!0,...u,focusable:!a,active:p,children:w.jsx(Xe.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:Ye(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?l.onValueChange(r):g.preventDefault()}),onKeyDown:Ye(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&l.onValueChange(r)}),onFocus:Ye(e.onFocus,()=>{const g=l.activationMode!=="manual";!p&&!a&&g&&l.onValueChange(r)})})})});pU.displayName=fU;var gU="TabsContent",hU=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...l}=e,u=u0(gU,n),c=mU(u.baseId,r),f=bU(u.baseId,r),p=r===u.value,g=k.useRef(p);return k.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),w.jsx(Jn,{present:a||p,children:({present:b})=>w.jsx(Xe.div,{"data-state":p?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!b,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:b&&i})})});hU.displayName=gU;function mU(e,t){return`${e}-trigger-${t}`}function bU(e,t){return`${e}-content-${t}`}var IY=uU,yU=dU,vU=pU,SU=hU;const LY=IY,EU=k.forwardRef(({className:e,...t},n)=>w.jsx(yU,{ref:n,className:Me("bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1",e),...t}));EU.displayName=yU.displayName;const wU=k.forwardRef(({className:e,...t},n)=>w.jsx(vU,{ref:n,className:Me("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",e),...t}));wU.displayName=vU.displayName;const Vs=k.forwardRef(({className:e,...t},n)=>w.jsx(SU,{ref:n,className:Me("ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t}));Vs.displayName=SU.displayName;function qc({value:e,currentTab:t,children:n}){return w.jsx(wU,{value:e,className:Me("cursor-pointer px-2 py-1 transition-all",t===e?"!bg-emerald-400 !text-zinc-50":"hover:bg-background/60"),children:n})}function MY(){const e=We.use.currentTab();return w.jsx("div",{className:"flex h-8 self-center",children:w.jsxs(EU,{className:"h-full gap-2",children:[w.jsx(qc,{value:"documents",currentTab:e,children:"Documents"}),w.jsx(qc,{value:"knowledge-graph",currentTab:e,children:"Knowledge Graph"}),w.jsx(qc,{value:"retrieval",currentTab:e,children:"Retrieval"}),w.jsx(qc,{value:"api",currentTab:e,children:"API"})]})})}function FY(){return w.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[w.jsxs("a",{href:"/",className:"mr-6 flex items-center gap-2",children:[w.jsx(p8,{className:"size-4 text-emerald-400","aria-hidden":"true"}),w.jsx("span",{className:"font-bold md:inline-block",children:sR.name})]}),w.jsx("div",{className:"flex h-10 flex-1 justify-center",children:w.jsx(MY,{})}),w.jsxs("nav",{className:"flex items-center",children:[w.jsx(Lt,{variant:"ghost",size:"icon",side:"bottom",tooltip:"Project Repository",children:w.jsx("a",{href:sR.github,target:"_blank",rel:"noopener noreferrer",children:w.jsx(Pq,{className:"size-4","aria-hidden":"true"})})}),w.jsx(bY,{})]})]})}var Vc={exports:{}},YR;function zY(){if(YR)return Vc.exports;YR=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(N,_,O){return Function.prototype.apply.call(N,_,O)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(N){return Object.getOwnPropertyNames(N).concat(Object.getOwnPropertySymbols(N))}:n=function(N){return Object.getOwnPropertyNames(N)};function r(C){console&&console.warn&&console.warn(C)}var a=Number.isNaN||function(N){return N!==N};function i(){i.init.call(this)}Vc.exports=i,Vc.exports.once=R,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var l=10;function u(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(C){if(typeof C!="number"||C<0||a(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");l=C}}),i.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},i.prototype.setMaxListeners=function(N){if(typeof N!="number"||N<0||a(N))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+N+".");return this._maxListeners=N,this};function c(C){return C._maxListeners===void 0?i.defaultMaxListeners:C._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(N){for(var _=[],O=1;O 0&&(M=_[0]),M instanceof Error)throw M;var H=new Error("Unhandled error."+(M?" ("+M.message+")":""));throw H.context=M,H}var q=I[N];if(q===void 0)return!1;if(typeof q=="function")t(q,this,_);else for(var P=q.length,W=S(q,P),O=0;O 0&&M.length>z&&!M.warned){M.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(N)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=C,H.type=N,H.count=M.length,r(H)}return C}i.prototype.addListener=function(N,_){return f(this,N,_,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(N,_){return f(this,N,_,!0)};function p(){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 g(C,N,_){var O={fired:!1,wrapFn:void 0,target:C,type:N,listener:_},z=p.bind(O);return z.listener=_,O.wrapFn=z,z}i.prototype.once=function(N,_){return u(_),this.on(N,g(this,N,_)),this},i.prototype.prependOnceListener=function(N,_){return u(_),this.prependListener(N,g(this,N,_)),this},i.prototype.removeListener=function(N,_){var O,z,I,M,H;if(u(_),z=this._events,z===void 0)return this;if(O=z[N],O===void 0)return this;if(O===_||O.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete z[N],z.removeListener&&this.emit("removeListener",N,O.listener||_));else if(typeof O!="function"){for(I=-1,M=O.length-1;M>=0;M--)if(O[M]===_||O[M].listener===_){H=O[M].listener,I=M;break}if(I<0)return this;I===0?O.shift():v(O,I),O.length===1&&(z[N]=O[0]),z.removeListener!==void 0&&this.emit("removeListener",N,H||_)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(N){var _,O,z;if(O=this._events,O===void 0)return this;if(O.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):O[N]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete O[N]),this;if(arguments.length===0){var I=Object.keys(O),M;for(z=0;z
=0;z--)this.removeListener(N,_[z]);return this};function b(C,N,_){var O=C._events;if(O===void 0)return[];var z=O[N];return z===void 0?[]:typeof z=="function"?_?[z.listener||z]:[z]:_?A(z):S(z,z.length)}i.prototype.listeners=function(N){return b(this,N,!0)},i.prototype.rawListeners=function(N){return b(this,N,!1)},i.listenerCount=function(C,N){return typeof C.listenerCount=="function"?C.listenerCount(N):m.call(C,N)},i.prototype.listenerCount=m;function m(C){var N=this._events;if(N!==void 0){var _=N[C];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function S(C,N){for(var _=new Array(N),O=0;O e++}function Na(){const e=arguments;let 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 Ol(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class c0 extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class Le extends c0{constructor(t){super(t),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Le.prototype.constructor)}}class De extends c0{constructor(t){super(t),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,De.prototype.constructor)}}class Ze extends c0{constructor(t){super(t),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ze.prototype.constructor)}}function AU(e,t){this.key=e,this.attributes=t,this.clear()}AU.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 TU(e,t){this.key=e,this.attributes=t,this.clear()}TU.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function _U(e,t){this.key=e,this.attributes=t,this.clear()}_U.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Dl(e,t,n,r,a){this.key=t,this.attributes=a,this.undirected=e,this.source=n,this.target=r}Dl.prototype.attach=function(){let e="out",t="in";this.undirected&&(e=t="undirected");const n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)};Dl.prototype.attachMulti=function(){let e="out",t="in";const n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");const a=this.source[e],i=a[r];if(typeof i>"u"){a[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}i.previous=this,this.next=i,a[r]=this,this.target[t][n]=this};Dl.prototype.detach=function(){const e=this.source.key,t=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]};Dl.prototype.detachMulti=function(){const e=this.source.key,t=this.target.key;let 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))};const RU=0,CU=1,UY=2,NU=3;function Ma(e,t,n,r,a,i,l){let u,c,f,p;if(r=""+r,n===RU){if(u=e._nodes.get(r),!u)throw new De(`Graph.${t}: could not find the "${r}" node in the graph.`);f=a,p=i}else if(n===NU){if(a=""+a,c=e._edges.get(a),!c)throw new De(`Graph.${t}: could not find the "${a}" edge in the graph.`);const g=c.source.key,b=c.target.key;if(r===g)u=c.target;else if(r===b)u=c.source;else throw new De(`Graph.${t}: the "${r}" node is not attached to the "${a}" edge (${g}, ${b}).`);f=i,p=l}else{if(c=e._edges.get(r),!c)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`);n===CU?u=c.source:u=c.target,f=a,p=i}return[u,f,p]}function jY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);return l.attributes[u]}}function GY(e,t,n){e.prototype[t]=function(r,a){const[i]=Ma(this,t,n,r,a);return i.attributes}}function HY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);return l.attributes.hasOwnProperty(u)}}function $Y(e,t,n){e.prototype[t]=function(r,a,i,l){const[u,c,f]=Ma(this,t,n,r,a,i,l);return u.attributes[c]=f,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:c}),this}}function qY(e,t,n){e.prototype[t]=function(r,a,i,l){const[u,c,f]=Ma(this,t,n,r,a,i,l);if(typeof f!="function")throw new Le(`Graph.${t}: updater should be a function.`);const p=u.attributes,g=f(p[c]);return p[c]=g,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:c}),this}}function VY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);return delete l.attributes[u],this.emit("nodeAttributesUpdated",{key:l.key,type:"remove",attributes:l.attributes,name:u}),this}}function WY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);if(!gn(u))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return l.attributes=u,this.emit("nodeAttributesUpdated",{key:l.key,type:"replace",attributes:l.attributes}),this}}function YY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);if(!gn(u))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return Qt(l.attributes,u),this.emit("nodeAttributesUpdated",{key:l.key,type:"merge",attributes:l.attributes,data:u}),this}}function KY(e,t,n){e.prototype[t]=function(r,a,i){const[l,u]=Ma(this,t,n,r,a,i);if(typeof u!="function")throw new Le(`Graph.${t}: provided updater is not a function.`);return l.attributes=u(l.attributes),this.emit("nodeAttributesUpdated",{key:l.key,type:"update",attributes:l.attributes}),this}}const XY=[{name:e=>`get${e}Attribute`,attacher:jY},{name:e=>`get${e}Attributes`,attacher:GY},{name:e=>`has${e}Attribute`,attacher:HY},{name:e=>`set${e}Attribute`,attacher:$Y},{name:e=>`update${e}Attribute`,attacher:qY},{name:e=>`remove${e}Attribute`,attacher:VY},{name:e=>`replace${e}Attributes`,attacher:WY},{name:e=>`merge${e}Attributes`,attacher:YY},{name:e=>`update${e}Attributes`,attacher:KY}];function ZY(e){XY.forEach(function({name:t,attacher:n}){n(e,t("Node"),RU),n(e,t("Source"),CU),n(e,t("Target"),UY),n(e,t("Opposite"),NU)})}function QY(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes[a]}}function JY(e,t,n){e.prototype[t]=function(r){let a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Ze(`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.`);const i=""+r,l=""+arguments[1];if(a=hr(this,i,l,n),!a)throw new De(`Graph.${t}: could not find an edge for the given path ("${i}" - "${l}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,a=this._edges.get(r),!a)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return a.attributes}}function eK(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes.hasOwnProperty(a)}}function tK(e,t,n){e.prototype[t]=function(r,a,i){let l;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ze(`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.`);const u=""+r,c=""+a;if(a=arguments[2],i=arguments[3],l=hr(this,u,c,n),!l)throw new De(`Graph.${t}: could not find an edge for the given path ("${u}" - "${c}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,l=this._edges.get(r),!l)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return l.attributes[a]=i,this.emit("edgeAttributesUpdated",{key:l.key,type:"set",attributes:l.attributes,name:a}),this}}function nK(e,t,n){e.prototype[t]=function(r,a,i){let l;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ze(`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.`);const u=""+r,c=""+a;if(a=arguments[2],i=arguments[3],l=hr(this,u,c,n),!l)throw new De(`Graph.${t}: could not find an edge for the given path ("${u}" - "${c}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,l=this._edges.get(r),!l)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new Le(`Graph.${t}: updater should be a function.`);return l.attributes[a]=i(l.attributes[a]),this.emit("edgeAttributesUpdated",{key:l.key,type:"set",attributes:l.attributes,name:a}),this}}function rK(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return delete i.attributes[a],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:a}),this}}function aK(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!gn(a))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=a,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function oK(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!gn(a))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return Qt(i.attributes,a),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:a}),this}}function iK(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const l=""+r,u=""+a;if(a=arguments[2],i=hr(this,l,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${l}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof a!="function")throw new Le(`Graph.${t}: provided updater is not a function.`);return i.attributes=a(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}const lK=[{name:e=>`get${e}Attribute`,attacher:QY},{name:e=>`get${e}Attributes`,attacher:JY},{name:e=>`has${e}Attribute`,attacher:eK},{name:e=>`set${e}Attribute`,attacher:tK},{name:e=>`update${e}Attribute`,attacher:nK},{name:e=>`remove${e}Attribute`,attacher:rK},{name:e=>`replace${e}Attributes`,attacher:aK},{name:e=>`merge${e}Attributes`,attacher:oK},{name:e=>`update${e}Attributes`,attacher:iK}];function sK(e){lK.forEach(function({name:t,attacher:n}){n(e,t("Edge"),"mixed"),n(e,t("DirectedEdge"),"directed"),n(e,t("UndirectedEdge"),"undirected")})}const uK=[{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 cK(e,t,n,r){let a=!1;for(const i in t){if(i===r)continue;const l=t[i];if(a=n(l.key,l.attributes,l.source.key,l.target.key,l.source.attributes,l.target.attributes,l.undirected),e&&a)return l.key}}function dK(e,t,n,r){let a,i,l,u=!1;for(const c in t)if(c!==r){a=t[c];do{if(i=a.source,l=a.target,u=n(a.key,a.attributes,i.key,l.key,i.attributes,l.attributes,a.undirected),e&&u)return a.key;a=a.next}while(a!==void 0)}}function xh(e,t){const n=Object.keys(e),r=n.length;let a,i=0;return{[Symbol.iterator](){return this},next(){do if(a)a=a.next;else{if(i>=r)return{done:!0};const l=n[i++];if(l===t){a=void 0;continue}a=e[l]}while(!a);return{done:!1,value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected}}}}}function fK(e,t,n,r){const a=t[n];if(!a)return;const i=a.source,l=a.target;if(r(a.key,a.attributes,i.key,l.key,i.attributes,l.attributes,a.undirected)&&e)return a.key}function pK(e,t,n,r){let a=t[n];if(!a)return;let i=!1;do{if(i=r(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),e&&i)return a.key;a=a.next}while(a!==void 0)}function kh(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const a={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:a}}};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 gK(e,t){if(e.size===0)return[];if(t==="mixed"||t===e.type)return Array.from(e._edges.keys());const n=t==="undirected"?e.undirectedSize:e.directedSize,r=new Array(n),a=t==="undirected",i=e._edges.values();let l=0,u,c;for(;u=i.next(),u.done!==!0;)c=u.value,c.undirected===a&&(r[l++]=c.key);return r}function OU(e,t,n,r){if(t.size===0)return;const a=n!=="mixed"&&n!==t.type,i=n==="undirected";let l,u,c=!1;const f=t._edges.values();for(;l=f.next(),l.done!==!0;){if(u=l.value,a&&u.undirected!==i)continue;const{key:p,attributes:g,source:b,target:m}=u;if(c=r(p,g,b.key,m.key,b.attributes,m.attributes,u.undirected),e&&c)return p}}function hK(e,t){if(e.size===0)return Ol();const n=t!=="mixed"&&t!==e.type,r=t==="undirected",a=e._edges.values();return{[Symbol.iterator](){return this},next(){let i,l;for(;;){if(i=a.next(),i.done)return i;if(l=i.value,!(n&&l.undirected!==r))break}return{value:{edge:l.key,attributes:l.attributes,source:l.source.key,target:l.target.key,sourceAttributes:l.source.attributes,targetAttributes:l.target.attributes,undirected:l.undirected},done:!1}}}}function d0(e,t,n,r,a,i){const l=t?dK:cK;let u;if(n!=="undirected"&&(r!=="out"&&(u=l(e,a.in,i),e&&u)||r!=="in"&&(u=l(e,a.out,i,r?void 0:a.key),e&&u))||n!=="directed"&&(u=l(e,a.undirected,i),e&&u))return u}function mK(e,t,n,r){const a=[];return d0(!1,e,t,n,r,function(i){a.push(i)}),a}function bK(e,t,n){let r=Ol();return e!=="undirected"&&(t!=="out"&&typeof n.in<"u"&&(r=Na(r,xh(n.in))),t!=="in"&&typeof n.out<"u"&&(r=Na(r,xh(n.out,t?void 0:n.key)))),e!=="directed"&&typeof n.undirected<"u"&&(r=Na(r,xh(n.undirected))),r}function f0(e,t,n,r,a,i,l){const u=n?pK:fK;let c;if(t!=="undirected"&&(typeof a.in<"u"&&r!=="out"&&(c=u(e,a.in,i,l),e&&c)||typeof a.out<"u"&&r!=="in"&&(r||a.key!==i)&&(c=u(e,a.out,i,l),e&&c))||t!=="directed"&&typeof a.undirected<"u"&&(c=u(e,a.undirected,i,l),e&&c))return c}function yK(e,t,n,r,a){const i=[];return f0(!1,e,t,n,r,a,function(l){i.push(l)}),i}function vK(e,t,n,r){let a=Ol();return e!=="undirected"&&(typeof n.in<"u"&&t!=="out"&&r in n.in&&(a=Na(a,kh(n.in,r))),typeof n.out<"u"&&t!=="in"&&r in n.out&&(t||n.key!==r)&&(a=Na(a,kh(n.out,r)))),e!=="directed"&&typeof n.undirected<"u"&&r in n.undirected&&(a=Na(a,kh(n.undirected,r))),a}function SK(e,t){const{name:n,type:r,direction:a}=t;e.prototype[n]=function(i,l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return gK(this,r);if(arguments.length===1){i=""+i;const u=this._nodes.get(i);if(typeof u>"u")throw new De(`Graph.${n}: could not find the "${i}" node in the graph.`);return mK(this.multi,r==="mixed"?this.type:r,a,u)}if(arguments.length===2){i=""+i,l=""+l;const u=this._nodes.get(i);if(!u)throw new De(`Graph.${n}: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(l))throw new De(`Graph.${n}: could not find the "${l}" target node in the graph.`);return yK(r,this.multi,a,u,l)}throw new Le(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function EK(e,t){const{name:n,type:r,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(f,p,g){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return g=f,OU(!1,this,r,g);if(arguments.length===2){f=""+f,g=p;const b=this._nodes.get(f);if(typeof b>"u")throw new De(`Graph.${i}: could not find the "${f}" node in the graph.`);return d0(!1,this.multi,r==="mixed"?this.type:r,a,b,g)}if(arguments.length===3){f=""+f,p=""+p;const b=this._nodes.get(f);if(!b)throw new De(`Graph.${i}: could not find the "${f}" source node in the graph.`);if(!this._nodes.has(p))throw new De(`Graph.${i}: could not find the "${p}" target node in the graph.`);return f0(!1,r,this.multi,a,b,p,g)}throw new Le(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const l="map"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(){const f=Array.prototype.slice.call(arguments),p=f.pop();let g;if(f.length===0){let b=0;r!=="directed"&&(b+=this.undirectedSize),r!=="undirected"&&(b+=this.directedSize),g=new Array(b);let m=0;f.push((S,v,A,R,x,T,C)=>{g[m++]=p(S,v,A,R,x,T,C)})}else g=[],f.push((b,m,S,v,A,R,x)=>{g.push(p(b,m,S,v,A,R,x))});return this[i].apply(this,f),g};const u="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[u]=function(){const f=Array.prototype.slice.call(arguments),p=f.pop(),g=[];return f.push((b,m,S,v,A,R,x)=>{p(b,m,S,v,A,R,x)&&g.push(b)}),this[i].apply(this,f),g};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let f=Array.prototype.slice.call(arguments);if(f.length<2||f.length>4)throw new Le(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${f.length}).`);if(typeof f[f.length-1]=="function"&&typeof f[f.length-2]!="function")throw new Le(`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 p,g;f.length===2?(p=f[0],g=f[1],f=[]):f.length===3?(p=f[1],g=f[2],f=[f[0]]):f.length===4&&(p=f[2],g=f[3],f=[f[0],f[1]]);let b=g;return f.push((m,S,v,A,R,x,T)=>{b=p(b,m,S,v,A,R,x,T)}),this[i].apply(this,f),b}}function wK(e,t){const{name:n,type:r,direction:a}=t,i="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(c,f,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return p=c,OU(!0,this,r,p);if(arguments.length===2){c=""+c,p=f;const g=this._nodes.get(c);if(typeof g>"u")throw new De(`Graph.${i}: could not find the "${c}" node in the graph.`);return d0(!0,this.multi,r==="mixed"?this.type:r,a,g,p)}if(arguments.length===3){c=""+c,f=""+f;const g=this._nodes.get(c);if(!g)throw new De(`Graph.${i}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(f))throw new De(`Graph.${i}: could not find the "${f}" target node in the graph.`);return f0(!0,r,this.multi,a,g,f,p)}throw new Le(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const l="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[l]=function(){const c=Array.prototype.slice.call(arguments),f=c.pop();return c.push((g,b,m,S,v,A,R)=>f(g,b,m,S,v,A,R)),!!this[i].apply(this,c)};const u="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[u]=function(){const c=Array.prototype.slice.call(arguments),f=c.pop();return c.push((g,b,m,S,v,A,R)=>!f(g,b,m,S,v,A,R)),!this[i].apply(this,c)}}function xK(e,t){const{name:n,type:r,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(l,u){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ol();if(!arguments.length)return hK(this,r);if(arguments.length===1){l=""+l;const c=this._nodes.get(l);if(!c)throw new De(`Graph.${i}: could not find the "${l}" node in the graph.`);return bK(r,a,c)}if(arguments.length===2){l=""+l,u=""+u;const c=this._nodes.get(l);if(!c)throw new De(`Graph.${i}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(u))throw new De(`Graph.${i}: could not find the "${u}" target node in the graph.`);return vK(r,a,c,u)}throw new Le(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function kK(e){uK.forEach(t=>{SK(e,t),EK(e,t),wK(e,t),xK(e,t)})}const AK=[{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 Rf(){this.A=null,this.B=null}Rf.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)};Rf.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function Fs(e,t,n,r,a){for(const i in r){const l=r[i],u=l.source,c=l.target,f=u===n?c:u;if(t&&t.has(f.key))continue;const p=a(f.key,f.attributes);if(e&&p)return f.key}}function p0(e,t,n,r,a){if(t!=="mixed"){if(t==="undirected")return Fs(e,null,r,r.undirected,a);if(typeof n=="string")return Fs(e,null,r,r[n],a)}const i=new Rf;let l;if(t!=="undirected"){if(n!=="out"){if(l=Fs(e,null,r,r.in,a),e&&l)return l;i.wrap(r.in)}if(n!=="in"){if(l=Fs(e,i,r,r.out,a),e&&l)return l;i.wrap(r.out)}}if(t!=="directed"&&(l=Fs(e,i,r,r.undirected,a),e&&l))return l}function TK(e,t,n){if(e!=="mixed"){if(e==="undirected")return Object.keys(n.undirected);if(typeof t=="string")return Object.keys(n[t])}const r=[];return p0(!1,e,t,n,function(a){r.push(a)}),r}function zs(e,t,n){const r=Object.keys(n),a=r.length;let i=0;return{[Symbol.iterator](){return this},next(){let l=null;do{if(i>=a)return e&&e.wrap(n),{done:!0};const u=n[r[i++]],c=u.source,f=u.target;if(l=c===t?f:c,e&&e.has(l.key)){l=null;continue}}while(l===null);return{done:!1,value:{neighbor:l.key,attributes:l.attributes}}}}}function _K(e,t,n){if(e!=="mixed"){if(e==="undirected")return zs(null,n,n.undirected);if(typeof t=="string")return zs(null,n,n[t])}let r=Ol();const a=new Rf;return e!=="undirected"&&(t!=="out"&&(r=Na(r,zs(a,n,n.in))),t!=="in"&&(r=Na(r,zs(a,n,n.out)))),e!=="directed"&&(r=Na(r,zs(a,n,n.undirected))),r}function RK(e,t){const{name:n,type:r,direction:a}=t;e.prototype[n]=function(i){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];i=""+i;const l=this._nodes.get(i);if(typeof l>"u")throw new De(`Graph.${n}: could not find the "${i}" node in the graph.`);return TK(r==="mixed"?this.type:r,a,l)}}function CK(e,t){const{name:n,type:r,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(f,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;f=""+f;const g=this._nodes.get(f);if(typeof g>"u")throw new De(`Graph.${i}: could not find the "${f}" node in the graph.`);p0(!1,r==="mixed"?this.type:r,a,g,p)};const l="map"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(f,p){const g=[];return this[i](f,(b,m)=>{g.push(p(b,m))}),g};const u="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[u]=function(f,p){const g=[];return this[i](f,(b,m)=>{p(b,m)&&g.push(b)}),g};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(f,p,g){if(arguments.length<3)throw new Le(`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 b=g;return this[i](f,(m,S)=>{b=p(b,m,S)}),b}}function NK(e,t){const{name:n,type:r,direction:a}=t,i=n[0].toUpperCase()+n.slice(1,-1),l="find"+i;e.prototype[l]=function(f,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;f=""+f;const g=this._nodes.get(f);if(typeof g>"u")throw new De(`Graph.${l}: could not find the "${f}" node in the graph.`);return p0(!0,r==="mixed"?this.type:r,a,g,p)};const u="some"+i;e.prototype[u]=function(f,p){return!!this[l](f,p)};const c="every"+i;e.prototype[c]=function(f,p){return!this[l](f,(b,m)=>!p(b,m))}}function OK(e,t){const{name:n,type:r,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(l){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Ol();l=""+l;const u=this._nodes.get(l);if(typeof u>"u")throw new De(`Graph.${i}: could not find the "${l}" node in the graph.`);return _K(r==="mixed"?this.type:r,a,u)}}function DK(e){AK.forEach(t=>{RK(e,t),CK(e,t),NK(e,t),OK(e,t)})}function Wc(e,t,n,r,a){const i=r._nodes.values(),l=r.type;let u,c,f,p,g,b;for(;u=i.next(),u.done!==!0;){let m=!1;if(c=u.value,l!=="undirected"){p=c.out;for(f in p){g=p[f];do b=g.target,m=!0,a(c.key,b.key,c.attributes,b.attributes,g.key,g.attributes,g.undirected),g=g.next;while(g)}}if(l!=="directed"){p=c.undirected;for(f in p)if(!(t&&c.key>f)){g=p[f];do b=g.target,b.key!==f&&(b=g.source),m=!0,a(c.key,b.key,c.attributes,b.attributes,g.key,g.attributes,g.undirected),g=g.next;while(g)}}n&&!m&&a(c.key,null,c.attributes,null,null,null,null)}}function IK(e,t){const n={key:e};return kU(t.attributes)||(n.attributes=Qt({},t.attributes)),n}function LK(e,t,n){const r={key:t,source:n.source.key,target:n.target.key};return kU(n.attributes)||(r.attributes=Qt({},n.attributes)),e==="mixed"&&n.undirected&&(r.undirected=!0),r}function MK(e){if(!gn(e))throw new Le('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 Le("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!gn(e.attributes)||e.attributes===null))throw new Le("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function FK(e){if(!gn(e))throw new Le('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 Le("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new Le("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!gn(e.attributes)||e.attributes===null))throw new Le("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&typeof e.undirected!="boolean")throw new Le("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const zK=BY(),PK=new Set(["directed","undirected","mixed"]),XR=new Set(["domain","_events","_eventsCount","_maxListeners"]),BK=[{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"}],UK={allowSelfLoops:!0,multi:!1,type:"mixed"};function jK(e,t,n){if(n&&!gn(n))throw new Le(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=""+t,n=n||{},e._nodes.has(t))throw new Ze(`Graph.addNode: the "${t}" node already exist in the graph.`);const r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function ZR(e,t,n){const r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function DU(e,t,n,r,a,i,l,u){if(!r&&e.type==="undirected")throw new Ze(`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 Ze(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(u&&!gn(u))throw new Le(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`);if(i=""+i,l=""+l,u=u||{},!e.allowSelfLoops&&i===l)throw new Ze(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=e._nodes.get(i),f=e._nodes.get(l);if(!c)throw new De(`Graph.${t}: source node "${i}" not found.`);if(!f)throw new De(`Graph.${t}: target node "${l}" not found.`);const p={key:null,undirected:r,source:i,target:l,attributes:u};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new Ze(`Graph.${t}: the "${a}" edge already exists in the graph.`);if(!e.multi&&(r?typeof c.undirected[l]<"u":typeof c.out[l]<"u"))throw new Ze(`Graph.${t}: an edge linking "${i}" to "${l}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const g=new Dl(r,a,c,f,u);e._edges.set(a,g);const b=i===l;return r?(c.undirectedDegree++,f.undirectedDegree++,b&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,f.inDegree++,b&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?g.attachMulti():g.attach(),r?e._undirectedSize++:e._directedSize++,p.key=a,e.emit("edgeAdded",p),a}function GK(e,t,n,r,a,i,l,u,c){if(!r&&e.type==="undirected")throw new Ze(`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 Ze(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(u){if(c){if(typeof u!="function")throw new Le(`Graph.${t}: invalid updater function. Expecting a function but got "${u}"`)}else if(!gn(u))throw new Le(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`)}i=""+i,l=""+l;let f;if(c&&(f=u,u=void 0),!e.allowSelfLoops&&i===l)throw new Ze(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=e._nodes.get(i),g=e._nodes.get(l),b,m;if(!n&&(b=e._edges.get(a),b)){if((b.source.key!==i||b.target.key!==l)&&(!r||b.source.key!==l||b.target.key!==i))throw new Ze(`Graph.${t}: inconsistency detected when attempting to merge the "${a}" edge with "${i}" source & "${l}" target vs. ("${b.source.key}", "${b.target.key}").`);m=b}if(!m&&!e.multi&&p&&(m=r?p.undirected[l]:p.out[l]),m){const x=[m.key,!1,!1,!1];if(c?!f:!u)return x;if(c){const T=m.attributes;m.attributes=f(T),e.emit("edgeAttributesUpdated",{type:"replace",key:m.key,attributes:m.attributes})}else Qt(m.attributes,u),e.emit("edgeAttributesUpdated",{type:"merge",key:m.key,attributes:m.attributes,data:u});return x}u=u||{},c&&f&&(u=f(u));const S={key:null,undirected:r,source:i,target:l,attributes:u};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new Ze(`Graph.${t}: the "${a}" edge already exists in the graph.`);let v=!1,A=!1;p||(p=ZR(e,i,{}),v=!0,i===l&&(g=p,A=!0)),g||(g=ZR(e,l,{}),A=!0),b=new Dl(r,a,p,g,u),e._edges.set(a,b);const R=i===l;return r?(p.undirectedDegree++,g.undirectedDegree++,R&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,g.inDegree++,R&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?b.attachMulti():b.attach(),r?e._undirectedSize++:e._directedSize++,S.key=a,e.emit("edgeAdded",S),[a,!0,v,A]}function Qi(e,t){e._edges.delete(t.key);const{source:n,target:r,attributes:a}=t,i=t.undirected,l=n===r;i?(n.undirectedDegree--,r.undirectedDegree--,l&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,l&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),i?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:a,source:n.key,target:r.key,undirected:i})}class Tt extends xU.EventEmitter{constructor(t){if(super(),t=Qt({},UK,t),typeof t.multi!="boolean")throw new Le(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!PK.has(t.type))throw new Le(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if(typeof t.allowSelfLoops!="boolean")throw new Le(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);const n=t.type==="mixed"?AU:t.type==="directed"?TU:_U;pr(this,"NodeDataClass",n);const r="geid_"+zK()+"_";let a=0;const i=()=>{let l;do l=r+a++;while(this._edges.has(l));return l};pr(this,"_attributes",{}),pr(this,"_nodes",new Map),pr(this,"_edges",new Map),pr(this,"_directedSize",0),pr(this,"_undirectedSize",0),pr(this,"_directedSelfLoopCount",0),pr(this,"_undirectedSelfLoopCount",0),pr(this,"_edgeKeyGenerator",i),pr(this,"_options",t),XR.forEach(l=>pr(this,l,this[l])),Tr(this,"order",()=>this._nodes.size),Tr(this,"size",()=>this._edges.size),Tr(this,"directedSize",()=>this._directedSize),Tr(this,"undirectedSize",()=>this._undirectedSize),Tr(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Tr(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Tr(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Tr(this,"multi",this._options.multi),Tr(this,"type",this._options.type),Tr(this,"allowSelfLoops",this._options.allowSelfLoops),Tr(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,n){if(this.type==="undirected")return!1;if(arguments.length===1){const r=""+t,a=this._edges.get(r);return!!a&&!a.undirected}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?r.out.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+t,a=this._edges.get(r);return!!a&&a.undirected}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?r.undirected.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(arguments.length===1){const r=""+t;return this._edges.has(r)}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?typeof r.out<"u"&&r.out.hasOwnProperty(n)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(this.type==="undirected")return;if(t=""+t,n=""+n,this.multi)throw new Ze("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(t);if(!r)throw new De(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.directedEdge: could not find the "${n}" target node in the graph.`);const a=r.out&&r.out[n]||void 0;if(a)return a.key}undirectedEdge(t,n){if(this.type==="directed")return;if(t=""+t,n=""+n,this.multi)throw new Ze("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(t);if(!r)throw new De(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.undirectedEdge: could not find the "${n}" target node in the graph.`);const a=r.undirected&&r.undirected[n]||void 0;if(a)return a.key}edge(t,n){if(this.multi)throw new Ze("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.edge: could not find the "${n}" target node in the graph.`);const a=r.out&&r.out[n]||r.undirected&&r.undirected[n]||void 0;if(a)return a.key}areDirectedNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.in||n in r.out}areOutNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.out}areInNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.in}areUndirectedNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="directed"?!1:n in r.undirected}areNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&(n in r.in||n in r.out)||this.type!=="directed"&&n in r.undirected}areInboundNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&n in r.in||this.type!=="directed"&&n in r.undirected}areOutboundNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&n in r.out||this.type!=="directed"&&n in r.undirected}inDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree}outDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.outDegree}directedDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree}undirectedDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree}inboundDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree),r}outboundDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.outDegree),r}degree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.degree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree),r}inDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree-n.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.outDegree-n.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree-n.directedLoops*2}undirectedDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree-n.undirectedLoops*2}inboundDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree,a+=n.directedLoops),r-a}outboundDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.outDegree,a+=n.directedLoops),r-a}degreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree,a+=n.directedLoops*2),r-a}source(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.source: could not find the "${t}" edge in the graph.`);return n.source.key}target(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.target: could not find the "${t}" edge in the graph.`);return n.target.key}extremities(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[n.source.key,n.target.key]}opposite(t,n){t=""+t,n=""+n;const r=this._edges.get(n);if(!r)throw new De(`Graph.opposite: could not find the "${n}" edge in the graph.`);const a=r.source.key,i=r.target.key;if(t===a)return i;if(t===i)return a;throw new De(`Graph.opposite: the "${t}" node is not attached to the "${n}" edge (${a}, ${i}).`)}hasExtremity(t,n){t=""+t,n=""+n;const r=this._edges.get(t);if(!r)throw new De(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return r.source.key===n||r.target.key===n}isUndirected(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return n.undirected}isDirected(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!n.undirected}isSelfLoop(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return n.source===n.target}addNode(t,n){return jK(this,t,n).key}mergeNode(t,n){if(n&&!gn(n))throw new Le(`Graph.mergeNode: invalid attributes. Expecting an object but got "${n}"`);t=""+t,n=n||{};let r=this._nodes.get(t);return r?(n&&(Qt(r.attributes,n),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:r.attributes,data:n})),[t,!1]):(r=new this.NodeDataClass(t,n),this._nodes.set(t,r),this.emit("nodeAdded",{key:t,attributes:n}),[t,!0])}updateNode(t,n){if(n&&typeof n!="function")throw new Le(`Graph.updateNode: invalid updater function. Expecting a function but got "${n}"`);t=""+t;let r=this._nodes.get(t);if(r){if(n){const i=r.attributes;r.attributes=n(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:r.attributes})}return[t,!1]}const a=n?n({}):{};return r=new this.NodeDataClass(t,a),this._nodes.set(t,r),this.emit("nodeAdded",{key:t,attributes:a}),[t,!0]}dropNode(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.dropNode: could not find the "${t}" node in the graph.`);let r;if(this.type!=="undirected"){for(const a in n.out){r=n.out[a];do Qi(this,r),r=r.next;while(r)}for(const a in n.in){r=n.in[a];do Qi(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const a in n.undirected){r=n.undirected[a];do Qi(this,r),r=r.next;while(r)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})}dropEdge(t){let n;if(arguments.length>1){const r=""+arguments[0],a=""+arguments[1];if(n=hr(this,r,a,this.type),!n)throw new De(`Graph.dropEdge: could not find the "${r}" -> "${a}" edge in the graph.`)}else if(t=""+t,n=this._edges.get(t),!n)throw new De(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return Qi(this,n),this}dropDirectedEdge(t,n){if(arguments.length<2)throw new Ze("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 Ze("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.");t=""+t,n=""+n;const r=hr(this,t,n,"directed");if(!r)throw new De(`Graph.dropDirectedEdge: could not find a "${t}" -> "${n}" edge in the graph.`);return Qi(this,r),this}dropUndirectedEdge(t,n){if(arguments.length<2)throw new Ze("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 Ze("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const r=hr(this,t,n,"undirected");if(!r)throw new De(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${n}" edge in the graph.`);return Qi(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let n;for(;n=t.next(),n.done!==!0;)n.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,n){return this._attributes[t]=n,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,n){if(typeof n!="function")throw new Le("Graph.updateAttribute: updater should be a function.");const r=this._attributes[t];return this._attributes[t]=n(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!gn(t))throw new Le("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!gn(t))throw new Le("Graph.mergeAttributes: provided attributes are not a plain object.");return Qt(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if(typeof t!="function")throw new Le("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,n){if(typeof t!="function")throw new Le("Graph.updateEachNodeAttributes: expecting an updater function.");if(n&&!KR(n))throw new Le("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.values();let a,i;for(;a=r.next(),a.done!==!0;)i=a.value,i.attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:n||null})}updateEachEdgeAttributes(t,n){if(typeof t!="function")throw new Le("Graph.updateEachEdgeAttributes: expecting an updater function.");if(n&&!KR(n))throw new Le("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let a,i,l,u;for(;a=r.next(),a.done!==!0;)i=a.value,l=i.source,u=i.target,i.attributes=t(i.key,i.attributes,l.key,u.key,l.attributes,u.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:n||null})}forEachAdjacencyEntry(t){if(typeof t!="function")throw new Le("Graph.forEachAdjacencyEntry: expecting a callback.");Wc(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new Le("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Wc(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if(typeof t!="function")throw new Le("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Wc(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new Le("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Wc(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if(typeof t!="function")throw new Le("Graph.forEachNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)a=r.value,t(a.key,a.attributes)}findNode(t){if(typeof t!="function")throw new Le("Graph.findNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,t(a.key,a.attributes))return a.key}mapNodes(t){if(typeof t!="function")throw new Le("Graph.mapNode: expecting a callback.");const n=this._nodes.values();let r,a;const i=new Array(this.order);let l=0;for(;r=n.next(),r.done!==!0;)a=r.value,i[l++]=t(a.key,a.attributes);return i}someNode(t){if(typeof t!="function")throw new Le("Graph.someNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,t(a.key,a.attributes))return!0;return!1}everyNode(t){if(typeof t!="function")throw new Le("Graph.everyNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,!t(a.key,a.attributes))return!1;return!0}filterNodes(t){if(typeof t!="function")throw new Le("Graph.filterNodes: expecting a callback.");const n=this._nodes.values();let r,a;const i=[];for(;r=n.next(),r.done!==!0;)a=r.value,t(a.key,a.attributes)&&i.push(a.key);return i}reduceNodes(t,n){if(typeof t!="function")throw new Le("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Le("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 r=n;const a=this._nodes.values();let i,l;for(;i=a.next(),i.done!==!0;)l=i.value,r=t(r,l.key,l.attributes);return r}nodeEntries(){const t=this._nodes.values();return{[Symbol.iterator](){return this},next(){const n=t.next();if(n.done)return n;const r=n.value;return{value:{node:r.key,attributes:r.attributes},done:!1}}}}export(){const t=new Array(this._nodes.size);let n=0;this._nodes.forEach((a,i)=>{t[n++]=IK(i,a)});const r=new Array(this._edges.size);return n=0,this._edges.forEach((a,i)=>{r[n++]=LK(this.type,i,a)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}}import(t,n=!1){if(t instanceof Tt)return t.forEachNode((c,f)=>{n?this.mergeNode(c,f):this.addNode(c,f)}),t.forEachEdge((c,f,p,g,b,m,S)=>{n?S?this.mergeUndirectedEdgeWithKey(c,p,g,f):this.mergeDirectedEdgeWithKey(c,p,g,f):S?this.addUndirectedEdgeWithKey(c,p,g,f):this.addDirectedEdgeWithKey(c,p,g,f)}),this;if(!gn(t))throw new Le("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!gn(t.attributes))throw new Le("Graph.import: invalid attributes. Expecting a plain object.");n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,a,i,l,u;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new Le("Graph.import: invalid nodes. Expecting an array.");for(r=0,a=i.length;r{const i=Qt({},r.attributes);r=new n.NodeDataClass(a,i),n._nodes.set(a,r)}),n}copy(t){if(t=t||{},typeof t.type=="string"&&t.type!==this.type&&t.type!=="mixed")throw new Ze(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if(typeof t.multi=="boolean"&&t.multi!==this.multi&&t.multi!==!0)throw new Ze("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 t.allowSelfLoops=="boolean"&&t.allowSelfLoops!==this.allowSelfLoops&&t.allowSelfLoops!==!0)throw new Ze("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const n=this.emptyCopy(t),r=this._edges.values();let a,i;for(;a=r.next(),a.done!==!0;)i=a.value,DU(n,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,Qt({},i.attributes));return n}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((i,l)=>{t[l]=i.attributes});const n={},r={};this._edges.forEach((i,l)=>{const u=i.undirected?"--":"->";let c="",f=i.source.key,p=i.target.key,g;i.undirected&&f>p&&(g=f,f=p,p=g);const b=`(${f})${u}(${p})`;l.startsWith("geid_")?this.multi&&(typeof r[b]>"u"?r[b]=0:r[b]++,c+=`${r[b]}. `):c+=`[${l}]: `,c+=b,n[c]=i.attributes});const a={};for(const i in this)this.hasOwnProperty(i)&&!XR.has(i)&&typeof this[i]!="function"&&typeof i!="symbol"&&(a[i]=this[i]);return a.attributes=this._attributes,a.nodes=t,a.edges=n,pr(a,"constructor",this.constructor),a}}typeof Symbol<"u"&&(Tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Tt.prototype.inspect);BK.forEach(e=>{["add","merge","update"].forEach(t=>{const n=e.name(t),r=t==="add"?DU:GK;e.generateKey?Tt.prototype[n]=function(a,i,l){return r(this,n,!0,(e.type||this.type)==="undirected",null,a,i,l,t==="update")}:Tt.prototype[n]=function(a,i,l,u){return r(this,n,!1,(e.type||this.type)==="undirected",a,i,l,u,t==="update")}})});ZY(Tt);sK(Tt);kK(Tt);DK(Tt);class nu extends Tt{constructor(t){const n=Qt({type:"directed"},t);if("multi"in n&&n.multi!==!1)throw new Le("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new Le('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class IU extends Tt{constructor(t){const n=Qt({type:"undirected"},t);if("multi"in n&&n.multi!==!1)throw new Le("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="undirected")throw new Le('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class LU extends Tt{constructor(t){const n=Qt({multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(n)}}class MU extends Tt{constructor(t){const n=Qt({type:"directed",multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="directed")throw new Le('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class FU extends Tt{constructor(t){const n=Qt({type:"undirected",multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="undirected")throw new Le('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}function Il(e){e.from=function(t,n){const r=Qt({},t.options,n),a=new e(r);return a.import(t),a}}Il(Tt);Il(nu);Il(IU);Il(LU);Il(MU);Il(FU);Tt.Graph=Tt;Tt.DirectedGraph=nu;Tt.UndirectedGraph=IU;Tt.MultiGraph=LU;Tt.MultiDirectedGraph=MU;Tt.MultiUndirectedGraph=FU;Tt.InvalidArgumentsGraphError=Le;Tt.NotFoundGraphError=De;Tt.UsageGraphError=Ze;function HK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ys(e){var t=HK(e,"string");return typeof t=="symbol"?t:t+""}function on(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QR(e,t){for(var n=0;n e.length)&&(t=e.length);for(var n=0,r=Array(t);n >8&255,i=n>>16&255,l=n>>24&255;return[r,a,i,l]}var Th={};function GU(e){if(typeof Th[e]<"u")return Th[e];var t=(e&16711680)>>>16,n=(e&65280)>>>8,r=e&255,a=255,i=jU(t,n,r,a);return Th[e]=i,i}function JR(e,t,n,r){return n+(t<<8)+(e<<16)}function eC(e,t,n,r,a,i){var l=Math.floor(n/i*a),u=Math.floor(e.drawingBufferHeight/i-r/i*a),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(l,u,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var f=Sl(c,4),p=f[0],g=f[1],b=f[2],m=f[3];return[p,g,b,m]}function _e(e,t,n){return(t=Ys(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t C){var _="…";for(f=f+_,N=e.measureText(f).width;N>C&&f.length>1;)f=f.slice(0,-2)+_,N=e.measureText(f).width;if(f.length<4)return}var O;x>0?T>0?O=Math.acos(x/C):O=Math.asin(T/C):T>0?O=Math.acos(x/C)+Math.PI:O=Math.asin(x/C)+Math.PI/2,e.save(),e.translate(A,R),e.rotate(O),e.fillText(f,-N/2,t.size/2+i),e.restore()}}}function WU(e,t,n){if(t.label){var r=n.labelSize,a=n.labelFont,i=n.labelWeight,l=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.fillStyle=l,e.font="".concat(i," ").concat(r,"px ").concat(a),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}}function iX(e,t,n){var r=n.labelSize,a=n.labelFont,i=n.labelWeight;e.font="".concat(i," ").concat(r,"px ").concat(a),e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var l=2;if(typeof t.label=="string"){var u=e.measureText(t.label).width,c=Math.round(u+5),f=Math.round(r+2*l),p=Math.max(t.size,r/2)+l,g=Math.asin(f/2/p),b=Math.sqrt(Math.abs(Math.pow(p,2)-Math.pow(f/2,2)));e.beginPath(),e.moveTo(t.x+b,t.y+f/2),e.lineTo(t.x+p+c,t.y+f/2),e.lineTo(t.x+p+c,t.y-f/2),e.lineTo(t.x+b,t.y-f/2),e.arc(t.x,t.y,p,g,-g),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+l,0,Math.PI*2),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,WU(e,t,n)}var lX=` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return T.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},zW=DB,BW=IB,HB=LB,$B=MB,qB=UB,VB=GB,WB=PB,YB=BB;const UW=["top","right","bottom","left"],Ei=Math.min,Jn=Math.max,Xd=Math.round,rd=Math.floor,Jr=e=>({x:e,y:e}),jW={left:"right",right:"left",bottom:"top",top:"bottom"},GW={start:"end",end:"start"};function Kx(e,t,n){return Jn(e,Ei(t,n))}function Fa(e,t){return typeof e=="function"?e(t):e}function Pa(e){return e.split("-")[0]}function Ls(e){return e.split("-")[1]}function d0(e){return e==="x"?"y":"x"}function f0(e){return e==="y"?"height":"width"}function wi(e){return["top","bottom"].includes(Pa(e))?"y":"x"}function p0(e){return d0(wi(e))}function HW(e,t,n){n===void 0&&(n=!1);const r=Ls(e),a=p0(e),i=f0(a);let s=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Zd(s)),[s,Zd(s)]}function $W(e){const t=Zd(e);return[Xx(e),t,Xx(t)]}function Xx(e){return e.replace(/start|end/g,t=>GW[t])}function qW(e,t,n){const r=["left","right"],a=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:r:t?r:a;case"left":case"right":return t?i:s;default:return[]}}function VW(e,t,n,r){const a=Ls(e);let i=qW(Pa(e),n==="start",r);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(Xx)))),i}function Zd(e){return e.replace(/left|right|bottom|top/g,t=>jW[t])}function WW(e){return{top:0,right:0,bottom:0,left:0,...e}}function KB(e){return typeof e!="number"?WW(e):{top:e,right:e,bottom:e,left:e}}function Qd(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function EC(e,t,n){let{reference:r,floating:a}=e;const i=wi(t),s=p0(t),u=f0(s),c=Pa(t),d=i==="y",p=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,m=r[u]/2-a[u]/2;let b;switch(c){case"top":b={x:p,y:r.y-a.height};break;case"bottom":b={x:p,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:g};break;case"left":b={x:r.x-a.width,y:g};break;default:b={x:r.x,y:r.y}}switch(Ls(t)){case"start":b[s]-=m*(n&&d?-1:1);break;case"end":b[s]+=m*(n&&d?-1:1);break}return b}const YW=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:s}=n,u=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=EC(d,r,c),m=r,b={},S=0;for(let v=0;v ({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:s,elements:u,middlewareData:c}=t,{element:d,padding:p=0}=Fa(e,t)||{};if(d==null)return{};const g=KB(p),m={x:n,y:r},b=p0(a),S=f0(b),v=await s.getDimensions(d),k=b==="y",R=k?"top":"left",x=k?"bottom":"right",A=k?"clientHeight":"clientWidth",N=i.reference[S]+i.reference[b]-m[b]-i.floating[S],O=m[b]-i.reference[b],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let C=_?_[A]:0;(!C||!await(s.isElement==null?void 0:s.isElement(_)))&&(C=u.floating[A]||i.floating[S]);const F=N/2-O/2,I=C/2-v[S]/2-1,L=Ei(g[R],I),H=Ei(g[x],I),$=L,U=C-v[S]-H,W=C/2-v[S]/2+F,Y=Kx($,W,U),j=!c.arrow&&Ls(a)!=null&&W!==Y&&i.reference[S]/2-(W<$?L:H)-v[S]/2<0,G=j?W<$?W-$:W-U:0;return{[b]:m[b]+G,data:{[b]:Y,centerOffset:W-Y-G,...j&&{alignmentOffset:G}},reset:j}}}),XW=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:s,initialPlacement:u,platform:c,elements:d}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:v=!0,...k}=Fa(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const R=Pa(a),x=wi(u),A=Pa(u)===u,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),O=m||(A||!v?[Zd(u)]:$W(u)),_=S!=="none";!m&&_&&O.push(...VW(u,v,S,N));const C=[u,...O],F=await cu(t,k),I=[];let L=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&I.push(F[R]),g){const W=HW(a,s,N);I.push(F[W[0]],F[W[1]])}if(L=[...L,{placement:a,overflows:I}],!I.every(W=>W<=0)){var H,$;const W=(((H=i.flip)==null?void 0:H.index)||0)+1,Y=C[W];if(Y)return{data:{index:W,overflows:L},reset:{placement:Y}};let j=($=L.filter(G=>G.overflows[0]<=0).sort((G,z)=>G.overflows[1]-z.overflows[1])[0])==null?void 0:$.placement;if(!j)switch(b){case"bestFit":{var U;const G=(U=L.filter(z=>{if(_){const K=wi(z.placement);return K===x||K==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(K=>K>0).reduce((K,D)=>K+D,0)]).sort((z,K)=>z[1]-K[1])[0])==null?void 0:U[0];G&&(j=G);break}case"initialPlacement":j=u;break}if(a!==j)return{reset:{placement:j}}}return{}}}};function wC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xC(e){return UW.some(t=>e[t]>=0)}const ZW=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=Fa(e,t);switch(r){case"referenceHidden":{const i=await cu(t,{...a,elementContext:"reference"}),s=wC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:xC(s)}}}case"escaped":{const i=await cu(t,{...a,altBoundary:!0}),s=wC(i,n.floating);return{data:{escapedOffsets:s,escaped:xC(s)}}}default:return{}}}}};async function QW(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=Pa(n),u=Ls(n),c=wi(n)==="y",d=["left","top"].includes(s)?-1:1,p=i&&c?-1:1,g=Fa(t,e);let{mainAxis:m,crossAxis:b,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(b=u==="end"?S*-1:S),c?{x:b*p,y:m*d}:{x:m*d,y:b*p}}const JW=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:s,middlewareData:u}=t,c=await QW(t,e);return s===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:s}}}}},eY=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:u={fn:k=>{let{x:R,y:x}=k;return{x:R,y:x}}},...c}=Fa(e,t),d={x:n,y:r},p=await cu(t,c),g=wi(Pa(a)),m=d0(g);let b=d[m],S=d[g];if(i){const k=m==="y"?"top":"left",R=m==="y"?"bottom":"right",x=b+p[k],A=b-p[R];b=Kx(x,b,A)}if(s){const k=g==="y"?"top":"left",R=g==="y"?"bottom":"right",x=S+p[k],A=S-p[R];S=Kx(x,S,A)}const v=u.fn({...t,[m]:b,[g]:S});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:i,[g]:s}}}}}},tY=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:s}=t,{offset:u=0,mainAxis:c=!0,crossAxis:d=!0}=Fa(e,t),p={x:n,y:r},g=wi(a),m=d0(g);let b=p[m],S=p[g];const v=Fa(u,t),k=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const A=m==="y"?"height":"width",N=i.reference[m]-i.floating[A]+k.mainAxis,O=i.reference[m]+i.reference[A]-k.mainAxis;b O&&(b=O)}if(d){var R,x;const A=m==="y"?"width":"height",N=["top","left"].includes(Pa(a)),O=i.reference[g]-i.floating[A]+(N&&((R=s.offset)==null?void 0:R[g])||0)+(N?0:k.crossAxis),_=i.reference[g]+i.reference[A]+(N?0:((x=s.offset)==null?void 0:x[g])||0)-(N?k.crossAxis:0);S _&&(S=_)}return{[m]:b,[g]:S}}}},nY=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:s,elements:u}=t,{apply:c=()=>{},...d}=Fa(e,t),p=await cu(t,d),g=Pa(a),m=Ls(a),b=wi(a)==="y",{width:S,height:v}=i.floating;let k,R;g==="top"||g==="bottom"?(k=g,R=m===(await(s.isRTL==null?void 0:s.isRTL(u.floating))?"start":"end")?"left":"right"):(R=g,k=m==="end"?"top":"bottom");const x=v-p.top-p.bottom,A=S-p.left-p.right,N=Ei(v-p[k],x),O=Ei(S-p[R],A),_=!t.middlewareData.shift;let C=N,F=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(F=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=x),_&&!m){const L=Jn(p.left,0),H=Jn(p.right,0),$=Jn(p.top,0),U=Jn(p.bottom,0);b?F=S-2*(L!==0||H!==0?L+H:Jn(p.left,p.right)):C=v-2*($!==0||U!==0?$+U:Jn(p.top,p.bottom))}await c({...t,availableWidth:F,availableHeight:C});const I=await s.getDimensions(u.floating);return S!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function Ff(){return typeof window<"u"}function Ms(e){return XB(e)?(e.nodeName||"").toLowerCase():"#document"}function tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ta(e){var t;return(t=(XB(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function XB(e){return Ff()?e instanceof Node||e instanceof tr(e).Node:!1}function Fr(e){return Ff()?e instanceof Element||e instanceof tr(e).Element:!1}function ea(e){return Ff()?e instanceof HTMLElement||e instanceof tr(e).HTMLElement:!1}function kC(e){return!Ff()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof tr(e).ShadowRoot}function _u(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Pr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(a)}function rY(e){return["table","td","th"].includes(Ms(e))}function Pf(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function g0(e){const t=h0(),n=Fr(e)?Pr(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function aY(e){let t=xi(e);for(;ea(t)&&!ws(t);){if(g0(t))return t;if(Pf(t))return null;t=xi(t)}return null}function h0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ws(e){return["html","body","#document"].includes(Ms(e))}function Pr(e){return tr(e).getComputedStyle(e)}function zf(e){return Fr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xi(e){if(Ms(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kC(e)&&e.host||ta(e);return kC(t)?t.host:t}function ZB(e){const t=xi(e);return ws(t)?e.ownerDocument?e.ownerDocument.body:e.body:ea(t)&&_u(t)?t:ZB(t)}function du(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=ZB(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),s=tr(a);if(i){const u=Zx(s);return t.concat(s,s.visualViewport||[],_u(a)?a:[],u&&n?du(u):[])}return t.concat(a,du(a,[],n))}function Zx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function QB(e){const t=Pr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=ea(e),i=a?e.offsetWidth:n,s=a?e.offsetHeight:r,u=Xd(n)!==i||Xd(r)!==s;return u&&(n=i,r=s),{width:n,height:r,$:u}}function m0(e){return Fr(e)?e:e.contextElement}function ys(e){const t=m0(e);if(!ea(t))return Jr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=QB(t);let s=(i?Xd(n.width):n.width)/r,u=(i?Xd(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!u||!Number.isFinite(u))&&(u=1),{x:s,y:u}}const iY=Jr(0);function JB(e){const t=tr(e);return!h0()||!t.visualViewport?iY:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oY(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==tr(e)?!1:t}function uo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=m0(e);let s=Jr(1);t&&(r?Fr(r)&&(s=ys(r)):s=ys(e));const u=oY(i,n,r)?JB(i):Jr(0);let c=(a.left+u.x)/s.x,d=(a.top+u.y)/s.y,p=a.width/s.x,g=a.height/s.y;if(i){const m=tr(i),b=r&&Fr(r)?tr(r):r;let S=m,v=Zx(S);for(;v&&r&&b!==S;){const k=ys(v),R=v.getBoundingClientRect(),x=Pr(v),A=R.left+(v.clientLeft+parseFloat(x.paddingLeft))*k.x,N=R.top+(v.clientTop+parseFloat(x.paddingTop))*k.y;c*=k.x,d*=k.y,p*=k.x,g*=k.y,c+=A,d+=N,S=tr(v),v=Zx(S)}}return Qd({width:p,height:g,x:c,y:d})}function b0(e,t){const n=zf(e).scrollLeft;return t?t.left+n:uo(ta(e)).left+n}function eU(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-(n?0:b0(e,r)),i=r.top+t.scrollTop;return{x:a,y:i}}function sY(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",s=ta(r),u=t?Pf(t.floating):!1;if(r===s||u&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Jr(1);const p=Jr(0),g=ea(r);if((g||!g&&!i)&&((Ms(r)!=="body"||_u(s))&&(c=zf(r)),ea(r))){const b=uo(r);d=ys(r),p.x=b.x+r.clientLeft,p.y=b.y+r.clientTop}const m=s&&!g&&!i?eU(s,c,!0):Jr(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+p.x+m.x,y:n.y*d.y-c.scrollTop*d.y+p.y+m.y}}function lY(e){return Array.from(e.getClientRects())}function uY(e){const t=ta(e),n=zf(e),r=e.ownerDocument.body,a=Jn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Jn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+b0(e);const u=-n.scrollTop;return Pr(r).direction==="rtl"&&(s+=Jn(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:s,y:u}}function cY(e,t){const n=tr(e),r=ta(e),a=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,u=0,c=0;if(a){i=a.width,s=a.height;const d=h0();(!d||d&&t==="fixed")&&(u=a.offsetLeft,c=a.offsetTop)}return{width:i,height:s,x:u,y:c}}function dY(e,t){const n=uo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=ea(e)?ys(e):Jr(1),s=e.clientWidth*i.x,u=e.clientHeight*i.y,c=a*i.x,d=r*i.y;return{width:s,height:u,x:c,y:d}}function TC(e,t,n){let r;if(t==="viewport")r=cY(e,n);else if(t==="document")r=uY(ta(e));else if(Fr(t))r=dY(t,n);else{const a=JB(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Qd(r)}function tU(e,t){const n=xi(e);return n===t||!Fr(n)||ws(n)?!1:Pr(n).position==="fixed"||tU(n,t)}function fY(e,t){const n=t.get(e);if(n)return n;let r=du(e,[],!1).filter(u=>Fr(u)&&Ms(u)!=="body"),a=null;const i=Pr(e).position==="fixed";let s=i?xi(e):e;for(;Fr(s)&&!ws(s);){const u=Pr(s),c=g0(s);!c&&u.position==="fixed"&&(a=null),(i?!c&&!a:!c&&u.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||_u(s)&&!c&&tU(e,s))?r=r.filter(p=>p!==s):a=u,s=xi(s)}return t.set(e,r),r}function pY(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const s=[...n==="clippingAncestors"?Pf(t)?[]:fY(t,this._c):[].concat(n),r],u=s[0],c=s.reduce((d,p)=>{const g=TC(t,p,a);return d.top=Jn(g.top,d.top),d.right=Ei(g.right,d.right),d.bottom=Ei(g.bottom,d.bottom),d.left=Jn(g.left,d.left),d},TC(t,u,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function gY(e){const{width:t,height:n}=QB(e);return{width:t,height:n}}function hY(e,t,n){const r=ea(t),a=ta(t),i=n==="fixed",s=uo(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const c=Jr(0);if(r||!r&&!i)if((Ms(t)!=="body"||_u(a))&&(u=zf(t)),r){const m=uo(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else a&&(c.x=b0(a));const d=a&&!r&&!i?eU(a,u):Jr(0),p=s.left+u.scrollLeft-c.x-d.x,g=s.top+u.scrollTop-c.y-d.y;return{x:p,y:g,width:s.width,height:s.height}}function Bh(e){return Pr(e).position==="static"}function AC(e,t){if(!ea(e)||Pr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ta(e)===n&&(n=n.ownerDocument.body),n}function nU(e,t){const n=tr(e);if(Pf(e))return n;if(!ea(e)){let a=xi(e);for(;a&&!ws(a);){if(Fr(a)&&!Bh(a))return a;a=xi(a)}return n}let r=AC(e,t);for(;r&&rY(r)&&Bh(r);)r=AC(r,t);return r&&ws(r)&&Bh(r)&&!g0(r)?n:r||aY(e)||n}const mY=async function(e){const t=this.getOffsetParent||nU,n=this.getDimensions,r=await n(e.floating);return{reference:hY(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bY(e){return Pr(e).direction==="rtl"}const yY={convertOffsetParentRelativeRectToViewportRelativeRect:sY,getDocumentElement:ta,getClippingRect:pY,getOffsetParent:nU,getElementRects:mY,getClientRects:lY,getDimensions:gY,getScale:ys,isElement:Fr,isRTL:bY};function rU(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vY(e,t){let n=null,r;const a=ta(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function s(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:p,top:g,width:m,height:b}=d;if(u||t(),!m||!b)return;const S=rd(g),v=rd(a.clientWidth-(p+m)),k=rd(a.clientHeight-(g+b)),R=rd(p),A={rootMargin:-S+"px "+-v+"px "+-k+"px "+-R+"px",threshold:Jn(0,Ei(1,c))||1};let N=!0;function O(_){const C=_[0].intersectionRatio;if(C!==c){if(!N)return s();C?s(!1,C):r=setTimeout(()=>{s(!1,1e-7)},1e3)}C===1&&!rU(d,e.getBoundingClientRect())&&s(),N=!1}try{n=new IntersectionObserver(O,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,A)}n.observe(e)}return s(!0),i}function SY(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=m0(e),p=a||i?[...d?du(d):[],...du(t)]:[];p.forEach(R=>{a&&R.addEventListener("scroll",n,{passive:!0}),i&&R.addEventListener("resize",n)});const g=d&&u?vY(d,n):null;let m=-1,b=null;s&&(b=new ResizeObserver(R=>{let[x]=R;x&&x.target===d&&b&&(b.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var A;(A=b)==null||A.observe(t)})),n()}),d&&!c&&b.observe(d),b.observe(t));let S,v=c?uo(e):null;c&&k();function k(){const R=uo(e);v&&!rU(v,R)&&n(),v=R,S=requestAnimationFrame(k)}return n(),()=>{var R;p.forEach(x=>{a&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),g==null||g(),(R=b)==null||R.disconnect(),b=null,c&&cancelAnimationFrame(S)}}const EY=JW,wY=eY,xY=XW,kY=nY,TY=ZW,_C=KW,AY=tY,_Y=(e,t,n)=>{const r=new Map,a={platform:yY,...n},i={...a.platform,_c:r};return YW(e,t,{...a,platform:i})};var Nd=typeof document<"u"?T.useLayoutEffect:T.useEffect;function Jd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Jd(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!Jd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function aU(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RC(e,t){const n=aU(e);return Math.round(t*n)/n}function Uh(e){const t=T.useRef(e);return Nd(()=>{t.current=e}),t}function RY(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:s}={},transform:u=!0,whileElementsMounted:c,open:d}=e,[p,g]=T.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,b]=T.useState(r);Jd(m,r)||b(r);const[S,v]=T.useState(null),[k,R]=T.useState(null),x=T.useCallback(z=>{z!==_.current&&(_.current=z,v(z))},[]),A=T.useCallback(z=>{z!==C.current&&(C.current=z,R(z))},[]),N=i||S,O=s||k,_=T.useRef(null),C=T.useRef(null),F=T.useRef(p),I=c!=null,L=Uh(c),H=Uh(a),$=Uh(d),U=T.useCallback(()=>{if(!_.current||!C.current)return;const z={placement:t,strategy:n,middleware:m};H.current&&(z.platform=H.current),_Y(_.current,C.current,z).then(K=>{const D={...K,isPositioned:$.current!==!1};W.current&&!Jd(F.current,D)&&(F.current=D,Tu.flushSync(()=>{g(D)}))})},[m,t,n,H,$]);Nd(()=>{d===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[d]);const W=T.useRef(!1);Nd(()=>(W.current=!0,()=>{W.current=!1}),[]),Nd(()=>{if(N&&(_.current=N),O&&(C.current=O),N&&O){if(L.current)return L.current(N,O,U);U()}},[N,O,U,L,I]);const Y=T.useMemo(()=>({reference:_,floating:C,setReference:x,setFloating:A}),[x,A]),j=T.useMemo(()=>({reference:N,floating:O}),[N,O]),G=T.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const K=RC(j.floating,p.x),D=RC(j.floating,p.y);return u?{...z,transform:"translate("+K+"px, "+D+"px)",...aU(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:D}},[n,u,j.floating,p.x,p.y]);return T.useMemo(()=>({...p,update:U,refs:Y,elements:j,floatingStyles:G}),[p,U,Y,j,G])}const CY=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_C({element:r.current,padding:a}).fn(n):{}:r?_C({element:r,padding:a}).fn(n):{}}}},NY=(e,t)=>({...EY(e),options:[e,t]}),OY=(e,t)=>({...wY(e),options:[e,t]}),DY=(e,t)=>({...AY(e),options:[e,t]}),IY=(e,t)=>({...xY(e),options:[e,t]}),LY=(e,t)=>({...kY(e),options:[e,t]}),MY=(e,t)=>({...TY(e),options:[e,t]}),FY=(e,t)=>({...CY(e),options:[e,t]});var PY="Arrow",iU=T.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return E.jsx(Xe.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:E.jsx("polygon",{points:"0,0 30,0 15,10"})})});iU.displayName=PY;var zY=iU;function oU(e){const[t,n]=T.useState(void 0);return Tn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,u;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;s=d.inlineSize,u=d.blockSize}else s=e.offsetWidth,u=e.offsetHeight;n({width:s,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var y0="Popper",[sU,Fs]=Sr(y0),[BY,lU]=sU(y0),uU=e=>{const{__scopePopper:t,children:n}=e,[r,a]=T.useState(null);return E.jsx(BY,{scope:t,anchor:r,onAnchorChange:a,children:n})};uU.displayName=y0;var cU="PopperAnchor",dU=T.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=lU(cU,n),s=T.useRef(null),u=gt(t,s);return T.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:E.jsx(Xe.div,{...a,ref:u})});dU.displayName=cU;var v0="PopperContent",[UY,jY]=sU(v0),fU=T.forwardRef((e,t)=>{var re,se,Te,ae,we,xe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:b="optimized",onPlaced:S,...v}=e,k=lU(v0,n),[R,x]=T.useState(null),A=gt(t,Ie=>x(Ie)),[N,O]=T.useState(null),_=oU(N),C=(_==null?void 0:_.width)??0,F=(_==null?void 0:_.height)??0,I=r+(i!=="center"?"-"+i:""),L=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},H=Array.isArray(d)?d:[d],$=H.length>0,U={padding:L,boundary:H.filter(HY),altBoundary:$},{refs:W,floatingStyles:Y,placement:j,isPositioned:G,middlewareData:z}=RY({strategy:"fixed",placement:I,whileElementsMounted:(...Ie)=>SY(...Ie,{animationFrame:b==="always"}),elements:{reference:k.anchor},middleware:[NY({mainAxis:a+F,alignmentAxis:s}),c&&OY({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?DY():void 0,...U}),c&&IY({...U}),LY({...U,apply:({elements:Ie,rects:Ce,availableWidth:Ee,availableHeight:J})=>{const{width:fe,height:ke}=Ce.reference,me=Ie.floating.style;me.setProperty("--radix-popper-available-width",`${Ee}px`),me.setProperty("--radix-popper-available-height",`${J}px`),me.setProperty("--radix-popper-anchor-width",`${fe}px`),me.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),N&&FY({element:N,padding:u}),$Y({arrowWidth:C,arrowHeight:F}),m&&MY({strategy:"referenceHidden",...U})]}),[K,D]=hU(j),V=mn(S);Tn(()=>{G&&(V==null||V())},[G,V]);const B=(re=z.arrow)==null?void 0:re.x,M=(se=z.arrow)==null?void 0:se.y,X=((Te=z.arrow)==null?void 0:Te.centerOffset)!==0,[Q,le]=T.useState();return Tn(()=>{R&&le(window.getComputedStyle(R).zIndex)},[R]),E.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:G?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ae=z.transformOrigin)==null?void 0:ae.x,(we=z.transformOrigin)==null?void 0:we.y].join(" "),...((xe=z.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:E.jsx(UY,{scope:n,placedSide:K,onArrowChange:O,arrowX:B,arrowY:M,shouldHideArrow:X,children:E.jsx(Xe.div,{"data-side":K,"data-align":D,...v,ref:A,style:{...v.style,animation:G?void 0:"none"}})})})});fU.displayName=v0;var pU="PopperArrow",GY={top:"bottom",right:"left",bottom:"top",left:"right"},gU=T.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=jY(pU,r),s=GY[i.placedSide];return E.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:E.jsx(zY,{...a,ref:n,style:{...a.style,display:"block"}})})});gU.displayName=pU;function HY(e){return e!==null}var $Y=e=>({name:"transformOrigin",options:e,fn(t){var k,R,x;const{placement:n,rects:r,middlewareData:a}=t,s=((k=a.arrow)==null?void 0:k.centerOffset)!==0,u=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[d,p]=hU(n),g={start:"0%",center:"50%",end:"100%"}[p],m=(((R=a.arrow)==null?void 0:R.x)??0)+u/2,b=(((x=a.arrow)==null?void 0:x.y)??0)+c/2;let S="",v="";return d==="bottom"?(S=s?g:`${m}px`,v=`${-c}px`):d==="top"?(S=s?g:`${m}px`,v=`${r.floating.height+c}px`):d==="right"?(S=`${-c}px`,v=s?g:`${b}px`):d==="left"&&(S=`${r.floating.width+c}px`,v=s?g:`${b}px`),{data:{x:S,y:v}}}});function hU(e){const[t,n="center"]=e.split("-");return[t,n]}var S0=uU,Bf=dU,E0=fU,w0=gU,qY="VisuallyHidden",x0=T.forwardRef((e,t)=>E.jsx(Xe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));x0.displayName=qY;var VY=x0,[Uf,GSe]=Sr("Tooltip",[Fs]),jf=Fs(),mU="TooltipProvider",WY=700,Qx="tooltip.open",[YY,k0]=Uf(mU),bU=e=>{const{__scopeTooltip:t,delayDuration:n=WY,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,[s,u]=T.useState(!0),c=T.useRef(!1),d=T.useRef(0);return T.useEffect(()=>{const p=d.current;return()=>window.clearTimeout(p)},[]),E.jsx(YY,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:T.useCallback(()=>{window.clearTimeout(d.current),u(!1)},[]),onClose:T.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:T.useCallback(p=>{c.current=p},[]),disableHoverableContent:a,children:i})};bU.displayName=mU;var Gf="Tooltip",[KY,Hf]=Uf(Gf),yU=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:u}=e,c=k0(Gf,e.__scopeTooltip),d=jf(t),[p,g]=T.useState(null),m=kn(),b=T.useRef(0),S=s??c.disableHoverableContent,v=u??c.delayDuration,k=T.useRef(!1),[R=!1,x]=Ma({prop:r,defaultProp:a,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(Qx))):c.onClose(),i==null||i(C)}}),A=T.useMemo(()=>R?k.current?"delayed-open":"instant-open":"closed",[R]),N=T.useCallback(()=>{window.clearTimeout(b.current),b.current=0,k.current=!1,x(!0)},[x]),O=T.useCallback(()=>{window.clearTimeout(b.current),b.current=0,x(!1)},[x]),_=T.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{k.current=!0,x(!0),b.current=0},v)},[v,x]);return T.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),E.jsx(S0,{...d,children:E.jsx(KY,{scope:t,contentId:m,open:R,stateAttribute:A,trigger:p,onTriggerChange:g,onTriggerEnter:T.useCallback(()=>{c.isOpenDelayed?_():N()},[c.isOpenDelayed,_,N]),onTriggerLeave:T.useCallback(()=>{S?O():(window.clearTimeout(b.current),b.current=0)},[O,S]),onOpen:N,onClose:O,disableHoverableContent:S,children:n})})};yU.displayName=Gf;var Jx="TooltipTrigger",vU=T.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Hf(Jx,n),i=k0(Jx,n),s=jf(n),u=T.useRef(null),c=gt(t,u,a.onTriggerChange),d=T.useRef(!1),p=T.useRef(!1),g=T.useCallback(()=>d.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),E.jsx(Bf,{asChild:!0,...s,children:E.jsx(Xe.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:Ye(e.onPointerMove,m=>{m.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ye(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:Ye(e.onPointerDown,()=>{d.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Ye(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:Ye(e.onBlur,a.onClose),onClick:Ye(e.onClick,a.onClose)})})});vU.displayName=Jx;var XY="TooltipPortal",[HSe,ZY]=Uf(XY,{forceMount:void 0}),xs="TooltipContent",SU=T.forwardRef((e,t)=>{const n=ZY(xs,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,s=Hf(xs,e.__scopeTooltip);return E.jsx(rr,{present:r||s.open,children:s.disableHoverableContent?E.jsx(EU,{side:a,...i,ref:t}):E.jsx(QY,{side:a,...i,ref:t})})}),QY=T.forwardRef((e,t)=>{const n=Hf(xs,e.__scopeTooltip),r=k0(xs,e.__scopeTooltip),a=T.useRef(null),i=gt(t,a),[s,u]=T.useState(null),{trigger:c,onClose:d}=n,p=a.current,{onPointerInTransitChange:g}=r,m=T.useCallback(()=>{u(null),g(!1)},[g]),b=T.useCallback((S,v)=>{const k=S.currentTarget,R={x:S.clientX,y:S.clientY},x=nK(R,k.getBoundingClientRect()),A=rK(R,x),N=aK(v.getBoundingClientRect()),O=oK([...A,...N]);u(O),g(!0)},[g]);return T.useEffect(()=>()=>m(),[m]),T.useEffect(()=>{if(c&&p){const S=k=>b(k,p),v=k=>b(k,c);return c.addEventListener("pointerleave",S),p.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",S),p.removeEventListener("pointerleave",v)}}},[c,p,b,m]),T.useEffect(()=>{if(s){const S=v=>{const k=v.target,R={x:v.clientX,y:v.clientY},x=(c==null?void 0:c.contains(k))||(p==null?void 0:p.contains(k)),A=!iK(R,s);x?m():A&&(m(),d())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[c,p,s,d,m]),E.jsx(EU,{...e,ref:i})}),[JY,eK]=Uf(Gf,{isInside:!1}),EU=T.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...u}=e,c=Hf(xs,n),d=jf(n),{onClose:p}=c;return T.useEffect(()=>(document.addEventListener(Qx,p),()=>document.removeEventListener(Qx,p)),[p]),T.useEffect(()=>{if(c.trigger){const g=m=>{const b=m.target;b!=null&&b.contains(c.trigger)&&p()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[c.trigger,p]),E.jsx(Au,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:g=>g.preventDefault(),onDismiss:p,children:E.jsxs(E0,{"data-state":c.stateAttribute,...d,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[E.jsx(Jk,{children:r}),E.jsx(JY,{scope:n,isInside:!0,children:E.jsx(VY,{id:c.contentId,role:"tooltip",children:a||r})})]})})});SU.displayName=xs;var wU="TooltipArrow",tK=T.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=jf(n);return eK(wU,n).isInside?null:E.jsx(w0,{...a,...r,ref:t})});tK.displayName=wU;function nK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function rK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function aK(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function iK(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i r!=p>r&&n<(d-u)*(r-c)/(p-c)+u&&(a=!a)}return a}function oK(e){const t=e.slice();return t.sort((n,r)=>n.x r.x?1:n.y r.y?1:0),sK(t)}function sK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r =2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var lK=bU,uK=yU,cK=vU,xU=SU;const kU=lK,TU=uK,AU=cK,dK=e=>typeof e!="string"?e:E.jsx("div",{className:"relative top-0 pt-1 whitespace-pre-wrap break-words",children:e}),T0=T.forwardRef(({className:e,side:t="left",align:n="start",children:r,...a},i)=>{const s=T.useRef(null);return T.useEffect(()=>{s.current&&(s.current.scrollTop=0)},[r]),E.jsx(xU,{ref:i,side:t,align:n,className:Me("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-words rounded-md border px-3 py-2 text-sm shadow-md",e),...a,children:typeof r=="string"?dK(r):r})});T0.displayName=xU.displayName;const ef=bz("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-8"}},defaultVariants:{variant:"default",size:"default"}}),Mt=T.forwardRef(({className:e,variant:t,tooltip:n,size:r,side:a="right",asChild:i=!1,...s},u)=>{const c=i?Si:"button";return n?E.jsx(kU,{children:E.jsxs(TU,{children:[E.jsx(AU,{asChild:!0,children:E.jsx(c,{className:Me(ef({variant:t,size:r,className:e}),"cursor-pointer"),ref:u,...s})}),E.jsx(T0,{side:a,children:n})]})}):E.jsx(c,{className:Me(ef({variant:t,size:r,className:e}),"cursor-pointer"),ref:u,...s})});Mt.displayName="Button";const fK=zW,pK=BW,_U=T.forwardRef(({className:e,...t},n)=>E.jsx(HB,{className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...t,ref:n}));_U.displayName=HB.displayName;const RU=T.forwardRef(({className:e,...t},n)=>E.jsxs(pK,{children:[E.jsx(_U,{}),E.jsx($B,{ref:n,className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...t})]}));RU.displayName=$B.displayName;const CU=({className:e,...t})=>E.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});CU.displayName="AlertDialogHeader";const NU=T.forwardRef(({className:e,...t},n)=>E.jsx(WB,{ref:n,className:Me("text-lg font-semibold",e),...t}));NU.displayName=WB.displayName;const OU=T.forwardRef(({className:e,...t},n)=>E.jsx(YB,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));OU.displayName=YB.displayName;const gK=T.forwardRef(({className:e,...t},n)=>E.jsx(qB,{ref:n,className:Me(ef(),e),...t}));gK.displayName=qB.displayName;const hK=T.forwardRef(({className:e,...t},n)=>E.jsx(VB,{ref:n,className:Me(ef({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));hK.displayName=VB.displayName;const ki=T.forwardRef(({className:e,type:t,...n},r)=>E.jsx("input",{type:t,className:Me("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 rounded-md border bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm [&::-webkit-inner-spin-button]:opacity-100 [&::-webkit-outer-spin-button]:opacity-100",e),ref:r,...n}));ki.displayName="Input";var mK=e=>{switch(e){case"success":return vK;case"info":return EK;case"warning":return SK;case"error":return wK;default:return null}},bK=Array(12).fill(0),yK=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},bK.map((n,r)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),vK=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),SK=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),EK=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),wK=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),xK=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kK=()=>{let[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},ek=1,TK=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:ek++,i=this.toasts.find(u=>u.id===a),s=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(u=>u.id===a?(this.publish({...u,...e,id:a,title:n}),{...u,...e,id:a,dismissible:s,title:n}):u):this.addToast({title:n,...r,dismissible:s,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,i,s=r.then(async c=>{if(i=["resolve",c],ye.isValidElement(c))a=!1,this.create({id:n,type:"default",message:c});else if(_K(c)&&!c.ok){a=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:p})}else if(t.success!==void 0){a=!1;let d=typeof t.success=="function"?await t.success(c):t.success,p=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:p})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){a=!1;let d=typeof t.error=="function"?await t.error(c):t.error,p=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:p})}}).finally(()=>{var c;a&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),u=()=>new Promise((c,d)=>s.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:u}:Object.assign(n,{unwrap:u})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||ek++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Bn=new TK,AK=(e,t)=>{let n=(t==null?void 0:t.id)||ek++;return Bn.addToast({title:e,...t,id:n}),n},_K=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",RK=AK,CK=()=>Bn.toasts,NK=()=>Bn.getActiveToasts(),wn=Object.assign(RK,{success:Bn.success,info:Bn.info,warning:Bn.warning,error:Bn.error,custom:Bn.custom,message:Bn.message,promise:Bn.promise,dismiss:Bn.dismiss,loading:Bn.loading},{getHistory:CK,getToasts:NK});function OK(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}OK(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function ad(e){return e.label!==void 0}var DK=3,IK="32px",LK="16px",CC=4e3,MK=356,FK=14,PK=20,zK=200;function Cr(...e){return e.filter(Boolean).join(" ")}function BK(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var UK=e=>{var t,n,r,a,i,s,u,c,d,p,g;let{invert:m,toast:b,unstyled:S,interacting:v,setHeights:k,visibleToasts:R,heights:x,index:A,toasts:N,expanded:O,removeToast:_,defaultRichColors:C,closeButton:F,style:I,cancelButtonStyle:L,actionButtonStyle:H,className:$="",descriptionClassName:U="",duration:W,position:Y,gap:j,loadingIcon:G,expandByDefault:z,classNames:K,icons:D,closeButtonAriaLabel:V="Close toast",pauseWhenPageIsHidden:B}=e,[M,X]=ye.useState(null),[Q,le]=ye.useState(null),[re,se]=ye.useState(!1),[Te,ae]=ye.useState(!1),[we,xe]=ye.useState(!1),[Ie,Ce]=ye.useState(!1),[Ee,J]=ye.useState(!1),[fe,ke]=ye.useState(0),[me,ve]=ye.useState(0),oe=ye.useRef(b.duration||W||CC),Pe=ye.useRef(null),ze=ye.useRef(null),he=A===0,Ne=A+1<=R,ee=b.type,ce=b.dismissible!==!1,Re=b.className||"",Fe=b.descriptionClassName||"",Ve=ye.useMemo(()=>x.findIndex(Ke=>Ke.toastId===b.id)||0,[x,b.id]),yt=ye.useMemo(()=>{var Ke;return(Ke=b.closeButton)!=null?Ke:F},[b.closeButton,F]),wt=ye.useMemo(()=>b.duration||W||CC,[b.duration,W]),ht=ye.useRef(0),et=ye.useRef(0),xt=ye.useRef(0),it=ye.useRef(null),[vt,jt]=Y.split("-"),dn=ye.useMemo(()=>x.reduce((Ke,mt,Rt)=>Rt>=Ve?Ke:Ke+mt.height,0),[x,Ve]),Ft=kK(),ar=b.invert||m,jr=ee==="loading";et.current=ye.useMemo(()=>Ve*j+dn,[Ve,dn]),ye.useEffect(()=>{oe.current=wt},[wt]),ye.useEffect(()=>{se(!0)},[]),ye.useEffect(()=>{let Ke=ze.current;if(Ke){let mt=Ke.getBoundingClientRect().height;return ve(mt),k(Rt=>[{toastId:b.id,height:mt,position:b.position},...Rt]),()=>k(Rt=>Rt.filter(On=>On.toastId!==b.id))}},[k,b.id]),ye.useLayoutEffect(()=>{if(!re)return;let Ke=ze.current,mt=Ke.style.height;Ke.style.height="auto";let Rt=Ke.getBoundingClientRect().height;Ke.style.height=mt,ve(Rt),k(On=>On.find(_n=>_n.toastId===b.id)?On.map(_n=>_n.toastId===b.id?{..._n,height:Rt}:_n):[{toastId:b.id,height:Rt,position:b.position},...On])},[re,b.title,b.description,k,b.id]);let Qt=ye.useCallback(()=>{ae(!0),ke(et.current),k(Ke=>Ke.filter(mt=>mt.toastId!==b.id)),setTimeout(()=>{_(b)},zK)},[b,_,k,et]);ye.useEffect(()=>{if(b.promise&&ee==="loading"||b.duration===1/0||b.type==="loading")return;let Ke;return O||v||B&&Ft?(()=>{if(xt.current {var mt;(mt=b.onAutoClose)==null||mt.call(b,b),Qt()},oe.current)),()=>clearTimeout(Ke)},[O,v,b,ee,B,Ft,Qt]),ye.useEffect(()=>{b.delete&&Qt()},[Qt,b.delete]);function oa(){var Ke,mt,Rt;return D!=null&&D.loading?ye.createElement("div",{className:Cr(K==null?void 0:K.loader,(Ke=b==null?void 0:b.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":ee==="loading"},D.loading):G?ye.createElement("div",{className:Cr(K==null?void 0:K.loader,(mt=b==null?void 0:b.classNames)==null?void 0:mt.loader,"sonner-loader"),"data-visible":ee==="loading"},G):ye.createElement(yK,{className:Cr(K==null?void 0:K.loader,(Rt=b==null?void 0:b.classNames)==null?void 0:Rt.loader),visible:ee==="loading"})}return ye.createElement("li",{tabIndex:0,ref:ze,className:Cr($,Re,K==null?void 0:K.toast,(t=b==null?void 0:b.classNames)==null?void 0:t.toast,K==null?void 0:K.default,K==null?void 0:K[ee],(n=b==null?void 0:b.classNames)==null?void 0:n[ee]),"data-sonner-toast":"","data-rich-colors":(r=b.richColors)!=null?r:C,"data-styled":!(b.jsx||b.unstyled||S),"data-mounted":re,"data-promise":!!b.promise,"data-swiped":Ee,"data-removed":Te,"data-visible":Ne,"data-y-position":vt,"data-x-position":jt,"data-index":A,"data-front":he,"data-swiping":we,"data-dismissible":ce,"data-type":ee,"data-invert":ar,"data-swipe-out":Ie,"data-swipe-direction":Q,"data-expanded":!!(O||z&&re),style:{"--index":A,"--toasts-before":A,"--z-index":N.length-A,"--offset":`${Te?fe:et.current}px`,"--initial-height":z?"auto":`${me}px`,...I,...b.style},onDragEnd:()=>{xe(!1),X(null),it.current=null},onPointerDown:Ke=>{jr||!ce||(Pe.current=new Date,ke(et.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(xe(!0),it.current={x:Ke.clientX,y:Ke.clientY}))},onPointerUp:()=>{var Ke,mt,Rt,On;if(Ie||!ce)return;it.current=null;let _n=Number(((Ke=ze.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Dn=Number(((mt=ze.current)==null?void 0:mt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),sa=new Date().getTime()-((Rt=Pe.current)==null?void 0:Rt.getTime()),In=M==="x"?_n:Dn,kr=Math.abs(In)/sa;if(Math.abs(In)>=PK||kr>.11){ke(et.current),(On=b.onDismiss)==null||On.call(b,b),le(M==="x"?_n>0?"right":"left":Dn>0?"down":"up"),Qt(),Ce(!0),J(!1);return}xe(!1),X(null)},onPointerMove:Ke=>{var mt,Rt,On,_n;if(!it.current||!ce||((mt=window.getSelection())==null?void 0:mt.toString().length)>0)return;let Dn=Ke.clientY-it.current.y,sa=Ke.clientX-it.current.x,In=(Rt=e.swipeDirections)!=null?Rt:BK(Y);!M&&(Math.abs(sa)>1||Math.abs(Dn)>1)&&X(Math.abs(sa)>Math.abs(Dn)?"x":"y");let kr={x:0,y:0};M==="y"?(In.includes("top")||In.includes("bottom"))&&(In.includes("top")&&Dn<0||In.includes("bottom")&&Dn>0)&&(kr.y=Dn):M==="x"&&(In.includes("left")||In.includes("right"))&&(In.includes("left")&&sa<0||In.includes("right")&&sa>0)&&(kr.x=sa),(Math.abs(kr.x)>0||Math.abs(kr.y)>0)&&J(!0),(On=ze.current)==null||On.style.setProperty("--swipe-amount-x",`${kr.x}px`),(_n=ze.current)==null||_n.style.setProperty("--swipe-amount-y",`${kr.y}px`)}},yt&&!b.jsx?ye.createElement("button",{"aria-label":V,"data-disabled":jr,"data-close-button":!0,onClick:jr||!ce?()=>{}:()=>{var Ke;Qt(),(Ke=b.onDismiss)==null||Ke.call(b,b)},className:Cr(K==null?void 0:K.closeButton,(a=b==null?void 0:b.classNames)==null?void 0:a.closeButton)},(i=D==null?void 0:D.close)!=null?i:xK):null,b.jsx||T.isValidElement(b.title)?b.jsx?b.jsx:typeof b.title=="function"?b.title():b.title:ye.createElement(ye.Fragment,null,ee||b.icon||b.promise?ye.createElement("div",{"data-icon":"",className:Cr(K==null?void 0:K.icon,(s=b==null?void 0:b.classNames)==null?void 0:s.icon)},b.promise||b.type==="loading"&&!b.icon?b.icon||oa():null,b.type!=="loading"?b.icon||(D==null?void 0:D[ee])||mK(ee):null):null,ye.createElement("div",{"data-content":"",className:Cr(K==null?void 0:K.content,(u=b==null?void 0:b.classNames)==null?void 0:u.content)},ye.createElement("div",{"data-title":"",className:Cr(K==null?void 0:K.title,(c=b==null?void 0:b.classNames)==null?void 0:c.title)},typeof b.title=="function"?b.title():b.title),b.description?ye.createElement("div",{"data-description":"",className:Cr(U,Fe,K==null?void 0:K.description,(d=b==null?void 0:b.classNames)==null?void 0:d.description)},typeof b.description=="function"?b.description():b.description):null),T.isValidElement(b.cancel)?b.cancel:b.cancel&&ad(b.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||L,onClick:Ke=>{var mt,Rt;ad(b.cancel)&&ce&&((Rt=(mt=b.cancel).onClick)==null||Rt.call(mt,Ke),Qt())},className:Cr(K==null?void 0:K.cancelButton,(p=b==null?void 0:b.classNames)==null?void 0:p.cancelButton)},b.cancel.label):null,T.isValidElement(b.action)?b.action:b.action&&ad(b.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||H,onClick:Ke=>{var mt,Rt;ad(b.action)&&((Rt=(mt=b.action).onClick)==null||Rt.call(mt,Ke),!Ke.defaultPrevented&&Qt())},className:Cr(K==null?void 0:K.actionButton,(g=b==null?void 0:b.classNames)==null?void 0:g.actionButton)},b.action.label):null))};function NC(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jK(e,t){let n={};return[e,t].forEach((r,a)=>{let i=a===1,s=i?"--mobile-offset":"--offset",u=i?LK:IK;function c(d){["top","right","bottom","left"].forEach(p=>{n[`${s}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${s}-${d}`]=u:n[`${s}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(u)}),n}var GK=T.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:s,className:u,offset:c,mobileOffset:d,theme:p="light",richColors:g,duration:m,style:b,visibleToasts:S=DK,toastOptions:v,dir:k=NC(),gap:R=FK,loadingIcon:x,icons:A,containerAriaLabel:N="Notifications",pauseWhenPageIsHidden:O}=e,[_,C]=ye.useState([]),F=ye.useMemo(()=>Array.from(new Set([r].concat(_.filter(B=>B.position).map(B=>B.position)))),[_,r]),[I,L]=ye.useState([]),[H,$]=ye.useState(!1),[U,W]=ye.useState(!1),[Y,j]=ye.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ye.useRef(null),z=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),K=ye.useRef(null),D=ye.useRef(!1),V=ye.useCallback(B=>{C(M=>{var X;return(X=M.find(Q=>Q.id===B.id))!=null&&X.delete||Bn.dismiss(B.id),M.filter(({id:Q})=>Q!==B.id)})},[]);return ye.useEffect(()=>Bn.subscribe(B=>{if(B.dismiss){C(M=>M.map(X=>X.id===B.id?{...X,delete:!0}:X));return}setTimeout(()=>{tB.flushSync(()=>{C(M=>{let X=M.findIndex(Q=>Q.id===B.id);return X!==-1?[...M.slice(0,X),{...M[X],...B},...M.slice(X+1)]:[B,...M]})})})}),[]),ye.useEffect(()=>{if(p!=="system"){j(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?j("dark"):j("light")),typeof window>"u")return;let B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:M})=>{j(M?"dark":"light")})}catch{B.addListener(({matches:X})=>{try{j(X?"dark":"light")}catch(Q){console.error(Q)}})}},[p]),ye.useEffect(()=>{_.length<=1&&$(!1)},[_]),ye.useEffect(()=>{let B=M=>{var X,Q;a.every(le=>M[le]||M.code===le)&&($(!0),(X=G.current)==null||X.focus()),M.code==="Escape"&&(document.activeElement===G.current||(Q=G.current)!=null&&Q.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[a]),ye.useEffect(()=>{if(G.current)return()=>{K.current&&(K.current.focus({preventScroll:!0}),K.current=null,D.current=!1)}},[G.current]),ye.createElement("section",{ref:t,"aria-label":`${N} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},F.map((B,M)=>{var X;let[Q,le]=B.split("-");return _.length?ye.createElement("ol",{key:B,dir:k==="auto"?NC():k,tabIndex:-1,ref:G,className:u,"data-sonner-toaster":!0,"data-theme":Y,"data-y-position":Q,"data-lifted":H&&_.length>1&&!i,"data-x-position":le,style:{"--front-toast-height":`${((X=I[0])==null?void 0:X.height)||0}px`,"--width":`${MK}px`,"--gap":`${R}px`,...b,...jK(c,d)},onBlur:re=>{D.current&&!re.currentTarget.contains(re.relatedTarget)&&(D.current=!1,K.current&&(K.current.focus({preventScroll:!0}),K.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||D.current||(D.current=!0,K.current=re.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{U||$(!1)},onDragEnd:()=>$(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},_.filter(re=>!re.position&&M===0||re.position===B).map((re,se)=>{var Te,ae;return ye.createElement(UK,{key:re.id,icons:A,index:se,toast:re,defaultRichColors:g,duration:(Te=v==null?void 0:v.duration)!=null?Te:m,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:n,visibleToasts:S,closeButton:(ae=v==null?void 0:v.closeButton)!=null?ae:s,interacting:U,position:B,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:V,toasts:_.filter(we=>we.position==re.position),heights:I.filter(we=>we.position==re.position),setHeights:L,expandByDefault:i,gap:R,loadingIcon:x,expanded:H,pauseWhenPageIsHidden:O,swipeDirections:e.swipeDirections})})):null}))});const HK=()=>{const[e,t]=T.useState(!0),n=je.use.apiKey(),[r,a]=T.useState(""),i=Gn.use.message();T.useEffect(()=>{a(n||"")},[n,e]),T.useEffect(()=>{i&&(i.includes(Vz)||i.includes(Wz))&&t(!0)},[i,t]);const s=T.useCallback(async()=>{if(je.setState({apiKey:r||null}),await Gn.getState().check()){t(!1);return}wn.error("API Key is invalid")},[r]),u=T.useCallback(c=>{a(c.target.value)},[a]);return E.jsx(fK,{open:e,onOpenChange:t,children:E.jsxs(RU,{children:[E.jsxs(CU,{children:[E.jsx(NU,{children:"API Key is required"}),E.jsx(OU,{children:"Please enter your API key"})]}),E.jsxs("form",{className:"flex gap-2",onSubmit:c=>c.preventDefault(),children:[E.jsx(ki,{type:"password",value:r,onChange:u,placeholder:"Enter your API key",className:"max-h-full w-full min-w-0",autoComplete:"off"}),E.jsx(Mt,{onClick:s,variant:"outline",size:"sm",children:"Save"})]})]})})};var A0="Popover",[DU,$Se]=Sr(A0,[Fs]),Ru=Fs(),[$K,Ti]=DU(A0),IU=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,u=Ru(t),c=T.useRef(null),[d,p]=T.useState(!1),[g=!1,m]=Ma({prop:r,defaultProp:a,onChange:i});return E.jsx(S0,{...u,children:E.jsx($K,{scope:t,contentId:kn(),triggerRef:c,open:g,onOpenChange:m,onOpenToggle:T.useCallback(()=>m(b=>!b),[m]),hasCustomAnchor:d,onCustomAnchorAdd:T.useCallback(()=>p(!0),[]),onCustomAnchorRemove:T.useCallback(()=>p(!1),[]),modal:s,children:n})})};IU.displayName=A0;var LU="PopoverAnchor",qK=T.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Ti(LU,n),i=Ru(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:u}=a;return T.useEffect(()=>(s(),()=>u()),[s,u]),E.jsx(Bf,{...i,...r,ref:t})});qK.displayName=LU;var MU="PopoverTrigger",FU=T.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Ti(MU,n),i=Ru(n),s=gt(t,a.triggerRef),u=E.jsx(Xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":jU(a.open),...r,ref:s,onClick:Ye(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:E.jsx(Bf,{asChild:!0,...i,children:u})});FU.displayName=MU;var _0="PopoverPortal",[VK,WK]=DU(_0,{forceMount:void 0}),PU=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=Ti(_0,t);return E.jsx(VK,{scope:t,forceMount:n,children:E.jsx(rr,{present:n||i.open,children:E.jsx(Of,{asChild:!0,container:a,children:r})})})};PU.displayName=_0;var ks="PopoverContent",zU=T.forwardRef((e,t)=>{const n=WK(ks,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=Ti(ks,e.__scopePopover);return E.jsx(rr,{present:r||i.open,children:i.modal?E.jsx(YK,{...a,ref:t}):E.jsx(KK,{...a,ref:t})})});zU.displayName=ks;var YK=T.forwardRef((e,t)=>{const n=Ti(ks,e.__scopePopover),r=T.useRef(null),a=gt(t,r),i=T.useRef(!1);return T.useEffect(()=>{const s=r.current;if(s)return t0(s)},[]),E.jsx(If,{as:Si,allowPinchZoom:!0,children:E.jsx(BU,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(e.onCloseAutoFocus,s=>{var u;s.preventDefault(),i.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Ye(e.onPointerDownOutside,s=>{const u=s.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,d=u.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),KK=T.forwardRef((e,t)=>{const n=Ti(ks,e.__scopePopover),r=T.useRef(!1),a=T.useRef(!1);return E.jsx(BU,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,u;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),BU=T.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:p,...g}=e,m=Ti(ks,n),b=Ru(n);return e0(),E.jsx(Nf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:E.jsx(Au,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:p,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:E.jsx(E0,{"data-state":jU(m.open),role:"dialog",id:m.contentId,...b,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),UU="PopoverClose",XK=T.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Ti(UU,n);return E.jsx(Xe.button,{type:"button",...r,ref:t,onClick:Ye(e.onClick,()=>a.onOpenChange(!1))})});XK.displayName=UU;var ZK="PopoverArrow",QK=T.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Ru(n);return E.jsx(w0,{...a,...r,ref:t})});QK.displayName=ZK;function jU(e){return e?"open":"closed"}var JK=IU,eX=FU,tX=PU,GU=zU;const Cu=JK,Nu=eX,Ps=T.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>E.jsx(tX,{children:E.jsx(GU,{ref:a,align:t,sideOffset:n,className:Me("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 rounded-md border p-4 shadow-md outline-none",e),...r})}));Ps.displayName=GU.displayName;const nX=({status:e})=>{const{t}=Ut();return e?E.jsxs("div",{className:"min-w-[300px] space-y-3 text-sm",children:[E.jsxs("div",{className:"space-y-1",children:[E.jsx("h4",{className:"font-medium",children:t("graphPanel.statusCard.storageInfo")}),E.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[E.jsxs("span",{children:[t("graphPanel.statusCard.workingDirectory"),":"]}),E.jsx("span",{className:"truncate",children:e.working_directory}),E.jsxs("span",{children:[t("graphPanel.statusCard.inputDirectory"),":"]}),E.jsx("span",{className:"truncate",children:e.input_directory})]})]}),E.jsxs("div",{className:"space-y-1",children:[E.jsx("h4",{className:"font-medium",children:t("graphPanel.statusCard.llmConfig")}),E.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[E.jsxs("span",{children:[t("graphPanel.statusCard.llmBinding"),":"]}),E.jsx("span",{children:e.configuration.llm_binding}),E.jsxs("span",{children:[t("graphPanel.statusCard.llmBindingHost"),":"]}),E.jsx("span",{children:e.configuration.llm_binding_host}),E.jsxs("span",{children:[t("graphPanel.statusCard.llmModel"),":"]}),E.jsx("span",{children:e.configuration.llm_model}),E.jsxs("span",{children:[t("graphPanel.statusCard.maxTokens"),":"]}),E.jsx("span",{children:e.configuration.max_tokens})]})]}),E.jsxs("div",{className:"space-y-1",children:[E.jsx("h4",{className:"font-medium",children:t("graphPanel.statusCard.embeddingConfig")}),E.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[E.jsxs("span",{children:[t("graphPanel.statusCard.embeddingBinding"),":"]}),E.jsx("span",{children:e.configuration.embedding_binding}),E.jsxs("span",{children:[t("graphPanel.statusCard.embeddingBindingHost"),":"]}),E.jsx("span",{children:e.configuration.embedding_binding_host}),E.jsxs("span",{children:[t("graphPanel.statusCard.embeddingModel"),":"]}),E.jsx("span",{children:e.configuration.embedding_model})]})]}),E.jsxs("div",{className:"space-y-1",children:[E.jsx("h4",{className:"font-medium",children:t("graphPanel.statusCard.storageConfig")}),E.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[E.jsxs("span",{children:[t("graphPanel.statusCard.kvStorage"),":"]}),E.jsx("span",{children:e.configuration.kv_storage}),E.jsxs("span",{children:[t("graphPanel.statusCard.docStatusStorage"),":"]}),E.jsx("span",{children:e.configuration.doc_status_storage}),E.jsxs("span",{children:[t("graphPanel.statusCard.graphStorage"),":"]}),E.jsx("span",{children:e.configuration.graph_storage}),E.jsxs("span",{children:[t("graphPanel.statusCard.vectorStorage"),":"]}),E.jsx("span",{children:e.configuration.vector_storage})]})]})]}):E.jsx("div",{className:"text-muted-foreground text-sm",children:t("graphPanel.statusCard.unavailable")})},rX=()=>{const{t:e}=Ut(),t=Gn.use.health(),n=Gn.use.lastCheckTime(),r=Gn.use.status(),[a,i]=T.useState(!1);return T.useEffect(()=>{i(!0);const s=setTimeout(()=>i(!1),300);return()=>clearTimeout(s)},[n]),E.jsx("div",{className:"fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none",children:E.jsxs(Cu,{children:[E.jsx(Nu,{asChild:!0,children:E.jsxs("div",{className:"flex cursor-help items-center gap-2",children:[E.jsx("div",{className:Me("h-3 w-3 rounded-full transition-all duration-300","shadow-[0_0_8px_rgba(0,0,0,0.2)]",t?"bg-green-500":"bg-red-500",a&&"scale-125",a&&t&&"shadow-[0_0_12px_rgba(34,197,94,0.4)]",a&&!t&&"shadow-[0_0_12px_rgba(239,68,68,0.4)]")}),E.jsx("span",{className:"text-muted-foreground text-xs",children:e(t?"graphPanel.statusIndicator.connected":"graphPanel.statusIndicator.disconnected")})]})}),E.jsx(Ps,{className:"w-auto",side:"top",align:"end",children:E.jsx(nX,{status:r})})]})})};function tk(e,[t,n]){return Math.min(n,Math.max(t,e))}function HU(e){const t=e+"CollectionProvider",[n,r]=Sr(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:S,children:v}=b,k=ye.useRef(null),R=ye.useRef(new Map).current;return E.jsx(a,{scope:S,itemMap:R,collectionRef:k,children:v})};s.displayName=t;const u=e+"CollectionSlot",c=ye.forwardRef((b,S)=>{const{scope:v,children:k}=b,R=i(u,v),x=gt(S,R.collectionRef);return E.jsx(Si,{ref:x,children:k})});c.displayName=u;const d=e+"CollectionItemSlot",p="data-radix-collection-item",g=ye.forwardRef((b,S)=>{const{scope:v,children:k,...R}=b,x=ye.useRef(null),A=gt(S,x),N=i(d,v);return ye.useEffect(()=>(N.itemMap.set(x,{ref:x,...R}),()=>void N.itemMap.delete(x))),E.jsx(Si,{[p]:"",ref:A,children:k})});g.displayName=d;function m(b){const S=i(e+"CollectionConsumer",b);return ye.useCallback(()=>{const k=S.collectionRef.current;if(!k)return[];const R=Array.from(k.querySelectorAll(`[${p}]`));return Array.from(S.itemMap.values()).sort((N,O)=>R.indexOf(N.ref.current)-R.indexOf(O.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:s,Slot:c,ItemSlot:g},m,r]}var aX=T.createContext(void 0);function $f(e){const t=T.useContext(aX);return e||t||"ltr"}function $U(e){const t=T.useRef({value:e,previous:e});return T.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var iX=[" ","Enter","ArrowUp","ArrowDown"],oX=[" ","Enter"],Ou="Select",[qf,Vf,sX]=HU(Ou),[zs,qSe]=Sr(Ou,[sX,Fs]),Wf=Fs(),[lX,Ai]=zs(Ou),[uX,cX]=zs(Ou),qU=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:s,defaultValue:u,onValueChange:c,dir:d,name:p,autoComplete:g,disabled:m,required:b,form:S}=e,v=Wf(t),[k,R]=T.useState(null),[x,A]=T.useState(null),[N,O]=T.useState(!1),_=$f(d),[C=!1,F]=Ma({prop:r,defaultProp:a,onChange:i}),[I,L]=Ma({prop:s,defaultProp:u,onChange:c}),H=T.useRef(null),$=k?S||!!k.closest("form"):!0,[U,W]=T.useState(new Set),Y=Array.from(U).map(j=>j.props.value).join(";");return E.jsx(S0,{...v,children:E.jsxs(lX,{required:b,scope:t,trigger:k,onTriggerChange:R,valueNode:x,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:O,contentId:kn(),value:I,onValueChange:L,open:C,onOpenChange:F,dir:_,triggerPointerDownPosRef:H,disabled:m,children:[E.jsx(qf.Provider,{scope:t,children:E.jsx(uX,{scope:e.__scopeSelect,onNativeOptionAdd:T.useCallback(j=>{W(G=>new Set(G).add(j))},[]),onNativeOptionRemove:T.useCallback(j=>{W(G=>{const z=new Set(G);return z.delete(j),z})},[]),children:n})}),$?E.jsxs(b3,{"aria-hidden":!0,required:b,tabIndex:-1,name:p,autoComplete:g,value:I,onChange:j=>L(j.target.value),disabled:m,form:S,children:[I===void 0?E.jsx("option",{value:""}):null,Array.from(U)]},Y):null]})})};qU.displayName=Ou;var VU="SelectTrigger",WU=T.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=Wf(n),s=Ai(VU,n),u=s.disabled||r,c=gt(t,s.onTriggerChange),d=Vf(n),p=T.useRef("touch"),[g,m,b]=y3(v=>{const k=d().filter(A=>!A.disabled),R=k.find(A=>A.value===s.value),x=v3(k,v,R);x!==void 0&&s.onValueChange(x.value)}),S=v=>{u||(s.onOpenChange(!0),b()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return E.jsx(Bf,{asChild:!0,...i,children:E.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":m3(s.value)?"":void 0,...a,ref:c,onClick:Ye(a.onClick,v=>{v.currentTarget.focus(),p.current!=="mouse"&&S(v)}),onPointerDown:Ye(a.onPointerDown,v=>{p.current=v.pointerType;const k=v.target;k.hasPointerCapture(v.pointerId)&&k.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(S(v),v.preventDefault())}),onKeyDown:Ye(a.onKeyDown,v=>{const k=g.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(k&&v.key===" ")&&iX.includes(v.key)&&(S(),v.preventDefault())})})})});WU.displayName=VU;var YU="SelectValue",KU=T.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:s="",...u}=e,c=Ai(YU,n),{onValueNodeHasChildrenChange:d}=c,p=i!==void 0,g=gt(t,c.onValueNodeChange);return Tn(()=>{d(p)},[d,p]),E.jsx(Xe.span,{...u,ref:g,style:{pointerEvents:"none"},children:m3(c.value)?E.jsx(E.Fragment,{children:s}):i})});KU.displayName=YU;var dX="SelectIcon",XU=T.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return E.jsx(Xe.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});XU.displayName=dX;var fX="SelectPortal",ZU=e=>E.jsx(Of,{asChild:!0,...e});ZU.displayName=fX;var co="SelectContent",QU=T.forwardRef((e,t)=>{const n=Ai(co,e.__scopeSelect),[r,a]=T.useState();if(Tn(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?Tu.createPortal(E.jsx(JU,{scope:e.__scopeSelect,children:E.jsx(qf.Slot,{scope:e.__scopeSelect,children:E.jsx("div",{children:e.children})})}),i):null}return E.jsx(e3,{...e,ref:t})});QU.displayName=co;var Or=10,[JU,_i]=zs(co),pX="SelectContentImpl",e3=T.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:u,sideOffset:c,align:d,alignOffset:p,arrowPadding:g,collisionBoundary:m,collisionPadding:b,sticky:S,hideWhenDetached:v,avoidCollisions:k,...R}=e,x=Ai(co,n),[A,N]=T.useState(null),[O,_]=T.useState(null),C=gt(t,re=>N(re)),[F,I]=T.useState(null),[L,H]=T.useState(null),$=Vf(n),[U,W]=T.useState(!1),Y=T.useRef(!1);T.useEffect(()=>{if(A)return t0(A)},[A]),e0();const j=T.useCallback(re=>{const[se,...Te]=$().map(xe=>xe.ref.current),[ae]=Te.slice(-1),we=document.activeElement;for(const xe of re)if(xe===we||(xe==null||xe.scrollIntoView({block:"nearest"}),xe===se&&O&&(O.scrollTop=0),xe===ae&&O&&(O.scrollTop=O.scrollHeight),xe==null||xe.focus(),document.activeElement!==we))return},[$,O]),G=T.useCallback(()=>j([F,A]),[j,F,A]);T.useEffect(()=>{U&&G()},[U,G]);const{onOpenChange:z,triggerPointerDownPosRef:K}=x;T.useEffect(()=>{if(A){let re={x:0,y:0};const se=ae=>{var we,xe;re={x:Math.abs(Math.round(ae.pageX)-(((we=K.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((xe=K.current)==null?void 0:xe.y)??0))}},Te=ae=>{re.x<=10&&re.y<=10?ae.preventDefault():A.contains(ae.target)||z(!1),document.removeEventListener("pointermove",se),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Te,{capture:!0})}}},[A,z,K]),T.useEffect(()=>{const re=()=>z(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[z]);const[D,V]=y3(re=>{const se=$().filter(we=>!we.disabled),Te=se.find(we=>we.ref.current===document.activeElement),ae=v3(se,re,Te);ae&&setTimeout(()=>ae.ref.current.focus())}),B=T.useCallback((re,se,Te)=>{const ae=!Y.current&&!Te;(x.value!==void 0&&x.value===se||ae)&&(I(re),ae&&(Y.current=!0))},[x.value]),M=T.useCallback(()=>A==null?void 0:A.focus(),[A]),X=T.useCallback((re,se,Te)=>{const ae=!Y.current&&!Te;(x.value!==void 0&&x.value===se||ae)&&H(re)},[x.value]),Q=r==="popper"?nk:t3,le=Q===nk?{side:u,sideOffset:c,align:d,alignOffset:p,arrowPadding:g,collisionBoundary:m,collisionPadding:b,sticky:S,hideWhenDetached:v,avoidCollisions:k}:{};return E.jsx(JU,{scope:n,content:A,viewport:O,onViewportChange:_,itemRefCallback:B,selectedItem:F,onItemLeave:M,itemTextRefCallback:X,focusSelectedItem:G,selectedItemText:L,position:r,isPositioned:U,searchRef:D,children:E.jsx(If,{as:Si,allowPinchZoom:!0,children:E.jsx(Nf,{asChild:!0,trapped:x.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Ye(a,re=>{var se;(se=x.trigger)==null||se.focus({preventScroll:!0}),re.preventDefault()}),children:E.jsx(Au,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:E.jsx(Q,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:re=>re.preventDefault(),...R,...le,onPlaced:()=>W(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:Ye(R.onKeyDown,re=>{const se=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!se&&re.key.length===1&&V(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let ae=$().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(re.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const we=re.target,xe=ae.indexOf(we);ae=ae.slice(xe+1)}setTimeout(()=>j(ae)),re.preventDefault()}})})})})})})});e3.displayName=pX;var gX="SelectItemAlignedPosition",t3=T.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=Ai(co,n),s=_i(co,n),[u,c]=T.useState(null),[d,p]=T.useState(null),g=gt(t,C=>p(C)),m=Vf(n),b=T.useRef(!1),S=T.useRef(!0),{viewport:v,selectedItem:k,selectedItemText:R,focusSelectedItem:x}=s,A=T.useCallback(()=>{if(i.trigger&&i.valueNode&&u&&d&&v&&k&&R){const C=i.trigger.getBoundingClientRect(),F=d.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),L=R.getBoundingClientRect();if(i.dir!=="rtl"){const we=L.left-F.left,xe=I.left-we,Ie=C.left-xe,Ce=C.width+Ie,Ee=Math.max(Ce,F.width),J=window.innerWidth-Or,fe=tk(xe,[Or,Math.max(Or,J-Ee)]);u.style.minWidth=Ce+"px",u.style.left=fe+"px"}else{const we=F.right-L.right,xe=window.innerWidth-I.right-we,Ie=window.innerWidth-C.right-xe,Ce=C.width+Ie,Ee=Math.max(Ce,F.width),J=window.innerWidth-Or,fe=tk(xe,[Or,Math.max(Or,J-Ee)]);u.style.minWidth=Ce+"px",u.style.right=fe+"px"}const H=m(),$=window.innerHeight-Or*2,U=v.scrollHeight,W=window.getComputedStyle(d),Y=parseInt(W.borderTopWidth,10),j=parseInt(W.paddingTop,10),G=parseInt(W.borderBottomWidth,10),z=parseInt(W.paddingBottom,10),K=Y+j+U+z+G,D=Math.min(k.offsetHeight*5,K),V=window.getComputedStyle(v),B=parseInt(V.paddingTop,10),M=parseInt(V.paddingBottom,10),X=C.top+C.height/2-Or,Q=$-X,le=k.offsetHeight/2,re=k.offsetTop+le,se=Y+j+re,Te=K-se;if(se<=X){const we=H.length>0&&k===H[H.length-1].ref.current;u.style.bottom="0px";const xe=d.clientHeight-v.offsetTop-v.offsetHeight,Ie=Math.max(Q,le+(we?M:0)+xe+G),Ce=se+Ie;u.style.height=Ce+"px"}else{const we=H.length>0&&k===H[0].ref.current;u.style.top="0px";const Ie=Math.max(X,Y+v.offsetTop+(we?B:0)+le)+Te;u.style.height=Ie+"px",v.scrollTop=se-X+v.offsetTop}u.style.margin=`${Or}px 0`,u.style.minHeight=D+"px",u.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[m,i.trigger,i.valueNode,u,d,v,k,R,i.dir,r]);Tn(()=>A(),[A]);const[N,O]=T.useState();Tn(()=>{d&&O(window.getComputedStyle(d).zIndex)},[d]);const _=T.useCallback(C=>{C&&S.current===!0&&(A(),x==null||x(),S.current=!1)},[A,x]);return E.jsx(mX,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:b,onScrollButtonChange:_,children:E.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:E.jsx(Xe.div,{...a,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});t3.displayName=gX;var hX="SelectPopperPosition",nk=T.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Or,...i}=e,s=Wf(n);return E.jsx(E0,{...s,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});nk.displayName=hX;var[mX,R0]=zs(co,{}),rk="SelectViewport",n3=T.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=_i(rk,n),s=R0(rk,n),u=gt(t,i.onViewportChange),c=T.useRef(0);return E.jsxs(E.Fragment,{children:[E.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),E.jsx(qf.Slot,{scope:n,children:E.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Ye(a.onScroll,d=>{const p=d.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:m}=s;if(m!=null&&m.current&&g){const b=Math.abs(c.current-p.scrollTop);if(b>0){const S=window.innerHeight-Or*2,v=parseFloat(g.style.minHeight),k=parseFloat(g.style.height),R=Math.max(v,k);if(R 0?N:0,g.style.justifyContent="flex-end")}}}c.current=p.scrollTop})})})]})});n3.displayName=rk;var r3="SelectGroup",[bX,yX]=zs(r3),a3=T.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=kn();return E.jsx(bX,{scope:n,id:a,children:E.jsx(Xe.div,{role:"group","aria-labelledby":a,...r,ref:t})})});a3.displayName=r3;var i3="SelectLabel",o3=T.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=yX(i3,n);return E.jsx(Xe.div,{id:a.id,...r,ref:t})});o3.displayName=i3;var tf="SelectItem",[vX,s3]=zs(tf),l3=T.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...s}=e,u=Ai(tf,n),c=_i(tf,n),d=u.value===r,[p,g]=T.useState(i??""),[m,b]=T.useState(!1),S=gt(t,x=>{var A;return(A=c.itemRefCallback)==null?void 0:A.call(c,x,r,a)}),v=kn(),k=T.useRef("touch"),R=()=>{a||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("Amust have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return E.jsx(vX,{scope:n,value:r,disabled:a,textId:v,isSelected:d,onItemTextChange:T.useCallback(x=>{g(A=>A||((x==null?void 0:x.textContent)??"").trim())},[]),children:E.jsx(qf.ItemSlot,{scope:n,value:r,disabled:a,textValue:p,children:E.jsx(Xe.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:S,onFocus:Ye(s.onFocus,()=>b(!0)),onBlur:Ye(s.onBlur,()=>b(!1)),onClick:Ye(s.onClick,()=>{k.current!=="mouse"&&R()}),onPointerUp:Ye(s.onPointerUp,()=>{k.current==="mouse"&&R()}),onPointerDown:Ye(s.onPointerDown,x=>{k.current=x.pointerType}),onPointerMove:Ye(s.onPointerMove,x=>{var A;k.current=x.pointerType,a?(A=c.onItemLeave)==null||A.call(c):k.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ye(s.onPointerLeave,x=>{var A;x.currentTarget===document.activeElement&&((A=c.onItemLeave)==null||A.call(c))}),onKeyDown:Ye(s.onKeyDown,x=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&x.key===" "||(oX.includes(x.key)&&R(),x.key===" "&&x.preventDefault())})})})})});l3.displayName=tf;var eu="SelectItemText",u3=T.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,s=Ai(eu,n),u=_i(eu,n),c=s3(eu,n),d=cX(eu,n),[p,g]=T.useState(null),m=gt(t,R=>g(R),c.onItemTextChange,R=>{var x;return(x=u.itemTextRefCallback)==null?void 0:x.call(u,R,c.value,c.disabled)}),b=p==null?void 0:p.textContent,S=T.useMemo(()=>E.jsx("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:v,onNativeOptionRemove:k}=d;return Tn(()=>(v(S),()=>k(S)),[v,k,S]),E.jsxs(E.Fragment,{children:[E.jsx(Xe.span,{id:c.textId,...i,ref:m}),c.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Tu.createPortal(i.children,s.valueNode):null]})});u3.displayName=eu;var c3="SelectItemIndicator",d3=T.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s3(c3,n).isSelected?E.jsx(Xe.span,{"aria-hidden":!0,...r,ref:t}):null});d3.displayName=c3;var ak="SelectScrollUpButton",f3=T.forwardRef((e,t)=>{const n=_i(ak,e.__scopeSelect),r=R0(ak,e.__scopeSelect),[a,i]=T.useState(!1),s=gt(t,r.onScrollButtonChange);return Tn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return u(),c.addEventListener("scroll",u),()=>c.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?E.jsx(g3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:c}=n;u&&c&&(u.scrollTop=u.scrollTop-c.offsetHeight)}}):null});f3.displayName=ak;var ik="SelectScrollDownButton",p3=T.forwardRef((e,t)=>{const n=_i(ik,e.__scopeSelect),r=R0(ik,e.__scopeSelect),[a,i]=T.useState(!1),s=gt(t,r.onScrollButtonChange);return Tn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=c.scrollHeight-c.clientHeight,p=Math.ceil(c.scrollTop) c.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?E.jsx(g3,{...e,ref:s,onAutoScroll:()=>{const{viewport:u,selectedItem:c}=n;u&&c&&(u.scrollTop=u.scrollTop+c.offsetHeight)}}):null});p3.displayName=ik;var g3=T.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=_i("SelectScrollButton",n),s=T.useRef(null),u=Vf(n),c=T.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return T.useEffect(()=>()=>c(),[c]),Tn(()=>{var p;const d=u().find(g=>g.ref.current===document.activeElement);(p=d==null?void 0:d.ref.current)==null||p.scrollIntoView({block:"nearest"})},[u]),E.jsx(Xe.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Ye(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ye(a.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ye(a.onPointerLeave,()=>{c()})})}),SX="SelectSeparator",h3=T.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return E.jsx(Xe.div,{"aria-hidden":!0,...r,ref:t})});h3.displayName=SX;var ok="SelectArrow",EX=T.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Wf(n),i=Ai(ok,n),s=_i(ok,n);return i.open&&s.position==="popper"?E.jsx(w0,{...a,...r,ref:t}):null});EX.displayName=ok;function m3(e){return e===""||e===void 0}var b3=T.forwardRef((e,t)=>{const{value:n,...r}=e,a=T.useRef(null),i=gt(t,a),s=$U(n);return T.useEffect(()=>{const u=a.current,c=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(c,"value").set;if(s!==n&&p){const g=new Event("change",{bubbles:!0});p.call(u,n),u.dispatchEvent(g)}},[s,n]),E.jsx(x0,{asChild:!0,children:E.jsx("select",{...r,ref:i,defaultValue:n})})});b3.displayName="BubbleSelect";function y3(e){const t=mn(e),n=T.useRef(""),r=T.useRef(0),a=T.useCallback(s=>{const u=n.current+s;t(u),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(u)},[t]),i=T.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function v3(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=wX(e,Math.max(i,0));a.length===1&&(s=s.filter(d=>d!==n));const c=s.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function wX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xX=qU,S3=WU,kX=KU,TX=XU,AX=ZU,E3=QU,_X=n3,RX=a3,w3=o3,x3=l3,CX=u3,NX=d3,k3=f3,T3=p3,A3=h3;const nf=xX,OC=RX,rf=kX,fu=T.forwardRef(({className:e,children:t,...n},r)=>E.jsxs(S3,{ref:r,className:Me("border-input bg-background ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex h-10 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,E.jsx(TX,{asChild:!0,children:E.jsx(Qk,{className:"h-4 w-4 opacity-50"})})]}));fu.displayName=S3.displayName;const _3=T.forwardRef(({className:e,...t},n)=>E.jsx(k3,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(Kz,{className:"h-4 w-4"})}));_3.displayName=k3.displayName;const R3=T.forwardRef(({className:e,...t},n)=>E.jsx(T3,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:E.jsx(Qk,{className:"h-4 w-4"})}));R3.displayName=T3.displayName;const pu=T.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>E.jsx(AX,{children:E.jsxs(E3,{ref:a,className:Me("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[E.jsx(_3,{}),E.jsx(_X,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),E.jsx(R3,{})]})}));pu.displayName=E3.displayName;const OX=T.forwardRef(({className:e,...t},n)=>E.jsx(w3,{ref:n,className:Me("py-1.5 pr-2 pl-8 text-sm font-semibold",e),...t}));OX.displayName=w3.displayName;const Un=T.forwardRef(({className:e,children:t,...n},r)=>E.jsxs(x3,{ref:r,className:Me("focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[E.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:E.jsx(NX,{children:E.jsx(Zk,{className:"h-4 w-4"})})}),E.jsx(CX,{children:t})]}));Un.displayName=x3.displayName;const DX=T.forwardRef(({className:e,...t},n)=>E.jsx(A3,{ref:n,className:Me("bg-muted -mx-1 my-1 h-px",e),...t}));DX.displayName=A3.displayName;function IX(){const[e,t]=T.useState(!1),{t:n}=Ut(),r=je.use.language(),a=je.use.setLanguage(),i=je.use.theme(),s=je.use.setTheme(),u=T.useCallback(d=>{a(d)},[a]),c=T.useCallback(d=>{s(d)},[s]);return E.jsxs(Cu,{open:e,onOpenChange:t,children:[E.jsx(Nu,{asChild:!0,children:E.jsx(Mt,{variant:"outline",size:"icon",className:"h-9 w-9",children:E.jsx(B7,{className:"h-5 w-5"})})}),E.jsx(Ps,{side:"bottom",align:"end",className:"w-56",children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{className:"text-sm font-medium",children:n("settings.language")}),E.jsxs(nf,{value:r,onValueChange:u,children:[E.jsx(fu,{children:E.jsx(rf,{})}),E.jsxs(pu,{children:[E.jsx(Un,{value:"en",children:"English"}),E.jsx(Un,{value:"zh",children:"中文"})]})]})]}),E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{className:"text-sm font-medium",children:n("settings.theme")}),E.jsxs(nf,{value:i,onValueChange:c,children:[E.jsx(fu,{children:E.jsx(rf,{})}),E.jsxs(pu,{children:[E.jsx(Un,{value:"light",children:n("settings.light")}),E.jsx(Un,{value:"dark",children:n("settings.dark")}),E.jsx(Un,{value:"system",children:n("settings.system")})]})]})]})]})})]})}var jh="rovingFocusGroup.onEntryFocus",LX={bubbles:!1,cancelable:!0},Yf="RovingFocusGroup",[sk,C3,MX]=HU(Yf),[FX,N3]=Sr(Yf,[MX]),[PX,zX]=FX(Yf),O3=T.forwardRef((e,t)=>E.jsx(sk.Provider,{scope:e.__scopeRovingFocusGroup,children:E.jsx(sk.Slot,{scope:e.__scopeRovingFocusGroup,children:E.jsx(BX,{...e,ref:t})})}));O3.displayName=Yf;var BX=T.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...g}=e,m=T.useRef(null),b=gt(t,m),S=$f(i),[v=null,k]=Ma({prop:s,defaultProp:u,onChange:c}),[R,x]=T.useState(!1),A=mn(d),N=C3(n),O=T.useRef(!1),[_,C]=T.useState(0);return T.useEffect(()=>{const F=m.current;if(F)return F.addEventListener(jh,A),()=>F.removeEventListener(jh,A)},[A]),E.jsx(PX,{scope:n,orientation:r,dir:S,loop:a,currentTabStopId:v,onItemFocus:T.useCallback(F=>k(F),[k]),onItemShiftTab:T.useCallback(()=>x(!0),[]),onFocusableItemAdd:T.useCallback(()=>C(F=>F+1),[]),onFocusableItemRemove:T.useCallback(()=>C(F=>F-1),[]),children:E.jsx(Xe.div,{tabIndex:R||_===0?-1:0,"data-orientation":r,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Ye(e.onMouseDown,()=>{O.current=!0}),onFocus:Ye(e.onFocus,F=>{const I=!O.current;if(F.target===F.currentTarget&&I&&!R){const L=new CustomEvent(jh,LX);if(F.currentTarget.dispatchEvent(L),!L.defaultPrevented){const H=N().filter(j=>j.focusable),$=H.find(j=>j.active),U=H.find(j=>j.id===v),Y=[$,U,...H].filter(Boolean).map(j=>j.ref.current);L3(Y,p)}}O.current=!1}),onBlur:Ye(e.onBlur,()=>x(!1))})})}),D3="RovingFocusGroupItem",I3=T.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,...s}=e,u=kn(),c=i||u,d=zX(D3,n),p=d.currentTabStopId===c,g=C3(n),{onFocusableItemAdd:m,onFocusableItemRemove:b}=d;return T.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),E.jsx(sk.ItemSlot,{scope:n,id:c,focusable:r,active:a,children:E.jsx(Xe.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...s,ref:t,onMouseDown:Ye(e.onMouseDown,S=>{r?d.onItemFocus(c):S.preventDefault()}),onFocus:Ye(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Ye(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){d.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const v=GX(S,d.orientation,d.dir);if(v!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=g().filter(x=>x.focusable).map(x=>x.ref.current);if(v==="last")R.reverse();else if(v==="prev"||v==="next"){v==="prev"&&R.reverse();const x=R.indexOf(S.currentTarget);R=d.loop?HX(R,x+1):R.slice(x+1)}setTimeout(()=>L3(R))}})})})});I3.displayName=D3;var UX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function GX(e,t,n){const r=jX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return UX[r]}function L3(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function HX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $X=O3,qX=I3,C0="Tabs",[VX,VSe]=Sr(C0,[N3]),M3=N3(),[WX,N0]=VX(C0),F3=T.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:s="horizontal",dir:u,activationMode:c="automatic",...d}=e,p=$f(u),[g,m]=Ma({prop:r,onChange:a,defaultProp:i});return E.jsx(WX,{scope:n,baseId:kn(),value:g,onValueChange:m,orientation:s,dir:p,activationMode:c,children:E.jsx(Xe.div,{dir:p,"data-orientation":s,...d,ref:t})})});F3.displayName=C0;var P3="TabsList",z3=T.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,i=N0(P3,n),s=M3(n);return E.jsx($X,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:E.jsx(Xe.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});z3.displayName=P3;var B3="TabsTrigger",U3=T.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=e,s=N0(B3,n),u=M3(n),c=H3(s.baseId,r),d=$3(s.baseId,r),p=r===s.value;return E.jsx(qX,{asChild:!0,...u,focusable:!a,active:p,children:E.jsx(Xe.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:Ye(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?s.onValueChange(r):g.preventDefault()}),onKeyDown:Ye(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&s.onValueChange(r)}),onFocus:Ye(e.onFocus,()=>{const g=s.activationMode!=="manual";!p&&!a&&g&&s.onValueChange(r)})})})});U3.displayName=B3;var j3="TabsContent",G3=T.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...s}=e,u=N0(j3,n),c=H3(u.baseId,r),d=$3(u.baseId,r),p=r===u.value,g=T.useRef(p);return T.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),E.jsx(rr,{present:a||p,children:({present:m})=>E.jsx(Xe.div,{"data-state":p?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&i})})});G3.displayName=j3;function H3(e,t){return`${e}-trigger-${t}`}function $3(e,t){return`${e}-content-${t}`}var YX=F3,q3=z3,V3=U3,W3=G3;const KX=YX,Y3=T.forwardRef(({className:e,...t},n)=>E.jsx(q3,{ref:n,className:Me("bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1",e),...t}));Y3.displayName=q3.displayName;const K3=T.forwardRef(({className:e,...t},n)=>E.jsx(V3,{ref:n,className:Me("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",e),...t}));K3.displayName=V3.displayName;const tu=T.forwardRef(({className:e,...t},n)=>E.jsx(W3,{ref:n,className:Me("ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","data-[state=inactive]:invisible data-[state=active]:visible","h-full w-full",e),forceMount:!0,...t}));tu.displayName=W3.displayName;function id({value:e,currentTab:t,children:n}){return E.jsx(K3,{value:e,className:Me("cursor-pointer px-2 py-1 transition-all",t===e?"!bg-emerald-400 !text-zinc-50":"hover:bg-background/60"),children:n})}function XX(){const e=je.use.currentTab(),{t}=Ut();return E.jsx("div",{className:"flex h-8 self-center",children:E.jsxs(Y3,{className:"h-full gap-2",children:[E.jsx(id,{value:"documents",currentTab:e,children:t("header.documents")}),E.jsx(id,{value:"knowledge-graph",currentTab:e,children:t("header.knowledgeGraph")}),E.jsx(id,{value:"retrieval",currentTab:e,children:t("header.retrieval")}),E.jsx(id,{value:"api",currentTab:e,children:t("header.api")})]})})}function ZX(){const{t:e}=Ut();return E.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[E.jsxs("a",{href:"/",className:"mr-6 flex items-center gap-2",children:[E.jsx(eV,{className:"size-4 text-emerald-400","aria-hidden":"true"}),E.jsx("span",{className:"font-bold md:inline-block",children:qR.name})]}),E.jsx("div",{className:"flex h-10 flex-1 justify-center",children:E.jsx(XX,{})}),E.jsx("nav",{className:"flex items-center",children:E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Mt,{variant:"ghost",size:"icon",side:"bottom",tooltip:e("header.projectRepository"),children:E.jsx("a",{href:qR.github,target:"_blank",rel:"noopener noreferrer",children:E.jsx(R7,{className:"size-4","aria-hidden":"true"})})}),E.jsx(IX,{})]})})]})}const Kf=()=>{const e=T.useContext(mz);if(!e)throw new Error("useTabVisibility must be used within a TabVisibilityProvider");return e};var od={exports:{}},DC;function QX(){if(DC)return od.exports;DC=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(O,_,C){return Function.prototype.apply.call(O,_,C)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(O){return Object.getOwnPropertyNames(O).concat(Object.getOwnPropertySymbols(O))}:n=function(O){return Object.getOwnPropertyNames(O)};function r(N){console&&console.warn&&console.warn(N)}var a=Number.isNaN||function(O){return O!==O};function i(){i.init.call(this)}od.exports=i,od.exports.once=R,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function u(N){if(typeof N!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof N)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(N){if(typeof N!="number"||N<0||a(N))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+N+".");s=N}}),i.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},i.prototype.setMaxListeners=function(O){if(typeof O!="number"||O<0||a(O))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+O+".");return this._maxListeners=O,this};function c(N){return N._maxListeners===void 0?i.defaultMaxListeners:N._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(O){for(var _=[],C=1;C 0&&(L=_[0]),L instanceof Error)throw L;var H=new Error("Unhandled error."+(L?" ("+L.message+")":""));throw H.context=L,H}var $=I[O];if($===void 0)return!1;if(typeof $=="function")t($,this,_);else for(var U=$.length,W=S($,U),C=0;C0&&L.length>F&&!L.warned){L.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+L.length+" "+String(O)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=N,H.type=O,H.count=L.length,r(H)}return N}i.prototype.addListener=function(O,_){return d(this,O,_,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(O,_){return d(this,O,_,!0)};function p(){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 g(N,O,_){var C={fired:!1,wrapFn:void 0,target:N,type:O,listener:_},F=p.bind(C);return F.listener=_,C.wrapFn=F,F}i.prototype.once=function(O,_){return u(_),this.on(O,g(this,O,_)),this},i.prototype.prependOnceListener=function(O,_){return u(_),this.prependListener(O,g(this,O,_)),this},i.prototype.removeListener=function(O,_){var C,F,I,L,H;if(u(_),F=this._events,F===void 0)return this;if(C=F[O],C===void 0)return this;if(C===_||C.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete F[O],F.removeListener&&this.emit("removeListener",O,C.listener||_));else if(typeof C!="function"){for(I=-1,L=C.length-1;L>=0;L--)if(C[L]===_||C[L].listener===_){H=C[L].listener,I=L;break}if(I<0)return this;I===0?C.shift():v(C,I),C.length===1&&(F[O]=C[0]),F.removeListener!==void 0&&this.emit("removeListener",O,H||_)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(O){var _,C,F;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[O]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[O]),this;if(arguments.length===0){var I=Object.keys(C),L;for(F=0;F =0;F--)this.removeListener(O,_[F]);return this};function m(N,O,_){var C=N._events;if(C===void 0)return[];var F=C[O];return F===void 0?[]:typeof F=="function"?_?[F.listener||F]:[F]:_?k(F):S(F,F.length)}i.prototype.listeners=function(O){return m(this,O,!0)},i.prototype.rawListeners=function(O){return m(this,O,!1)},i.listenerCount=function(N,O){return typeof N.listenerCount=="function"?N.listenerCount(O):b.call(N,O)},i.prototype.listenerCount=b;function b(N){var O=this._events;if(O!==void 0){var _=O[N];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function S(N,O){for(var _=new Array(O),C=0;C e++}function La(){const e=arguments;let 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 Bs(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class O0 extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class Le extends O0{constructor(t){super(t),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Le.prototype.constructor)}}class De extends O0{constructor(t){super(t),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,De.prototype.constructor)}}class Ze extends O0{constructor(t){super(t),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ze.prototype.constructor)}}function Q3(e,t){this.key=e,this.attributes=t,this.clear()}Q3.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 J3(e,t){this.key=e,this.attributes=t,this.clear()}J3.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function ej(e,t){this.key=e,this.attributes=t,this.clear()}ej.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Us(e,t,n,r,a){this.key=t,this.attributes=a,this.undirected=e,this.source=n,this.target=r}Us.prototype.attach=function(){let e="out",t="in";this.undirected&&(e=t="undirected");const n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)};Us.prototype.attachMulti=function(){let e="out",t="in";const n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");const a=this.source[e],i=a[r];if(typeof i>"u"){a[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}i.previous=this,this.next=i,a[r]=this,this.target[t][n]=this};Us.prototype.detach=function(){const e=this.source.key,t=this.target.key;let n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]};Us.prototype.detachMulti=function(){const e=this.source.key,t=this.target.key;let 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))};const tj=0,nj=1,tZ=2,rj=3;function Ba(e,t,n,r,a,i,s){let u,c,d,p;if(r=""+r,n===tj){if(u=e._nodes.get(r),!u)throw new De(`Graph.${t}: could not find the "${r}" node in the graph.`);d=a,p=i}else if(n===rj){if(a=""+a,c=e._edges.get(a),!c)throw new De(`Graph.${t}: could not find the "${a}" edge in the graph.`);const g=c.source.key,m=c.target.key;if(r===g)u=c.target;else if(r===m)u=c.source;else throw new De(`Graph.${t}: the "${r}" node is not attached to the "${a}" edge (${g}, ${m}).`);d=i,p=s}else{if(c=e._edges.get(r),!c)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`);n===nj?u=c.source:u=c.target,d=a,p=i}return[u,d,p]}function nZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);return s.attributes[u]}}function rZ(e,t,n){e.prototype[t]=function(r,a){const[i]=Ba(this,t,n,r,a);return i.attributes}}function aZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);return s.attributes.hasOwnProperty(u)}}function iZ(e,t,n){e.prototype[t]=function(r,a,i,s){const[u,c,d]=Ba(this,t,n,r,a,i,s);return u.attributes[c]=d,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:c}),this}}function oZ(e,t,n){e.prototype[t]=function(r,a,i,s){const[u,c,d]=Ba(this,t,n,r,a,i,s);if(typeof d!="function")throw new Le(`Graph.${t}: updater should be a function.`);const p=u.attributes,g=d(p[c]);return p[c]=g,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:c}),this}}function sZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);return delete s.attributes[u],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:u}),this}}function lZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);if(!bn(u))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return s.attributes=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function uZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);if(!bn(u))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return tn(s.attributes,u),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:u}),this}}function cZ(e,t,n){e.prototype[t]=function(r,a,i){const[s,u]=Ba(this,t,n,r,a,i);if(typeof u!="function")throw new Le(`Graph.${t}: provided updater is not a function.`);return s.attributes=u(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const dZ=[{name:e=>`get${e}Attribute`,attacher:nZ},{name:e=>`get${e}Attributes`,attacher:rZ},{name:e=>`has${e}Attribute`,attacher:aZ},{name:e=>`set${e}Attribute`,attacher:iZ},{name:e=>`update${e}Attribute`,attacher:oZ},{name:e=>`remove${e}Attribute`,attacher:sZ},{name:e=>`replace${e}Attributes`,attacher:lZ},{name:e=>`merge${e}Attributes`,attacher:uZ},{name:e=>`update${e}Attributes`,attacher:cZ}];function fZ(e){dZ.forEach(function({name:t,attacher:n}){n(e,t("Node"),tj),n(e,t("Source"),nj),n(e,t("Target"),tZ),n(e,t("Opposite"),rj)})}function pZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes[a]}}function gZ(e,t,n){e.prototype[t]=function(r){let a;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Ze(`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.`);const i=""+r,s=""+arguments[1];if(a=vr(this,i,s,n),!a)throw new De(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,a=this._edges.get(r),!a)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return a.attributes}}function hZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return i.attributes.hasOwnProperty(a)}}function mZ(e,t,n){e.prototype[t]=function(r,a,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ze(`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.`);const u=""+r,c=""+a;if(a=arguments[2],i=arguments[3],s=vr(this,u,c,n),!s)throw new De(`Graph.${t}: could not find an edge for the given path ("${u}" - "${c}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,s=this._edges.get(r),!s)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return s.attributes[a]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}function bZ(e,t,n){e.prototype[t]=function(r,a,i){let s;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Ze(`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.`);const u=""+r,c=""+a;if(a=arguments[2],i=arguments[3],s=vr(this,u,c,n),!s)throw new De(`Graph.${t}: could not find an edge for the given path ("${u}" - "${c}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,s=this._edges.get(r),!s)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new Le(`Graph.${t}: updater should be a function.`);return s.attributes[a]=i(s.attributes[a]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:a}),this}}function yZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}return delete i.attributes[a],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:a}),this}}function vZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!bn(a))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=a,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function SZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(!bn(a))throw new Le(`Graph.${t}: provided attributes are not a plain object.`);return tn(i.attributes,a),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:a}),this}}function EZ(e,t,n){e.prototype[t]=function(r,a){let i;if(this.type!=="mixed"&&n!=="mixed"&&n!==this.type)throw new Ze(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Ze(`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.`);const s=""+r,u=""+a;if(a=arguments[2],i=vr(this,s,u,n),!i)throw new De(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(n!=="mixed")throw new Ze(`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(r=""+r,i=this._edges.get(r),!i)throw new De(`Graph.${t}: could not find the "${r}" edge in the graph.`)}if(typeof a!="function")throw new Le(`Graph.${t}: provided updater is not a function.`);return i.attributes=a(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}const wZ=[{name:e=>`get${e}Attribute`,attacher:pZ},{name:e=>`get${e}Attributes`,attacher:gZ},{name:e=>`has${e}Attribute`,attacher:hZ},{name:e=>`set${e}Attribute`,attacher:mZ},{name:e=>`update${e}Attribute`,attacher:bZ},{name:e=>`remove${e}Attribute`,attacher:yZ},{name:e=>`replace${e}Attributes`,attacher:vZ},{name:e=>`merge${e}Attributes`,attacher:SZ},{name:e=>`update${e}Attributes`,attacher:EZ}];function xZ(e){wZ.forEach(function({name:t,attacher:n}){n(e,t("Edge"),"mixed"),n(e,t("DirectedEdge"),"directed"),n(e,t("UndirectedEdge"),"undirected")})}const kZ=[{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 TZ(e,t,n,r){let a=!1;for(const i in t){if(i===r)continue;const s=t[i];if(a=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),e&&a)return s.key}}function AZ(e,t,n,r){let a,i,s,u=!1;for(const c in t)if(c!==r){a=t[c];do{if(i=a.source,s=a.target,u=n(a.key,a.attributes,i.key,s.key,i.attributes,s.attributes,a.undirected),e&&u)return a.key;a=a.next}while(a!==void 0)}}function Gh(e,t){const n=Object.keys(e),r=n.length;let a,i=0;return{[Symbol.iterator](){return this},next(){do if(a)a=a.next;else{if(i>=r)return{done:!0};const s=n[i++];if(s===t){a=void 0;continue}a=e[s]}while(!a);return{done:!1,value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected}}}}}function _Z(e,t,n,r){const a=t[n];if(!a)return;const i=a.source,s=a.target;if(r(a.key,a.attributes,i.key,s.key,i.attributes,s.attributes,a.undirected)&&e)return a.key}function RZ(e,t,n,r){let a=t[n];if(!a)return;let i=!1;do{if(i=r(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),e&&i)return a.key;a=a.next}while(a!==void 0)}function Hh(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const a={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:a}}};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 CZ(e,t){if(e.size===0)return[];if(t==="mixed"||t===e.type)return Array.from(e._edges.keys());const n=t==="undirected"?e.undirectedSize:e.directedSize,r=new Array(n),a=t==="undirected",i=e._edges.values();let s=0,u,c;for(;u=i.next(),u.done!==!0;)c=u.value,c.undirected===a&&(r[s++]=c.key);return r}function aj(e,t,n,r){if(t.size===0)return;const a=n!=="mixed"&&n!==t.type,i=n==="undirected";let s,u,c=!1;const d=t._edges.values();for(;s=d.next(),s.done!==!0;){if(u=s.value,a&&u.undirected!==i)continue;const{key:p,attributes:g,source:m,target:b}=u;if(c=r(p,g,m.key,b.key,m.attributes,b.attributes,u.undirected),e&&c)return p}}function NZ(e,t){if(e.size===0)return Bs();const n=t!=="mixed"&&t!==e.type,r=t==="undirected",a=e._edges.values();return{[Symbol.iterator](){return this},next(){let i,s;for(;;){if(i=a.next(),i.done)return i;if(s=i.value,!(n&&s.undirected!==r))break}return{value:{edge:s.key,attributes:s.attributes,source:s.source.key,target:s.target.key,sourceAttributes:s.source.attributes,targetAttributes:s.target.attributes,undirected:s.undirected},done:!1}}}}function D0(e,t,n,r,a,i){const s=t?AZ:TZ;let u;if(n!=="undirected"&&(r!=="out"&&(u=s(e,a.in,i),e&&u)||r!=="in"&&(u=s(e,a.out,i,r?void 0:a.key),e&&u))||n!=="directed"&&(u=s(e,a.undirected,i),e&&u))return u}function OZ(e,t,n,r){const a=[];return D0(!1,e,t,n,r,function(i){a.push(i)}),a}function DZ(e,t,n){let r=Bs();return e!=="undirected"&&(t!=="out"&&typeof n.in<"u"&&(r=La(r,Gh(n.in))),t!=="in"&&typeof n.out<"u"&&(r=La(r,Gh(n.out,t?void 0:n.key)))),e!=="directed"&&typeof n.undirected<"u"&&(r=La(r,Gh(n.undirected))),r}function I0(e,t,n,r,a,i,s){const u=n?RZ:_Z;let c;if(t!=="undirected"&&(typeof a.in<"u"&&r!=="out"&&(c=u(e,a.in,i,s),e&&c)||typeof a.out<"u"&&r!=="in"&&(r||a.key!==i)&&(c=u(e,a.out,i,s),e&&c))||t!=="directed"&&typeof a.undirected<"u"&&(c=u(e,a.undirected,i,s),e&&c))return c}function IZ(e,t,n,r,a){const i=[];return I0(!1,e,t,n,r,a,function(s){i.push(s)}),i}function LZ(e,t,n,r){let a=Bs();return e!=="undirected"&&(typeof n.in<"u"&&t!=="out"&&r in n.in&&(a=La(a,Hh(n.in,r))),typeof n.out<"u"&&t!=="in"&&r in n.out&&(t||n.key!==r)&&(a=La(a,Hh(n.out,r)))),e!=="directed"&&typeof n.undirected<"u"&&r in n.undirected&&(a=La(a,Hh(n.undirected,r))),a}function MZ(e,t){const{name:n,type:r,direction:a}=t;e.prototype[n]=function(i,s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return CZ(this,r);if(arguments.length===1){i=""+i;const u=this._nodes.get(i);if(typeof u>"u")throw new De(`Graph.${n}: could not find the "${i}" node in the graph.`);return OZ(this.multi,r==="mixed"?this.type:r,a,u)}if(arguments.length===2){i=""+i,s=""+s;const u=this._nodes.get(i);if(!u)throw new De(`Graph.${n}: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(s))throw new De(`Graph.${n}: could not find the "${s}" target node in the graph.`);return IZ(r,this.multi,a,u,s)}throw new Le(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function FZ(e,t){const{name:n,type:r,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(d,p,g){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return g=d,aj(!1,this,r,g);if(arguments.length===2){d=""+d,g=p;const m=this._nodes.get(d);if(typeof m>"u")throw new De(`Graph.${i}: could not find the "${d}" node in the graph.`);return D0(!1,this.multi,r==="mixed"?this.type:r,a,m,g)}if(arguments.length===3){d=""+d,p=""+p;const m=this._nodes.get(d);if(!m)throw new De(`Graph.${i}: could not find the "${d}" source node in the graph.`);if(!this._nodes.has(p))throw new De(`Graph.${i}: could not find the "${p}" target node in the graph.`);return I0(!1,r,this.multi,a,m,p,g)}throw new Le(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){const d=Array.prototype.slice.call(arguments),p=d.pop();let g;if(d.length===0){let m=0;r!=="directed"&&(m+=this.undirectedSize),r!=="undirected"&&(m+=this.directedSize),g=new Array(m);let b=0;d.push((S,v,k,R,x,A,N)=>{g[b++]=p(S,v,k,R,x,A,N)})}else g=[],d.push((m,b,S,v,k,R,x)=>{g.push(p(m,b,S,v,k,R,x))});return this[i].apply(this,d),g};const u="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[u]=function(){const d=Array.prototype.slice.call(arguments),p=d.pop(),g=[];return d.push((m,b,S,v,k,R,x)=>{p(m,b,S,v,k,R,x)&&g.push(m)}),this[i].apply(this,d),g};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let d=Array.prototype.slice.call(arguments);if(d.length<2||d.length>4)throw new Le(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${d.length}).`);if(typeof d[d.length-1]=="function"&&typeof d[d.length-2]!="function")throw new Le(`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 p,g;d.length===2?(p=d[0],g=d[1],d=[]):d.length===3?(p=d[1],g=d[2],d=[d[0]]):d.length===4&&(p=d[2],g=d[3],d=[d[0],d[1]]);let m=g;return d.push((b,S,v,k,R,x,A)=>{m=p(m,b,S,v,k,R,x,A)}),this[i].apply(this,d),m}}function PZ(e,t){const{name:n,type:r,direction:a}=t,i="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(c,d,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return p=c,aj(!0,this,r,p);if(arguments.length===2){c=""+c,p=d;const g=this._nodes.get(c);if(typeof g>"u")throw new De(`Graph.${i}: could not find the "${c}" node in the graph.`);return D0(!0,this.multi,r==="mixed"?this.type:r,a,g,p)}if(arguments.length===3){c=""+c,d=""+d;const g=this._nodes.get(c);if(!g)throw new De(`Graph.${i}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(d))throw new De(`Graph.${i}: could not find the "${d}" target node in the graph.`);return I0(!0,r,this.multi,a,g,d,p)}throw new Le(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){const c=Array.prototype.slice.call(arguments),d=c.pop();return c.push((g,m,b,S,v,k,R)=>d(g,m,b,S,v,k,R)),!!this[i].apply(this,c)};const u="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[u]=function(){const c=Array.prototype.slice.call(arguments),d=c.pop();return c.push((g,m,b,S,v,k,R)=>!d(g,m,b,S,v,k,R)),!this[i].apply(this,c)}}function zZ(e,t){const{name:n,type:r,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s,u){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Bs();if(!arguments.length)return NZ(this,r);if(arguments.length===1){s=""+s;const c=this._nodes.get(s);if(!c)throw new De(`Graph.${i}: could not find the "${s}" node in the graph.`);return DZ(r,a,c)}if(arguments.length===2){s=""+s,u=""+u;const c=this._nodes.get(s);if(!c)throw new De(`Graph.${i}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(u))throw new De(`Graph.${i}: could not find the "${u}" target node in the graph.`);return LZ(r,a,c,u)}throw new Le(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function BZ(e){kZ.forEach(t=>{MZ(e,t),FZ(e,t),PZ(e,t),zZ(e,t)})}const UZ=[{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 Xf(){this.A=null,this.B=null}Xf.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)};Xf.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function $l(e,t,n,r,a){for(const i in r){const s=r[i],u=s.source,c=s.target,d=u===n?c:u;if(t&&t.has(d.key))continue;const p=a(d.key,d.attributes);if(e&&p)return d.key}}function L0(e,t,n,r,a){if(t!=="mixed"){if(t==="undirected")return $l(e,null,r,r.undirected,a);if(typeof n=="string")return $l(e,null,r,r[n],a)}const i=new Xf;let s;if(t!=="undirected"){if(n!=="out"){if(s=$l(e,null,r,r.in,a),e&&s)return s;i.wrap(r.in)}if(n!=="in"){if(s=$l(e,i,r,r.out,a),e&&s)return s;i.wrap(r.out)}}if(t!=="directed"&&(s=$l(e,i,r,r.undirected,a),e&&s))return s}function jZ(e,t,n){if(e!=="mixed"){if(e==="undirected")return Object.keys(n.undirected);if(typeof t=="string")return Object.keys(n[t])}const r=[];return L0(!1,e,t,n,function(a){r.push(a)}),r}function ql(e,t,n){const r=Object.keys(n),a=r.length;let i=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(i>=a)return e&&e.wrap(n),{done:!0};const u=n[r[i++]],c=u.source,d=u.target;if(s=c===t?d:c,e&&e.has(s.key)){s=null;continue}}while(s===null);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function GZ(e,t,n){if(e!=="mixed"){if(e==="undirected")return ql(null,n,n.undirected);if(typeof t=="string")return ql(null,n,n[t])}let r=Bs();const a=new Xf;return e!=="undirected"&&(t!=="out"&&(r=La(r,ql(a,n,n.in))),t!=="in"&&(r=La(r,ql(a,n,n.out)))),e!=="directed"&&(r=La(r,ql(a,n,n.undirected))),r}function HZ(e,t){const{name:n,type:r,direction:a}=t;e.prototype[n]=function(i){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];i=""+i;const s=this._nodes.get(i);if(typeof s>"u")throw new De(`Graph.${n}: could not find the "${i}" node in the graph.`);return jZ(r==="mixed"?this.type:r,a,s)}}function $Z(e,t){const{name:n,type:r,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(d,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;d=""+d;const g=this._nodes.get(d);if(typeof g>"u")throw new De(`Graph.${i}: could not find the "${d}" node in the graph.`);L0(!1,r==="mixed"?this.type:r,a,g,p)};const s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(d,p){const g=[];return this[i](d,(m,b)=>{g.push(p(m,b))}),g};const u="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[u]=function(d,p){const g=[];return this[i](d,(m,b)=>{p(m,b)&&g.push(m)}),g};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(d,p,g){if(arguments.length<3)throw new Le(`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 m=g;return this[i](d,(b,S)=>{m=p(m,b,S)}),m}}function qZ(e,t){const{name:n,type:r,direction:a}=t,i=n[0].toUpperCase()+n.slice(1,-1),s="find"+i;e.prototype[s]=function(d,p){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;d=""+d;const g=this._nodes.get(d);if(typeof g>"u")throw new De(`Graph.${s}: could not find the "${d}" node in the graph.`);return L0(!0,r==="mixed"?this.type:r,a,g,p)};const u="some"+i;e.prototype[u]=function(d,p){return!!this[s](d,p)};const c="every"+i;e.prototype[c]=function(d,p){return!this[s](d,(m,b)=>!p(m,b))}}function VZ(e,t){const{name:n,type:r,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Bs();s=""+s;const u=this._nodes.get(s);if(typeof u>"u")throw new De(`Graph.${i}: could not find the "${s}" node in the graph.`);return GZ(r==="mixed"?this.type:r,a,u)}}function WZ(e){UZ.forEach(t=>{HZ(e,t),$Z(e,t),qZ(e,t),VZ(e,t)})}function sd(e,t,n,r,a){const i=r._nodes.values(),s=r.type;let u,c,d,p,g,m;for(;u=i.next(),u.done!==!0;){let b=!1;if(c=u.value,s!=="undirected"){p=c.out;for(d in p){g=p[d];do m=g.target,b=!0,a(c.key,m.key,c.attributes,m.attributes,g.key,g.attributes,g.undirected),g=g.next;while(g)}}if(s!=="directed"){p=c.undirected;for(d in p)if(!(t&&c.key>d)){g=p[d];do m=g.target,m.key!==d&&(m=g.source),b=!0,a(c.key,m.key,c.attributes,m.attributes,g.key,g.attributes,g.undirected),g=g.next;while(g)}}n&&!b&&a(c.key,null,c.attributes,null,null,null,null)}}function YZ(e,t){const n={key:e};return Z3(t.attributes)||(n.attributes=tn({},t.attributes)),n}function KZ(e,t,n){const r={key:t,source:n.source.key,target:n.target.key};return Z3(n.attributes)||(r.attributes=tn({},n.attributes)),e==="mixed"&&n.undirected&&(r.undirected=!0),r}function XZ(e){if(!bn(e))throw new Le('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 Le("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!bn(e.attributes)||e.attributes===null))throw new Le("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ZZ(e){if(!bn(e))throw new Le('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 Le("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new Le("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!bn(e.attributes)||e.attributes===null))throw new Le("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&typeof e.undirected!="boolean")throw new Le("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const QZ=eZ(),JZ=new Set(["directed","undirected","mixed"]),LC=new Set(["domain","_events","_eventsCount","_maxListeners"]),eQ=[{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"}],tQ={allowSelfLoops:!0,multi:!1,type:"mixed"};function nQ(e,t,n){if(n&&!bn(n))throw new Le(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=""+t,n=n||{},e._nodes.has(t))throw new Ze(`Graph.addNode: the "${t}" node already exist in the graph.`);const r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function MC(e,t,n){const r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function ij(e,t,n,r,a,i,s,u){if(!r&&e.type==="undirected")throw new Ze(`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 Ze(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(u&&!bn(u))throw new Le(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`);if(i=""+i,s=""+s,u=u||{},!e.allowSelfLoops&&i===s)throw new Ze(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=e._nodes.get(i),d=e._nodes.get(s);if(!c)throw new De(`Graph.${t}: source node "${i}" not found.`);if(!d)throw new De(`Graph.${t}: target node "${s}" not found.`);const p={key:null,undirected:r,source:i,target:s,attributes:u};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new Ze(`Graph.${t}: the "${a}" edge already exists in the graph.`);if(!e.multi&&(r?typeof c.undirected[s]<"u":typeof c.out[s]<"u"))throw new Ze(`Graph.${t}: an edge linking "${i}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const g=new Us(r,a,c,d,u);e._edges.set(a,g);const m=i===s;return r?(c.undirectedDegree++,d.undirectedDegree++,m&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,d.inDegree++,m&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?g.attachMulti():g.attach(),r?e._undirectedSize++:e._directedSize++,p.key=a,e.emit("edgeAdded",p),a}function rQ(e,t,n,r,a,i,s,u,c){if(!r&&e.type==="undirected")throw new Ze(`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 Ze(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(u){if(c){if(typeof u!="function")throw new Le(`Graph.${t}: invalid updater function. Expecting a function but got "${u}"`)}else if(!bn(u))throw new Le(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`)}i=""+i,s=""+s;let d;if(c&&(d=u,u=void 0),!e.allowSelfLoops&&i===s)throw new Ze(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=e._nodes.get(i),g=e._nodes.get(s),m,b;if(!n&&(m=e._edges.get(a),m)){if((m.source.key!==i||m.target.key!==s)&&(!r||m.source.key!==s||m.target.key!==i))throw new Ze(`Graph.${t}: inconsistency detected when attempting to merge the "${a}" edge with "${i}" source & "${s}" target vs. ("${m.source.key}", "${m.target.key}").`);b=m}if(!b&&!e.multi&&p&&(b=r?p.undirected[s]:p.out[s]),b){const x=[b.key,!1,!1,!1];if(c?!d:!u)return x;if(c){const A=b.attributes;b.attributes=d(A),e.emit("edgeAttributesUpdated",{type:"replace",key:b.key,attributes:b.attributes})}else tn(b.attributes,u),e.emit("edgeAttributesUpdated",{type:"merge",key:b.key,attributes:b.attributes,data:u});return x}u=u||{},c&&d&&(u=d(u));const S={key:null,undirected:r,source:i,target:s,attributes:u};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new Ze(`Graph.${t}: the "${a}" edge already exists in the graph.`);let v=!1,k=!1;p||(p=MC(e,i,{}),v=!0,i===s&&(g=p,k=!0)),g||(g=MC(e,s,{}),k=!0),m=new Us(r,a,p,g,u),e._edges.set(a,m);const R=i===s;return r?(p.undirectedDegree++,g.undirectedDegree++,R&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,g.inDegree++,R&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?m.attachMulti():m.attach(),r?e._undirectedSize++:e._directedSize++,S.key=a,e.emit("edgeAdded",S),[a,!0,v,k]}function is(e,t){e._edges.delete(t.key);const{source:n,target:r,attributes:a}=t,i=t.undirected,s=n===r;i?(n.undirectedDegree--,r.undirectedDegree--,s&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,s&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),i?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:a,source:n.key,target:r.key,undirected:i})}class At extends X3.EventEmitter{constructor(t){if(super(),t=tn({},tQ,t),typeof t.multi!="boolean")throw new Le(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!JZ.has(t.type))throw new Le(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if(typeof t.allowSelfLoops!="boolean")throw new Le(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);const n=t.type==="mixed"?Q3:t.type==="directed"?J3:ej;br(this,"NodeDataClass",n);const r="geid_"+QZ()+"_";let a=0;const i=()=>{let s;do s=r+a++;while(this._edges.has(s));return s};br(this,"_attributes",{}),br(this,"_nodes",new Map),br(this,"_edges",new Map),br(this,"_directedSize",0),br(this,"_undirectedSize",0),br(this,"_directedSelfLoopCount",0),br(this,"_undirectedSelfLoopCount",0),br(this,"_edgeKeyGenerator",i),br(this,"_options",t),LC.forEach(s=>br(this,s,this[s])),Nr(this,"order",()=>this._nodes.size),Nr(this,"size",()=>this._edges.size),Nr(this,"directedSize",()=>this._directedSize),Nr(this,"undirectedSize",()=>this._undirectedSize),Nr(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Nr(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Nr(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Nr(this,"multi",this._options.multi),Nr(this,"type",this._options.type),Nr(this,"allowSelfLoops",this._options.allowSelfLoops),Nr(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,n){if(this.type==="undirected")return!1;if(arguments.length===1){const r=""+t,a=this._edges.get(r);return!!a&&!a.undirected}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?r.out.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+t,a=this._edges.get(r);return!!a&&a.undirected}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?r.undirected.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(arguments.length===1){const r=""+t;return this._edges.has(r)}else if(arguments.length===2){t=""+t,n=""+n;const r=this._nodes.get(t);return r?typeof r.out<"u"&&r.out.hasOwnProperty(n)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(n):!1}throw new Le(`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(t,n){if(this.type==="undirected")return;if(t=""+t,n=""+n,this.multi)throw new Ze("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(t);if(!r)throw new De(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.directedEdge: could not find the "${n}" target node in the graph.`);const a=r.out&&r.out[n]||void 0;if(a)return a.key}undirectedEdge(t,n){if(this.type==="directed")return;if(t=""+t,n=""+n,this.multi)throw new Ze("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(t);if(!r)throw new De(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.undirectedEdge: could not find the "${n}" target node in the graph.`);const a=r.undirected&&r.undirected[n]||void 0;if(a)return a.key}edge(t,n){if(this.multi)throw new Ze("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(n))throw new De(`Graph.edge: could not find the "${n}" target node in the graph.`);const a=r.out&&r.out[n]||r.undirected&&r.undirected[n]||void 0;if(a)return a.key}areDirectedNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.in||n in r.out}areOutNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.out}areInNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:n in r.in}areUndirectedNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="directed"?!1:n in r.undirected}areNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&(n in r.in||n in r.out)||this.type!=="directed"&&n in r.undirected}areInboundNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&n in r.in||this.type!=="directed"&&n in r.undirected}areOutboundNeighbors(t,n){t=""+t,n=""+n;const r=this._nodes.get(t);if(!r)throw new De(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&n in r.out||this.type!=="directed"&&n in r.undirected}inDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree}outDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.outDegree}directedDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree}undirectedDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree}inboundDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree),r}outboundDegree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.outDegree),r}degree(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.degree: could not find the "${t}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=n.undirectedDegree),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree),r}inDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree-n.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.outDegree-n.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:n.inDegree+n.outDegree-n.directedLoops*2}undirectedDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:n.undirectedDegree-n.undirectedLoops*2}inboundDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree,a+=n.directedLoops),r-a}outboundDegreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.outDegree,a+=n.directedLoops),r-a}degreeWithoutSelfLoops(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let r=0,a=0;return this.type!=="directed"&&(r+=n.undirectedDegree,a+=n.undirectedLoops*2),this.type!=="undirected"&&(r+=n.inDegree+n.outDegree,a+=n.directedLoops*2),r-a}source(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.source: could not find the "${t}" edge in the graph.`);return n.source.key}target(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.target: could not find the "${t}" edge in the graph.`);return n.target.key}extremities(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[n.source.key,n.target.key]}opposite(t,n){t=""+t,n=""+n;const r=this._edges.get(n);if(!r)throw new De(`Graph.opposite: could not find the "${n}" edge in the graph.`);const a=r.source.key,i=r.target.key;if(t===a)return i;if(t===i)return a;throw new De(`Graph.opposite: the "${t}" node is not attached to the "${n}" edge (${a}, ${i}).`)}hasExtremity(t,n){t=""+t,n=""+n;const r=this._edges.get(t);if(!r)throw new De(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return r.source.key===n||r.target.key===n}isUndirected(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return n.undirected}isDirected(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!n.undirected}isSelfLoop(t){t=""+t;const n=this._edges.get(t);if(!n)throw new De(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return n.source===n.target}addNode(t,n){return nQ(this,t,n).key}mergeNode(t,n){if(n&&!bn(n))throw new Le(`Graph.mergeNode: invalid attributes. Expecting an object but got "${n}"`);t=""+t,n=n||{};let r=this._nodes.get(t);return r?(n&&(tn(r.attributes,n),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:r.attributes,data:n})),[t,!1]):(r=new this.NodeDataClass(t,n),this._nodes.set(t,r),this.emit("nodeAdded",{key:t,attributes:n}),[t,!0])}updateNode(t,n){if(n&&typeof n!="function")throw new Le(`Graph.updateNode: invalid updater function. Expecting a function but got "${n}"`);t=""+t;let r=this._nodes.get(t);if(r){if(n){const i=r.attributes;r.attributes=n(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:r.attributes})}return[t,!1]}const a=n?n({}):{};return r=new this.NodeDataClass(t,a),this._nodes.set(t,r),this.emit("nodeAdded",{key:t,attributes:a}),[t,!0]}dropNode(t){t=""+t;const n=this._nodes.get(t);if(!n)throw new De(`Graph.dropNode: could not find the "${t}" node in the graph.`);let r;if(this.type!=="undirected"){for(const a in n.out){r=n.out[a];do is(this,r),r=r.next;while(r)}for(const a in n.in){r=n.in[a];do is(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const a in n.undirected){r=n.undirected[a];do is(this,r),r=r.next;while(r)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})}dropEdge(t){let n;if(arguments.length>1){const r=""+arguments[0],a=""+arguments[1];if(n=vr(this,r,a,this.type),!n)throw new De(`Graph.dropEdge: could not find the "${r}" -> "${a}" edge in the graph.`)}else if(t=""+t,n=this._edges.get(t),!n)throw new De(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return is(this,n),this}dropDirectedEdge(t,n){if(arguments.length<2)throw new Ze("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 Ze("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.");t=""+t,n=""+n;const r=vr(this,t,n,"directed");if(!r)throw new De(`Graph.dropDirectedEdge: could not find a "${t}" -> "${n}" edge in the graph.`);return is(this,r),this}dropUndirectedEdge(t,n){if(arguments.length<2)throw new Ze("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 Ze("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const r=vr(this,t,n,"undirected");if(!r)throw new De(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${n}" edge in the graph.`);return is(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let n;for(;n=t.next(),n.done!==!0;)n.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,n){return this._attributes[t]=n,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,n){if(typeof n!="function")throw new Le("Graph.updateAttribute: updater should be a function.");const r=this._attributes[t];return this._attributes[t]=n(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!bn(t))throw new Le("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!bn(t))throw new Le("Graph.mergeAttributes: provided attributes are not a plain object.");return tn(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if(typeof t!="function")throw new Le("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,n){if(typeof t!="function")throw new Le("Graph.updateEachNodeAttributes: expecting an updater function.");if(n&&!IC(n))throw new Le("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.values();let a,i;for(;a=r.next(),a.done!==!0;)i=a.value,i.attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:n||null})}updateEachEdgeAttributes(t,n){if(typeof t!="function")throw new Le("Graph.updateEachEdgeAttributes: expecting an updater function.");if(n&&!IC(n))throw new Le("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let a,i,s,u;for(;a=r.next(),a.done!==!0;)i=a.value,s=i.source,u=i.target,i.attributes=t(i.key,i.attributes,s.key,u.key,s.attributes,u.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:n||null})}forEachAdjacencyEntry(t){if(typeof t!="function")throw new Le("Graph.forEachAdjacencyEntry: expecting a callback.");sd(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new Le("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");sd(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if(typeof t!="function")throw new Le("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");sd(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new Le("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");sd(!1,!0,!0,this,t)}nodes(){return Array.from(this._nodes.keys())}forEachNode(t){if(typeof t!="function")throw new Le("Graph.forEachNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)a=r.value,t(a.key,a.attributes)}findNode(t){if(typeof t!="function")throw new Le("Graph.findNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,t(a.key,a.attributes))return a.key}mapNodes(t){if(typeof t!="function")throw new Le("Graph.mapNode: expecting a callback.");const n=this._nodes.values();let r,a;const i=new Array(this.order);let s=0;for(;r=n.next(),r.done!==!0;)a=r.value,i[s++]=t(a.key,a.attributes);return i}someNode(t){if(typeof t!="function")throw new Le("Graph.someNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,t(a.key,a.attributes))return!0;return!1}everyNode(t){if(typeof t!="function")throw new Le("Graph.everyNode: expecting a callback.");const n=this._nodes.values();let r,a;for(;r=n.next(),r.done!==!0;)if(a=r.value,!t(a.key,a.attributes))return!1;return!0}filterNodes(t){if(typeof t!="function")throw new Le("Graph.filterNodes: expecting a callback.");const n=this._nodes.values();let r,a;const i=[];for(;r=n.next(),r.done!==!0;)a=r.value,t(a.key,a.attributes)&&i.push(a.key);return i}reduceNodes(t,n){if(typeof t!="function")throw new Le("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Le("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 r=n;const a=this._nodes.values();let i,s;for(;i=a.next(),i.done!==!0;)s=i.value,r=t(r,s.key,s.attributes);return r}nodeEntries(){const t=this._nodes.values();return{[Symbol.iterator](){return this},next(){const n=t.next();if(n.done)return n;const r=n.value;return{value:{node:r.key,attributes:r.attributes},done:!1}}}}export(){const t=new Array(this._nodes.size);let n=0;this._nodes.forEach((a,i)=>{t[n++]=YZ(i,a)});const r=new Array(this._edges.size);return n=0,this._edges.forEach((a,i)=>{r[n++]=KZ(this.type,i,a)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}}import(t,n=!1){if(t instanceof At)return t.forEachNode((c,d)=>{n?this.mergeNode(c,d):this.addNode(c,d)}),t.forEachEdge((c,d,p,g,m,b,S)=>{n?S?this.mergeUndirectedEdgeWithKey(c,p,g,d):this.mergeDirectedEdgeWithKey(c,p,g,d):S?this.addUndirectedEdgeWithKey(c,p,g,d):this.addDirectedEdgeWithKey(c,p,g,d)}),this;if(!bn(t))throw new Le("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!bn(t.attributes))throw new Le("Graph.import: invalid attributes. Expecting a plain object.");n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,a,i,s,u;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new Le("Graph.import: invalid nodes. Expecting an array.");for(r=0,a=i.length;r{const i=tn({},r.attributes);r=new n.NodeDataClass(a,i),n._nodes.set(a,r)}),n}copy(t){if(t=t||{},typeof t.type=="string"&&t.type!==this.type&&t.type!=="mixed")throw new Ze(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if(typeof t.multi=="boolean"&&t.multi!==this.multi&&t.multi!==!0)throw new Ze("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 t.allowSelfLoops=="boolean"&&t.allowSelfLoops!==this.allowSelfLoops&&t.allowSelfLoops!==!0)throw new Ze("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const n=this.emptyCopy(t),r=this._edges.values();let a,i;for(;a=r.next(),a.done!==!0;)i=a.value,ij(n,"copy",!1,i.undirected,i.key,i.source.key,i.target.key,tn({},i.attributes));return n}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((i,s)=>{t[s]=i.attributes});const n={},r={};this._edges.forEach((i,s)=>{const u=i.undirected?"--":"->";let c="",d=i.source.key,p=i.target.key,g;i.undirected&&d>p&&(g=d,d=p,p=g);const m=`(${d})${u}(${p})`;s.startsWith("geid_")?this.multi&&(typeof r[m]>"u"?r[m]=0:r[m]++,c+=`${r[m]}. `):c+=`[${s}]: `,c+=m,n[c]=i.attributes});const a={};for(const i in this)this.hasOwnProperty(i)&&!LC.has(i)&&typeof this[i]!="function"&&typeof i!="symbol"&&(a[i]=this[i]);return a.attributes=this._attributes,a.nodes=t,a.edges=n,br(a,"constructor",this.constructor),a}}typeof Symbol<"u"&&(At.prototype[Symbol.for("nodejs.util.inspect.custom")]=At.prototype.inspect);eQ.forEach(e=>{["add","merge","update"].forEach(t=>{const n=e.name(t),r=t==="add"?ij:rQ;e.generateKey?At.prototype[n]=function(a,i,s){return r(this,n,!0,(e.type||this.type)==="undirected",null,a,i,s,t==="update")}:At.prototype[n]=function(a,i,s,u){return r(this,n,!1,(e.type||this.type)==="undirected",a,i,s,u,t==="update")}})});fZ(At);xZ(At);BZ(At);WZ(At);class Zf extends At{constructor(t){const n=tn({type:"directed"},t);if("multi"in n&&n.multi!==!1)throw new Le("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="directed")throw new Le('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class oj extends At{constructor(t){const n=tn({type:"undirected"},t);if("multi"in n&&n.multi!==!1)throw new Le("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(n.type!=="undirected")throw new Le('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class sj extends At{constructor(t){const n=tn({multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(n)}}class lj extends At{constructor(t){const n=tn({type:"directed",multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="directed")throw new Le('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}class uj extends At{constructor(t){const n=tn({type:"undirected",multi:!0},t);if("multi"in n&&n.multi!==!0)throw new Le("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(n.type!=="undirected")throw new Le('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');super(n)}}function js(e){e.from=function(t,n){const r=tn({},t.options,n),a=new e(r);return a.import(t),a}}js(At);js(Zf);js(oj);js(sj);js(lj);js(uj);At.Graph=At;At.DirectedGraph=Zf;At.UndirectedGraph=oj;At.MultiGraph=sj;At.MultiDirectedGraph=lj;At.MultiUndirectedGraph=uj;At.InvalidArgumentsGraphError=Le;At.NotFoundGraphError=De;At.UsageGraphError=Ze;function aQ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ru(e){var t=aQ(e,"string");return typeof t=="symbol"?t:t+""}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FC(e,t){for(var n=0;n e.length)&&(t=e.length);for(var n=0,r=Array(t);n >8&255,i=n>>16&255,s=n>>24&255;return[r,a,i,s]}var qh={};function hj(e){if(typeof qh[e]<"u")return qh[e];var t=(e&16711680)>>>16,n=(e&65280)>>>8,r=e&255,a=255,i=gj(t,n,r,a);return qh[e]=i,i}function PC(e,t,n,r){return n+(t<<8)+(e<<16)}function zC(e,t,n,r,a,i){var s=Math.floor(n/i*a),u=Math.floor(e.drawingBufferHeight/i-r/i*a),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(s,u,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var d=As(c,4),p=d[0],g=d[1],m=d[2],b=d[3];return[p,g,m,b]}function _e(e,t,n){return(t=ru(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t N){var _="…";for(d=d+_,O=e.measureText(d).width;O>N&&d.length>1;)d=d.slice(0,-2)+_,O=e.measureText(d).width;if(d.length<4)return}var C;x>0?A>0?C=Math.acos(x/N):C=Math.asin(A/N):A>0?C=Math.acos(x/N)+Math.PI:C=Math.asin(x/N)+Math.PI/2,e.save(),e.translate(k,R),e.rotate(C),e.fillText(d,-O/2,t.size/2+i),e.restore()}}}function Sj(e,t,n){if(t.label){var r=n.labelSize,a=n.labelFont,i=n.labelWeight,s=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||"#000":n.labelColor.color;e.fillStyle=s,e.font="".concat(i," ").concat(r,"px ").concat(a),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}}function EQ(e,t,n){var r=n.labelSize,a=n.labelFont,i=n.labelWeight;e.font="".concat(i," ").concat(r,"px ").concat(a),e.fillStyle="#FFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var s=2;if(typeof t.label=="string"){var u=e.measureText(t.label).width,c=Math.round(u+5),d=Math.round(r+2*s),p=Math.max(t.size,r/2)+s,g=Math.asin(d/2/p),m=Math.sqrt(Math.abs(Math.pow(p,2)-Math.pow(d/2,2)));e.beginPath(),e.moveTo(t.x+m,t.y+d/2),e.lineTo(t.x+p+c,t.y+d/2),e.lineTo(t.x+p+c,t.y-d/2),e.lineTo(t.x+m,t.y-d/2),e.arc(t.x,t.y,p,g,-g),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+s,0,Math.PI*2),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,Sj(e,t,n)}var wQ=` precision highp float; varying vec4 v_color; @@ -306,7 +339,7 @@ void main(void) { gl_FragColor = mix(v_color, transparent, t); #endif } -`,sX=lX,uX=` +`,xQ=wQ,kQ=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_position; @@ -347,7 +380,7 @@ void main() { v_color.a *= bias; } -`,cX=uX,YU=WebGLRenderingContext,oC=YU.UNSIGNED_BYTE,Rh=YU.FLOAT,dX=["u_sizeRatio","u_correctionRatio","u_matrix"],Su=function(e){function t(){return on(this,t),Bn(this,t,arguments)}return Un(t,e),ln(t,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:cX,FRAGMENT_SHADER_SOURCE:sX,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:dX,ATTRIBUTES:[{name:"a_position",size:2,type:Rh},{name:"a_size",size:1,type:Rh},{name:"a_color",size:4,type:oC,normalized:!0},{name:"a_id",size:4,type:oC,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:Rh}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:"processVisibleItem",value:function(r,a,i){var l=this.array,u=Qr(i.color);l[a++]=i.x,l[a++]=i.y,l[a++]=i.size,l[a++]=u,l[a++]=r}},{key:"setUniforms",value:function(r,a){var i=a.gl,l=a.uniformLocations,u=l.u_sizeRatio,c=l.u_correctionRatio,f=l.u_matrix;i.uniform1f(c,r.correctionRatio),i.uniform1f(u,r.sizeRatio),i.uniformMatrix3fv(f,!1,r.matrix)}}])}(g0);_e(Su,"ANGLE_1",0);_e(Su,"ANGLE_2",2*Math.PI/3);_e(Su,"ANGLE_3",4*Math.PI/3);var fX=` +`,TQ=kQ,Ej=WebGLRenderingContext,HC=Ej.UNSIGNED_BYTE,Wh=Ej.FLOAT,AQ=["u_sizeRatio","u_correctionRatio","u_matrix"],Iu=function(e){function t(){return un(this,t),Hn(this,t,arguments)}return $n(t,e),cn(t,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:TQ,FRAGMENT_SHADER_SOURCE:xQ,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:AQ,ATTRIBUTES:[{name:"a_position",size:2,type:Wh},{name:"a_size",size:1,type:Wh},{name:"a_color",size:4,type:HC,normalized:!0},{name:"a_id",size:4,type:HC,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:Wh}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:"processVisibleItem",value:function(r,a,i){var s=this.array,u=na(i.color);s[a++]=i.x,s[a++]=i.y,s[a++]=i.size,s[a++]=u,s[a++]=r}},{key:"setUniforms",value:function(r,a){var i=a.gl,s=a.uniformLocations,u=s.u_sizeRatio,c=s.u_correctionRatio,d=s.u_matrix;i.uniform1f(c,r.correctionRatio),i.uniform1f(u,r.sizeRatio),i.uniformMatrix3fv(d,!1,r.matrix)}}])}(M0);_e(Iu,"ANGLE_1",0);_e(Iu,"ANGLE_2",2*Math.PI/3);_e(Iu,"ANGLE_3",4*Math.PI/3);var _Q=` precision mediump float; varying vec4 v_color; @@ -355,7 +388,7 @@ varying vec4 v_color; void main(void) { gl_FragColor = v_color; } -`,pX=fX,gX=` +`,RQ=_Q,CQ=` attribute vec2 a_position; attribute vec2 a_normal; attribute float a_radius; @@ -421,7 +454,7 @@ void main() { v_color.a *= bias; } -`,hX=gX,KU=WebGLRenderingContext,iC=KU.UNSIGNED_BYTE,Kc=KU.FLOAT,mX=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],Eu={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function Pd(e){var t=Be(Be({},Eu),e||{});return function(n){function r(){return on(this,r),Bn(this,r,arguments)}return Un(r,n),ln(r,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:hX,FRAGMENT_SHADER_SOURCE:pX,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:mX,ATTRIBUTES:[{name:"a_position",size:2,type:Kc},{name:"a_normal",size:2,type:Kc},{name:"a_radius",size:1,type:Kc},{name:"a_color",size:4,type:iC,normalized:!0},{name:"a_id",size:4,type:iC,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:Kc}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(i,l,u,c,f){if(t.extremity==="source"){var p=[c,u];u=p[0],c=p[1]}var g=f.size||1,b=c.size||1,m=u.x,S=u.y,v=c.x,A=c.y,R=Qr(f.color),x=v-m,T=A-S,C=x*x+T*T,N=0,_=0;C&&(C=1/Math.sqrt(C),N=-T*C*g,_=x*C*g);var O=this.array;O[l++]=v,O[l++]=A,O[l++]=-N,O[l++]=-_,O[l++]=b,O[l++]=R,O[l++]=i}},{key:"setUniforms",value:function(i,l){var u=l.gl,c=l.uniformLocations,f=c.u_matrix,p=c.u_sizeRatio,g=c.u_correctionRatio,b=c.u_minEdgeThickness,m=c.u_lengthToThicknessRatio,S=c.u_widenessToThicknessRatio;u.uniformMatrix3fv(f,!1,i.matrix),u.uniform1f(p,i.sizeRatio),u.uniform1f(g,i.correctionRatio),u.uniform1f(b,i.minEdgeThickness),u.uniform1f(m,t.lengthToThicknessRatio),u.uniform1f(S,t.widenessToThicknessRatio)}}])}(vu)}Pd();var bX=` +`,NQ=CQ,wj=WebGLRenderingContext,$C=wj.UNSIGNED_BYTE,ud=wj.FLOAT,OQ=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],Lu={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function af(e){var t=Be(Be({},Lu),e||{});return function(n){function r(){return un(this,r),Hn(this,r,arguments)}return $n(r,n),cn(r,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:NQ,FRAGMENT_SHADER_SOURCE:RQ,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:OQ,ATTRIBUTES:[{name:"a_position",size:2,type:ud},{name:"a_normal",size:2,type:ud},{name:"a_radius",size:1,type:ud},{name:"a_color",size:4,type:$C,normalized:!0},{name:"a_id",size:4,type:$C,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:ud}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(i,s,u,c,d){if(t.extremity==="source"){var p=[c,u];u=p[0],c=p[1]}var g=d.size||1,m=c.size||1,b=u.x,S=u.y,v=c.x,k=c.y,R=na(d.color),x=v-b,A=k-S,N=x*x+A*A,O=0,_=0;N&&(N=1/Math.sqrt(N),O=-A*N*g,_=x*N*g);var C=this.array;C[s++]=v,C[s++]=k,C[s++]=-O,C[s++]=-_,C[s++]=m,C[s++]=R,C[s++]=i}},{key:"setUniforms",value:function(i,s){var u=s.gl,c=s.uniformLocations,d=c.u_matrix,p=c.u_sizeRatio,g=c.u_correctionRatio,m=c.u_minEdgeThickness,b=c.u_lengthToThicknessRatio,S=c.u_widenessToThicknessRatio;u.uniformMatrix3fv(d,!1,i.matrix),u.uniform1f(p,i.sizeRatio),u.uniform1f(g,i.correctionRatio),u.uniform1f(m,i.minEdgeThickness),u.uniform1f(b,t.lengthToThicknessRatio),u.uniform1f(S,t.widenessToThicknessRatio)}}])}(Du)}af();var DQ=` precision mediump float; varying vec4 v_color; @@ -447,7 +480,7 @@ void main(void) { gl_FragColor = mix(v_color, transparent, t); #endif } -`,h0=bX,yX=` +`,F0=DQ,IQ=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; @@ -515,7 +548,7 @@ void main() { v_color.a *= bias; } -`,vX=yX,XU=WebGLRenderingContext,lC=XU.UNSIGNED_BYTE,Ko=XU.FLOAT,SX=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],EX={lengthToThicknessRatio:Eu.lengthToThicknessRatio};function ZU(e){var t=Be(Be({},EX),{});return function(n){function r(){return on(this,r),Bn(this,r,arguments)}return Un(r,n),ln(r,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:vX,FRAGMENT_SHADER_SOURCE:h0,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:SX,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Ko},{name:"a_positionEnd",size:2,type:Ko},{name:"a_normal",size:2,type:Ko},{name:"a_color",size:4,type:lC,normalized:!0},{name:"a_id",size:4,type:lC,normalized:!0},{name:"a_radius",size:1,type:Ko}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Ko},{name:"a_normalCoef",size:1,type:Ko},{name:"a_radiusCoef",size:1,type:Ko}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(i,l,u,c,f){var p=f.size||1,g=u.x,b=u.y,m=c.x,S=c.y,v=Qr(f.color),A=m-g,R=S-b,x=c.size||1,T=A*A+R*R,C=0,N=0;T&&(T=1/Math.sqrt(T),C=-R*T*p,N=A*T*p);var _=this.array;_[l++]=g,_[l++]=b,_[l++]=m,_[l++]=S,_[l++]=C,_[l++]=N,_[l++]=v,_[l++]=i,_[l++]=x}},{key:"setUniforms",value:function(i,l){var u=l.gl,c=l.uniformLocations,f=c.u_matrix,p=c.u_zoomRatio,g=c.u_feather,b=c.u_pixelRatio,m=c.u_correctionRatio,S=c.u_sizeRatio,v=c.u_minEdgeThickness,A=c.u_lengthToThicknessRatio;u.uniformMatrix3fv(f,!1,i.matrix),u.uniform1f(p,i.zoomRatio),u.uniform1f(S,i.sizeRatio),u.uniform1f(m,i.correctionRatio),u.uniform1f(b,i.pixelRatio),u.uniform1f(g,i.antiAliasingFeather),u.uniform1f(v,i.minEdgeThickness),u.uniform1f(A,t.lengthToThicknessRatio)}}])}(vu)}ZU();function wX(e){return VU([ZU(),Pd(e)])}var xX=wX(),QU=xX,kX=` +`,LQ=IQ,xj=WebGLRenderingContext,qC=xj.UNSIGNED_BYTE,Qi=xj.FLOAT,MQ=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],FQ={lengthToThicknessRatio:Lu.lengthToThicknessRatio};function kj(e){var t=Be(Be({},FQ),{});return function(n){function r(){return un(this,r),Hn(this,r,arguments)}return $n(r,n),cn(r,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:LQ,FRAGMENT_SHADER_SOURCE:F0,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:MQ,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Qi},{name:"a_positionEnd",size:2,type:Qi},{name:"a_normal",size:2,type:Qi},{name:"a_color",size:4,type:qC,normalized:!0},{name:"a_id",size:4,type:qC,normalized:!0},{name:"a_radius",size:1,type:Qi}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Qi},{name:"a_normalCoef",size:1,type:Qi},{name:"a_radiusCoef",size:1,type:Qi}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(i,s,u,c,d){var p=d.size||1,g=u.x,m=u.y,b=c.x,S=c.y,v=na(d.color),k=b-g,R=S-m,x=c.size||1,A=k*k+R*R,N=0,O=0;A&&(A=1/Math.sqrt(A),N=-R*A*p,O=k*A*p);var _=this.array;_[s++]=g,_[s++]=m,_[s++]=b,_[s++]=S,_[s++]=N,_[s++]=O,_[s++]=v,_[s++]=i,_[s++]=x}},{key:"setUniforms",value:function(i,s){var u=s.gl,c=s.uniformLocations,d=c.u_matrix,p=c.u_zoomRatio,g=c.u_feather,m=c.u_pixelRatio,b=c.u_correctionRatio,S=c.u_sizeRatio,v=c.u_minEdgeThickness,k=c.u_lengthToThicknessRatio;u.uniformMatrix3fv(d,!1,i.matrix),u.uniform1f(p,i.zoomRatio),u.uniform1f(S,i.sizeRatio),u.uniform1f(b,i.correctionRatio),u.uniform1f(m,i.pixelRatio),u.uniform1f(g,i.antiAliasingFeather),u.uniform1f(v,i.minEdgeThickness),u.uniform1f(k,t.lengthToThicknessRatio)}}])}(Du)}kj();function PQ(e){return vj([kj(),af(e)])}var zQ=PQ(),Tj=zQ,BQ=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; @@ -580,8 +613,8 @@ void main() { v_color.a *= bias; } -`,AX=kX,JU=WebGLRenderingContext,sC=JU.UNSIGNED_BYTE,Ps=JU.FLOAT,TX=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],_X=function(e){function t(){return on(this,t),Bn(this,t,arguments)}return Un(t,e),ln(t,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:AX,FRAGMENT_SHADER_SOURCE:h0,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:TX,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Ps},{name:"a_positionEnd",size:2,type:Ps},{name:"a_normal",size:2,type:Ps},{name:"a_color",size:4,type:sC,normalized:!0},{name:"a_id",size:4,type:sC,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Ps},{name:"a_normalCoef",size:1,type:Ps}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(r,a,i,l,u){var c=u.size||1,f=i.x,p=i.y,g=l.x,b=l.y,m=Qr(u.color),S=g-f,v=b-p,A=S*S+v*v,R=0,x=0;A&&(A=1/Math.sqrt(A),R=-v*A*c,x=S*A*c);var T=this.array;T[a++]=f,T[a++]=p,T[a++]=g,T[a++]=b,T[a++]=R,T[a++]=x,T[a++]=m,T[a++]=r}},{key:"setUniforms",value:function(r,a){var i=a.gl,l=a.uniformLocations,u=l.u_matrix,c=l.u_zoomRatio,f=l.u_feather,p=l.u_pixelRatio,g=l.u_correctionRatio,b=l.u_sizeRatio,m=l.u_minEdgeThickness;i.uniformMatrix3fv(u,!1,r.matrix),i.uniform1f(c,r.zoomRatio),i.uniform1f(b,r.sizeRatio),i.uniform1f(g,r.correctionRatio),i.uniform1f(p,r.pixelRatio),i.uniform1f(f,r.antiAliasingFeather),i.uniform1f(m,r.minEdgeThickness)}}])}(vu),m0=function(e){function t(){var n;return on(this,t),n=Bn(this,t),n.rawEmitter=n,n}return Un(t,e),ln(t)}(xU.EventEmitter),Ch,uC;function Jr(){return uC||(uC=1,Ch=function(t){return t!==null&&typeof t=="object"&&typeof t.addUndirectedEdgeWithKey=="function"&&typeof t.dropNode=="function"&&typeof t.multi=="boolean"}),Ch}var RX=Jr();const CX=an(RX);var NX=function(t){return t},OX=function(t){return t*t},DX=function(t){return t*(2-t)},IX=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},LX=function(t){return t*t*t},MX=function(t){return--t*t*t+1},FX=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},e3={linear:NX,quadraticIn:OX,quadraticOut:DX,quadraticInOut:IX,cubicIn:LX,cubicOut:MX,cubicInOut:FX},t3={easing:"quadraticInOut",duration:150};function zX(e,t,n,r){var a=Object.assign({},t3,n),i=typeof a.easing=="function"?a.easing:e3[a.easing],l=Date.now(),u={};for(var c in t){var f=t[c];u[c]={};for(var p in f)u[c][p]=e.getNodeAttribute(c,p)}var g=null,b=function(){g=null;var S=(Date.now()-l)/a.duration;if(S>=1){for(var v in t){var A=t[v];for(var R in A)e.setNodeAttribute(v,R,A[R])}return}S=i(S);for(var x in t){var T=t[x],C=u[x];for(var N in T)e.setNodeAttribute(x,N,T[N]*S+C[N]*(1-S))}g=requestAnimationFrame(b)};return b(),function(){g&&cancelAnimationFrame(g)}}function _r(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function Xc(e,t,n){return e[0]=t,e[4]=typeof n=="number"?n:t,e}function cC(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 dC(e,t,n){return e[6]=t,e[7]=n,e}function io(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],l=e[4],u=e[5],c=e[6],f=e[7],p=e[8],g=t[0],b=t[1],m=t[2],S=t[3],v=t[4],A=t[5],R=t[6],x=t[7],T=t[8];return e[0]=g*n+b*i+m*c,e[1]=g*r+b*l+m*f,e[2]=g*a+b*u+m*p,e[3]=S*n+v*i+A*c,e[4]=S*r+v*l+A*f,e[5]=S*a+v*u+A*p,e[6]=R*n+x*i+T*c,e[7]=R*r+x*l+T*f,e[8]=R*a+x*u+T*p,e}function Fx(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=e[0],a=e[1],i=e[3],l=e[4],u=e[6],c=e[7],f=t.x,p=t.y;return{x:f*r+p*i+u*n,y:f*a+p*l+c*n}}function PX(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 Bs(e,t,n,r,a){var i=e.angle,l=e.ratio,u=e.x,c=e.y,f=t.width,p=t.height,g=_r(),b=Math.min(f,p)-2*r,m=PX(t,n);return a?(io(g,dC(_r(),u,c)),io(g,Xc(_r(),l)),io(g,cC(_r(),i)),io(g,Xc(_r(),f/b/2/m,p/b/2/m))):(io(g,Xc(_r(),2*(b/f)*m,2*(b/p)*m)),io(g,cC(_r(),-i)),io(g,Xc(_r(),1/l)),io(g,dC(_r(),-u,-c))),g}function BX(e,t,n){var r=Fx(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),a=r.x,i=r.y;return 1/Math.sqrt(Math.pow(a,2)+Math.pow(i,2))/n.width}function UX(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,r=1/0,a=-1/0;return e.forEachNode(function(i,l){var u=l.x,c=l.y;u n&&(n=u),c a&&(a=c)}),{x:[t,n],y:[r,a]}}function jX(e){if(!CX(e))throw new Error("Sigma: invalid graph instance.");e.forEachNode(function(t,n){if(!Number.isFinite(n.x)||!Number.isFinite(n.y))throw new Error("Sigma: Coordinates of node ".concat(t," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function GX(e,t,n){var r=document.createElement(e);if(t)for(var a in t)r.style[a]=t[a];if(n)for(var i in n)r.setAttribute(i,n[i]);return r}function fC(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function pC(e,t,n){return n.sort(function(r,a){var i=t(r)||0,l=t(a)||0;return i l?1:0})}function gC(e){var t=Sl(e.x,2),n=t[0],r=t[1],a=Sl(e.y,2),i=a[0],l=a[1],u=Math.max(r-n,l-i),c=(r+n)/2,f=(l+i)/2;(u===0||Math.abs(u)===1/0||isNaN(u))&&(u=1),isNaN(c)&&(c=0),isNaN(f)&&(f=0);var p=function(b){return{x:.5+(b.x-c)/u,y:.5+(b.y-f)/u}};return p.applyTo=function(g){g.x=.5+(g.x-c)/u,g.y=.5+(g.y-f)/u},p.inverse=function(g){return{x:c+u*(g.x-.5),y:f+u*(g.y-.5)}},p.ratio=u,p}function zx(e){"@babel/helpers - typeof";return zx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zx(e)}function hC(e,t){var n=t.size;if(n!==0){var r=e.length;e.length+=n;var a=0;t.forEach(function(i){e[r+a]=i,a++})}}function Nh(e){e=e||{};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t 1&&arguments[1]!==void 0?arguments[1]:{},l=arguments.length>2?arguments[2]:void 0;if(!l)return new Promise(function(m){return a.animate(r,i,m)});if(this.enabled){var u=Be(Be({},t3),i),c=this.validateState(r),f=typeof u.easing=="function"?u.easing:e3[u.easing],p=Date.now(),g=this.getState(),b=function(){var S=(Date.now()-p)/u.duration;if(S>=1){a.nextFrame=null,a.setState(c),a.animationCallback&&(a.animationCallback.call(null),a.animationCallback=void 0);return}var v=f(S),A={};typeof c.x=="number"&&(A.x=g.x+(c.x-g.x)*v),typeof c.y=="number"&&(A.y=g.y+(c.y-g.y)*v),a.enabledRotation&&typeof c.angle=="number"&&(A.angle=g.angle+(c.angle-g.angle)*v),typeof c.ratio=="number"&&(A.ratio=g.ratio+(c.ratio-g.ratio)*v),a.setState(A),a.nextFrame=requestAnimationFrame(b)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(b)):b(),this.animationCallback=l}}},{key:"animatedZoom",value:function(r){return r?typeof r=="number"?this.animate({ratio:this.ratio/r}):this.animate({ratio:this.ratio/(r.factor||Zc)},r):this.animate({ratio:this.ratio/Zc})}},{key:"animatedUnzoom",value:function(r){return r?typeof r=="number"?this.animate({ratio:this.ratio*r}):this.animate({ratio:this.ratio*(r.factor||Zc)},r):this.animate({ratio:this.ratio*Zc})}},{key:"animatedReset",value:function(r){return this.animate({x:.5,y:.5,ratio:1,angle:0},r)}},{key:"copy",value:function(){return t.from(this.getState())}}],[{key:"from",value:function(r){var a=new t;return a.setState(r)}}])}(m0);function Cr(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Aa(e,t){var n=Be(Be({},Cr(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Us(e){var t="x"in e?e:Be(Be({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function VX(e,t){return Be(Be({},Aa(e,t)),{},{delta:n3(e)})}var WX=2;function vd(e){for(var t=[],n=0,r=Math.min(e.length,WX);n 0;a.draggedEvents=0,g&&a.renderer.getSetting("hideEdgesOnMove")&&a.renderer.refresh()},0),this.emit("mouseup",Aa(r,this.container))}}},{key:"handleMove",value:function(r){var a=this;if(this.enabled){var i=Aa(r,this.container);if(this.emit("mousemovebody",i),(r.target===this.container||r.composedPath()[0]===this.container)&&this.emit("mousemove",i),!i.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){a.movingTimeout=null,a.isMoving=!1},this.settings.dragTimeout);var l=this.renderer.getCamera(),u=Cr(r,this.container),c=u.x,f=u.y,p=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),g=this.renderer.viewportToFramedGraph({x:c,y:f}),b=p.x-g.x,m=p.y-g.y,S=l.getState(),v=S.x+b,A=S.y+m;l.setState({x:v,y:A}),this.lastMouseX=c,this.lastMouseY=f,r.preventDefault(),r.stopPropagation()}}}},{key:"handleLeave",value:function(r){this.emit("mouseleave",Aa(r,this.container))}},{key:"handleEnter",value:function(r){this.emit("mouseenter",Aa(r,this.container))}},{key:"handleWheel",value:function(r){var a=this,i=this.renderer.getCamera();if(!(!this.enabled||!i.enabledZooming)){var l=n3(r);if(l){var u=VX(r,this.container);if(this.emit("wheel",u),u.sigmaDefaultPrevented){r.preventDefault(),r.stopPropagation();return}var c=i.getState().ratio,f=l>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,p=i.getBoundedRatio(c*f),g=l>0?1:-1,b=Date.now();c!==p&&(r.preventDefault(),r.stopPropagation(),!(this.currentWheelDirection===g&&this.lastWheelTriggerTime&&b-this.lastWheelTriggerTime r.size?-1:n.size r.key?1:-1}}])}(),vC=function(){function e(){on(this,e),_e(this,"width",0),_e(this,"height",0),_e(this,"cellSize",0),_e(this,"columns",0),_e(this,"rows",0),_e(this,"cells",{})}return ln(e,[{key:"resizeAndClear",value:function(n,r){this.width=n.width,this.height=n.height,this.cellSize=r,this.columns=Math.ceil(n.width/r),this.rows=Math.ceil(n.height/r),this.cells={}}},{key:"getIndex",value:function(n){var r=Math.floor(n.x/this.cellSize),a=Math.floor(n.y/this.cellSize);return a*this.columns+r}},{key:"add",value:function(n,r,a){var i=new yC(n,r),l=this.getIndex(a),u=this.cells[l];u||(u=[],this.cells[l]=u),u.push(i)}},{key:"organize",value:function(){for(var n in this.cells){var r=this.cells[n];r.sort(yC.compare)}}},{key:"getLabelsToDisplay",value:function(n,r){var a=this.cellSize*this.cellSize,i=a/n/n,l=i*r/a,u=Math.ceil(l),c=[];for(var f in this.cells)for(var p=this.cells[f],g=0;g 2&&arguments[2]!==void 0?arguments[2]:{};if(on(this,t),a=Bn(this,t),_e(a,"elements",{}),_e(a,"canvasContexts",{}),_e(a,"webGLContexts",{}),_e(a,"pickingLayers",new Set),_e(a,"textures",{}),_e(a,"frameBuffers",{}),_e(a,"activeListeners",{}),_e(a,"labelGrid",new vC),_e(a,"nodeDataCache",{}),_e(a,"edgeDataCache",{}),_e(a,"nodeProgramIndex",{}),_e(a,"edgeProgramIndex",{}),_e(a,"nodesWithForcedLabels",new Set),_e(a,"edgesWithForcedLabels",new Set),_e(a,"nodeExtent",{x:[0,1],y:[0,1]}),_e(a,"nodeZExtent",[1/0,-1/0]),_e(a,"edgeZExtent",[1/0,-1/0]),_e(a,"matrix",_r()),_e(a,"invMatrix",_r()),_e(a,"correctionRatio",1),_e(a,"customBBox",null),_e(a,"normalizationFunction",gC({x:[0,1],y:[0,1]})),_e(a,"graphToViewportRatio",1),_e(a,"itemIDsIndex",{}),_e(a,"nodeIndices",{}),_e(a,"edgeIndices",{}),_e(a,"width",0),_e(a,"height",0),_e(a,"pixelRatio",fC()),_e(a,"pickingDownSizingRatio",2*a.pixelRatio),_e(a,"displayedNodeLabels",new Set),_e(a,"displayedEdgeLabels",new Set),_e(a,"highlightedNodes",new Set),_e(a,"hoveredNode",null),_e(a,"hoveredEdge",null),_e(a,"renderFrame",null),_e(a,"renderHighlightedNodesFrame",null),_e(a,"needToProcess",!1),_e(a,"checkEdgesEventsFrame",null),_e(a,"nodePrograms",{}),_e(a,"nodeHoverPrograms",{}),_e(a,"edgePrograms",{}),a.settings=qX(i),Oh(a.settings),jX(n),!(r instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");a.graph=n,a.container=r,a.createWebGLContext("edges",{picking:i.enableEdgeEvents}),a.createCanvasContext("edgeLabels"),a.createWebGLContext("nodes",{picking:!0}),a.createCanvasContext("labels"),a.createCanvasContext("hovers"),a.createWebGLContext("hoverNodes"),a.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),a.resize();for(var l in a.settings.nodeProgramClasses)a.registerNodeProgram(l,a.settings.nodeProgramClasses[l],a.settings.nodeHoverProgramClasses[l]);for(var u in a.settings.edgeProgramClasses)a.registerEdgeProgram(u,a.settings.edgeProgramClasses[u]);return a.camera=new mC,a.bindCameraHandlers(),a.mouseCaptor=new XX(a.elements.mouse,a),a.mouseCaptor.setSettings(a.settings),a.touchCaptor=new JX(a.elements.mouse,a),a.touchCaptor.setSettings(a.settings),a.bindEventHandlers(),a.bindGraphHandlers(),a.handleSettingsUpdate(),a.refresh(),a}return Un(t,e),ln(t,[{key:"registerNodeProgram",value:function(r,a,i){return this.nodePrograms[r]&&this.nodePrograms[r].kill(),this.nodeHoverPrograms[r]&&this.nodeHoverPrograms[r].kill(),this.nodePrograms[r]=new a(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[r]=new(i||a)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(r,a){return this.edgePrograms[r]&&this.edgePrograms[r].kill(),this.edgePrograms[r]=new a(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(r){if(this.nodePrograms[r]){var a=this.nodePrograms,i=a[r],l=Dh(a,[r].map(Ys));i.kill(),this.nodePrograms=l}if(this.nodeHoverPrograms[r]){var u=this.nodeHoverPrograms,c=u[r],f=Dh(u,[r].map(Ys));c.kill(),this.nodePrograms=f}return this}},{key:"unregisterEdgeProgram",value:function(r){if(this.edgePrograms[r]){var a=this.edgePrograms,i=a[r],l=Dh(a,[r].map(Ys));i.kill(),this.edgePrograms=l}return this}},{key:"resetWebGLTexture",value:function(r){var a=this.webGLContexts[r],i=this.frameBuffers[r],l=this.textures[r];l&&a.deleteTexture(l);var u=a.createTexture();return a.bindFramebuffer(a.FRAMEBUFFER,i),a.bindTexture(a.TEXTURE_2D,u),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,this.width,this.height,0,a.RGBA,a.UNSIGNED_BYTE,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,0),this.textures[r]=u,this}},{key:"bindCameraHandlers",value:function(){var r=this;return this.activeListeners.camera=function(){r.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(r){var a=r.x,i=r.y,l=eC(this.webGLContexts.nodes,this.frameBuffers.nodes,a,i,this.pixelRatio,this.pickingDownSizingRatio),u=JR.apply(void 0,bC(l)),c=this.itemIDsIndex[u];return c&&c.type==="node"?c.id:null}},{key:"bindEventHandlers",value:function(){var r=this;this.activeListeners.handleResize=function(){r.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(i){var l=Us(i),u={event:l,preventSigmaDefault:function(){l.preventSigmaDefault()}},c=r.getNodeAtPosition(l);if(c&&r.hoveredNode!==c&&!r.nodeDataCache[c].hidden){r.hoveredNode&&r.emit("leaveNode",Be(Be({},u),{},{node:r.hoveredNode})),r.hoveredNode=c,r.emit("enterNode",Be(Be({},u),{},{node:c})),r.scheduleHighlightedNodesRender();return}if(r.hoveredNode&&r.getNodeAtPosition(l)!==r.hoveredNode){var f=r.hoveredNode;r.hoveredNode=null,r.emit("leaveNode",Be(Be({},u),{},{node:f})),r.scheduleHighlightedNodesRender();return}if(r.settings.enableEdgeEvents){var p=r.hoveredNode?null:r.getEdgeAtPoint(u.event.x,u.event.y);p!==r.hoveredEdge&&(r.hoveredEdge&&r.emit("leaveEdge",Be(Be({},u),{},{edge:r.hoveredEdge})),p&&r.emit("enterEdge",Be(Be({},u),{},{edge:p})),r.hoveredEdge=p)}},this.activeListeners.handleMoveBody=function(i){var l=Us(i);r.emit("moveBody",{event:l,preventSigmaDefault:function(){l.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(i){var l=Us(i),u={event:l,preventSigmaDefault:function(){l.preventSigmaDefault()}};r.hoveredNode&&(r.emit("leaveNode",Be(Be({},u),{},{node:r.hoveredNode})),r.scheduleHighlightedNodesRender()),r.settings.enableEdgeEvents&&r.hoveredEdge&&(r.emit("leaveEdge",Be(Be({},u),{},{edge:r.hoveredEdge})),r.scheduleHighlightedNodesRender()),r.emit("leaveStage",Be({},u))},this.activeListeners.handleEnter=function(i){var l=Us(i),u={event:l,preventSigmaDefault:function(){l.preventSigmaDefault()}};r.emit("enterStage",Be({},u))};var a=function(l){return function(u){var c=Us(u),f={event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}},p=r.getNodeAtPosition(c);if(p)return r.emit("".concat(l,"Node"),Be(Be({},f),{},{node:p}));if(r.settings.enableEdgeEvents){var g=r.getEdgeAtPoint(c.x,c.y);if(g)return r.emit("".concat(l,"Edge"),Be(Be({},f),{},{edge:g}))}return r.emit("".concat(l,"Stage"),f)}};return this.activeListeners.handleClick=a("click"),this.activeListeners.handleRightClick=a("rightClick"),this.activeListeners.handleDoubleClick=a("doubleClick"),this.activeListeners.handleWheel=a("wheel"),this.activeListeners.handleDown=a("down"),this.activeListeners.handleUp=a("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 r=this,a=this.graph,i=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(l){var u,c=(u=l.hints)===null||u===void 0?void 0:u.attributes;r.graph.forEachNode(function(p){return r.updateNode(p)});var f=!c||c.some(function(p){return i.has(p)});r.refresh({partialGraph:{nodes:a.nodes()},skipIndexation:!f,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(l){var u,c=(u=l.hints)===null||u===void 0?void 0:u.attributes;r.graph.forEachEdge(function(p){return r.updateEdge(p)});var f=c&&["zIndex","type"].some(function(p){return c==null?void 0:c.includes(p)});r.refresh({partialGraph:{edges:a.edges()},skipIndexation:!f,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(l){var u=l.key;r.addNode(u),r.refresh({partialGraph:{nodes:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(l){var u=l.key;r.refresh({partialGraph:{nodes:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(l){var u=l.key;r.removeNode(u),r.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(l){var u=l.key;r.addEdge(u),r.refresh({partialGraph:{edges:[u]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(l){var u=l.key;r.refresh({partialGraph:{edges:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(l){var u=l.key;r.removeEdge(u),r.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){r.clearEdgeState(),r.clearEdgeIndices(),r.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){r.clearEdgeState(),r.clearNodeState(),r.clearEdgeIndices(),r.clearNodeIndices(),r.refresh({schedule:!0})},a.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),a.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),a.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),a.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),a.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),a.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),a.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),a.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),a.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),a.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var r=this.graph;r.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),r.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),r.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),r.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),r.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),r.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),r.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),r.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),r.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),r.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(r,a){var i=eC(this.webGLContexts.edges,this.frameBuffers.edges,r,a,this.pixelRatio,this.pickingDownSizingRatio),l=JR.apply(void 0,bC(i)),u=this.itemIDsIndex[l];return u&&u.type==="edge"?u.id:null}},{key:"process",value:function(){var r=this;this.emit("beforeProcess");var a=this.graph,i=this.settings,l=this.getDimensions();if(this.nodeExtent=UX(this.graph),!this.settings.autoRescale){var u=l.width,c=l.height,f=this.nodeExtent,p=f.x,g=f.y;this.nodeExtent={x:[(p[0]+p[1])/2-u/2,(p[0]+p[1])/2+u/2],y:[(g[0]+g[1])/2-c/2,(g[0]+g[1])/2+c/2]}}this.normalizationFunction=gC(this.customBBox||this.nodeExtent);var b=new mC,m=Bs(b.getState(),l,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(l,i.labelGridCellSize);for(var S={},v={},A={},R={},x=1,T=a.nodes(),C=0,N=T.length;C 1&&arguments[1]!==void 0?arguments[1]:{},i=a.tolerance,l=i===void 0?0:i,u=a.boundaries,c=Be({},r),f=u||this.nodeExtent,p=Sl(f.x,2),g=p[0],b=p[1],m=Sl(f.y,2),S=m[0],v=m[1],A=[this.graphToViewport({x:g,y:S},{cameraState:r}),this.graphToViewport({x:b,y:S},{cameraState:r}),this.graphToViewport({x:g,y:v},{cameraState:r}),this.graphToViewport({x:b,y:v},{cameraState:r})],R=1/0,x=-1/0,T=1/0,C=-1/0;A.forEach(function(W){var Z=W.x,j=W.y;R=Math.min(R,Z),x=Math.max(x,Z),T=Math.min(T,j),C=Math.max(C,j)});var N=x-R,_=C-T,O=this.getDimensions(),z=O.width,I=O.height,M=0,H=0;if(N>=z?x l&&(M=R-l):x>z+l?M=x-(z+l):R<-l&&(M=R+l),_>=I?C l&&(H=T-l):C>I+l?H=C-(I+l):T<-l&&(H=T+l),M||H){var q=this.viewportToFramedGraph({x:0,y:0},{cameraState:r}),P=this.viewportToFramedGraph({x:M,y:H},{cameraState:r});M=P.x-q.x,H=P.y-q.y,c.x+=M,c.y+=H}return c}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var r=this.camera.getState(),a=this.labelGrid.getLabelsToDisplay(r.ratio,this.settings.labelDensity);hC(a,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var i=this.canvasContexts.labels,l=0,u=a.length;lthis.width+oZ||b<-50||b>this.height+iZ)){this.displayedNodeLabels.add(c);var S=this.settings.defaultDrawNodeLabel,v=this.nodePrograms[f.type],A=(v==null?void 0:v.drawLabel)||S;A(i,Be(Be({key:c},f),{},{size:m,x:g,y:b}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var r=this.canvasContexts.edgeLabels;r.clearRect(0,0,this.width,this.height);var a=aZ({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});hC(a,this.edgesWithForcedLabels);for(var i=new Set,l=0,u=a.length;lthis.nodeZExtent[1]&&(this.nodeZExtent[1]=i.zIndex))}},{key:"updateNode",value:function(r){this.addNode(r);var a=this.nodeDataCache[r];this.normalizationFunction.applyTo(a)}},{key:"removeNode",value:function(r){delete this.nodeDataCache[r],delete this.nodeProgramIndex[r],this.highlightedNodes.delete(r),this.hoveredNode===r&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(r)}},{key:"addEdge",value:function(r){var a=Object.assign({},this.graph.getEdgeAttributes(r));this.settings.edgeReducer&&(a=this.settings.edgeReducer(r,a));var i=sZ(this.settings,r,a);this.edgeDataCache[r]=i,this.edgesWithForcedLabels.delete(r),i.forceLabel&&!i.hidden&&this.edgesWithForcedLabels.add(r),this.settings.zIndex&&(i.zIndex this.edgeZExtent[1]&&(this.edgeZExtent[1]=i.zIndex))}},{key:"updateEdge",value:function(r){this.addEdge(r)}},{key:"removeEdge",value:function(r){delete this.edgeDataCache[r],delete this.edgeProgramIndex[r],this.hoveredEdge===r&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(r)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new vC,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0]}},{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(r,a,i){var l=this.nodeDataCache[r],u=this.nodePrograms[l.type];if(!u)throw new Error('Sigma: could not find a suitable program for node type "'.concat(l.type,'"!'));u.process(a,i,l),this.nodeProgramIndex[r]=i}},{key:"addEdgeToProgram",value:function(r,a,i){var l=this.edgeDataCache[r],u=this.edgePrograms[l.type];if(!u)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(l.type,'"!'));var c=this.graph.extremities(r),f=this.nodeDataCache[c[0]],p=this.nodeDataCache[c[1]];u.process(a,i,f,p,l),this.edgeProgramIndex[r]=i}},{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 r=this.settings,a=r.stagePadding,i=r.autoRescale;return i&&a||0}},{key:"createLayer",value:function(r,a){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[r])throw new Error('Sigma: a layer named "'.concat(r,'" already exists'));var l=GX(a,{position:"absolute"},{class:"sigma-".concat(r)});return i.style&&Object.assign(l.style,i.style),this.elements[r]=l,"beforeLayer"in i&&i.beforeLayer?this.elements[i.beforeLayer].before(l):"afterLayer"in i&&i.afterLayer?this.elements[i.afterLayer].after(l):this.container.appendChild(l),l}},{key:"createCanvas",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(r,"canvas",a)}},{key:"createCanvasContext",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.createCanvas(r,a),l={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[r]=i.getContext("2d",l),this}},{key:"createWebGLContext",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(a==null?void 0:a.canvas)||this.createCanvas(r,a);a.hidden&&i.remove();var l=Be({preserveDrawingBuffer:!1,antialias:!1},a),u;u=i.getContext("webgl2",l),u||(u=i.getContext("webgl",l)),u||(u=i.getContext("experimental-webgl",l));var c=u;if(this.webGLContexts[r]=c,c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),a.picking){this.pickingLayers.add(r);var f=c.createFramebuffer();if(!f)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(r));this.frameBuffers[r]=f}return c}},{key:"killLayer",value:function(r){var a=this.elements[r];if(!a)throw new Error("Sigma: cannot kill layer ".concat(r,", which does not exist"));if(this.webGLContexts[r]){var i,l=this.webGLContexts[r];(i=l.getExtension("WEBGL_lose_context"))===null||i===void 0||i.loseContext(),delete this.webGLContexts[r]}else this.canvasContexts[r]&&delete this.canvasContexts[r];return a.remove(),delete this.elements[r],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(r){this.unbindCameraHandlers(),this.camera=r,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(r){r!==this.graph&&(this.hoveredNode&&!r.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!r.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=r,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 r=this.customBBox||this.nodeExtent;return{width:r.x[1]-r.x[0]||1,height:r.y[1]-r.y[0]||1}}},{key:"getNodeDisplayData",value:function(r){var a=this.nodeDataCache[r];return a?Object.assign({},a):void 0}},{key:"getEdgeDisplayData",value:function(r){var a=this.edgeDataCache[r];return a?Object.assign({},a):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 Be({},this.settings)}},{key:"getSetting",value:function(r){return this.settings[r]}},{key:"setSetting",value:function(r,a){var i=Be({},this.settings);return this.settings[r]=a,Oh(this.settings),this.handleSettingsUpdate(i),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(r,a){return this.setSetting(r,a(this.settings[r])),this}},{key:"setSettings",value:function(r){var a=Be({},this.settings);return this.settings=Be(Be({},this.settings),r),Oh(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"resize",value:function(r){var a=this.width,i=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=fC(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!r&&a===this.width&&i===this.height)return this;for(var l in this.elements){var u=this.elements[l];u.style.width=this.width+"px",u.style.height=this.height+"px"}for(var c in this.canvasContexts)this.elements[c].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[c].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[c].scale(this.pixelRatio,this.pixelRatio);for(var f in this.webGLContexts){this.elements[f].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[f].setAttribute("height",this.height*this.pixelRatio+"px");var p=this.webGLContexts[f];if(p.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(f)){var g=this.textures[f];g&&p.deleteTexture(g)}}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(r){var a=this,i=(r==null?void 0:r.skipIndexation)!==void 0?r==null?void 0:r.skipIndexation:!1,l=(r==null?void 0:r.schedule)!==void 0?r.schedule:!1,u=!r||!r.partialGraph;if(u)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(C){return a.addNode(C)}),this.graph.forEachEdge(function(C){return a.addEdge(C)});else{for(var c,f,p=((c=r.partialGraph)===null||c===void 0?void 0:c.nodes)||[],g=0,b=(p==null?void 0:p.length)||0;g1&&arguments[1]!==void 0?arguments[1]:{},i=!!a.cameraState||!!a.viewportDimensions||!!a.graphDimensions,l=a.matrix?a.matrix:i?Bs(a.cameraState||this.camera.getState(),a.viewportDimensions||this.getDimensions(),a.graphDimensions||this.getGraphDimensions(),a.padding||this.getStagePadding()):this.matrix,u=Fx(l,r);return{x:(1+u.x)*this.width/2,y:(1-u.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=!!a.cameraState||!!a.viewportDimensions||!a.graphDimensions,l=a.matrix?a.matrix:i?Bs(a.cameraState||this.camera.getState(),a.viewportDimensions||this.getDimensions(),a.graphDimensions||this.getGraphDimensions(),a.padding||this.getStagePadding(),!0):this.invMatrix,u=Fx(l,{x:r.x/this.width*2-1,y:1-r.y/this.height*2});return isNaN(u.x)&&(u.x=0),isNaN(u.y)&&(u.y=0),u}},{key:"viewportToGraph",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(r,a))}},{key:"graphToViewport",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(r),a)}},{key:"getGraphToViewportRatio",value:function(){var r={x:0,y:0},a={x:1,y:1},i=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),l=this.graphToViewport(r),u=this.graphToViewport(a),c=Math.sqrt(Math.pow(l.x-u.x,2)+Math.pow(l.y-u.y,2));return c/i}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(r){return this.customBBox=r,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var r=this.container;r.firstChild;)r.removeChild(r.firstChild);this.canvasContexts={},this.webGLContexts={},this.elements={};for(var a in this.nodePrograms)this.nodePrograms[a].kill();for(var i in this.nodeHoverPrograms)this.nodeHoverPrograms[i].kill();for(var l in this.edgePrograms)this.edgePrograms[l].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var u in this.elements)this.killLayer(u)}},{key:"scaleSize",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return r/this.settings.zoomToSizeRatioFunction(a)*(this.getSetting("itemSizesReference")==="positions"?a*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var r={};for(var a in this.elements)this.elements[a]instanceof HTMLCanvasElement&&(r[a]=this.elements[a]);return r}}])}(m0);const a3=k.createContext(null),cZ=a3.Provider;function y0(){const e=k.useContext(a3);if(e==null)throw new Error("No context provided: useSigmaContext() can only be used in a descendant of ");return e}function br(){return y0().sigma}function o3(){const{sigma:e}=y0();return k.useCallback(t=>{e&&Object.keys(t).forEach(n=>{e.setSetting(n,t[n])})},[e])}function Cf(e){return new Set(Object.keys(e))}const SC=Cf({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}),EC=Cf({click:!0,rightClick:!0,doubleClick:!0,mouseup:!0,mousedown:!0,mousemove:!0,mousemovebody:!0,mouseleave:!0,mouseenter:!0,wheel:!0}),wC=Cf({touchup:!0,touchdown:!0,touchmove:!0,touchmovebody:!0,tap:!0,doubletap:!0}),xC=Cf({updated:!0});function i3(){const e=br(),t=o3(),[n,r]=k.useState({});return k.useEffect(()=>{if(!e||!n)return;const a=n,i=Object.keys(a);return i.forEach(l=>{const u=a[l];SC.has(l)&&e.on(l,u),EC.has(l)&&e.getMouseCaptor().on(l,u),wC.has(l)&&e.getTouchCaptor().on(l,u),xC.has(l)&&e.getCamera().on(l,u)}),()=>{e&&i.forEach(l=>{const u=a[l];SC.has(l)&&e.off(l,u),EC.has(l)&&e.getMouseCaptor().off(l,u),wC.has(l)&&e.getTouchCaptor().off(l,u),xC.has(l)&&e.getCamera().off(l,u)})}},[e,n,t]),r}function dZ(){const e=br();return k.useCallback((t,n=!0)=>{e&&t&&(n&&e.getGraph().order>0&&e.getGraph().clear(),e.getGraph().import(t),e.refresh())},[e])}function wu(e,t){if(e===t)return!0;if(typeof e=="object"&&e!=null&&typeof t=="object"&&t!=null){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(const n in e)if(!Object.hasOwn(t,n)||!wu(e[n],t[n]))return!1;return!0}return!1}function l3(e){const t=br(),[n,r]=k.useState(e||{});k.useEffect(()=>{r(f=>wu(f,e||{})?f:e||{})},[e]);const a=k.useCallback(f=>{t.getCamera().animatedZoom(Object.assign(Object.assign({},n),f))},[t,n]),i=k.useCallback(f=>{t.getCamera().animatedUnzoom(Object.assign(Object.assign({},n),f))},[t,n]),l=k.useCallback(f=>{t.getCamera().animatedReset(Object.assign(Object.assign({},n),f))},[t,n]),u=k.useCallback((f,p)=>{t.getCamera().animate(f,Object.assign(Object.assign({},n),p))},[t,n]),c=k.useCallback((f,p)=>{const g=t.getNodeDisplayData(f);g?t.getCamera().animate(g,Object.assign(Object.assign({},n),p)):console.warn(`Node ${f} not found`)},[t,n]);return{zoomIn:a,zoomOut:i,reset:l,goto:u,gotoNode:c}}function fZ(e){const t=y0(),[n,r]=k.useState(!1),[a,i]=k.useState(t.container),l=k.useCallback(()=>r(u=>!u),[]);return k.useEffect(()=>(document.addEventListener("fullscreenchange",l),()=>document.removeEventListener("fullscreenchange",l)),[l]),k.useEffect(()=>{i(t.container)},[e,t.container]),{toggle:k.useCallback(()=>{var u;u=a,document.fullscreenElement!==u?u.requestFullscreen():document.exitFullscreen&&document.exitFullscreen()},[a]),isFullScreen:n}}const pZ=k.forwardRef(({graph:e,id:t,className:n,style:r,settings:a={},children:i},l)=>{const u=k.useRef(null),c=k.useRef(null),f={className:`react-sigma ${n||""}`,id:t,style:r},[p,g]=k.useState(null),[b,m]=k.useState(a);k.useEffect(()=>{m(A=>wu(A,a)?A:a)},[a]),k.useEffect(()=>{g(A=>{let R=null;if(c.current!==null){let x=new Tt;e&&(x=typeof e=="function"?new e:e);let T=null;A&&(T=A.getCamera().getState(),A.kill()),R=new uZ(x,c.current,b),T&&R.getCamera().setState(T)}return R})},[c,e,b]),k.useImperativeHandle(l,()=>p,[p]);const S=k.useMemo(()=>p&&u.current?{sigma:p,container:u.current}:null,[p,u]),v=S!==null?ye.createElement(cZ,{value:S},i):null;return ye.createElement("div",Object.assign({},f,{ref:u}),ye.createElement("div",{className:"sigma-container",ref:c}),v)});var gZ=` +`,UQ=BQ,Aj=WebGLRenderingContext,VC=Aj.UNSIGNED_BYTE,Vl=Aj.FLOAT,jQ=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],GQ=function(e){function t(){return un(this,t),Hn(this,t,arguments)}return $n(t,e),cn(t,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:UQ,FRAGMENT_SHADER_SOURCE:F0,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:jQ,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Vl},{name:"a_positionEnd",size:2,type:Vl},{name:"a_normal",size:2,type:Vl},{name:"a_color",size:4,type:VC,normalized:!0},{name:"a_id",size:4,type:VC,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Vl},{name:"a_normalCoef",size:1,type:Vl}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(r,a,i,s,u){var c=u.size||1,d=i.x,p=i.y,g=s.x,m=s.y,b=na(u.color),S=g-d,v=m-p,k=S*S+v*v,R=0,x=0;k&&(k=1/Math.sqrt(k),R=-v*k*c,x=S*k*c);var A=this.array;A[a++]=d,A[a++]=p,A[a++]=g,A[a++]=m,A[a++]=R,A[a++]=x,A[a++]=b,A[a++]=r}},{key:"setUniforms",value:function(r,a){var i=a.gl,s=a.uniformLocations,u=s.u_matrix,c=s.u_zoomRatio,d=s.u_feather,p=s.u_pixelRatio,g=s.u_correctionRatio,m=s.u_sizeRatio,b=s.u_minEdgeThickness;i.uniformMatrix3fv(u,!1,r.matrix),i.uniform1f(c,r.zoomRatio),i.uniform1f(m,r.sizeRatio),i.uniform1f(g,r.correctionRatio),i.uniform1f(p,r.pixelRatio),i.uniform1f(d,r.antiAliasingFeather),i.uniform1f(b,r.minEdgeThickness)}}])}(Du),P0=function(e){function t(){var n;return un(this,t),n=Hn(this,t),n.rawEmitter=n,n}return $n(t,e),cn(t)}(X3.EventEmitter),Yh,WC;function ra(){return WC||(WC=1,Yh=function(t){return t!==null&&typeof t=="object"&&typeof t.addUndirectedEdgeWithKey=="function"&&typeof t.dropNode=="function"&&typeof t.multi=="boolean"}),Yh}var HQ=ra();const $Q=ln(HQ);var qQ=function(t){return t},VQ=function(t){return t*t},WQ=function(t){return t*(2-t)},YQ=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},KQ=function(t){return t*t*t},XQ=function(t){return--t*t*t+1},ZQ=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},_j={linear:qQ,quadraticIn:VQ,quadraticOut:WQ,quadraticInOut:YQ,cubicIn:KQ,cubicOut:XQ,cubicInOut:ZQ},Rj={easing:"quadraticInOut",duration:150};function QQ(e,t,n,r){var a=Object.assign({},Rj,n),i=typeof a.easing=="function"?a.easing:_j[a.easing],s=Date.now(),u={};for(var c in t){var d=t[c];u[c]={};for(var p in d)u[c][p]=e.getNodeAttribute(c,p)}var g=null,m=function(){g=null;var S=(Date.now()-s)/a.duration;if(S>=1){for(var v in t){var k=t[v];for(var R in k)e.setNodeAttribute(v,R,k[R])}return}S=i(S);for(var x in t){var A=t[x],N=u[x];for(var O in A)e.setNodeAttribute(x,O,A[O]*S+N[O]*(1-S))}g=requestAnimationFrame(m)};return m(),function(){g&&cancelAnimationFrame(g)}}function Dr(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function cd(e,t,n){return e[0]=t,e[4]=typeof n=="number"?n:t,e}function YC(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 KC(e,t,n){return e[6]=t,e[7]=n,e}function ci(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],s=e[4],u=e[5],c=e[6],d=e[7],p=e[8],g=t[0],m=t[1],b=t[2],S=t[3],v=t[4],k=t[5],R=t[6],x=t[7],A=t[8];return e[0]=g*n+m*i+b*c,e[1]=g*r+m*s+b*d,e[2]=g*a+m*u+b*p,e[3]=S*n+v*i+k*c,e[4]=S*r+v*s+k*d,e[5]=S*a+v*u+k*p,e[6]=R*n+x*i+A*c,e[7]=R*r+x*s+A*d,e[8]=R*a+x*u+A*p,e}function dk(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=e[0],a=e[1],i=e[3],s=e[4],u=e[6],c=e[7],d=t.x,p=t.y;return{x:d*r+p*i+u*n,y:d*a+p*s+c*n}}function JQ(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 Wl(e,t,n,r,a){var i=e.angle,s=e.ratio,u=e.x,c=e.y,d=t.width,p=t.height,g=Dr(),m=Math.min(d,p)-2*r,b=JQ(t,n);return a?(ci(g,KC(Dr(),u,c)),ci(g,cd(Dr(),s)),ci(g,YC(Dr(),i)),ci(g,cd(Dr(),d/m/2/b,p/m/2/b))):(ci(g,cd(Dr(),2*(m/d)*b,2*(m/p)*b)),ci(g,YC(Dr(),-i)),ci(g,cd(Dr(),1/s)),ci(g,KC(Dr(),-u,-c))),g}function eJ(e,t,n){var r=dk(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),a=r.x,i=r.y;return 1/Math.sqrt(Math.pow(a,2)+Math.pow(i,2))/n.width}function tJ(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,r=1/0,a=-1/0;return e.forEachNode(function(i,s){var u=s.x,c=s.y;u n&&(n=u),c a&&(a=c)}),{x:[t,n],y:[r,a]}}function nJ(e){if(!$Q(e))throw new Error("Sigma: invalid graph instance.");e.forEachNode(function(t,n){if(!Number.isFinite(n.x)||!Number.isFinite(n.y))throw new Error("Sigma: Coordinates of node ".concat(t," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function rJ(e,t,n){var r=document.createElement(e);if(t)for(var a in t)r.style[a]=t[a];if(n)for(var i in n)r.setAttribute(i,n[i]);return r}function XC(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ZC(e,t,n){return n.sort(function(r,a){var i=t(r)||0,s=t(a)||0;return i s?1:0})}function QC(e){var t=As(e.x,2),n=t[0],r=t[1],a=As(e.y,2),i=a[0],s=a[1],u=Math.max(r-n,s-i),c=(r+n)/2,d=(s+i)/2;(u===0||Math.abs(u)===1/0||isNaN(u))&&(u=1),isNaN(c)&&(c=0),isNaN(d)&&(d=0);var p=function(m){return{x:.5+(m.x-c)/u,y:.5+(m.y-d)/u}};return p.applyTo=function(g){g.x=.5+(g.x-c)/u,g.y=.5+(g.y-d)/u},p.inverse=function(g){return{x:c+u*(g.x-.5),y:d+u*(g.y-.5)}},p.ratio=u,p}function fk(e){"@babel/helpers - typeof";return fk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fk(e)}function JC(e,t){var n=t.size;if(n!==0){var r=e.length;e.length+=n;var a=0;t.forEach(function(i){e[r+a]=i,a++})}}function Kh(e){e=e||{};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(!s)return new Promise(function(b){return a.animate(r,i,b)});if(this.enabled){var u=Be(Be({},Rj),i),c=this.validateState(r),d=typeof u.easing=="function"?u.easing:_j[u.easing],p=Date.now(),g=this.getState(),m=function(){var S=(Date.now()-p)/u.duration;if(S>=1){a.nextFrame=null,a.setState(c),a.animationCallback&&(a.animationCallback.call(null),a.animationCallback=void 0);return}var v=d(S),k={};typeof c.x=="number"&&(k.x=g.x+(c.x-g.x)*v),typeof c.y=="number"&&(k.y=g.y+(c.y-g.y)*v),a.enabledRotation&&typeof c.angle=="number"&&(k.angle=g.angle+(c.angle-g.angle)*v),typeof c.ratio=="number"&&(k.ratio=g.ratio+(c.ratio-g.ratio)*v),a.setState(k),a.nextFrame=requestAnimationFrame(m)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(m)):m(),this.animationCallback=s}}},{key:"animatedZoom",value:function(r){return r?typeof r=="number"?this.animate({ratio:this.ratio/r}):this.animate({ratio:this.ratio/(r.factor||dd)},r):this.animate({ratio:this.ratio/dd})}},{key:"animatedUnzoom",value:function(r){return r?typeof r=="number"?this.animate({ratio:this.ratio*r}):this.animate({ratio:this.ratio*(r.factor||dd)},r):this.animate({ratio:this.ratio*dd})}},{key:"animatedReset",value:function(r){return this.animate({x:.5,y:.5,ratio:1,angle:0},r)}},{key:"copy",value:function(){return t.from(this.getState())}}],[{key:"from",value:function(r){var a=new t;return a.setState(r)}}])}(P0);function Ir(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Ca(e,t){var n=Be(Be({},Ir(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Yl(e){var t="x"in e?e:Be(Be({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function sJ(e,t){return Be(Be({},Ca(e,t)),{},{delta:Cj(e)})}var lJ=2;function Dd(e){for(var t=[],n=0,r=Math.min(e.length,lJ);n 0;a.draggedEvents=0,g&&a.renderer.getSetting("hideEdgesOnMove")&&a.renderer.refresh()},0),this.emit("mouseup",Ca(r,this.container))}}},{key:"handleMove",value:function(r){var a=this;if(this.enabled){var i=Ca(r,this.container);if(this.emit("mousemovebody",i),(r.target===this.container||r.composedPath()[0]===this.container)&&this.emit("mousemove",i),!i.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){a.movingTimeout=null,a.isMoving=!1},this.settings.dragTimeout);var s=this.renderer.getCamera(),u=Ir(r,this.container),c=u.x,d=u.y,p=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),g=this.renderer.viewportToFramedGraph({x:c,y:d}),m=p.x-g.x,b=p.y-g.y,S=s.getState(),v=S.x+m,k=S.y+b;s.setState({x:v,y:k}),this.lastMouseX=c,this.lastMouseY=d,r.preventDefault(),r.stopPropagation()}}}},{key:"handleLeave",value:function(r){this.emit("mouseleave",Ca(r,this.container))}},{key:"handleEnter",value:function(r){this.emit("mouseenter",Ca(r,this.container))}},{key:"handleWheel",value:function(r){var a=this,i=this.renderer.getCamera();if(!(!this.enabled||!i.enabledZooming)){var s=Cj(r);if(s){var u=sJ(r,this.container);if(this.emit("wheel",u),u.sigmaDefaultPrevented){r.preventDefault(),r.stopPropagation();return}var c=i.getState().ratio,d=s>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,p=i.getBoundedRatio(c*d),g=s>0?1:-1,m=Date.now();c!==p&&(r.preventDefault(),r.stopPropagation(),!(this.currentWheelDirection===g&&this.lastWheelTriggerTime&&m-this.lastWheelTriggerTime r.size?-1:n.size r.key?1:-1}}])}(),rN=function(){function e(){un(this,e),_e(this,"width",0),_e(this,"height",0),_e(this,"cellSize",0),_e(this,"columns",0),_e(this,"rows",0),_e(this,"cells",{})}return cn(e,[{key:"resizeAndClear",value:function(n,r){this.width=n.width,this.height=n.height,this.cellSize=r,this.columns=Math.ceil(n.width/r),this.rows=Math.ceil(n.height/r),this.cells={}}},{key:"getIndex",value:function(n){var r=Math.floor(n.x/this.cellSize),a=Math.floor(n.y/this.cellSize);return a*this.columns+r}},{key:"add",value:function(n,r,a){var i=new nN(n,r),s=this.getIndex(a),u=this.cells[s];u||(u=[],this.cells[s]=u),u.push(i)}},{key:"organize",value:function(){for(var n in this.cells){var r=this.cells[n];r.sort(nN.compare)}}},{key:"getLabelsToDisplay",value:function(n,r){var a=this.cellSize*this.cellSize,i=a/n/n,s=i*r/a,u=Math.ceil(s),c=[];for(var d in this.cells)for(var p=this.cells[d],g=0;g 2&&arguments[2]!==void 0?arguments[2]:{};if(un(this,t),a=Hn(this,t),_e(a,"elements",{}),_e(a,"canvasContexts",{}),_e(a,"webGLContexts",{}),_e(a,"pickingLayers",new Set),_e(a,"textures",{}),_e(a,"frameBuffers",{}),_e(a,"activeListeners",{}),_e(a,"labelGrid",new rN),_e(a,"nodeDataCache",{}),_e(a,"edgeDataCache",{}),_e(a,"nodeProgramIndex",{}),_e(a,"edgeProgramIndex",{}),_e(a,"nodesWithForcedLabels",new Set),_e(a,"edgesWithForcedLabels",new Set),_e(a,"nodeExtent",{x:[0,1],y:[0,1]}),_e(a,"nodeZExtent",[1/0,-1/0]),_e(a,"edgeZExtent",[1/0,-1/0]),_e(a,"matrix",Dr()),_e(a,"invMatrix",Dr()),_e(a,"correctionRatio",1),_e(a,"customBBox",null),_e(a,"normalizationFunction",QC({x:[0,1],y:[0,1]})),_e(a,"graphToViewportRatio",1),_e(a,"itemIDsIndex",{}),_e(a,"nodeIndices",{}),_e(a,"edgeIndices",{}),_e(a,"width",0),_e(a,"height",0),_e(a,"pixelRatio",XC()),_e(a,"pickingDownSizingRatio",2*a.pixelRatio),_e(a,"displayedNodeLabels",new Set),_e(a,"displayedEdgeLabels",new Set),_e(a,"highlightedNodes",new Set),_e(a,"hoveredNode",null),_e(a,"hoveredEdge",null),_e(a,"renderFrame",null),_e(a,"renderHighlightedNodesFrame",null),_e(a,"needToProcess",!1),_e(a,"checkEdgesEventsFrame",null),_e(a,"nodePrograms",{}),_e(a,"nodeHoverPrograms",{}),_e(a,"edgePrograms",{}),a.settings=oJ(i),Xh(a.settings),nJ(n),!(r instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");a.graph=n,a.container=r,a.createWebGLContext("edges",{picking:i.enableEdgeEvents}),a.createCanvasContext("edgeLabels"),a.createWebGLContext("nodes",{picking:!0}),a.createCanvasContext("labels"),a.createCanvasContext("hovers"),a.createWebGLContext("hoverNodes"),a.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),a.resize();for(var s in a.settings.nodeProgramClasses)a.registerNodeProgram(s,a.settings.nodeProgramClasses[s],a.settings.nodeHoverProgramClasses[s]);for(var u in a.settings.edgeProgramClasses)a.registerEdgeProgram(u,a.settings.edgeProgramClasses[u]);return a.camera=new eN,a.bindCameraHandlers(),a.mouseCaptor=new dJ(a.elements.mouse,a),a.mouseCaptor.setSettings(a.settings),a.touchCaptor=new gJ(a.elements.mouse,a),a.touchCaptor.setSettings(a.settings),a.bindEventHandlers(),a.bindGraphHandlers(),a.handleSettingsUpdate(),a.refresh(),a}return $n(t,e),cn(t,[{key:"registerNodeProgram",value:function(r,a,i){return this.nodePrograms[r]&&this.nodePrograms[r].kill(),this.nodeHoverPrograms[r]&&this.nodeHoverPrograms[r].kill(),this.nodePrograms[r]=new a(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[r]=new(i||a)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(r,a){return this.edgePrograms[r]&&this.edgePrograms[r].kill(),this.edgePrograms[r]=new a(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(r){if(this.nodePrograms[r]){var a=this.nodePrograms,i=a[r],s=Zh(a,[r].map(ru));i.kill(),this.nodePrograms=s}if(this.nodeHoverPrograms[r]){var u=this.nodeHoverPrograms,c=u[r],d=Zh(u,[r].map(ru));c.kill(),this.nodePrograms=d}return this}},{key:"unregisterEdgeProgram",value:function(r){if(this.edgePrograms[r]){var a=this.edgePrograms,i=a[r],s=Zh(a,[r].map(ru));i.kill(),this.edgePrograms=s}return this}},{key:"resetWebGLTexture",value:function(r){var a=this.webGLContexts[r],i=this.frameBuffers[r],s=this.textures[r];s&&a.deleteTexture(s);var u=a.createTexture();return a.bindFramebuffer(a.FRAMEBUFFER,i),a.bindTexture(a.TEXTURE_2D,u),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,this.width,this.height,0,a.RGBA,a.UNSIGNED_BYTE,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,0),this.textures[r]=u,this}},{key:"bindCameraHandlers",value:function(){var r=this;return this.activeListeners.camera=function(){r.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(r){var a=r.x,i=r.y,s=zC(this.webGLContexts.nodes,this.frameBuffers.nodes,a,i,this.pixelRatio,this.pickingDownSizingRatio),u=PC.apply(void 0,tN(s)),c=this.itemIDsIndex[u];return c&&c.type==="node"?c.id:null}},{key:"bindEventHandlers",value:function(){var r=this;this.activeListeners.handleResize=function(){r.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(i){var s=Yl(i),u={event:s,preventSigmaDefault:function(){s.preventSigmaDefault()}},c=r.getNodeAtPosition(s);if(c&&r.hoveredNode!==c&&!r.nodeDataCache[c].hidden){r.hoveredNode&&r.emit("leaveNode",Be(Be({},u),{},{node:r.hoveredNode})),r.hoveredNode=c,r.emit("enterNode",Be(Be({},u),{},{node:c})),r.scheduleHighlightedNodesRender();return}if(r.hoveredNode&&r.getNodeAtPosition(s)!==r.hoveredNode){var d=r.hoveredNode;r.hoveredNode=null,r.emit("leaveNode",Be(Be({},u),{},{node:d})),r.scheduleHighlightedNodesRender();return}if(r.settings.enableEdgeEvents){var p=r.hoveredNode?null:r.getEdgeAtPoint(u.event.x,u.event.y);p!==r.hoveredEdge&&(r.hoveredEdge&&r.emit("leaveEdge",Be(Be({},u),{},{edge:r.hoveredEdge})),p&&r.emit("enterEdge",Be(Be({},u),{},{edge:p})),r.hoveredEdge=p)}},this.activeListeners.handleMoveBody=function(i){var s=Yl(i);r.emit("moveBody",{event:s,preventSigmaDefault:function(){s.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(i){var s=Yl(i),u={event:s,preventSigmaDefault:function(){s.preventSigmaDefault()}};r.hoveredNode&&(r.emit("leaveNode",Be(Be({},u),{},{node:r.hoveredNode})),r.scheduleHighlightedNodesRender()),r.settings.enableEdgeEvents&&r.hoveredEdge&&(r.emit("leaveEdge",Be(Be({},u),{},{edge:r.hoveredEdge})),r.scheduleHighlightedNodesRender()),r.emit("leaveStage",Be({},u))},this.activeListeners.handleEnter=function(i){var s=Yl(i),u={event:s,preventSigmaDefault:function(){s.preventSigmaDefault()}};r.emit("enterStage",Be({},u))};var a=function(s){return function(u){var c=Yl(u),d={event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}},p=r.getNodeAtPosition(c);if(p)return r.emit("".concat(s,"Node"),Be(Be({},d),{},{node:p}));if(r.settings.enableEdgeEvents){var g=r.getEdgeAtPoint(c.x,c.y);if(g)return r.emit("".concat(s,"Edge"),Be(Be({},d),{},{edge:g}))}return r.emit("".concat(s,"Stage"),d)}};return this.activeListeners.handleClick=a("click"),this.activeListeners.handleRightClick=a("rightClick"),this.activeListeners.handleDoubleClick=a("doubleClick"),this.activeListeners.handleWheel=a("wheel"),this.activeListeners.handleDown=a("down"),this.activeListeners.handleUp=a("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 r=this,a=this.graph,i=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(s){var u,c=(u=s.hints)===null||u===void 0?void 0:u.attributes;r.graph.forEachNode(function(p){return r.updateNode(p)});var d=!c||c.some(function(p){return i.has(p)});r.refresh({partialGraph:{nodes:a.nodes()},skipIndexation:!d,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(s){var u,c=(u=s.hints)===null||u===void 0?void 0:u.attributes;r.graph.forEachEdge(function(p){return r.updateEdge(p)});var d=c&&["zIndex","type"].some(function(p){return c==null?void 0:c.includes(p)});r.refresh({partialGraph:{edges:a.edges()},skipIndexation:!d,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(s){var u=s.key;r.addNode(u),r.refresh({partialGraph:{nodes:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(s){var u=s.key;r.refresh({partialGraph:{nodes:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(s){var u=s.key;r.removeNode(u),r.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(s){var u=s.key;r.addEdge(u),r.refresh({partialGraph:{edges:[u]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(s){var u=s.key;r.refresh({partialGraph:{edges:[u]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(s){var u=s.key;r.removeEdge(u),r.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){r.clearEdgeState(),r.clearEdgeIndices(),r.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){r.clearEdgeState(),r.clearNodeState(),r.clearEdgeIndices(),r.clearNodeIndices(),r.refresh({schedule:!0})},a.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),a.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),a.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),a.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),a.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),a.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),a.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),a.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),a.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),a.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var r=this.graph;r.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),r.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),r.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),r.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),r.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),r.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),r.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),r.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),r.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),r.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(r,a){var i=zC(this.webGLContexts.edges,this.frameBuffers.edges,r,a,this.pixelRatio,this.pickingDownSizingRatio),s=PC.apply(void 0,tN(i)),u=this.itemIDsIndex[s];return u&&u.type==="edge"?u.id:null}},{key:"process",value:function(){var r=this;this.emit("beforeProcess");var a=this.graph,i=this.settings,s=this.getDimensions();if(this.nodeExtent=tJ(this.graph),!this.settings.autoRescale){var u=s.width,c=s.height,d=this.nodeExtent,p=d.x,g=d.y;this.nodeExtent={x:[(p[0]+p[1])/2-u/2,(p[0]+p[1])/2+u/2],y:[(g[0]+g[1])/2-c/2,(g[0]+g[1])/2+c/2]}}this.normalizationFunction=QC(this.customBBox||this.nodeExtent);var m=new eN,b=Wl(m.getState(),s,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(s,i.labelGridCellSize);for(var S={},v={},k={},R={},x=1,A=a.nodes(),N=0,O=A.length;N 1&&arguments[1]!==void 0?arguments[1]:{},i=a.tolerance,s=i===void 0?0:i,u=a.boundaries,c=Be({},r),d=u||this.nodeExtent,p=As(d.x,2),g=p[0],m=p[1],b=As(d.y,2),S=b[0],v=b[1],k=[this.graphToViewport({x:g,y:S},{cameraState:r}),this.graphToViewport({x:m,y:S},{cameraState:r}),this.graphToViewport({x:g,y:v},{cameraState:r}),this.graphToViewport({x:m,y:v},{cameraState:r})],R=1/0,x=-1/0,A=1/0,N=-1/0;k.forEach(function(W){var Y=W.x,j=W.y;R=Math.min(R,Y),x=Math.max(x,Y),A=Math.min(A,j),N=Math.max(N,j)});var O=x-R,_=N-A,C=this.getDimensions(),F=C.width,I=C.height,L=0,H=0;if(O>=F?x s&&(L=R-s):x>F+s?L=x-(F+s):R<-s&&(L=R+s),_>=I?N s&&(H=A-s):N>I+s?H=N-(I+s):A<-s&&(H=A+s),L||H){var $=this.viewportToFramedGraph({x:0,y:0},{cameraState:r}),U=this.viewportToFramedGraph({x:L,y:H},{cameraState:r});L=U.x-$.x,H=U.y-$.y,c.x+=L,c.y+=H}return c}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var r=this.camera.getState(),a=this.labelGrid.getLabelsToDisplay(r.ratio,this.settings.labelDensity);JC(a,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var i=this.canvasContexts.labels,s=0,u=a.length;sthis.width+SJ||m<-50||m>this.height+EJ)){this.displayedNodeLabels.add(c);var S=this.settings.defaultDrawNodeLabel,v=this.nodePrograms[d.type],k=(v==null?void 0:v.drawLabel)||S;k(i,Be(Be({key:c},d),{},{size:b,x:g,y:m}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var r=this.canvasContexts.edgeLabels;r.clearRect(0,0,this.width,this.height);var a=vJ({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});JC(a,this.edgesWithForcedLabels);for(var i=new Set,s=0,u=a.length;sthis.nodeZExtent[1]&&(this.nodeZExtent[1]=i.zIndex))}},{key:"updateNode",value:function(r){this.addNode(r);var a=this.nodeDataCache[r];this.normalizationFunction.applyTo(a)}},{key:"removeNode",value:function(r){delete this.nodeDataCache[r],delete this.nodeProgramIndex[r],this.highlightedNodes.delete(r),this.hoveredNode===r&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(r)}},{key:"addEdge",value:function(r){var a=Object.assign({},this.graph.getEdgeAttributes(r));this.settings.edgeReducer&&(a=this.settings.edgeReducer(r,a));var i=xJ(this.settings,r,a);this.edgeDataCache[r]=i,this.edgesWithForcedLabels.delete(r),i.forceLabel&&!i.hidden&&this.edgesWithForcedLabels.add(r),this.settings.zIndex&&(i.zIndex this.edgeZExtent[1]&&(this.edgeZExtent[1]=i.zIndex))}},{key:"updateEdge",value:function(r){this.addEdge(r)}},{key:"removeEdge",value:function(r){delete this.edgeDataCache[r],delete this.edgeProgramIndex[r],this.hoveredEdge===r&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(r)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new rN,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0]}},{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(r,a,i){var s=this.nodeDataCache[r],u=this.nodePrograms[s.type];if(!u)throw new Error('Sigma: could not find a suitable program for node type "'.concat(s.type,'"!'));u.process(a,i,s),this.nodeProgramIndex[r]=i}},{key:"addEdgeToProgram",value:function(r,a,i){var s=this.edgeDataCache[r],u=this.edgePrograms[s.type];if(!u)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(s.type,'"!'));var c=this.graph.extremities(r),d=this.nodeDataCache[c[0]],p=this.nodeDataCache[c[1]];u.process(a,i,d,p,s),this.edgeProgramIndex[r]=i}},{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 r=this.settings,a=r.stagePadding,i=r.autoRescale;return i&&a||0}},{key:"createLayer",value:function(r,a){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[r])throw new Error('Sigma: a layer named "'.concat(r,'" already exists'));var s=rJ(a,{position:"absolute"},{class:"sigma-".concat(r)});return i.style&&Object.assign(s.style,i.style),this.elements[r]=s,"beforeLayer"in i&&i.beforeLayer?this.elements[i.beforeLayer].before(s):"afterLayer"in i&&i.afterLayer?this.elements[i.afterLayer].after(s):this.container.appendChild(s),s}},{key:"createCanvas",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(r,"canvas",a)}},{key:"createCanvasContext",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.createCanvas(r,a),s={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[r]=i.getContext("2d",s),this}},{key:"createWebGLContext",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(a==null?void 0:a.canvas)||this.createCanvas(r,a);a.hidden&&i.remove();var s=Be({preserveDrawingBuffer:!1,antialias:!1},a),u;u=i.getContext("webgl2",s),u||(u=i.getContext("webgl",s)),u||(u=i.getContext("experimental-webgl",s));var c=u;if(this.webGLContexts[r]=c,c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),a.picking){this.pickingLayers.add(r);var d=c.createFramebuffer();if(!d)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(r));this.frameBuffers[r]=d}return c}},{key:"killLayer",value:function(r){var a=this.elements[r];if(!a)throw new Error("Sigma: cannot kill layer ".concat(r,", which does not exist"));if(this.webGLContexts[r]){var i,s=this.webGLContexts[r];(i=s.getExtension("WEBGL_lose_context"))===null||i===void 0||i.loseContext(),delete this.webGLContexts[r]}else this.canvasContexts[r]&&delete this.canvasContexts[r];return a.remove(),delete this.elements[r],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(r){this.unbindCameraHandlers(),this.camera=r,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(r){r!==this.graph&&(this.hoveredNode&&!r.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!r.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=r,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 r=this.customBBox||this.nodeExtent;return{width:r.x[1]-r.x[0]||1,height:r.y[1]-r.y[0]||1}}},{key:"getNodeDisplayData",value:function(r){var a=this.nodeDataCache[r];return a?Object.assign({},a):void 0}},{key:"getEdgeDisplayData",value:function(r){var a=this.edgeDataCache[r];return a?Object.assign({},a):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 Be({},this.settings)}},{key:"getSetting",value:function(r){return this.settings[r]}},{key:"setSetting",value:function(r,a){var i=Be({},this.settings);return this.settings[r]=a,Xh(this.settings),this.handleSettingsUpdate(i),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(r,a){return this.setSetting(r,a(this.settings[r])),this}},{key:"setSettings",value:function(r){var a=Be({},this.settings);return this.settings=Be(Be({},this.settings),r),Xh(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"resize",value:function(r){var a=this.width,i=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=XC(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!r&&a===this.width&&i===this.height)return this;for(var s in this.elements){var u=this.elements[s];u.style.width=this.width+"px",u.style.height=this.height+"px"}for(var c in this.canvasContexts)this.elements[c].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[c].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[c].scale(this.pixelRatio,this.pixelRatio);for(var d in this.webGLContexts){this.elements[d].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[d].setAttribute("height",this.height*this.pixelRatio+"px");var p=this.webGLContexts[d];if(p.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(d)){var g=this.textures[d];g&&p.deleteTexture(g)}}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(r){var a=this,i=(r==null?void 0:r.skipIndexation)!==void 0?r==null?void 0:r.skipIndexation:!1,s=(r==null?void 0:r.schedule)!==void 0?r.schedule:!1,u=!r||!r.partialGraph;if(u)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(N){return a.addNode(N)}),this.graph.forEachEdge(function(N){return a.addEdge(N)});else{for(var c,d,p=((c=r.partialGraph)===null||c===void 0?void 0:c.nodes)||[],g=0,m=(p==null?void 0:p.length)||0;g 1&&arguments[1]!==void 0?arguments[1]:{},i=!!a.cameraState||!!a.viewportDimensions||!!a.graphDimensions,s=a.matrix?a.matrix:i?Wl(a.cameraState||this.camera.getState(),a.viewportDimensions||this.getDimensions(),a.graphDimensions||this.getGraphDimensions(),a.padding||this.getStagePadding()):this.matrix,u=dk(s,r);return{x:(1+u.x)*this.width/2,y:(1-u.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=!!a.cameraState||!!a.viewportDimensions||!a.graphDimensions,s=a.matrix?a.matrix:i?Wl(a.cameraState||this.camera.getState(),a.viewportDimensions||this.getDimensions(),a.graphDimensions||this.getGraphDimensions(),a.padding||this.getStagePadding(),!0):this.invMatrix,u=dk(s,{x:r.x/this.width*2-1,y:1-r.y/this.height*2});return isNaN(u.x)&&(u.x=0),isNaN(u.y)&&(u.y=0),u}},{key:"viewportToGraph",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(r,a))}},{key:"graphToViewport",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(r),a)}},{key:"getGraphToViewportRatio",value:function(){var r={x:0,y:0},a={x:1,y:1},i=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),s=this.graphToViewport(r),u=this.graphToViewport(a),c=Math.sqrt(Math.pow(s.x-u.x,2)+Math.pow(s.y-u.y,2));return c/i}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(r){return this.customBBox=r,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var r=this.container;r.firstChild;)r.removeChild(r.firstChild);this.canvasContexts={},this.webGLContexts={},this.elements={};for(var a in this.nodePrograms)this.nodePrograms[a].kill();for(var i in this.nodeHoverPrograms)this.nodeHoverPrograms[i].kill();for(var s in this.edgePrograms)this.edgePrograms[s].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var u in this.elements)this.killLayer(u)}},{key:"scaleSize",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return r/this.settings.zoomToSizeRatioFunction(a)*(this.getSetting("itemSizesReference")==="positions"?a*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var r={};for(var a in this.elements)this.elements[a]instanceof HTMLCanvasElement&&(r[a]=this.elements[a]);return r}}])}(P0);const Oj=T.createContext(null),TJ=Oj.Provider;function B0(){const e=T.useContext(Oj);if(e==null)throw new Error("No context provided: useSigmaContext() can only be used in a descendant of ");return e}function Er(){return B0().sigma}function Dj(){const{sigma:e}=B0();return T.useCallback(t=>{e&&Object.keys(t).forEach(n=>{e.setSetting(n,t[n])})},[e])}function Qf(e){return new Set(Object.keys(e))}const aN=Qf({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}),iN=Qf({click:!0,rightClick:!0,doubleClick:!0,mouseup:!0,mousedown:!0,mousemove:!0,mousemovebody:!0,mouseleave:!0,mouseenter:!0,wheel:!0}),oN=Qf({touchup:!0,touchdown:!0,touchmove:!0,touchmovebody:!0,tap:!0,doubletap:!0}),sN=Qf({updated:!0});function Ij(){const e=Er(),t=Dj(),[n,r]=T.useState({});return T.useEffect(()=>{if(!e||!n)return;const a=n,i=Object.keys(a);return i.forEach(s=>{const u=a[s];aN.has(s)&&e.on(s,u),iN.has(s)&&e.getMouseCaptor().on(s,u),oN.has(s)&&e.getTouchCaptor().on(s,u),sN.has(s)&&e.getCamera().on(s,u)}),()=>{e&&i.forEach(s=>{const u=a[s];aN.has(s)&&e.off(s,u),iN.has(s)&&e.getMouseCaptor().off(s,u),oN.has(s)&&e.getTouchCaptor().off(s,u),sN.has(s)&&e.getCamera().off(s,u)})}},[e,n,t]),r}function AJ(){const e=Er();return T.useCallback((t,n=!0)=>{e&&t&&(n&&e.getGraph().order>0&&e.getGraph().clear(),e.getGraph().import(t),e.refresh())},[e])}function Mu(e,t){if(e===t)return!0;if(typeof e=="object"&&e!=null&&typeof t=="object"&&t!=null){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(const n in e)if(!Object.hasOwn(t,n)||!Mu(e[n],t[n]))return!1;return!0}return!1}function Lj(e){const t=Er(),[n,r]=T.useState(e||{});T.useEffect(()=>{r(d=>Mu(d,e||{})?d:e||{})},[e]);const a=T.useCallback(d=>{t.getCamera().animatedZoom(Object.assign(Object.assign({},n),d))},[t,n]),i=T.useCallback(d=>{t.getCamera().animatedUnzoom(Object.assign(Object.assign({},n),d))},[t,n]),s=T.useCallback(d=>{t.getCamera().animatedReset(Object.assign(Object.assign({},n),d))},[t,n]),u=T.useCallback((d,p)=>{t.getCamera().animate(d,Object.assign(Object.assign({},n),p))},[t,n]),c=T.useCallback((d,p)=>{const g=t.getNodeDisplayData(d);g?t.getCamera().animate(g,Object.assign(Object.assign({},n),p)):console.warn(`Node ${d} not found`)},[t,n]);return{zoomIn:a,zoomOut:i,reset:s,goto:u,gotoNode:c}}function _J(e){const t=B0(),[n,r]=T.useState(!1),[a,i]=T.useState(t.container),s=T.useCallback(()=>r(u=>!u),[]);return T.useEffect(()=>(document.addEventListener("fullscreenchange",s),()=>document.removeEventListener("fullscreenchange",s)),[s]),T.useEffect(()=>{i(t.container)},[e,t.container]),{toggle:T.useCallback(()=>{var u;u=a,document.fullscreenElement!==u?u.requestFullscreen():document.exitFullscreen&&document.exitFullscreen()},[a]),isFullScreen:n}}const RJ=T.forwardRef(({graph:e,id:t,className:n,style:r,settings:a={},children:i},s)=>{const u=T.useRef(null),c=T.useRef(null),d={className:`react-sigma ${n||""}`,id:t,style:r},[p,g]=T.useState(null),[m,b]=T.useState(a);T.useEffect(()=>{b(k=>Mu(k,a)?k:a)},[a]),T.useEffect(()=>{g(k=>{let R=null;if(c.current!==null){let x=new At;e&&(x=typeof e=="function"?new e:e);let A=null;k&&(A=k.getCamera().getState(),k.kill()),R=new kJ(x,c.current,m),A&&R.getCamera().setState(A)}return R})},[c,e,m]),T.useImperativeHandle(s,()=>p,[p]);const S=T.useMemo(()=>p&&u.current?{sigma:p,container:u.current}:null,[p,u]),v=S!==null?ye.createElement(TJ,{value:S},i):null;return ye.createElement("div",Object.assign({},d,{ref:u}),ye.createElement("div",{className:"sigma-container",ref:c}),v)});var CJ=` precision mediump float; varying vec4 v_color; @@ -611,7 +644,7 @@ void main(void) { gl_FragColor = mix(transparent, v_color, t); #endif } -`,hZ=gZ,mZ=` +`,NJ=CJ,OJ=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_position; @@ -650,7 +683,7 @@ void main() { v_color.a *= bias; } -`,bZ=mZ,s3=WebGLRenderingContext,kC=s3.UNSIGNED_BYTE,AC=s3.FLOAT,yZ=["u_sizeRatio","u_pixelRatio","u_matrix"],vZ=function(e){function t(){return on(this,t),Bn(this,t,arguments)}return Un(t,e),ln(t,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:bZ,FRAGMENT_SHADER_SOURCE:hZ,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:yZ,ATTRIBUTES:[{name:"a_position",size:2,type:AC},{name:"a_size",size:1,type:AC},{name:"a_color",size:4,type:kC,normalized:!0},{name:"a_id",size:4,type:kC,normalized:!0}]}}},{key:"processVisibleItem",value:function(r,a,i){var l=this.array;l[a++]=i.x,l[a++]=i.y,l[a++]=i.size,l[a++]=Qr(i.color),l[a++]=r}},{key:"setUniforms",value:function(r,a){var i=r.sizeRatio,l=r.pixelRatio,u=r.matrix,c=a.gl,f=a.uniformLocations,p=f.u_sizeRatio,g=f.u_pixelRatio,b=f.u_matrix;c.uniform1f(g,l),c.uniform1f(p,i),c.uniformMatrix3fv(b,!1,u)}}])}(g0),SZ=` +`,DJ=OJ,Mj=WebGLRenderingContext,lN=Mj.UNSIGNED_BYTE,uN=Mj.FLOAT,IJ=["u_sizeRatio","u_pixelRatio","u_matrix"],LJ=function(e){function t(){return un(this,t),Hn(this,t,arguments)}return $n(t,e),cn(t,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:DJ,FRAGMENT_SHADER_SOURCE:NJ,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:IJ,ATTRIBUTES:[{name:"a_position",size:2,type:uN},{name:"a_size",size:1,type:uN},{name:"a_color",size:4,type:lN,normalized:!0},{name:"a_id",size:4,type:lN,normalized:!0}]}}},{key:"processVisibleItem",value:function(r,a,i){var s=this.array;s[a++]=i.x,s[a++]=i.y,s[a++]=i.size,s[a++]=na(i.color),s[a++]=r}},{key:"setUniforms",value:function(r,a){var i=r.sizeRatio,s=r.pixelRatio,u=r.matrix,c=a.gl,d=a.uniformLocations,p=d.u_sizeRatio,g=d.u_pixelRatio,m=d.u_matrix;c.uniform1f(g,s),c.uniform1f(p,i),c.uniformMatrix3fv(m,!1,u)}}])}(M0),MJ=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; @@ -731,9 +764,9 @@ void main() { v_color.a *= bias; } -`,EZ=SZ,u3=WebGLRenderingContext,TC=u3.UNSIGNED_BYTE,wa=u3.FLOAT,wZ=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],xZ={lengthToThicknessRatio:Eu.lengthToThicknessRatio};function c3(e){var t=Be(Be({},xZ),{});return function(n){function r(){return on(this,r),Bn(this,r,arguments)}return Un(r,n),ln(r,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:EZ,FRAGMENT_SHADER_SOURCE:h0,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:wZ,ATTRIBUTES:[{name:"a_positionStart",size:2,type:wa},{name:"a_positionEnd",size:2,type:wa},{name:"a_normal",size:2,type:wa},{name:"a_color",size:4,type:TC,normalized:!0},{name:"a_id",size:4,type:TC,normalized:!0},{name:"a_sourceRadius",size:1,type:wa},{name:"a_targetRadius",size:1,type:wa}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:wa},{name:"a_normalCoef",size:1,type:wa},{name:"a_sourceRadiusCoef",size:1,type:wa},{name:"a_targetRadiusCoef",size:1,type:wa}],CONSTANT_DATA:[[0,1,-1,0],[0,-1,1,0],[1,1,0,1],[1,1,0,1],[0,-1,1,0],[1,-1,0,-1]]}}},{key:"processVisibleItem",value:function(i,l,u,c,f){var p=f.size||1,g=u.x,b=u.y,m=c.x,S=c.y,v=Qr(f.color),A=m-g,R=S-b,x=u.size||1,T=c.size||1,C=A*A+R*R,N=0,_=0;C&&(C=1/Math.sqrt(C),N=-R*C*p,_=A*C*p);var O=this.array;O[l++]=g,O[l++]=b,O[l++]=m,O[l++]=S,O[l++]=N,O[l++]=_,O[l++]=v,O[l++]=i,O[l++]=x,O[l++]=T}},{key:"setUniforms",value:function(i,l){var u=l.gl,c=l.uniformLocations,f=c.u_matrix,p=c.u_zoomRatio,g=c.u_feather,b=c.u_pixelRatio,m=c.u_correctionRatio,S=c.u_sizeRatio,v=c.u_minEdgeThickness,A=c.u_lengthToThicknessRatio;u.uniformMatrix3fv(f,!1,i.matrix),u.uniform1f(p,i.zoomRatio),u.uniform1f(S,i.sizeRatio),u.uniform1f(m,i.correctionRatio),u.uniform1f(b,i.pixelRatio),u.uniform1f(g,i.antiAliasingFeather),u.uniform1f(v,i.minEdgeThickness),u.uniform1f(A,t.lengthToThicknessRatio)}}])}(vu)}c3();function kZ(e){return VU([c3(),Pd(e),Pd(Be(Be({},e),{},{extremity:"source"}))])}kZ();function AZ(e){if(Array.isArray(e))return e}function TZ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,l,u=[],c=!0,f=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(p){f=!0,a=p}finally{try{if(!c&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw a}}return u}}function Px(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n e.length)&&(t=e.length);for(var n=0,r=Array(t);n adjustedBorderSize_0) { @@ -796,7 +829,7 @@ void main(void) { } else `)}).join(""),` { /* Nothing to add here */ } #endif } -`);return r}function HZ(e){var t=e.borders,n=` +`);return r}function aee(e){var t=e.borders,n=` attribute vec2 a_position; attribute float a_size; attribute float a_angle; @@ -843,8 +876,8 @@ void main() { `),` #endif } -`);return n}var g3=WebGLRenderingContext,CC=g3.UNSIGNED_BYTE,Qc=g3.FLOAT;function $Z(e){var t,n=RC(RC({},UZ),{}),r=n.borders,a=n.drawLabel,i=n.drawHover,l=["u_sizeRatio","u_correctionRatio","u_matrix"].concat(Ih(r.flatMap(function(u,c){var f=u.color;return"value"in f?["u_borderColor_".concat(c+1)]:[]})));return t=function(u){MZ(c,u);function c(){var f;CZ(this,c);for(var p=arguments.length,g=new Array(p),b=0;b e.length)&&(t=e.length);for(var n=0,r=Array(t);n
L){var Y="…";for(v=v+Y,U=i.measureText(v).width;U>L&&v.length>1;)v=v.slice(0,-2)+Y,U=i.measureText(v).width;if(v.length<4)return}for(var Q={},se=0,re=v.length;se e.length)&&(t=e.length);for(var n=0,r=Array(t);n M){var X="…";for(v=v+X,B=i.measureText(v).width;B>M&&v.length>1;)v=v.slice(0,-2)+X,B=i.measureText(v).width;if(v.length<4)return}for(var Q={},le=0,re=v.length;le {const n=this.nodeIdMap[t];if(n!==void 0)return this.nodes[n]});Ea(this,"getEdge",(t,n=!0)=>{const r=n?this.edgeDynamicIdMap[t]:this.edgeIdMap[t];if(r!==void 0)return this.edges[r]});Ea(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let t=0;t ({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,rawGraph:null,sigmaGraph:null,setSelectedNode:(t,n)=>e({selectedNode:t,moveToSelectedNode:n}),setFocusedNode:t=>e({focusedNode:t}),setSelectedEdge:t=>e({selectedEdge:t}),setFocusedEdge:t=>e({focusedEdge:t}),clearSelection:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,moveToSelectedNode:!1}),setRawGraph:t=>e({rawGraph:t}),setSigmaGraph:t=>e({sigmaGraph:t}),setMoveToSelectedNode:t=>e({moveToSelectedNode:t})})),Et=Tk(dQ),fQ=({node:e,move:t})=>{const n=br(),{gotoNode:r}=l3();return k.useEffect(()=>{if(e)return n.getGraph().setNodeAttribute(e,"highlighted",!0),t&&(r(e),Et.getState().setMoveToSelectedNode(!1)),()=>{n.getGraph().setNodeAttribute(e,"highlighted",!1)}},[e,t,n,r]),null};function Ll(e,t){const n=br(),r=k.useRef(t);return wu(r.current,t)||(r.current=t),{positions:k.useCallback(()=>r.current?e(n.getGraph(),r.current):{},[n,r,e]),assign:k.useCallback(()=>{r.current&&e.assign(n.getGraph(),r.current)},[n,r,e])}}function S0(e,t){const n=br(),[r,a]=k.useState(!1),[i,l]=k.useState(null),u=k.useRef(t);return wu(u.current,t)||(u.current=t),k.useEffect(()=>{a(!1);let c=null;return u.current&&(c=new e(n.getGraph(),u.current)),l(c),()=>{c!==null&&c.kill()}},[n,u,l,a,e]),{stop:k.useCallback(()=>{i&&(i.stop(),a(!1))},[i,a]),start:k.useCallback(()=>{i&&(i.start(),a(!0))},[i,a]),kill:k.useCallback(()=>{i&&i.kill(),a(!1)},[i,a]),isRunning:r}}var Mh,DC;function xu(){if(DC)return Mh;DC=1;function e(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function t(n,r){n=n||{};var a={};for(var i in r){var l=n[i],u=r[i];if(!e(u)){a[i]=t(l,u);continue}l===void 0?a[i]=u:a[i]=l}return a}return Mh=t,Mh}var Fh,IC;function pQ(){if(IC)return Fh;IC=1;function e(n){return function(r,a){return r+Math.floor(n()*(a-r+1))}}var t=e(Math.random);return t.createRandom=e,Fh=t,Fh}var zh,LC;function gQ(){if(LC)return zh;LC=1;var e=pQ().createRandom;function t(r){var a=e(r);return function(i){for(var l=i.length,u=l-1,c=-1;++c 0},a.prototype.addChild=function(O,z){this.children[O]=z,++this.countChildren},a.prototype.getChild=function(O){if(!this.children.hasOwnProperty(O)){var z=new a;this.children[O]=z,++this.countChildren}return this.children[O]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var O=this;for(var z in O.children){var I=O.children[z];I.x+=O.x,I.y+=O.y,I.applyPositionToChildren()}}};function i(O,z,I){for(var M in z.children){var H=z.children[M];H.hasChildren()?i(O,H,I):I[H.id]={x:H.x,y:H.y}}}function l(O,z){var I=O.r-z.r,M=z.x-O.x,H=z.y-O.y;return I<0||I*I 0&&I*I>M*M+H*H}function c(O,z){for(var I=0;I Z?(H=(j+Z-q)/(2*j),W=Math.sqrt(Math.max(0,Z/j-H*H)),I.x=O.x-H*M-W*P,I.y=O.y-H*P+W*M):(H=(j+q-Z)/(2*j),W=Math.sqrt(Math.max(0,q/j-H*H)),I.x=z.x+H*M-W*P,I.y=z.y+H*P+W*M)):(I.x=z.x+I.r,I.y=z.y)}function R(O,z){var I=O.r+z.r-1e-6,M=z.x-O.x,H=z.y-O.y;return I>0&&I*I>M*M+H*H}function x(O,z){var I=O.length;if(I===0)return 0;var M,H,q,P,W,Z,j,G,B,X;if(M=O[0],M.x=0,M.y=0,I<=1)return M.r;if(H=O[1],M.x=-H.r,H.x=M.r,H.y=0,I<=2)return M.r+H.r;q=O[2],A(H,M,q),M=new a(null,null,null,null,M),H=new a(null,null,null,null,H),q=new a(null,null,null,null,q),M.next=q.previous=H,H.next=M.previous=q,q.next=H.previous=M;e:for(Z=3;Z"u"?a:f};typeof a=="function"&&(l=a);var u=function(f){return l(f[r])},c=function(){return l(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(f,p){return u(f.getNodeAttributes(p))},i.fromEntry=function(f,p){return u(p)}):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},i.fromGraph=function(f,p){return l(r(p,f.getNodeAttributes(p)))},i.fromEntry=function(f,p){return l(r(f,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c),i}function n(r,a){var i={},l=function(f){return typeof f>"u"?a:f};typeof a=="function"&&(l=a);var u=function(f){return l(f[r])},c=function(){return l(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(f,p){return u(f.getEdgeAttributes(p))},i.fromEntry=function(f,p){return u(p)},i.fromPartialEntry=i.fromEntry,i.fromMinimalEntry=i.fromEntry):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},i.fromGraph=function(f,p){var g=f.extremities(p);return l(r(p,f.getEdgeAttributes(p),g[0],g[1],f.getNodeAttributes(g[0]),f.getNodeAttributes(g[1]),f.isUndirected(p)))},i.fromEntry=function(f,p,g,b,m,S,v){return l(r(f,p,g,b,m,S,v))},i.fromPartialEntry=function(f,p,g,b){return l(r(f,p,g,b))},i.fromMinimalEntry=function(f,p){return l(r(f,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c,i.fromMinimalEntry=c),i}return Gs.createNodeValueGetter=t,Gs.createEdgeValueGetter=n,Gs.createEdgeWeightGetter=function(r){return n(r,e)},Gs}var Uh,PC;function w3(){if(PC)return Uh;PC=1;const{createNodeValueGetter:e,createEdgeValueGetter:t}=E0();return Uh=function(r,a,i){const{nodeXAttribute:l,nodeYAttribute:u}=i,{attraction:c,repulsion:f,gravity:p,inertia:g,maxMove:b}=i.settings;let{shouldSkipNode:m,shouldSkipEdge:S,isNodeFixed:v}=i;v=e(v),m=e(m,!1),S=t(S,!1);const A=r.filterNodes((T,C)=>!m.fromEntry(T,C)),R=A.length;for(let T=0;T {if(N===_||m.fromEntry(N,O)||m.fromEntry(_,z)||S.fromEntry(T,C,N,_,O,z,I))return;const M=a[N],H=a[_],q=H.x-M.x,P=H.y-M.y,W=Math.sqrt(q*q+P*P)||1,Z=c*W*q,j=c*W*P;M.dx+=Z,M.dy+=j,H.dx-=Z,H.dy-=j}),p)for(let T=0;T b&&(N.dx*=b/_,N.dy*=b/_),v.fromGraph(r,C)?N.fixed=!0:(N.x+=N.dx,N.y+=N.dy,N.fixed=!1)}return{converged:x}},Uh}var Jc={},BC;function x3(){return BC||(BC=1,Jc.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((i,l)=>{const u=t[i];return!u||u.fixed||(l[r]=u.x,l[a]=u.y),l},{attributes:["x","y"]})},Jc.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),Jc}var jh,UC;function k3(){return UC||(UC=1,jh={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),jh}var Gh,jC;function xQ(){if(jC)return Gh;jC=1;const e=Jr(),t=xu(),n=w3(),r=x3(),a=k3();function i(u,c,f){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof f=="number"?f={maxIterations:f}:f=f||{};const p=f.maxIterations;if(f=t(f,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let b=null,m;for(m=0;m this.runFrame())},i.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},i.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},i.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},Hh=i,Hh}var _Q=TQ();const RQ=an(_Q);function CQ(e={maxIterations:100}){return Ll(AQ,e)}function NQ(e={}){return S0(RQ,e)}var $h,HC;function OQ(){if(HC)return $h;HC=1;var e=0,t=1,n=2,r=3,a=4,i=5,l=6,u=7,c=8,f=9,p=0,g=1,b=2,m=0,S=1,v=2,A=3,R=4,x=5,T=6,C=7,N=8,_=3,O=10,z=3,I=9,M=10;return $h=function(q,P,W){var Z,j,G,B,X,D,V,U,L,Y,Q=P.length,se=W.length,re=q.adjustSizes,le=q.barnesHutTheta*q.barnesHutTheta,Ae,ae,we,xe,Ie,Ce,Ee,J=[];for(G=0;G
Ne?(me-=(he-Ne)/2,ve=me+he):(fe-=(Ne-he)/2,ke=fe+Ne),J[0+m]=-1,J[0+S]=(fe+ke)/2,J[0+v]=(me+ve)/2,J[0+A]=Math.max(ke-fe,ve-me),J[0+R]=-1,J[0+x]=-1,J[0+T]=0,J[0+C]=0,J[0+N]=0,Z=1,G=0;G=0){P[G+e]=0)if(Ce=Math.pow(P[G+e]-J[j+C],2)+Math.pow(P[G+t]-J[j+N],2),Y=J[j+A],4*Y*Y/Ce 0?(Ee=ae*P[G+l]*J[j+T]/Ce,P[G+n]+=we*Ee,P[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*P[G+l]*J[j+T]/Math.sqrt(Ce),P[G+n]+=we*Ee,P[G+r]+=xe*Ee):Ce>0&&(Ee=ae*P[G+l]*J[j+T]/Ce,P[G+n]+=we*Ee,P[G+r]+=xe*Ee),j=J[j+R],j<0)break;continue}else{j=J[j+x];continue}else{if(D=J[j+m],D>=0&&D!==G&&(we=P[G+e]-P[D+e],xe=P[G+t]-P[D+t],Ce=we*we+xe*xe,re===!0?Ce>0?(Ee=ae*P[G+l]*P[D+l]/Ce,P[G+n]+=we*Ee,P[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*P[G+l]*P[D+l]/Math.sqrt(Ce),P[G+n]+=we*Ee,P[G+r]+=xe*Ee):Ce>0&&(Ee=ae*P[G+l]*P[D+l]/Ce,P[G+n]+=we*Ee,P[G+r]+=xe*Ee)),j=J[j+R],j<0)break;continue}else for(ae=q.scalingRatio,B=0;B 0?(Ee=ae*P[B+l]*P[X+l]/Ce/Ce,P[B+n]+=we*Ee,P[B+r]+=xe*Ee,P[X+n]-=we*Ee,P[X+r]-=xe*Ee):Ce<0&&(Ee=100*ae*P[B+l]*P[X+l],P[B+n]+=we*Ee,P[B+r]+=xe*Ee,P[X+n]-=we*Ee,P[X+r]-=xe*Ee)):(Ce=Math.sqrt(we*we+xe*xe),Ce>0&&(Ee=ae*P[B+l]*P[X+l]/Ce/Ce,P[B+n]+=we*Ee,P[B+r]+=xe*Ee,P[X+n]-=we*Ee,P[X+r]-=xe*Ee));for(L=q.gravity/q.scalingRatio,ae=q.scalingRatio,G=0;G0&&(Ee=ae*P[G+l]*L):Ce>0&&(Ee=ae*P[G+l]*L/Ce),P[G+n]-=we*Ee,P[G+r]-=xe*Ee;for(ae=1*(q.outboundAttractionDistribution?Ae:1),V=0;V0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/P[B+l]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):q.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie/P[B+l]):Ce>0&&(Ee=-ae*Ie)):(Ce=Math.sqrt(Math.pow(we,2)+Math.pow(xe,2)),q.linLogMode?q.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/P[B+l]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):q.outboundAttractionDistribution?(Ce=1,Ee=-ae*Ie/P[B+l]):(Ce=1,Ee=-ae*Ie)),Ce>0&&(P[B+n]+=we*Ee,P[B+r]+=xe*Ee,P[X+n]-=we*Ee,P[X+r]-=xe*Ee);var ee,ce,Re,Fe,qe,mt;if(re===!0)for(G=0;G M&&(P[G+n]=P[G+n]*M/ee,P[G+r]=P[G+r]*M/ee),ce=P[G+l]*Math.sqrt((P[G+a]-P[G+n])*(P[G+a]-P[G+n])+(P[G+i]-P[G+r])*(P[G+i]-P[G+r])),Re=Math.sqrt((P[G+a]+P[G+n])*(P[G+a]+P[G+n])+(P[G+i]+P[G+r])*(P[G+i]+P[G+r]))/2,Fe=.1*Math.log(1+Re)/(1+Math.sqrt(ce)),qe=P[G+e]+P[G+n]*(Fe/q.slowDown),P[G+e]=qe,mt=P[G+t]+P[G+r]*(Fe/q.slowDown),P[G+t]=mt);else for(G=0;G=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},xa.graphToByteArrays=function(n,r){var a=n.order,i=n.size,l={},u,c=new Float32Array(a*e),f=new Float32Array(i*t);return u=0,n.forEachNode(function(p,g){l[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,b,m,S,v,A){var R=l[b],x=l[m],T=r(p,g,b,m,S,v,A);c[R+6]+=T,c[x+6]+=T,f[u]=R,f[u+1]=x,f[u+2]=T,u+=t}),{nodes:c,edges:f}},xa.assignLayoutChanges=function(n,r,a){var i=0;n.updateEachNodeAttributes(function(l,u){return u.x=r[i],u.y=r[i+1],i+=e,a?a(l,u):u})},xa.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(i,l){r[a]=l.x,r[a+1]=l.y,a+=e})},xa.collectLayoutChanges=function(n,r,a){for(var i=n.nodes(),l={},u=0,c=0,f=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(f)}}var u=i.bind(null,!1);return u.assign=i.bind(null,!0),u.inferSettings=l,Vh=u,Vh}var IQ=DQ();const LQ=an(IQ);var Wh,WC;function MQ(){return WC||(WC=1,Wh=function(){var t,n,r={};(function(){var i=0,l=1,u=2,c=3,f=4,p=5,g=6,b=7,m=8,S=9,v=0,A=1,R=2,x=0,T=1,C=2,N=3,_=4,O=5,z=6,I=7,M=8,H=3,q=10,P=3,W=9,Z=10;r.exports=function(G,B,X){var D,V,U,L,Y,Q,se,re,le,Ae,ae=B.length,we=X.length,xe=G.adjustSizes,Ie=G.barnesHutTheta*G.barnesHutTheta,Ce,Ee,J,fe,ke,me,ve,ie=[];for(U=0;U qe?(he-=(Fe-qe)/2,Ne=he+Fe):(ze-=(qe-Fe)/2,Pe=ze+qe),ie[0+x]=-1,ie[0+T]=(ze+Pe)/2,ie[0+C]=(he+Ne)/2,ie[0+N]=Math.max(Pe-ze,Ne-he),ie[0+_]=-1,ie[0+O]=-1,ie[0+z]=0,ie[0+I]=0,ie[0+M]=0,D=1,U=0;U =0){B[U+i] =0)if(me=Math.pow(B[U+i]-ie[V+I],2)+Math.pow(B[U+l]-ie[V+M],2),Ae=ie[V+N],4*Ae*Ae/me 0?(ve=Ee*B[U+g]*ie[V+z]/me,B[U+u]+=J*ve,B[U+c]+=fe*ve):me<0&&(ve=-Ee*B[U+g]*ie[V+z]/Math.sqrt(me),B[U+u]+=J*ve,B[U+c]+=fe*ve):me>0&&(ve=Ee*B[U+g]*ie[V+z]/me,B[U+u]+=J*ve,B[U+c]+=fe*ve),V=ie[V+_],V<0)break;continue}else{V=ie[V+O];continue}else{if(Q=ie[V+x],Q>=0&&Q!==U&&(J=B[U+i]-B[Q+i],fe=B[U+l]-B[Q+l],me=J*J+fe*fe,xe===!0?me>0?(ve=Ee*B[U+g]*B[Q+g]/me,B[U+u]+=J*ve,B[U+c]+=fe*ve):me<0&&(ve=-Ee*B[U+g]*B[Q+g]/Math.sqrt(me),B[U+u]+=J*ve,B[U+c]+=fe*ve):me>0&&(ve=Ee*B[U+g]*B[Q+g]/me,B[U+u]+=J*ve,B[U+c]+=fe*ve)),V=ie[V+_],V<0)break;continue}else for(Ee=G.scalingRatio,L=0;L 0?(ve=Ee*B[L+g]*B[Y+g]/me/me,B[L+u]+=J*ve,B[L+c]+=fe*ve,B[Y+u]-=J*ve,B[Y+c]-=fe*ve):me<0&&(ve=100*Ee*B[L+g]*B[Y+g],B[L+u]+=J*ve,B[L+c]+=fe*ve,B[Y+u]-=J*ve,B[Y+c]-=fe*ve)):(me=Math.sqrt(J*J+fe*fe),me>0&&(ve=Ee*B[L+g]*B[Y+g]/me/me,B[L+u]+=J*ve,B[L+c]+=fe*ve,B[Y+u]-=J*ve,B[Y+c]-=fe*ve));for(le=G.gravity/G.scalingRatio,Ee=G.scalingRatio,U=0;U 0&&(ve=Ee*B[U+g]*le):me>0&&(ve=Ee*B[U+g]*le/me),B[U+u]-=J*ve,B[U+c]-=fe*ve;for(Ee=1*(G.outboundAttractionDistribution?Ce:1),se=0;se 0&&(ve=-Ee*ke*Math.log(1+me)/me/B[L+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke/B[L+g]):me>0&&(ve=-Ee*ke)):(me=Math.sqrt(Math.pow(J,2)+Math.pow(fe,2)),G.linLogMode?G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke*Math.log(1+me)/me/B[L+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?(me=1,ve=-Ee*ke/B[L+g]):(me=1,ve=-Ee*ke)),me>0&&(B[L+u]+=J*ve,B[L+c]+=fe*ve,B[Y+u]-=J*ve,B[Y+c]-=fe*ve);var mt,St,pt,Je,wt,rt;if(xe===!0)for(U=0;U Z&&(B[U+u]=B[U+u]*Z/mt,B[U+c]=B[U+c]*Z/mt),St=B[U+g]*Math.sqrt((B[U+f]-B[U+u])*(B[U+f]-B[U+u])+(B[U+p]-B[U+c])*(B[U+p]-B[U+c])),pt=Math.sqrt((B[U+f]+B[U+u])*(B[U+f]+B[U+u])+(B[U+p]+B[U+c])*(B[U+p]+B[U+c]))/2,Je=.1*Math.log(1+pt)/(1+Math.sqrt(St)),wt=B[U+i]+B[U+u]*(Je/G.slowDown),B[U+i]=wt,rt=B[U+l]+B[U+c]*(Je/G.slowDown),B[U+l]=rt);else for(U=0;U 1&&we.has(ve))&&(B>1&&we.add(ve),Ee=c[Ie+e],fe=c[Ie+t],me=c[Ie+n],ie=Ee-Ce,ze=fe-J,Pe=Math.sqrt(ie*ie+ze*ze),he=Pe 0?(O[Ie]+=ie/Pe*(1+ke),z[Ie]+=ze/Pe*(1+ke)):(O[Ie]+=P*i(),z[Ie]+=W*i())));for(S=0,v=0;S 1&&Ee.has(he))&&(U>1&&Ee.add(he),me=b[fe+a],ie=b[fe+i],Pe=b[fe+l],Ne=me-ke,ee=ie-ve,ce=Math.sqrt(Ne*Ne+ee*ee),Re=ce 0?(H[fe]+=Ne/ce*(1+ze),q[fe]+=ee/ce*(1+ze)):(H[fe]+=G*f(),q[fe]+=B*f())));for(x=0,T=0;x=0;)g=Hx(e,t,n,r,f+1,i+1,l),g>p&&(f===a?g*=nN:oJ.test(e.charAt(f-1))?(g*=tJ,m=e.slice(a,f-1).match(iJ),m&&a>0&&(g*=Math.pow(nm,m.length))):lJ.test(e.charAt(f-1))?(g*=eJ,S=e.slice(a,f-1).match(N3),S&&a>0&&(g*=Math.pow(nm,S.length))):(g*=nJ,a>0&&(g*=Math.pow(nm,f-a))),e.charAt(f)!==t.charAt(i)&&(g*=rJ)),(g g&&(g=b*tm)),g>p&&(p=g),f=n.indexOf(c,f+1);return l[u]=p,p}function rN(e){return e.toLowerCase().replace(N3," ")}function sJ(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Hx(e,t,rN(e),rN(t),0,0,{})}var rm={exports:{}},am={};/** +`);return a}var Wj=.25,wee={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:Wj},Yj=WebGLRenderingContext,hN=Yj.UNSIGNED_BYTE,di=Yj.FLOAT;function U0(e){var t=sf(sf({},wee),e||{}),n=t,r=n.arrowHead,a=n.curvatureAttribute,i=n.drawLabel,s=(r==null?void 0:r.extremity)==="target"||(r==null?void 0:r.extremity)==="both",u=(r==null?void 0:r.extremity)==="source"||(r==null?void 0:r.extremity)==="both",c=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(Jh(r?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(d){pee(p,d);function p(){var g;lee(this,p);for(var m=arguments.length,b=new Array(m),S=0;S {const n=this.nodeIdMap[t];if(n!==void 0)return this.nodes[n]});Ta(this,"getEdge",(t,n=!0)=>{const r=n?this.edgeDynamicIdMap[t]:this.edgeIdMap[t];if(r!==void 0)return this.edges[r]});Ta(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let t=0;t ({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,isFetching:!1,shouldRender:!1,graphDataFetchAttempted:!1,labelsFetchAttempted:!1,rawGraph:null,sigmaGraph:null,graphLabels:["*"],allDatabaseLabels:["*"],refreshLayout:()=>{const n=t().sigmaGraph;n&&(t().clearSelection(),t().setSigmaGraph(null),setTimeout(()=>{t().setSigmaGraph(n)},10))},setIsFetching:n=>e({isFetching:n}),setShouldRender:n=>e({shouldRender:n}),setSelectedNode:(n,r)=>e({selectedNode:n,moveToSelectedNode:r}),setFocusedNode:n=>e({focusedNode:n}),setSelectedEdge:n=>e({selectedEdge:n}),setFocusedEdge:n=>e({focusedEdge:n}),clearSelection:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{const n=t().sigmaGraph;n&&Array.from(n.nodes()).forEach(a=>n.dropNode(a)),e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,graphLabels:["*"],moveToSelectedNode:!1,shouldRender:!1})},setRawGraph:n=>e({rawGraph:n}),setSigmaGraph:n=>{e({sigmaGraph:n})},setGraphLabels:n=>e({graphLabels:n}),setAllDatabaseLabels:n=>e({allDatabaseLabels:n}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const n=await J8();e({allDatabaseLabels:["*",...n]});return}catch(n){throw console.error("Failed to fetch all database labels:",n),e({allDatabaseLabels:["*"]}),n}},setMoveToSelectedNode:n=>e({moveToSelectedNode:n}),setGraphDataFetchAttempted:n=>e({graphDataFetchAttempted:n}),setLabelsFetchAttempted:n=>e({labelsFetchAttempted:n})})),Je=Wk(Aee),_ee=({node:e,move:t})=>{const n=Er(),{gotoNode:r}=Lj();return T.useEffect(()=>(t?(e?(n.getGraph().setNodeAttribute(e,"highlighted",!0),r(e)):(n.setCustomBBox(null),n.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0})),Je.getState().setMoveToSelectedNode(!1)):e&&n.getGraph().setNodeAttribute(e,"highlighted",!0),()=>{e&&n.getGraph().setNodeAttribute(e,"highlighted",!1)}),[e,t,n,r]),null};function Gs(e,t){const n=Er(),r=T.useRef(t);return Mu(r.current,t)||(r.current=t),{positions:T.useCallback(()=>r.current?e(n.getGraph(),r.current):{},[n,r,e]),assign:T.useCallback(()=>{r.current&&e.assign(n.getGraph(),r.current)},[n,r,e])}}function j0(e,t){const n=Er(),[r,a]=T.useState(!1),[i,s]=T.useState(null),u=T.useRef(t);return Mu(u.current,t)||(u.current=t),T.useEffect(()=>{a(!1);let c=null;return u.current&&(c=new e(n.getGraph(),u.current)),s(c),()=>{c!==null&&c.kill()}},[n,u,s,a,e]),{stop:T.useCallback(()=>{i&&(i.stop(),a(!1))},[i,a]),start:T.useCallback(()=>{i&&(i.start(),a(!0))},[i,a]),kill:T.useCallback(()=>{i&&i.kill(),a(!1)},[i,a]),isRunning:r}}var em,mN;function Fu(){if(mN)return em;mN=1;function e(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function t(n,r){n=n||{};var a={};for(var i in r){var s=n[i],u=r[i];if(!e(u)){a[i]=t(s,u);continue}s===void 0?a[i]=u:a[i]=s}return a}return em=t,em}var tm,bN;function Ree(){if(bN)return tm;bN=1;function e(n){return function(r,a){return r+Math.floor(n()*(a-r+1))}}var t=e(Math.random);return t.createRandom=e,tm=t,tm}var nm,yN;function Cee(){if(yN)return nm;yN=1;var e=Ree().createRandom;function t(r){var a=e(r);return function(i){for(var s=i.length,u=s-1,c=-1;++c 0},a.prototype.addChild=function(C,F){this.children[C]=F,++this.countChildren},a.prototype.getChild=function(C){if(!this.children.hasOwnProperty(C)){var F=new a;this.children[C]=F,++this.countChildren}return this.children[C]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var C=this;for(var F in C.children){var I=C.children[F];I.x+=C.x,I.y+=C.y,I.applyPositionToChildren()}}};function i(C,F,I){for(var L in F.children){var H=F.children[L];H.hasChildren()?i(C,H,I):I[H.id]={x:H.x,y:H.y}}}function s(C,F){var I=C.r-F.r,L=F.x-C.x,H=F.y-C.y;return I<0||I*I0&&I*I>L*L+H*H}function c(C,F){for(var I=0;I Y?(H=(j+Y-$)/(2*j),W=Math.sqrt(Math.max(0,Y/j-H*H)),I.x=C.x-H*L-W*U,I.y=C.y-H*U+W*L):(H=(j+$-Y)/(2*j),W=Math.sqrt(Math.max(0,$/j-H*H)),I.x=F.x+H*L-W*U,I.y=F.y+H*U+W*L)):(I.x=F.x+I.r,I.y=F.y)}function R(C,F){var I=C.r+F.r-1e-6,L=F.x-C.x,H=F.y-C.y;return I>0&&I*I>L*L+H*H}function x(C,F){var I=C.length;if(I===0)return 0;var L,H,$,U,W,Y,j,G,z,K;if(L=C[0],L.x=0,L.y=0,I<=1)return L.r;if(H=C[1],L.x=-H.r,H.x=L.r,H.y=0,I<=2)return L.r+H.r;$=C[2],k(H,L,$),L=new a(null,null,null,null,L),H=new a(null,null,null,null,H),$=new a(null,null,null,null,$),L.next=$.previous=H,H.next=L.previous=$,$.next=H.previous=L;e:for(Y=3;Y"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(d,p){return u(d.getNodeAttributes(p))},i.fromEntry=function(d,p){return u(p)}):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},i.fromGraph=function(d,p){return s(r(p,d.getNodeAttributes(p)))},i.fromEntry=function(d,p){return s(r(d,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c),i}function n(r,a){var i={},s=function(d){return typeof d>"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(d,p){return u(d.getEdgeAttributes(p))},i.fromEntry=function(d,p){return u(p)},i.fromPartialEntry=i.fromEntry,i.fromMinimalEntry=i.fromEntry):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},i.fromGraph=function(d,p){var g=d.extremities(p);return s(r(p,d.getEdgeAttributes(p),g[0],g[1],d.getNodeAttributes(g[0]),d.getNodeAttributes(g[1]),d.isUndirected(p)))},i.fromEntry=function(d,p,g,m,b,S,v){return s(r(d,p,g,m,b,S,v))},i.fromPartialEntry=function(d,p,g,m){return s(r(d,p,g,m))},i.fromMinimalEntry=function(d,p){return s(r(d,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c,i.fromMinimalEntry=c),i}return Xl.createNodeValueGetter=t,Xl.createEdgeValueGetter=n,Xl.createEdgeWeightGetter=function(r){return n(r,e)},Xl}var im,wN;function Kj(){if(wN)return im;wN=1;const{createNodeValueGetter:e,createEdgeValueGetter:t}=G0();return im=function(r,a,i){const{nodeXAttribute:s,nodeYAttribute:u}=i,{attraction:c,repulsion:d,gravity:p,inertia:g,maxMove:m}=i.settings;let{shouldSkipNode:b,shouldSkipEdge:S,isNodeFixed:v}=i;v=e(v),b=e(b,!1),S=t(S,!1);const k=r.filterNodes((A,N)=>!b.fromEntry(A,N)),R=k.length;for(let A=0;A {if(O===_||b.fromEntry(O,C)||b.fromEntry(_,F)||S.fromEntry(A,N,O,_,C,F,I))return;const L=a[O],H=a[_],$=H.x-L.x,U=H.y-L.y,W=Math.sqrt($*$+U*U)||1,Y=c*W*$,j=c*W*U;L.dx+=Y,L.dy+=j,H.dx-=Y,H.dy-=j}),p)for(let A=0;A m&&(O.dx*=m/_,O.dy*=m/_),v.fromGraph(r,N)?O.fixed=!0:(O.x+=O.dx,O.y+=O.dy,O.fixed=!1)}return{converged:x}},im}var pd={},xN;function Xj(){return xN||(xN=1,pd.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((i,s)=>{const u=t[i];return!u||u.fixed||(s[r]=u.x,s[a]=u.y),s},{attributes:["x","y"]})},pd.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),pd}var om,kN;function Zj(){return kN||(kN=1,om={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),om}var sm,TN;function zee(){if(TN)return sm;TN=1;const e=ra(),t=Fu(),n=Kj(),r=Xj(),a=Zj();function i(u,c,d){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof d=="number"?d={maxIterations:d}:d=d||{};const p=d.maxIterations;if(d=t(d,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let m=null,b;for(b=0;b this.runFrame())},i.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},i.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},i.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},lm=i,lm}var Gee=jee();const Hee=ln(Gee);function $ee(e={maxIterations:100}){return Gs(Uee,e)}function qee(e={}){return j0(Hee,e)}var um,_N;function Vee(){if(_N)return um;_N=1;var e=0,t=1,n=2,r=3,a=4,i=5,s=6,u=7,c=8,d=9,p=0,g=1,m=2,b=0,S=1,v=2,k=3,R=4,x=5,A=6,N=7,O=8,_=3,C=10,F=3,I=9,L=10;return um=function($,U,W){var Y,j,G,z,K,D,V,B,M,X,Q=U.length,le=W.length,re=$.adjustSizes,se=$.barnesHutTheta*$.barnesHutTheta,Te,ae,we,xe,Ie,Ce,Ee,J=[];for(G=0;G
Ne?(me-=(he-Ne)/2,ve=me+he):(fe-=(Ne-he)/2,ke=fe+Ne),J[0+b]=-1,J[0+S]=(fe+ke)/2,J[0+v]=(me+ve)/2,J[0+k]=Math.max(ke-fe,ve-me),J[0+R]=-1,J[0+x]=-1,J[0+A]=0,J[0+N]=0,J[0+O]=0,Y=1,G=0;G=0){U[G+e]=0)if(Ce=Math.pow(U[G+e]-J[j+N],2)+Math.pow(U[G+t]-J[j+O],2),X=J[j+k],4*X*X/Ce 0?(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*J[j+A]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee),j=J[j+R],j<0)break;continue}else{j=J[j+x];continue}else{if(D=J[j+b],D>=0&&D!==G&&(we=U[G+e]-U[D+e],xe=U[G+t]-U[D+t],Ce=we*we+xe*xe,re===!0?Ce>0?(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*U[D+s]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee)),j=J[j+R],j<0)break;continue}else for(ae=$.scalingRatio,z=0;z 0?(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee):Ce<0&&(Ee=100*ae*U[z+s]*U[K+s],U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee)):(Ce=Math.sqrt(we*we+xe*xe),Ce>0&&(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee));for(M=$.gravity/$.scalingRatio,ae=$.scalingRatio,G=0;G0&&(Ee=ae*U[G+s]*M):Ce>0&&(Ee=ae*U[G+s]*M/Ce),U[G+n]-=we*Ee,U[G+r]-=xe*Ee;for(ae=1*($.outboundAttractionDistribution?Te:1),V=0;V0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie/U[z+s]):Ce>0&&(Ee=-ae*Ie)):(Ce=Math.sqrt(Math.pow(we,2)+Math.pow(xe,2)),$.linLogMode?$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?(Ce=1,Ee=-ae*Ie/U[z+s]):(Ce=1,Ee=-ae*Ie)),Ce>0&&(U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee);var ee,ce,Re,Fe,Ve,yt;if(re===!0)for(G=0;G L&&(U[G+n]=U[G+n]*L/ee,U[G+r]=U[G+r]*L/ee),ce=U[G+s]*Math.sqrt((U[G+a]-U[G+n])*(U[G+a]-U[G+n])+(U[G+i]-U[G+r])*(U[G+i]-U[G+r])),Re=Math.sqrt((U[G+a]+U[G+n])*(U[G+a]+U[G+n])+(U[G+i]+U[G+r])*(U[G+i]+U[G+r]))/2,Fe=.1*Math.log(1+Re)/(1+Math.sqrt(ce)),Ve=U[G+e]+U[G+n]*(Fe/$.slowDown),U[G+e]=Ve,yt=U[G+t]+U[G+r]*(Fe/$.slowDown),U[G+t]=yt);else for(G=0;G=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},_a.graphToByteArrays=function(n,r){var a=n.order,i=n.size,s={},u,c=new Float32Array(a*e),d=new Float32Array(i*t);return u=0,n.forEachNode(function(p,g){s[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,m,b,S,v,k){var R=s[m],x=s[b],A=r(p,g,m,b,S,v,k);c[R+6]+=A,c[x+6]+=A,d[u]=R,d[u+1]=x,d[u+2]=A,u+=t}),{nodes:c,edges:d}},_a.assignLayoutChanges=function(n,r,a){var i=0;n.updateEachNodeAttributes(function(s,u){return u.x=r[i],u.y=r[i+1],i+=e,a?a(s,u):u})},_a.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(i,s){r[a]=s.x,r[a+1]=s.y,a+=e})},_a.collectLayoutChanges=function(n,r,a){for(var i=n.nodes(),s={},u=0,c=0,d=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(d)}}var u=i.bind(null,!1);return u.assign=i.bind(null,!0),u.inferSettings=s,dm=u,dm}var Yee=Wee();const Kee=ln(Yee);var fm,ON;function Xee(){return ON||(ON=1,fm=function(){var t,n,r={};(function(){var i=0,s=1,u=2,c=3,d=4,p=5,g=6,m=7,b=8,S=9,v=0,k=1,R=2,x=0,A=1,N=2,O=3,_=4,C=5,F=6,I=7,L=8,H=3,$=10,U=3,W=9,Y=10;r.exports=function(G,z,K){var D,V,B,M,X,Q,le,re,se,Te,ae=z.length,we=K.length,xe=G.adjustSizes,Ie=G.barnesHutTheta*G.barnesHutTheta,Ce,Ee,J,fe,ke,me,ve,oe=[];for(B=0;B Ve?(he-=(Fe-Ve)/2,Ne=he+Fe):(Pe-=(Ve-Fe)/2,ze=Pe+Ve),oe[0+x]=-1,oe[0+A]=(Pe+ze)/2,oe[0+N]=(he+Ne)/2,oe[0+O]=Math.max(ze-Pe,Ne-he),oe[0+_]=-1,oe[0+C]=-1,oe[0+F]=0,oe[0+I]=0,oe[0+L]=0,D=1,B=0;B =0){z[B+i] =0)if(me=Math.pow(z[B+i]-oe[V+I],2)+Math.pow(z[B+s]-oe[V+L],2),Te=oe[V+O],4*Te*Te/me 0?(ve=Ee*z[B+g]*oe[V+F]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*oe[V+F]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*oe[V+F]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve),V=oe[V+_],V<0)break;continue}else{V=oe[V+C];continue}else{if(Q=oe[V+x],Q>=0&&Q!==B&&(J=z[B+i]-z[Q+i],fe=z[B+s]-z[Q+s],me=J*J+fe*fe,xe===!0?me>0?(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*z[Q+g]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve)),V=oe[V+_],V<0)break;continue}else for(Ee=G.scalingRatio,M=0;M 0?(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve):me<0&&(ve=100*Ee*z[M+g]*z[X+g],z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve)):(me=Math.sqrt(J*J+fe*fe),me>0&&(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve));for(se=G.gravity/G.scalingRatio,Ee=G.scalingRatio,B=0;B 0&&(ve=Ee*z[B+g]*se):me>0&&(ve=Ee*z[B+g]*se/me),z[B+u]-=J*ve,z[B+c]-=fe*ve;for(Ee=1*(G.outboundAttractionDistribution?Ce:1),le=0;le 0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke/z[M+g]):me>0&&(ve=-Ee*ke)):(me=Math.sqrt(Math.pow(J,2)+Math.pow(fe,2)),G.linLogMode?G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?(me=1,ve=-Ee*ke/z[M+g]):(me=1,ve=-Ee*ke)),me>0&&(z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve);var yt,wt,ht,et,xt,it;if(xe===!0)for(B=0;B Y&&(z[B+u]=z[B+u]*Y/yt,z[B+c]=z[B+c]*Y/yt),wt=z[B+g]*Math.sqrt((z[B+d]-z[B+u])*(z[B+d]-z[B+u])+(z[B+p]-z[B+c])*(z[B+p]-z[B+c])),ht=Math.sqrt((z[B+d]+z[B+u])*(z[B+d]+z[B+u])+(z[B+p]+z[B+c])*(z[B+p]+z[B+c]))/2,et=.1*Math.log(1+ht)/(1+Math.sqrt(wt)),xt=z[B+i]+z[B+u]*(et/G.slowDown),z[B+i]=xt,it=z[B+s]+z[B+c]*(et/G.slowDown),z[B+s]=it);else for(B=0;B 1&&we.has(ve))&&(z>1&&we.add(ve),Ee=c[Ie+e],fe=c[Ie+t],me=c[Ie+n],oe=Ee-Ce,Pe=fe-J,ze=Math.sqrt(oe*oe+Pe*Pe),he=ze 0?(C[Ie]+=oe/ze*(1+ke),F[Ie]+=Pe/ze*(1+ke)):(C[Ie]+=U*i(),F[Ie]+=W*i())));for(S=0,v=0;S 1&&Ee.has(he))&&(B>1&&Ee.add(he),me=m[fe+a],oe=m[fe+i],ze=m[fe+s],Ne=me-ke,ee=oe-ve,ce=Math.sqrt(Ne*Ne+ee*ee),Re=ce 0?(H[fe]+=Ne/ce*(1+Pe),$[fe]+=ee/ce*(1+Pe)):(H[fe]+=G*d(),$[fe]+=z*d())));for(x=0,A=0;x=0;)g=yk(e,t,n,r,d+1,i+1,s),g>p&&(d===a?g*=UN:Ste.test(e.charAt(d-1))?(g*=mte,b=e.slice(a,d-1).match(Ete),b&&a>0&&(g*=Math.pow(Em,b.length))):wte.test(e.charAt(d-1))?(g*=hte,S=e.slice(a,d-1).match(r4),S&&a>0&&(g*=Math.pow(Em,S.length))):(g*=bte,a>0&&(g*=Math.pow(Em,d-a))),e.charAt(d)!==t.charAt(i)&&(g*=yte)),(g g&&(g=m*Sm)),g>p&&(p=g),d=n.indexOf(c,d+1);return s[u]=p,p}function jN(e){return e.toLowerCase().replace(r4," ")}function xte(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,yk(e,t,jN(e),jN(t),0,0,{})}var wm={exports:{}},xm={};/** * @license React * use-sync-external-store-shim.production.js * @@ -1037,29 +1070,18 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var aN;function uJ(){if(aN)return am;aN=1;var e=nf();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(g,b){var m=b(),S=r({inst:{value:m,getSnapshot:b}}),v=S[0].inst,A=S[1];return i(function(){v.value=m,v.getSnapshot=b,c(v)&&A({inst:v})},[g,m,b]),a(function(){return c(v)&&A({inst:v}),g(function(){c(v)&&A({inst:v})})},[g]),l(m),m}function c(g){var b=g.getSnapshot;g=g.value;try{var m=b();return!n(g,m)}catch{return!0}}function f(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return am.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,am}var oN;function cJ(){return oN||(oN=1,rm.exports=uJ()),rm.exports}var dJ=cJ(),Hs='[cmdk-group=""]',om='[cmdk-group-items=""]',fJ='[cmdk-group-heading=""]',w0='[cmdk-item=""]',iN=`${w0}:not([aria-disabled="true"])`,$x="cmdk-item-select",Qo="data-value",pJ=(e,t,n)=>sJ(e,t,n),O3=k.createContext(void 0),ku=()=>k.useContext(O3),D3=k.createContext(void 0),x0=()=>k.useContext(D3),I3=k.createContext(void 0),L3=k.forwardRef((e,t)=>{let n=ol(()=>{var U,L;return{search:"",value:(L=(U=e.value)!=null?U:e.defaultValue)!=null?L:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=ol(()=>new Set),a=ol(()=>new Map),i=ol(()=>new Map),l=ol(()=>new Set),u=M3(e),{label:c,children:f,value:p,onValueChange:g,filter:b,shouldFilter:m,loop:S,disablePointerSelection:v=!1,vimBindings:A=!0,...R}=e,x=En(),T=En(),C=En(),N=k.useRef(null),_=kJ();ii(()=>{if(p!==void 0){let U=p.trim();n.current.value=U,O.emit()}},[p]),ii(()=>{_(6,P)},[]);let O=k.useMemo(()=>({subscribe:U=>(l.current.add(U),()=>l.current.delete(U)),snapshot:()=>n.current,setState:(U,L,Y)=>{var Q,se,re;if(!Object.is(n.current[U],L)){if(n.current[U]=L,U==="search")q(),M(),_(1,H);else if(U==="value"&&(Y||_(5,P),((Q=u.current)==null?void 0:Q.value)!==void 0)){let le=L??"";(re=(se=u.current).onValueChange)==null||re.call(se,le);return}O.emit()}},emit:()=>{l.current.forEach(U=>U())}}),[]),z=k.useMemo(()=>({value:(U,L,Y)=>{var Q;L!==((Q=i.current.get(U))==null?void 0:Q.value)&&(i.current.set(U,{value:L,keywords:Y}),n.current.filtered.items.set(U,I(L,Y)),_(2,()=>{M(),O.emit()}))},item:(U,L)=>(r.current.add(U),L&&(a.current.has(L)?a.current.get(L).add(U):a.current.set(L,new Set([U]))),_(3,()=>{q(),M(),n.current.value||H(),O.emit()}),()=>{i.current.delete(U),r.current.delete(U),n.current.filtered.items.delete(U);let Y=W();_(4,()=>{q(),(Y==null?void 0:Y.getAttribute("id"))===U&&H(),O.emit()})}),group:U=>(a.current.has(U)||a.current.set(U,new Set),()=>{i.current.delete(U),a.current.delete(U)}),filter:()=>u.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:x,inputId:C,labelId:T,listInnerRef:N}),[]);function I(U,L){var Y,Q;let se=(Q=(Y=u.current)==null?void 0:Y.filter)!=null?Q:pJ;return U?se(U,n.current.search,L):0}function M(){if(!n.current.search||u.current.shouldFilter===!1)return;let U=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(Q=>{let se=a.current.get(Q),re=0;se.forEach(le=>{let Ae=U.get(le);re=Math.max(Ae,re)}),L.push([Q,re])});let Y=N.current;Z().sort((Q,se)=>{var re,le;let Ae=Q.getAttribute("id"),ae=se.getAttribute("id");return((re=U.get(ae))!=null?re:0)-((le=U.get(Ae))!=null?le:0)}).forEach(Q=>{let se=Q.closest(om);se?se.appendChild(Q.parentElement===se?Q:Q.closest(`${om} > *`)):Y.appendChild(Q.parentElement===Y?Q:Q.closest(`${om} > *`))}),L.sort((Q,se)=>se[1]-Q[1]).forEach(Q=>{var se;let re=(se=N.current)==null?void 0:se.querySelector(`${Hs}[${Qo}="${encodeURIComponent(Q[0])}"]`);re==null||re.parentElement.appendChild(re)})}function H(){let U=Z().find(Y=>Y.getAttribute("aria-disabled")!=="true"),L=U==null?void 0:U.getAttribute(Qo);O.setState("value",L||void 0)}function q(){var U,L,Y,Q;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let se=0;for(let re of r.current){let le=(L=(U=i.current.get(re))==null?void 0:U.value)!=null?L:"",Ae=(Q=(Y=i.current.get(re))==null?void 0:Y.keywords)!=null?Q:[],ae=I(le,Ae);n.current.filtered.items.set(re,ae),ae>0&&se++}for(let[re,le]of a.current)for(let Ae of le)if(n.current.filtered.items.get(Ae)>0){n.current.filtered.groups.add(re);break}n.current.filtered.count=se}function P(){var U,L,Y;let Q=W();Q&&(((U=Q.parentElement)==null?void 0:U.firstChild)===Q&&((Y=(L=Q.closest(Hs))==null?void 0:L.querySelector(fJ))==null||Y.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function W(){var U;return(U=N.current)==null?void 0:U.querySelector(`${w0}[aria-selected="true"]`)}function Z(){var U;return Array.from(((U=N.current)==null?void 0:U.querySelectorAll(iN))||[])}function j(U){let L=Z()[U];L&&O.setState("value",L.getAttribute(Qo))}function G(U){var L;let Y=W(),Q=Z(),se=Q.findIndex(le=>le===Y),re=Q[se+U];(L=u.current)!=null&&L.loop&&(re=se+U<0?Q[Q.length-1]:se+U===Q.length?Q[0]:Q[se+U]),re&&O.setState("value",re.getAttribute(Qo))}function B(U){let L=W(),Y=L==null?void 0:L.closest(Hs),Q;for(;Y&&!Q;)Y=U>0?wJ(Y,Hs):xJ(Y,Hs),Q=Y==null?void 0:Y.querySelector(iN);Q?O.setState("value",Q.getAttribute(Qo)):G(U)}let X=()=>j(Z().length-1),D=U=>{U.preventDefault(),U.metaKey?X():U.altKey?B(1):G(1)},V=U=>{U.preventDefault(),U.metaKey?j(0):U.altKey?B(-1):G(-1)};return k.createElement(Xe.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:U=>{var L;if((L=R.onKeyDown)==null||L.call(R,U),!U.defaultPrevented)switch(U.key){case"n":case"j":{A&&U.ctrlKey&&D(U);break}case"ArrowDown":{D(U);break}case"p":case"k":{A&&U.ctrlKey&&V(U);break}case"ArrowUp":{V(U);break}case"Home":{U.preventDefault(),j(0);break}case"End":{U.preventDefault(),X();break}case"Enter":if(!U.nativeEvent.isComposing&&U.keyCode!==229){U.preventDefault();let Y=W();if(Y){let Q=new Event($x);Y.dispatchEvent(Q)}}}}},k.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:TJ},c),Nf(e,U=>k.createElement(D3.Provider,{value:O},k.createElement(O3.Provider,{value:z},U))))}),gJ=k.forwardRef((e,t)=>{var n,r;let a=En(),i=k.useRef(null),l=k.useContext(I3),u=ku(),c=M3(e),f=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:l==null?void 0:l.forceMount;ii(()=>{if(!f)return u.item(a,l==null?void 0:l.id)},[f]);let p=F3(a,i,[e.value,e.children,i],e.keywords),g=x0(),b=li(_=>_.value&&_.value===p.current),m=li(_=>f||u.filter()===!1?!0:_.search?_.filtered.items.get(a)>0:!0);k.useEffect(()=>{let _=i.current;if(!(!_||e.disabled))return _.addEventListener($x,S),()=>_.removeEventListener($x,S)},[m,e.onSelect,e.disabled]);function S(){var _,O;v(),(O=(_=c.current).onSelect)==null||O.call(_,p.current)}function v(){g.setState("value",p.current,!0)}if(!m)return null;let{disabled:A,value:R,onSelect:x,forceMount:T,keywords:C,...N}=e;return k.createElement(Xe.div,{ref:ru([i,t]),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!b,"data-disabled":!!A,"data-selected":!!b,onPointerMove:A||u.getDisablePointerSelection()?void 0:v,onClick:A?void 0:S},e.children)}),hJ=k.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...i}=e,l=En(),u=k.useRef(null),c=k.useRef(null),f=En(),p=ku(),g=li(m=>a||p.filter()===!1?!0:m.search?m.filtered.groups.has(l):!0);ii(()=>p.group(l),[]),F3(l,u,[e.value,e.heading,c]);let b=k.useMemo(()=>({id:l,forceMount:a}),[a]);return k.createElement(Xe.div,{ref:ru([u,t]),...i,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&k.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),Nf(e,m=>k.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},k.createElement(I3.Provider,{value:b},m))))}),mJ=k.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=k.useRef(null),i=li(l=>!l.search);return!n&&!i?null:k.createElement(Xe.div,{ref:ru([a,t]),...r,"cmdk-separator":"",role:"separator"})}),bJ=k.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,i=x0(),l=li(p=>p.search),u=li(p=>p.value),c=ku(),f=k.useMemo(()=>{var p;let g=(p=c.listInnerRef.current)==null?void 0:p.querySelector(`${w0}[${Qo}="${encodeURIComponent(u)}"]`);return g==null?void 0:g.getAttribute("id")},[]);return k.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),k.createElement(Xe.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":f,id:c.inputId,type:"text",value:a?e.value:l,onChange:p=>{a||i.setState("search",p.target.value),n==null||n(p.target.value)}})}),yJ=k.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,i=k.useRef(null),l=k.useRef(null),u=ku();return k.useEffect(()=>{if(l.current&&i.current){let c=l.current,f=i.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let b=c.offsetHeight;f.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(p),g.unobserve(c)}}},[]),k.createElement(Xe.div,{ref:ru([i,t]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:u.listId},Nf(e,c=>k.createElement("div",{ref:ru([l,u.listInnerRef]),"cmdk-list-sizer":""},c)))}),vJ=k.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:i,container:l,...u}=e;return k.createElement(Bk,{open:n,onOpenChange:r},k.createElement(Uk,{container:l},k.createElement(gf,{"cmdk-overlay":"",className:a}),k.createElement(hf,{"aria-label":e.label,"cmdk-dialog":"",className:i},k.createElement(L3,{ref:t,...u}))))}),SJ=k.forwardRef((e,t)=>li(n=>n.filtered.count===0)?k.createElement(Xe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),EJ=k.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...i}=e;return k.createElement(Xe.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Nf(e,l=>k.createElement("div",{"aria-hidden":!0},l)))}),jn=Object.assign(L3,{List:yJ,Item:gJ,Input:bJ,Group:hJ,Separator:mJ,Dialog:vJ,Empty:SJ,Loading:EJ});function wJ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function xJ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function M3(e){let t=k.useRef(e);return ii(()=>{t.current=e}),t}var ii=typeof window>"u"?k.useEffect:k.useLayoutEffect;function ol(e){let t=k.useRef();return t.current===void 0&&(t.current=e()),t}function ru(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function li(e){let t=x0(),n=()=>e(t.snapshot());return dJ.useSyncExternalStore(t.subscribe,n,n)}function F3(e,t,n,r=[]){let a=k.useRef(),i=ku();return ii(()=>{var l;let u=(()=>{var f;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(f=p.current.textContent)==null?void 0:f.trim():a.current}})(),c=r.map(f=>f.trim());i.value(e,u,c),(l=t.current)==null||l.setAttribute(Qo,u),a.current=u}),a}var kJ=()=>{let[e,t]=k.useState(),n=ol(()=>new Map);return ii(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function AJ(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Nf({asChild:e,children:t},n){return e&&k.isValidElement(t)?k.cloneElement(AJ(t),{ref:t.ref},n(t.props.children)):n(t)}var TJ={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const z3=Bk,P3=GP,_J=Uk,B3=k.forwardRef(({className:e,...t},n)=>w.jsx(gf,{ref:n,className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...t}));B3.displayName=gf.displayName;const k0=k.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(_J,{children:[w.jsx(B3,{}),w.jsxs(hf,{ref:r,className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...n,children:[t,w.jsxs(Hk,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[w.jsx(dP,{className:"h-4 w-4"}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));k0.displayName=hf.displayName;const A0=({className:e,...t})=>w.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});A0.displayName="DialogHeader";const T0=k.forwardRef(({className:e,...t},n)=>w.jsx(jk,{ref:n,className:Me("text-lg leading-none font-semibold tracking-tight",e),...t}));T0.displayName=jk.displayName;const _0=k.forwardRef(({className:e,...t},n)=>w.jsx(Gk,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));_0.displayName=Gk.displayName;const Of=k.forwardRef(({className:e,...t},n)=>w.jsx(jn,{ref:n,className:Me("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t}));Of.displayName=jn.displayName;const R0=k.forwardRef(({className:e,...t},n)=>w.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[w.jsx(r8,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),w.jsx(jn.Input,{ref:n,className:Me("placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));R0.displayName=jn.Input.displayName;const Df=k.forwardRef(({className:e,...t},n)=>w.jsx(jn.List,{ref:n,className:Me("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...t}));Df.displayName=jn.List.displayName;const C0=k.forwardRef((e,t)=>w.jsx(jn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));C0.displayName=jn.Empty.displayName;const Ml=k.forwardRef(({className:e,...t},n)=>w.jsx(jn.Group,{ref:n,className:Me("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t}));Ml.displayName=jn.Group.displayName;const RJ=k.forwardRef(({className:e,...t},n)=>w.jsx(jn.Separator,{ref:n,className:Me("bg-border -mx-1 h-px",e),...t}));RJ.displayName=jn.Separator.displayName;const Fl=k.forwardRef(({className:e,...t},n)=>w.jsx(jn.Item,{ref:n,className:Me("data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Fl.displayName=jn.Item.displayName;const CJ=({layout:e,autoRunFor:t})=>{const n=br(),{stop:r,start:a,isRunning:i}=e;return k.useEffect(()=>{if(!n)return;let l=null;return t!==void 0&&t>-1&&n.getGraph().order>0&&(a(),l=t>0?window.setTimeout(()=>{r()},t):null),()=>{r(),l&&clearTimeout(l)}},[t,a,r,n]),w.jsx(Lt,{size:"icon",onClick:()=>i?r():a(),tooltip:i?"Stop the layout animation":"Start the layout animation",variant:Yr,children:i?w.jsx(Zq,{}):w.jsx(Jq,{})})},NJ=()=>{const e=br(),[t,n]=k.useState("Circular"),[r,a]=k.useState(!1),i=We.use.graphLayoutMaxIterations(),l=wQ(),u=yQ(),c=JQ(),f=YQ({settings:{margin:1}}),p=CQ({maxIterations:i}),g=_3({iterations:i}),b=KQ(),m=NQ(),S=BQ(),v=k.useMemo(()=>({Circular:{layout:l},Circlepack:{layout:u},Random:{layout:c},Noverlaps:{layout:f,worker:b},"Force Directed":{layout:p,worker:m},"Force Atlas":{layout:g,worker:S}}),[u,l,p,g,f,c,m,b,S]),A=k.useCallback(R=>{console.debug(R);const{positions:x}=v[R].layout;zX(e.getGraph(),x(),{duration:500}),n(R)},[v,e]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{children:v[t]&&"worker"in v[t]&&w.jsx(CJ,{layout:v[t].worker})}),w.jsx("div",{children:w.jsxs(kf,{open:r,onOpenChange:a,children:[w.jsx(Af,{asChild:!0,children:w.jsx(Lt,{size:"icon",variant:Yr,onClick:()=>a(R=>!R),tooltip:"Layout Graph",children:w.jsx(Uq,{})})}),w.jsx(yu,{side:"right",align:"center",className:"p-1",children:w.jsx(Of,{children:w.jsx(Df,{children:w.jsx(Ml,{children:Object.keys(v).map(R=>w.jsx(Fl,{onSelect:()=>{A(R)},className:"cursor-pointer text-xs",children:R},R))})})})})]})})]})};var Sd={exports:{}},OJ=Sd.exports,lN;function DJ(){return lN||(lN=1,function(e){(function(t,n,r){function a(c){var f=this,p=u();f.next=function(){var g=2091639*f.s0+f.c*23283064365386963e-26;return f.s0=f.s1,f.s1=f.s2,f.s2=g-(f.c=g|0)},f.c=1,f.s0=p(" "),f.s1=p(" "),f.s2=p(" "),f.s0-=p(c),f.s0<0&&(f.s0+=1),f.s1-=p(c),f.s1<0&&(f.s1+=1),f.s2-=p(c),f.s2<0&&(f.s2+=1),p=null}function i(c,f){return f.c=c.c,f.s0=c.s0,f.s1=c.s1,f.s2=c.s2,f}function l(c,f){var p=new a(c),g=f&&f.state,b=p.next;return b.int32=function(){return p.next()*4294967296|0},b.double=function(){return b()+(b()*2097152|0)*11102230246251565e-32},b.quick=b,g&&(typeof g=="object"&&i(g,p),b.state=function(){return i(p,{})}),b}function u(){var c=4022871197,f=function(p){p=String(p);for(var g=0;g >>0,b-=c,b*=c,c=b>>>0,b-=c,c+=b*4294967296}return(c>>>0)*23283064365386963e-26};return f}n&&n.exports?n.exports=l:this.alea=l})(OJ,e)}(Sd)),Sd.exports}var Ed={exports:{}},IJ=Ed.exports,sN;function LJ(){return sN||(sN=1,function(e){(function(t,n,r){function a(u){var c=this,f="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var g=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^g^g>>>8},u===(u|0)?c.x=u:f+=u;for(var p=0;p >>0)/4294967296};return g.double=function(){do var b=f.next()>>>11,m=(f.next()>>>0)/4294967296,S=(b+m)/(1<<21);while(S===0);return S},g.int32=f.next,g.quick=g,p&&(typeof p=="object"&&i(p,f),g.state=function(){return i(f,{})}),g}n&&n.exports?n.exports=l:this.xor128=l})(IJ,e)}(Ed)),Ed.exports}var wd={exports:{}},MJ=wd.exports,uN;function FJ(){return uN||(uN=1,function(e){(function(t,n,r){function a(u){var c=this,f="";c.next=function(){var g=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(g^g<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,u===(u|0)?c.x=u:f+=u;for(var p=0;p >>4),c.next()}function i(u,c){return c.x=u.x,c.y=u.y,c.z=u.z,c.w=u.w,c.v=u.v,c.d=u.d,c}function l(u,c){var f=new a(u),p=c&&c.state,g=function(){return(f.next()>>>0)/4294967296};return g.double=function(){do var b=f.next()>>>11,m=(f.next()>>>0)/4294967296,S=(b+m)/(1<<21);while(S===0);return S},g.int32=f.next,g.quick=g,p&&(typeof p=="object"&&i(p,f),g.state=function(){return i(f,{})}),g}n&&n.exports?n.exports=l:this.xorwow=l})(MJ,e)}(wd)),wd.exports}var xd={exports:{}},zJ=xd.exports,cN;function PJ(){return cN||(cN=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.x,g=c.i,b,m;return b=p[g],b^=b>>>7,m=b^b<<24,b=p[g+1&7],m^=b^b>>>10,b=p[g+3&7],m^=b^b>>>3,b=p[g+4&7],m^=b^b<<7,b=p[g+7&7],b=b^b<<13,m^=b^b<<9,p[g]=m,c.i=g+1&7,m};function f(p,g){var b,m=[];if(g===(g|0))m[0]=g;else for(g=""+g,b=0;b 0;--b)p.next()}f(c,u)}function i(u,c){return c.x=u.x.slice(),c.i=u.i,c}function l(u,c){u==null&&(u=+new Date);var f=new a(u),p=c&&c.state,g=function(){return(f.next()>>>0)/4294967296};return g.double=function(){do var b=f.next()>>>11,m=(f.next()>>>0)/4294967296,S=(b+m)/(1<<21);while(S===0);return S},g.int32=f.next,g.quick=g,p&&(p.x&&i(p,f),g.state=function(){return i(f,{})}),g}n&&n.exports?n.exports=l:this.xorshift7=l})(zJ,e)}(xd)),xd.exports}var kd={exports:{}},BJ=kd.exports,dN;function UJ(){return dN||(dN=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.w,g=c.X,b=c.i,m,S;return c.w=p=p+1640531527|0,S=g[b+34&127],m=g[b=b+1&127],S^=S<<13,m^=m<<17,S^=S>>>15,m^=m>>>12,S=g[b]=S^m,c.i=b,S+(p^p>>>16)|0};function f(p,g){var b,m,S,v,A,R=[],x=128;for(g===(g|0)?(m=g,g=null):(g=g+"\0",m=0,x=Math.max(x,g.length)),S=0,v=-32;v >>15,m^=m<<4,m^=m>>>13,v>=0&&(A=A+1640531527|0,b=R[v&127]^=m+A,S=b==0?S+1:0);for(S>=128&&(R[(g&&g.length||0)&127]=-1),S=127,v=4*128;v>0;--v)m=R[S+34&127],b=R[S=S+1&127],m^=m<<13,b^=b<<17,m^=m>>>15,b^=b>>>12,R[S]=m^b;p.w=A,p.X=R,p.i=S}f(c,u)}function i(u,c){return c.i=u.i,c.w=u.w,c.X=u.X.slice(),c}function l(u,c){u==null&&(u=+new Date);var f=new a(u),p=c&&c.state,g=function(){return(f.next()>>>0)/4294967296};return g.double=function(){do var b=f.next()>>>11,m=(f.next()>>>0)/4294967296,S=(b+m)/(1<<21);while(S===0);return S},g.int32=f.next,g.quick=g,p&&(p.X&&i(p,f),g.state=function(){return i(f,{})}),g}n&&n.exports?n.exports=l:this.xor4096=l})(BJ,e)}(kd)),kd.exports}var Ad={exports:{}},jJ=Ad.exports,fN;function GJ(){return fN||(fN=1,function(e){(function(t,n,r){function a(u){var c=this,f="";c.next=function(){var g=c.b,b=c.c,m=c.d,S=c.a;return g=g<<25^g>>>7^b,b=b-m|0,m=m<<24^m>>>8^S,S=S-g|0,c.b=g=g<<20^g>>>12^b,c.c=b=b-m|0,c.d=m<<16^b>>>16^S,c.a=S-g|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,u===Math.floor(u)?(c.a=u/4294967296|0,c.b=u|0):f+=u;for(var p=0;p >>0)/4294967296};return g.double=function(){do var b=f.next()>>>11,m=(f.next()>>>0)/4294967296,S=(b+m)/(1<<21);while(S===0);return S},g.int32=f.next,g.quick=g,p&&(typeof p=="object"&&i(p,f),g.state=function(){return i(f,{})}),g}n&&n.exports?n.exports=l:this.tychei=l})(jJ,e)}(Ad)),Ad.exports}var Td={exports:{}};const HJ={},$J=Object.freeze(Object.defineProperty({__proto__:null,default:HJ},Symbol.toStringTag,{value:"Module"})),qJ=pH($J);var VJ=Td.exports,pN;function WJ(){return pN||(pN=1,function(e){(function(t,n,r){var a=256,i=6,l=52,u="random",c=r.pow(a,i),f=r.pow(2,l),p=f*2,g=a-1,b;function m(C,N,_){var O=[];N=N==!0?{entropy:!0}:N||{};var z=R(A(N.entropy?[C,T(n)]:C??x(),3),O),I=new S(O),M=function(){for(var H=I.g(i),q=c,P=0;H =p;)H/=2,q/=2,P>>>=1;return(H+P)/q};return M.int32=function(){return I.g(4)|0},M.quick=function(){return I.g(4)/4294967296},M.double=M,R(T(I.S),n),(N.pass||_||function(H,q,P,W){return W&&(W.S&&v(W,I),H.state=function(){return v(I,{})}),P?(r[u]=H,q):H})(M,z,"global"in N?N.global:this==r,N.state)}function S(C){var N,_=C.length,O=this,z=0,I=O.i=O.j=0,M=O.S=[];for(_||(C=[_++]);z{if(!e||!Array.isArray(e.nodes)||!Array.isArray(e.edges))return!1;for(const t of e.nodes)if(!t.id||!t.labels||!t.properties)return!1;for(const t of e.edges)if(!t.id||!t.source||!t.target)return!1;for(const t of e.edges){const n=e.getNode(t.source),r=e.getNode(t.target);if(n==null||r==null)return!1}return!0},QJ=async(e,t,n)=>{let r=null;try{r=await sq(e,t,n)}catch(i){return Pn.getState().setErrorMessage(Nr(i),"Query Graphs Error!"),null}let a=null;if(r){const i={},l={};for(let p=0;p 0){const p=A9-iR;for(const g of r.nodes)g.size=Math.round(iR+p*Math.pow((g.degree-u)/f,.5))}a=new cQ,a.nodes=r.nodes,a.edges=r.edges,a.nodeIdMap=i,a.edgeIdMap=l,ZJ(a)||(a=null,console.error("Invalid graph data")),console.log("Graph data loaded")}return a},JJ=e=>{const t=new nu;for(const n of(e==null?void 0:e.nodes)??[])t.addNode(n.id,{label:n.labels.join(", "),color:n.color,x:n.x,y:n.y,size:n.size,borderColor:E9,borderSize:.2});for(const n of(e==null?void 0:e.edges)??[])n.dynamicId=t.addDirectedEdge(n.source,n.target,{label:n.type||void 0});return t},Ji={label:"",maxQueryDepth:0,minDegree:0},U3=()=>{const e=We.use.queryLabel(),t=Et.use.rawGraph(),n=Et.use.sigmaGraph(),r=We.use.graphQueryMaxDepth(),a=We.use.graphMinDegree(),i=k.useCallback(c=>(t==null?void 0:t.getNode(c))||null,[t]),l=k.useCallback((c,f=!0)=>(t==null?void 0:t.getEdge(c,f))||null,[t]);return k.useEffect(()=>{if(e){if(Ji.label!==e||Ji.maxQueryDepth!==r||Ji.minDegree!==a){Ji.label=e,Ji.maxQueryDepth=r,Ji.minDegree=a;const c=Et.getState();c.reset(),QJ(e,r,a).then(f=>{c.setSigmaGraph(JJ(f)),f==null||f.buildDynamicMap(),c.setRawGraph(f)})}}else{const c=Et.getState();c.reset(),c.setSigmaGraph(new nu)}},[e,r,a]),{lightrageGraph:k.useCallback(()=>{if(n)return n;const c=new nu;return Et.getState().setSigmaGraph(c),c},[n]),getNode:i,getEdge:l}},ed=e=>!!(e.type.startsWith("mouse")&&e.buttons!==0),eee=({disableHoverEffect:e})=>{const{lightrageGraph:t}=U3(),n=br(),r=i3(),a=o3(),i=dZ(),l=We.use.graphLayoutMaxIterations(),{assign:u}=_3({iterations:l}),{theme:c}=l0(),f=We.use.enableHideUnselectedEdges(),p=Et.use.selectedNode(),g=Et.use.focusedNode(),b=Et.use.selectedEdge(),m=Et.use.focusedEdge();return k.useEffect(()=>{const S=t();i(S),u()},[u,i,t,l]),k.useEffect(()=>{const{setFocusedNode:S,setSelectedNode:v,setFocusedEdge:A,setSelectedEdge:R,clearSelection:x}=Et.getState();r({enterNode:T=>{ed(T.event.original)||S(T.node)},leaveNode:T=>{ed(T.event.original)||S(null)},clickNode:T=>{v(T.node),R(null)},clickEdge:T=>{R(T.edge),v(null)},enterEdge:T=>{ed(T.event.original)||A(T.edge)},leaveEdge:T=>{ed(T.event.original)||A(null)},clickStage:()=>x()})},[r]),k.useEffect(()=>{const S=c==="dark",v=S?y9:void 0,A=S?x9:void 0;a({nodeReducer:(R,x)=>{const T=n.getGraph(),C={...x,highlighted:x.highlighted||!1,labelColor:v};if(!e){C.highlighted=!1;const N=g||p,_=m||b;if(N)(R===N||T.neighbors(N).includes(R))&&(C.highlighted=!0,R===p&&(C.borderColor=w9));else if(_)T.extremities(_).includes(R)&&(C.highlighted=!0,C.size=3);else return C;C.highlighted?S&&(C.labelColor=v9):C.color=S9}return C},edgeReducer:(R,x)=>{const T=n.getGraph(),C={...x,hidden:!1,labelColor:v,color:A};if(!e){const N=g||p;N?f?T.extremities(R).includes(N)||(C.hidden=!0):T.extremities(R).includes(N)&&(C.color=oR):(m||b)&&(R===b?C.color=k9:R===m?C.color=oR:f&&(C.hidden=!0))}return C}})},[p,g,b,m,a,n,e,c,f]),null},tee=()=>{const{zoomIn:e,zoomOut:t,reset:n}=l3({duration:200,factor:1.5}),r=k.useCallback(()=>e(),[e]),a=k.useCallback(()=>t(),[t]),i=k.useCallback(()=>n(),[n]);return w.jsxs(w.Fragment,{children:[w.jsx(Lt,{variant:Yr,onClick:r,tooltip:"Zoom In",size:"icon",children:w.jsx(h8,{})}),w.jsx(Lt,{variant:Yr,onClick:a,tooltip:"Zoom Out",size:"icon",children:w.jsx(b8,{})}),w.jsx(Lt,{variant:Yr,onClick:i,tooltip:"Reset Zoom",size:"icon",children:w.jsx(Fq,{})})]})},nee=()=>{const{isFullScreen:e,toggle:t}=fZ();return w.jsx(w.Fragment,{children:e?w.jsx(Lt,{variant:Yr,onClick:t,tooltip:"Windowed",size:"icon",children:w.jsx(Wq,{})}):w.jsx(Lt,{variant:Yr,onClick:t,tooltip:"Full Screen",size:"icon",children:w.jsx(qq,{})})})};function j3(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var N0="Checkbox",[ree,rve]=mr(N0),[aee,oee]=ree(N0),G3=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:l,disabled:u,value:c="on",onCheckedChange:f,form:p,...g}=e,[b,m]=k.useState(null),S=ft(t,C=>m(C)),v=k.useRef(!1),A=b?p||!!b.closest("form"):!0,[R=!1,x]=Oa({prop:a,defaultProp:i,onChange:f}),T=k.useRef(R);return k.useEffect(()=>{const C=b==null?void 0:b.form;if(C){const N=()=>x(T.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[b,x]),w.jsxs(aee,{scope:n,state:R,disabled:u,children:[w.jsx(Xe.button,{type:"button",role:"checkbox","aria-checked":ho(R)?"mixed":R,"aria-required":l,"data-state":q3(R),"data-disabled":u?"":void 0,disabled:u,value:c,...g,ref:S,onKeyDown:Ye(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Ye(e.onClick,C=>{x(N=>ho(N)?!0:!N),A&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),A&&w.jsx(iee,{control:b,bubbles:!v.current,name:r,value:c,checked:R,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"},defaultChecked:ho(i)?!1:i})]})});G3.displayName=N0;var H3="CheckboxIndicator",$3=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,i=oee(H3,n);return w.jsx(Jn,{present:r||ho(i.state)||i.state===!0,children:w.jsx(Xe.span,{"data-state":q3(i.state),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});$3.displayName=H3;var iee=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:a,...i}=e,l=k.useRef(null),u=j3(n),c=yB(t);k.useEffect(()=>{const p=l.current,g=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(g,"checked").set;if(u!==n&&m){const S=new Event("click",{bubbles:r});p.indeterminate=ho(n),m.call(p,ho(n)?!1:n),p.dispatchEvent(S)}},[u,n,r]);const f=k.useRef(ho(n)?!1:n);return w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??f.current,...i,tabIndex:-1,ref:l,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ho(e){return e==="indeterminate"}function q3(e){return ho(e)?"indeterminate":e?"checked":"unchecked"}var V3=G3,lee=$3;const Ks=k.forwardRef(({className:e,...t},n)=>w.jsx(V3,{ref:n,className:Me("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground h-4 w-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:w.jsx(lee,{className:Me("flex items-center justify-center text-current"),children:w.jsx(Nk,{className:"h-4 w-4"})})}));Ks.displayName=V3.displayName;var see="Separator",hN="horizontal",uee=["horizontal","vertical"],W3=k.forwardRef((e,t)=>{const{decorative:n,orientation:r=hN,...a}=e,i=cee(r)?r:hN,u=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return w.jsx(Xe.div,{"data-orientation":i,...u,...a,ref:t})});W3.displayName=see;function cee(e){return uee.includes(e)}var Y3=W3;const il=k.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>w.jsx(Y3,{ref:a,decorative:n,orientation:t,className:Me("bg-border shrink-0",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));il.displayName=Y3.displayName;const so=({checked:e,onCheckedChange:t,label:n})=>w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Ks,{checked:e,onCheckedChange:t}),w.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n})]}),lm=({value:e,onEditFinished:t,label:n,min:r,max:a})=>{const[i,l]=k.useState(e),u=k.useCallback(f=>{const p=f.target.value.trim();if(p.length===0){l(null);return}const g=Number.parseInt(p);if(!isNaN(g)&&g!==i){if(r!==void 0&&g a)return;l(g)}},[i,r,a]),c=k.useCallback(()=>{i!==null&&e!==i&&t(i)},[e,i,t]);return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n}),w.jsx(Eo,{type:"number",value:i===null?"":i,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:r,max:a,onBlur:c,onKeyDown:f=>{f.key==="Enter"&&c()}})]})};function dee(){const[e,t]=k.useState(!1),[n,r]=k.useState(""),a=We.use.showPropertyPanel(),i=We.use.showNodeSearchBar(),l=We.use.showNodeLabel(),u=We.use.enableEdgeEvents(),c=We.use.enableNodeDrag(),f=We.use.enableHideUnselectedEdges(),p=We.use.showEdgeLabel(),g=We.use.graphQueryMaxDepth(),b=We.use.graphMinDegree(),m=We.use.graphLayoutMaxIterations(),S=We.use.enableHealthCheck(),v=We.use.apiKey();k.useEffect(()=>{r(v||"")},[v,e]);const A=k.useCallback(()=>We.setState(P=>({enableNodeDrag:!P.enableNodeDrag})),[]),R=k.useCallback(()=>We.setState(P=>({enableEdgeEvents:!P.enableEdgeEvents})),[]),x=k.useCallback(()=>We.setState(P=>({enableHideUnselectedEdges:!P.enableHideUnselectedEdges})),[]),T=k.useCallback(()=>We.setState(P=>({showEdgeLabel:!P.showEdgeLabel})),[]),C=k.useCallback(()=>We.setState(P=>({showPropertyPanel:!P.showPropertyPanel})),[]),N=k.useCallback(()=>We.setState(P=>({showNodeSearchBar:!P.showNodeSearchBar})),[]),_=k.useCallback(()=>We.setState(P=>({showNodeLabel:!P.showNodeLabel})),[]),O=k.useCallback(()=>We.setState(P=>({enableHealthCheck:!P.enableHealthCheck})),[]),z=k.useCallback(P=>{P<1||We.setState({graphQueryMaxDepth:P})},[]),I=k.useCallback(P=>{P<0||We.setState({graphMinDegree:P})},[]),M=k.useCallback(P=>{P<1||We.setState({graphLayoutMaxIterations:P})},[]),H=k.useCallback(async()=>{We.setState({apiKey:n||null}),await Pn.getState().check(),t(!1)},[n]),q=k.useCallback(P=>{r(P.target.value)},[r]);return w.jsxs(kf,{open:e,onOpenChange:t,children:[w.jsx(Af,{asChild:!0,children:w.jsx(Lt,{variant:Yr,tooltip:"Settings",size:"icon",children:w.jsx(l8,{})})}),w.jsx(yu,{side:"right",align:"start",className:"mb-2 p-2",onCloseAutoFocus:P=>P.preventDefault(),children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(so,{checked:S,onCheckedChange:O,label:"Health Check"}),w.jsx(il,{}),w.jsx(so,{checked:a,onCheckedChange:C,label:"Show Property Panel"}),w.jsx(so,{checked:i,onCheckedChange:N,label:"Show Search Bar"}),w.jsx(il,{}),w.jsx(so,{checked:l,onCheckedChange:_,label:"Show Node Label"}),w.jsx(so,{checked:c,onCheckedChange:A,label:"Node Draggable"}),w.jsx(il,{}),w.jsx(so,{checked:p,onCheckedChange:T,label:"Show Edge Label"}),w.jsx(so,{checked:f,onCheckedChange:x,label:"Hide Unselected Edges"}),w.jsx(so,{checked:u,onCheckedChange:R,label:"Edge Events"}),w.jsx(il,{}),w.jsx(lm,{label:"Max Query Depth",min:1,value:g,onEditFinished:z}),w.jsx(lm,{label:"Minimum Degree",min:0,value:b,onEditFinished:I}),w.jsx(lm,{label:"Max Layout Iterations",min:1,max:20,value:m,onEditFinished:M}),w.jsx(il,{}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-sm font-medium",children:"API Key"}),w.jsxs("form",{className:"flex h-6 gap-2",onSubmit:P=>P.preventDefault(),children:[w.jsx("div",{className:"w-0 flex-1",children:w.jsx(Eo,{type:"password",value:n,onChange:q,placeholder:"Enter your API key",className:"max-h-full w-full min-w-0",autoComplete:"off"})}),w.jsx(Lt,{onClick:H,variant:"outline",size:"sm",className:"max-h-full shrink-0",children:"Save"})]})]})]})})]})}const fee="ENTRIES",K3="KEYS",X3="VALUES",fn="";class sm{constructor(t,n){const r=t._tree,a=Array.from(r.keys());this.set=t,this._type=n,this._path=a.length>0?[{node:r,keys:a}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:t,keys:n}=el(this._path);if(el(n)===fn)return{done:!1,value:this.result()};const r=t.get(el(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=el(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>el(t)).filter(t=>t!==fn).join("")}value(){return el(this._path).node.get(fn)}result(){switch(this._type){case X3:return this.value();case K3:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const el=e=>e[e.length-1],pee=(e,t,n)=>{const r=new Map;if(t===void 0)return r;const a=t.length+1,i=a+n,l=new Uint8Array(i*a).fill(n+1);for(let u=0;u{const c=i*l;e:for(const f of e.keys())if(f===fn){const p=a[c-1];p<=n&&r.set(u,[e.get(f),p])}else{let p=i;for(let g=0;g n)continue e}Z3(e.get(f),t,n,r,a,p,l,u+f)}};class po{constructor(t=new Map,n=""){this._size=void 0,this._tree=t,this._prefix=n}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=Gd(this._tree,t.slice(this._prefix.length));if(n===void 0){const[a,i]=O0(r);for(const l of a.keys())if(l!==fn&&l.startsWith(i)){const u=new Map;return u.set(l.slice(i.length),a.get(l)),new po(u,t)}}return new po(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,gee(this._tree,t)}entries(){return new sm(this,fee)}forEach(t){for(const[n,r]of this)t(n,r,this)}fuzzyGet(t,n){return pee(this._tree,t,n)}get(t){const n=qx(this._tree,t);return n!==void 0?n.get(fn):void 0}has(t){const n=qx(this._tree,t);return n!==void 0&&n.has(fn)}keys(){return new sm(this,K3)}set(t,n){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,um(this._tree,t).set(fn,n),this}get size(){if(this._size)return this._size;this._size=0;const t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=um(this._tree,t);return r.set(fn,n(r.get(fn))),this}fetch(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=um(this._tree,t);let a=r.get(fn);return a===void 0&&r.set(fn,a=n()),a}values(){return new sm(this,X3)}[Symbol.iterator](){return this.entries()}static from(t){const n=new po;for(const[r,a]of t)n.set(r,a);return n}static fromObject(t){return po.from(Object.entries(t))}}const Gd=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(const r of e.keys())if(r!==fn&&t.startsWith(r))return n.push([e,r]),Gd(e.get(r),t.slice(r.length),n);return n.push([e,t]),Gd(void 0,"",n)},qx=(e,t)=>{if(t.length===0||e==null)return e;for(const n of e.keys())if(n!==fn&&t.startsWith(n))return qx(e.get(n),t.slice(n.length))},um=(e,t)=>{const n=t.length;e:for(let r=0;e&&r {const[n,r]=Gd(e,t);if(n!==void 0){if(n.delete(fn),n.size===0)Q3(r);else if(n.size===1){const[a,i]=n.entries().next().value;J3(r,a,i)}}},Q3=e=>{if(e.length===0)return;const[t,n]=O0(e);if(t.delete(n),t.size===0)Q3(e.slice(0,-1));else if(t.size===1){const[r,a]=t.entries().next().value;r!==fn&&J3(e.slice(0,-1),r,a)}},J3=(e,t,n)=>{if(e.length===0)return;const[r,a]=O0(e);r.set(a+t,n),r.delete(a)},O0=e=>e[e.length-1],D0="or",e4="and",hee="and_not";class mo{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=t.autoVacuum==null||t.autoVacuum===!0?fm:t.autoVacuum;this._options={...dm,...t,autoVacuum:n,searchOptions:{...mN,...t.searchOptions||{}},autoSuggestOptions:{...See,...t.autoSuggestOptions||{}}},this._index=new po,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Wx,this.addFields(this._options.fields)}add(t){const{extractField:n,tokenize:r,processTerm:a,fields:i,idField:l}=this._options,u=n(t,l);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);const c=this.addDocumentId(u);this.saveStoredFields(c,t);for(const f of i){const p=n(t,f);if(p==null)continue;const g=r(p.toString(),f),b=this._fieldIds[f],m=new Set(g).size;this.addFieldLength(c,b,this._documentCount-1,m);for(const S of g){const v=a(S,f);if(Array.isArray(v))for(const A of v)this.addTerm(b,c,A);else v&&this.addTerm(b,c,v)}}}addAll(t){for(const n of t)this.add(n)}addAllAsync(t,n={}){const{chunkSize:r=10}=n,a={chunk:[],promise:Promise.resolve()},{chunk:i,promise:l}=t.reduce(({chunk:u,promise:c},f,p)=>(u.push(f),(p+1)%r===0?{chunk:[],promise:c.then(()=>new Promise(g=>setTimeout(g,0))).then(()=>this.addAll(u))}:{chunk:u,promise:c}),a);return l.then(()=>this.addAll(i))}remove(t){const{tokenize:n,processTerm:r,extractField:a,fields:i,idField:l}=this._options,u=a(t,l);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);const c=this._idToShortId.get(u);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(const f of i){const p=a(t,f);if(p==null)continue;const g=n(p.toString(),f),b=this._fieldIds[f],m=new Set(g).size;this.removeFieldLength(c,b,this._documentCount,m);for(const S of g){const v=r(S,f);if(Array.isArray(v))for(const A of v)this.removeTerm(b,c,A);else v&&this.removeTerm(b,c,v)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(u),this._fieldLength.delete(c),this._documentCount-=1}removeAll(t){if(t)for(const n of t)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new po,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){const n=this._idToShortId.get(t);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,a)=>{this.removeFieldLength(n,a,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:n,batchSize:r,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:n,minDirtFactor:t})}discardAll(t){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of t)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(t){const{idField:n,extractField:r}=this._options,a=r(t,n);this.discard(a),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Wx,this.performVacuuming(t,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const a=t.batchSize||Vx.batchSize,i=t.batchWait||Vx.batchWait;let l=1;for(const[u,c]of this._index){for(const[f,p]of c)for(const[g]of p)this._documentIds.has(g)||(p.size<=1?c.delete(f):p.delete(g));this._index.get(u).size===0&&this._index.delete(u),l%a===0&&await new Promise(f=>setTimeout(f,i)),l+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:n,minDirtFactor:r}=t;return n=n||fm.minDirtCount,r=r||fm.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const n=this._idToShortId.get(t);if(n!=null)return this._storedFields.get(n)}search(t,n={}){const{searchOptions:r}=this._options,a={...r,...n},i=this.executeQuery(t,n),l=[];for(const[u,{score:c,terms:f,match:p}]of i){const g=f.length||1,b={id:this._documentIds.get(u),score:c*g,terms:Object.keys(p),queryTerms:f,match:p};Object.assign(b,this._storedFields.get(u)),(a.filter==null||a.filter(b))&&l.push(b)}return t===mo.wildcard&&a.boostDocument==null||l.sort(yN),l}autoSuggest(t,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:i,terms:l}of this.search(t,n)){const u=l.join(" "),c=r.get(u);c!=null?(c.score+=i,c.count+=1):r.set(u,{score:i,terms:l,count:1})}const a=[];for(const[i,{score:l,terms:u,count:c}]of r)a.push({suggestion:i,terms:u,score:l/c});return a.sort(yN),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),n)}static async loadJSONAsync(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),n)}static getDefault(t){if(dm.hasOwnProperty(t))return cm(dm,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,n){const{index:r,documentIds:a,fieldLength:i,storedFields:l,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=td(a),c._fieldLength=td(i),c._storedFields=td(l);for(const[f,p]of c._documentIds)c._idToShortId.set(p,f);for(const[f,p]of r){const g=new Map;for(const b of Object.keys(p)){let m=p[b];u===1&&(m=m.ds),g.set(parseInt(b,10),td(m))}c._index.set(f,g)}return c}static async loadJSAsync(t,n){const{index:r,documentIds:a,fieldLength:i,storedFields:l,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=await nd(a),c._fieldLength=await nd(i),c._storedFields=await nd(l);for(const[p,g]of c._documentIds)c._idToShortId.set(g,p);let f=0;for(const[p,g]of r){const b=new Map;for(const m of Object.keys(g)){let S=g[m];u===1&&(S=S.ds),b.set(parseInt(m,10),await nd(S))}++f%1e3===0&&await t4(0),c._index.set(p,b)}return c}static instantiateMiniSearch(t,n){const{documentCount:r,nextId:a,fieldIds:i,averageFieldLength:l,dirtCount:u,serializationVersion:c}=t;if(c!==1&&c!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const f=new mo(n);return f._documentCount=r,f._nextId=a,f._idToShortId=new Map,f._fieldIds=i,f._avgFieldLength=l,f._dirtCount=u||0,f._index=new po,f}executeQuery(t,n={}){if(t===mo.wildcard)return this.executeWildcardQuery(n);if(typeof t!="string"){const b={...n,...t,queries:void 0},m=t.queries.map(S=>this.executeQuery(S,b));return this.combineResults(m,b.combineWith)}const{tokenize:r,processTerm:a,searchOptions:i}=this._options,l={tokenize:r,processTerm:a,...i,...n},{tokenize:u,processTerm:c}=l,g=u(t).flatMap(b=>c(b)).filter(b=>!!b).map(vee(l)).map(b=>this.executeQuerySpec(b,l));return this.combineResults(g,l.combineWith)}executeQuerySpec(t,n){const r={...this._options.searchOptions,...n},a=(r.fields||this._options.fields).reduce((v,A)=>({...v,[A]:cm(r.boost,A)||1}),{}),{boostDocument:i,weights:l,maxFuzzy:u,bm25:c}=r,{fuzzy:f,prefix:p}={...mN.weights,...l},g=this._index.get(t.term),b=this.termResults(t.term,t.term,1,t.termBoost,g,a,i,c);let m,S;if(t.prefix&&(m=this._index.atPrefix(t.term)),t.fuzzy){const v=t.fuzzy===!0?.2:t.fuzzy,A=v<1?Math.min(u,Math.round(t.term.length*v)):v;A&&(S=this._index.fuzzyGet(t.term,A))}if(m)for(const[v,A]of m){const R=v.length-t.term.length;if(!R)continue;S==null||S.delete(v);const x=p*v.length/(v.length+.3*R);this.termResults(t.term,v,x,t.termBoost,A,a,i,c,b)}if(S)for(const v of S.keys()){const[A,R]=S.get(v);if(!R)continue;const x=f*v.length/(v.length+R);this.termResults(t.term,v,x,t.termBoost,A,a,i,c,b)}return b}executeWildcardQuery(t){const n=new Map,r={...this._options.searchOptions,...t};for(const[a,i]of this._documentIds){const l=r.boostDocument?r.boostDocument(i,"",this._storedFields.get(a)):1;n.set(a,{score:l,terms:[],match:{}})}return n}combineResults(t,n=D0){if(t.length===0)return new Map;const r=n.toLowerCase(),a=mee[r];if(!a)throw new Error(`Invalid combination operator: ${n}`);return t.reduce(a)||new Map}toJSON(){const t=[];for(const[n,r]of this._index){const a={};for(const[i,l]of r)a[i]=Object.fromEntries(l);t.push([n,a])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,n,r,a,i,l,u,c,f=new Map){if(i==null)return f;for(const p of Object.keys(l)){const g=l[p],b=this._fieldIds[p],m=i.get(b);if(m==null)continue;let S=m.size;const v=this._avgFieldLength[b];for(const A of m.keys()){if(!this._documentIds.has(A)){this.removeTerm(b,A,n),S-=1;continue}const R=u?u(this._documentIds.get(A),n,this._storedFields.get(A)):1;if(!R)continue;const x=m.get(A),T=this._fieldLength.get(A)[b],C=yee(x,S,this._documentCount,T,v,c),N=r*a*g*R*C,_=f.get(A);if(_){_.score+=N,Eee(_.terms,t);const O=cm(_.match,n);O?O.push(p):_.match[n]=[p]}else f.set(A,{score:N,terms:[t],match:{[n]:[p]}})}}return f}addTerm(t,n,r){const a=this._index.fetch(r,vN);let i=a.get(t);if(i==null)i=new Map,i.set(n,1),a.set(t,i);else{const l=i.get(n);i.set(n,(l||0)+1)}}removeTerm(t,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,t,r);return}const a=this._index.fetch(r,vN),i=a.get(t);i==null||i.get(n)==null?this.warnDocumentChanged(n,t,r):i.get(n)<=1?i.size<=1?a.delete(t):i.delete(n):i.set(n,i.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(t,n,r){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${r}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const n=this._nextId;return this._idToShortId.set(t,n),this._documentIds.set(n,t),this._documentCount+=1,this._nextId+=1,n}addFields(t){for(let n=0;n Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,mee={[D0]:(e,t)=>{for(const n of t.keys()){const r=e.get(n);if(r==null)e.set(n,t.get(n));else{const{score:a,terms:i,match:l}=t.get(n);r.score=r.score+a,r.match=Object.assign(r.match,l),bN(r.terms,i)}}return e},[e4]:(e,t)=>{const n=new Map;for(const r of t.keys()){const a=e.get(r);if(a==null)continue;const{score:i,terms:l,match:u}=t.get(r);bN(a.terms,l),n.set(r,{score:a.score+i,terms:a.terms,match:Object.assign(a.match,u)})}return n},[hee]:(e,t)=>{for(const n of t.keys())e.delete(n);return e}},bee={k:1.2,b:.7,d:.5},yee=(e,t,n,r,a,i)=>{const{k:l,b:u,d:c}=i;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(l+1)/(e+l*(1-u+u*r/a)))},vee=e=>(t,n,r)=>{const a=typeof e.fuzzy=="function"?e.fuzzy(t,n,r):e.fuzzy||!1,i=typeof e.prefix=="function"?e.prefix(t,n,r):e.prefix===!0,l=typeof e.boostTerm=="function"?e.boostTerm(t,n,r):1;return{term:t,fuzzy:a,prefix:i,termBoost:l}},dm={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(wee),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},mN={combineWith:D0,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:bee},See={combineWith:e4,prefix:(e,t,n)=>t===n.length-1},Vx={batchSize:1e3,batchWait:10},Wx={minDirtFactor:.1,minDirtCount:20},fm={...Vx,...Wx},Eee=(e,t)=>{e.includes(t)||e.push(t)},bN=(e,t)=>{for(const n of t)e.includes(n)||e.push(n)},yN=({score:e},{score:t})=>t-e,vN=()=>new Map,td=e=>{const t=new Map;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},nd=async e=>{const t=new Map;let n=0;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3===0&&await t4(0);return t},t4=e=>new Promise(t=>setTimeout(t,e)),wee=/[\n\r\p{Z}\p{P}]+/u;function Yx(){return Yx=Object.assign?Object.assign.bind():function(e){for(var t=1;t e.length)&&(t=e.length);for(var n=0,r=Array(t);n ye.createElement("div",{className:"node"},ye.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:t||"#000"}}),ye.createElement("span",{className:`label ${n?"text-muted":""} ${e?"":"text-italic"}`},e||r.no_label||"No label")),Dee=({id:e,labels:t})=>{const n=br(),r=k.useMemo(()=>{const a=n.getGraph().getNodeAttributes(e),i=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),i?i(e,a):{})},[n,e]);return ye.createElement(Zx,Object.assign({},r,{labels:t}))},Iee=({label:e,color:t,source:n,target:r,hidden:a,directed:i,labels:l={}})=>ye.createElement("div",{className:"edge"},ye.createElement(Zx,Object.assign({},n,{labels:l})),ye.createElement("div",{className:"body"},ye.createElement("div",{className:"render"},ye.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",i&&ye.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),ye.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||l.no_label||"No label")),ye.createElement(Zx,Object.assign({},r,{labels:l}))),Lee=({id:e,labels:t})=>{const n=br(),r=k.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(e),i=n.getSetting("nodeReducer"),l=n.getSetting("edgeReducer"),u=n.getGraph().getNodeAttributes(n.getGraph().source(e)),c=n.getGraph().getNodeAttributes(n.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(e)},a),l?l(e,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},u),i?i(e,u):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},c),i?i(e,c):{})})},[n,e]);return ye.createElement(Iee,Object.assign({},r,{labels:t}))};function I0(e,t){const[n,r]=k.useState(e);return k.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}function Mee({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,notFound:i,loadingSkeleton:l,label:u,placeholder:c="Select...",value:f,onChange:p,onFocus:g,disabled:b=!1,className:m,noResultsMessage:S}){const[v,A]=k.useState(!1),[R,x]=k.useState(!1),[T,C]=k.useState([]),[N,_]=k.useState(!1),[O,z]=k.useState(null),[I,M]=k.useState(f),[H,q]=k.useState(null),[P,W]=k.useState(""),Z=I0(P,t?0:150),[j,G]=k.useState([]);k.useEffect(()=>{A(!0),M(f)},[f]),k.useEffect(()=>{v||(async()=>{try{_(!0),z(null);const V=f!==null?await e(f):[];G(V),C(V)}catch(V){z(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}})()},[v,e,f]),k.useEffect(()=>{const D=async()=>{try{_(!0),z(null);const V=await e(Z);G(V),C(V)}catch(V){z(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}};v&&t?t&&C(Z?j.filter(V=>n?n(V,Z):!0):j):D()},[e,Z,v,t,n]);const B=k.useCallback(D=>{D!==I&&(M(D),p(D)),x(!1)},[I,M,x,p]),X=k.useCallback(D=>{D!==H&&(q(D),g(D))},[H,q,g]);return w.jsx("div",{className:Me(b&&"cursor-not-allowed opacity-50",m),onFocus:()=>{x(!0)},onBlur:()=>x(!1),children:w.jsxs(Of,{shouldFilter:!1,className:"bg-transparent",children:[w.jsxs("div",{children:[w.jsx(R0,{placeholder:c,value:P,className:"max-h-8",onValueChange:D=>{W(D),D&&!R&&x(!0)}}),N&&T.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(cP,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(Df,{hidden:!R||Z.length===0,children:[O&&w.jsx("div",{className:"text-destructive p-4 text-center",children:O}),N&&T.length===0&&(l||w.jsx(Fee,{})),!N&&!O&&T.length===0&&(i||w.jsx(C0,{children:S??`No ${u.toLowerCase()} found.`})),w.jsx(Ml,{children:T.map((D,V)=>w.jsxs(w.Fragment,{children:[w.jsx(Fl,{value:a(D),onSelect:B,onMouseEnter:()=>X(a(D)),className:"truncate",children:r(D)},a(D)+`${V}`),V!==T.length-1&&w.jsx("div",{className:"bg-foreground/10 h-[1px]"},V)]}))})]})]})})}function Fee(){return w.jsx(Ml,{children:w.jsx(Fl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}function zee(e){return w.jsxs("div",{children:[e.type==="nodes"&&w.jsx(Dee,{id:e.id}),e.type==="edges"&&w.jsx(Lee,{id:e.id}),e.type==="message"&&w.jsx("div",{children:e.message})]})}const pm="__message_item",rd={graph:null,searchEngine:null},Pee=({onChange:e,onFocus:t,value:n})=>{const r=Et.use.sigmaGraph(),a=k.useMemo(()=>{if(rd.graph==r)return rd.searchEngine;if(!r||r.nodes().length==0)return;rd.graph=r;const l=new mo({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),u=r.nodes().map(c=>({id:c,label:r.getNodeAttribute(c,"label")}));return l.addAll(u),rd.searchEngine=l,l},[r]),i=k.useCallback(async l=>{if(t&&t(null),!l||!a)return[];const u=a.search(l).map(c=>({id:c.id,type:"nodes"}));return u.length<=lh?u:[...u.slice(0,lh),{type:"message",id:pm,message:`And ${u.length-lh} others`}]},[a,t]);return w.jsx(Mee,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:i,renderOption:zee,getOptionValue:l=>l.id,value:n&&n.type!=="message"?n.id:null,onChange:l=>{l!==pm&&e(l?{id:l,type:"nodes"}:null)},onFocus:l=>{l!==pm&&t&&t(l?{id:l,type:"nodes"}:null)},label:"item",placeholder:"Search nodes..."})},Bee=({...e})=>w.jsx(Pee,{...e});function Uee({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:i,notFound:l,loadingSkeleton:u,label:c,placeholder:f="Select...",value:p,onChange:g,disabled:b=!1,className:m,triggerClassName:S,searchInputClassName:v,noResultsMessage:A,triggerTooltip:R,clearable:x=!0}){const[T,C]=k.useState(!1),[N,_]=k.useState(!1),[O,z]=k.useState([]),[I,M]=k.useState(!1),[H,q]=k.useState(null),[P,W]=k.useState(p),[Z,j]=k.useState(null),[G,B]=k.useState(""),X=I0(G,t?0:150),[D,V]=k.useState([]);k.useEffect(()=>{C(!0),W(p)},[p]),k.useEffect(()=>{if(p&&O.length>0){const L=O.find(Y=>a(Y)===p);L&&j(L)}},[p,O,a]),k.useEffect(()=>{T||(async()=>{try{M(!0),q(null);const Y=await e(p);V(Y),z(Y)}catch(Y){q(Y instanceof Error?Y.message:"Failed to fetch options")}finally{M(!1)}})()},[T,e,p]),k.useEffect(()=>{const L=async()=>{try{M(!0),q(null);const Y=await e(X);V(Y),z(Y)}catch(Y){q(Y instanceof Error?Y.message:"Failed to fetch options")}finally{M(!1)}};T&&t?t&&z(X?D.filter(Y=>n?n(Y,X):!0):D):L()},[e,X,T,t,n]);const U=k.useCallback(L=>{const Y=x&&L===P?"":L;W(Y),j(O.find(Q=>a(Q)===Y)||null),g(Y),_(!1)},[P,g,x,O,a]);return w.jsxs(kf,{open:N,onOpenChange:_,children:[w.jsx(Af,{asChild:!0,children:w.jsxs(Lt,{variant:"outline",role:"combobox","aria-expanded":N,className:Me("justify-between",b&&"cursor-not-allowed opacity-50",S),disabled:b,tooltip:R,side:"bottom",children:[Z?i(Z):f,w.jsx(Aq,{className:"opacity-50",size:10})]})}),w.jsx(yu,{className:Me("p-0",m),onCloseAutoFocus:L=>L.preventDefault(),children:w.jsxs(Of,{shouldFilter:!1,children:[w.jsxs("div",{className:"relative w-full border-b",children:[w.jsx(R0,{placeholder:`Search ${c.toLowerCase()}...`,value:G,onValueChange:L=>{B(L)},className:v}),I&&O.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(cP,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(Df,{children:[H&&w.jsx("div",{className:"text-destructive p-4 text-center",children:H}),I&&O.length===0&&(u||w.jsx(jee,{})),!I&&!H&&O.length===0&&(l||w.jsx(C0,{children:A??`No ${c.toLowerCase()} found.`})),w.jsx(Ml,{children:O.map(L=>w.jsxs(Fl,{value:a(L),onSelect:U,className:"truncate",children:[r(L),w.jsx(Nk,{className:Me("ml-auto h-3 w-3",P===a(L)?"opacity-100":"opacity-0")})]},a(L)))})]})]})})]})}function jee(){return w.jsx(Ml,{children:w.jsx(Fl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const tl={graph:null,searchEngine:null,labels:[]},Gee=()=>{const e=We.use.queryLabel(),t=Et.use.sigmaGraph(),n=k.useCallback(async()=>{if(tl.graph==t)return{labels:tl.labels,searchEngine:tl.searchEngine};const i=["*"].concat(await uq());i.includes(We.getState().queryLabel)||We.getState().setQueryLabel(i[0]);const l=new mo({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),u=i.map((c,f)=>({id:f,value:c}));return l.addAll(u),tl.graph=t,tl.searchEngine=l,tl.labels=i,{labels:i,searchEngine:l}},[t]),r=k.useCallback(async i=>{const{labels:l,searchEngine:u}=await n();let c=l;return i&&(c=u.search(i).map(f=>l[f.id])),c.length<=sh?c:[...c.slice(0,sh),`And ${c.length-sh} others`]},[n]),a=k.useCallback(i=>{i.startsWith("And ")&&i.endsWith(" others")||We.getState().setQueryLabel(i)},[]);return w.jsx(Uee,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:"Select query label",fetcher:r,renderOption:i=>w.jsx("div",{children:i}),getOptionValue:i=>i,getDisplayValue:i=>w.jsx("div",{children:i}),notFound:w.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:"Label",placeholder:"Search labels...",value:e!==null?e:"",onChange:a})},Mn=({text:e,className:t,tooltipClassName:n,tooltip:r,side:a,onClick:i})=>r?w.jsx(FB,{delayDuration:200,children:w.jsxs(zB,{children:[w.jsx(PB,{asChild:!0,children:w.jsx("label",{className:Me(t,i!==void 0?"cursor-pointer":void 0),onClick:i,children:e})}),w.jsx(a0,{side:a,className:n,children:r})]})}):w.jsx("label",{className:Me(t,i!==void 0?"cursor-pointer":void 0),onClick:i,children:e}),Hee=()=>{const{getNode:e,getEdge:t}=U3(),n=Et.use.selectedNode(),r=Et.use.focusedNode(),a=Et.use.selectedEdge(),i=Et.use.focusedEdge(),[l,u]=k.useState(null),[c,f]=k.useState(null);return k.useEffect(()=>{let p=null,g=null;r?(p="node",g=e(r)):n?(p="node",g=e(n)):i?(p="edge",g=t(i,!0)):a&&(p="edge",g=t(a,!0)),g?(p=="node"?u($ee(g)):u(qee(g)),f(p)):(u(null),f(null))},[r,n,i,a,u,f,e,t]),l?w.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:c=="node"?w.jsx(Vee,{node:l}):w.jsx(Wee,{edge:l})}):w.jsx(w.Fragment,{})},$ee=e=>{const t=Et.getState(),n=[];if(t.sigmaGraph&&t.rawGraph)for(const r of t.sigmaGraph.edges(e.id)){const a=t.rawGraph.getEdge(r,!0);if(a){const l=e.id===a.source?a.target:a.source,u=t.rawGraph.getNode(l);u&&n.push({type:"Neighbour",id:l,label:u.properties.entity_id?u.properties.entity_id:u.labels.join(", ")})}}return{...e,relationships:n}},qee=e=>{var a,i;const t=Et.getState(),n=(a=t.rawGraph)==null?void 0:a.getNode(e.source),r=(i=t.rawGraph)==null?void 0:i.getNode(e.target);return{...e,sourceNode:n,targetNode:r}},Wr=({name:e,value:t,onClick:n,tooltip:r})=>w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("label",{className:"text-primary/60 tracking-wide",children:e}),":",w.jsx(Mn,{className:"hover:bg-primary/20 rounded p-1 text-ellipsis",tooltipClassName:"max-w-80",text:t,tooltip:r||t,side:"left",onClick:n})]}),Vee=({node:e})=>w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-sky-300",children:"Node"}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(Wr,{name:"Id",value:e.id}),w.jsx(Wr,{name:"Labels",value:e.labels.join(", "),onClick:()=>{Et.getState().setSelectedNode(e.id,!0)}}),w.jsx(Wr,{name:"Degree",value:e.degree})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-yellow-400/90",children:"Properties"}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(t=>w.jsx(Wr,{name:t,value:e.properties[t]},t))}),e.relationships.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-teal-600/90",children:"Relationships"}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:e.relationships.map(({type:t,id:n,label:r})=>w.jsx(Wr,{name:t,value:r,onClick:()=>{Et.getState().setSelectedNode(n,!0)}},n))})]})]}),Wee=({edge:e})=>w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-teal-600",children:"Relationship"}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(Wr,{name:"Id",value:e.id}),e.type&&w.jsx(Wr,{name:"Type",value:e.type}),w.jsx(Wr,{name:"Source",value:e.sourceNode?e.sourceNode.labels.join(", "):e.source,onClick:()=>{Et.getState().setSelectedNode(e.source,!0)}}),w.jsx(Wr,{name:"Target",value:e.targetNode?e.targetNode.labels.join(", "):e.target,onClick:()=>{Et.getState().setSelectedNode(e.target,!0)}})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-yellow-400/90",children:"Properties"}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(t=>w.jsx(Wr,{name:t,value:e.properties[t]},t))})]}),SN={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:QU,curvedArrow:uQ,curvedNoArrow:sQ},nodeProgramClasses:{default:qZ,circel:Su,point:vZ},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},Yee=()=>{const e=i3(),t=br(),[n,r]=k.useState(null);return k.useEffect(()=>{e({downNode:a=>{r(a.node),t.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!n)return;const i=t.viewportToGraph(a);t.getGraph().setNodeAttribute(n,"x",i.x),t.getGraph().setNodeAttribute(n,"y",i.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{n&&(r(null),t.getGraph().removeNodeAttribute(n,"highlighted"))},mousedown:()=>{t.getCustomBBox()||t.setCustomBBox(t.getBBox())}})},[e,t,n]),null},Kee=()=>{const[e,t]=k.useState(SN),n=Et.use.selectedNode(),r=Et.use.focusedNode(),a=Et.use.moveToSelectedNode(),i=We.use.showPropertyPanel(),l=We.use.showNodeSearchBar(),u=We.use.showNodeLabel(),c=We.use.enableEdgeEvents(),f=We.use.enableNodeDrag(),p=We.use.showEdgeLabel();k.useEffect(()=>{t({...SN,enableEdgeEvents:c,renderEdgeLabels:p,renderLabels:u})},[u,c,p]);const g=k.useCallback(v=>{v===null?Et.getState().setFocusedNode(null):v.type==="nodes"&&Et.getState().setFocusedNode(v.id)},[]),b=k.useCallback(v=>{v===null?Et.getState().setSelectedNode(null):v.type==="nodes"&&Et.getState().setSelectedNode(v.id,!0)},[]),m=k.useMemo(()=>r??n,[r,n]),S=k.useMemo(()=>n?{type:"nodes",id:n}:null,[n]);return w.jsxs(pZ,{settings:e,className:"!bg-background !size-full overflow-hidden",children:[w.jsx(eee,{}),f&&w.jsx(Yee,{}),w.jsx(fQ,{node:m,move:a}),w.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[w.jsx(Gee,{}),l&&w.jsx(Bee,{value:S,onFocus:g,onChange:b})]}),w.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[w.jsx(dee,{}),w.jsx(tee,{}),w.jsx(NJ,{}),w.jsx(nee,{})]}),i&&w.jsx("div",{className:"absolute top-2 right-2",children:w.jsx(Hee,{})})]})},r4=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{className:"relative w-full overflow-auto",children:w.jsx("table",{ref:n,className:Me("w-full caption-bottom text-sm",e),...t})}));r4.displayName="Table";const a4=k.forwardRef(({className:e,...t},n)=>w.jsx("thead",{ref:n,className:Me("[&_tr]:border-b",e),...t}));a4.displayName="TableHeader";const o4=k.forwardRef(({className:e,...t},n)=>w.jsx("tbody",{ref:n,className:Me("[&_tr:last-child]:border-0",e),...t}));o4.displayName="TableBody";const Xee=k.forwardRef(({className:e,...t},n)=>w.jsx("tfoot",{ref:n,className:Me("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));Xee.displayName="TableFooter";const Qx=k.forwardRef(({className:e,...t},n)=>w.jsx("tr",{ref:n,className:Me("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));Qx.displayName="TableRow";const Ta=k.forwardRef(({className:e,...t},n)=>w.jsx("th",{ref:n,className:Me("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Ta.displayName="TableHead";const _a=k.forwardRef(({className:e,...t},n)=>w.jsx("td",{ref:n,className:Me("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));_a.displayName="TableCell";const Zee=k.forwardRef(({className:e,...t},n)=>w.jsx("caption",{ref:n,className:Me("text-muted-foreground mt-4 text-sm",e),...t}));Zee.displayName="TableCaption";const ou=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("bg-card text-card-foreground rounded-xl border shadow",e),...t}));ou.displayName="Card";const Hd=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Hd.displayName="CardHeader";const iu=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("leading-none font-semibold tracking-tight",e),...t}));iu.displayName="CardTitle";const If=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));If.displayName="CardDescription";const $d=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));$d.displayName="CardContent";const Qee=k.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));Qee.displayName="CardFooter";function Jee({title:e,description:t,icon:n=Lq,action:r,className:a,...i}){return w.jsxs(ou,{className:Me("flex w-full flex-col items-center justify-center space-y-6 bg-transparent p-16",a),...i,children:[w.jsx("div",{className:"mr-4 shrink-0 rounded-full border border-dashed p-4",children:w.jsx(n,{className:"text-muted-foreground size-8","aria-hidden":"true"})}),w.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[w.jsx(iu,{children:e}),t?w.jsx(If,{children:t}):null]}),r||null]})}var gm={exports:{}},hm,EN;function ete(){if(EN)return hm;EN=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return hm=e,hm}var mm,wN;function tte(){if(wN)return mm;wN=1;var e=ete();function t(){}function n(){}return n.resetWarningCache=t,mm=function(){function r(l,u,c,f,p,g){if(g!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},mm}var xN;function nte(){return xN||(xN=1,gm.exports=tte()()),gm.exports}var rte=nte();const Ct=an(rte),ate=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function El(e,t,n){const r=ote(e),{webkitRelativePath:a}=e,i=typeof t=="string"?t:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof r.path!="string"&&kN(r,"path",i),kN(r,"relativePath",i),r}function ote(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),a=ate.get(r);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function kN(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const ite=[".DS_Store","Thumbs.db"];function lte(e){return ci(this,void 0,void 0,function*(){return qd(e)&&ste(e.dataTransfer)?fte(e.dataTransfer,e.type):ute(e)?cte(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?dte(e):[]})}function ste(e){return qd(e)}function ute(e){return qd(e)&&qd(e.target)}function qd(e){return typeof e=="object"&&e!==null}function cte(e){return Jx(e.target.files).map(t=>El(t))}function dte(e){return ci(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>El(n))})}function fte(e,t){return ci(this,void 0,void 0,function*(){if(e.items){const n=Jx(e.items).filter(a=>a.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(pte));return AN(i4(r))}return AN(Jx(e.files).map(n=>El(n)))})}function AN(e){return e.filter(t=>ite.indexOf(t.name)===-1)}function Jx(e){if(e===null)return[];const t=[];for(let n=0;n [...t,...Array.isArray(n)?i4(n):[n]],[])}function TN(e,t){return ci(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const l=yield i.getFile();return l.handle=i,El(l)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return El(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function gte(e){return ci(this,void 0,void 0,function*(){return e.isDirectory?l4(e):hte(e)})}function l4(e){const t=e.createReader();return new Promise((n,r)=>{const a=[];function i(){t.readEntries(l=>ci(this,void 0,void 0,function*(){if(l.length){const u=Promise.all(l.map(gte));a.push(u),i()}else try{const u=yield Promise.all(a);n(u)}catch(u){r(u)}}),l=>{r(l)})}i()})}function hte(e){return ci(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const a=El(r,e.fullPath);t(a)},r=>{n(r)})})})}var ad={},_N;function mte(){return _N||(_N=1,ad.__esModule=!0,ad.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",a=(e.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(l){var u=l.trim().toLowerCase();return u.charAt(0)==="."?r.toLowerCase().endsWith(u):u.endsWith("/*")?i===u.replace(/\/.*$/,""):a===u})}return!0}),ad}var bte=mte();const bm=an(bte);function RN(e){return Ste(e)||vte(e)||u4(e)||yte()}function yte(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ste(e){if(Array.isArray(e))return ek(e)}function CN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function NN(e){for(var t=1;t e.length)&&(t=e.length);for(var n=0,r=new Array(t);n