var Xx=Object.defineProperty;var Zx=(r,n,i)=>n in r?Xx(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i;var hr=(r,n,i)=>Zx(r,typeof n!="symbol"?n+"":n,i);function Wx(r,n){for(var i=0;ia[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function i(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(s){if(s.ep)return;s.ep=!0;const l=i(s);fetch(s.href,l)}})();function on(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Kx(r){if(r.__esModule)return r;var n=r.default;if(typeof n=="function"){var i=function a(){return this instanceof a?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};i.prototype=n.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(r).forEach(function(a){var s=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(i,a,s.get?s:{enumerable:!0,get:function(){return r[a]}})}),i}var jf={exports:{}},Ho={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Vv;function Qx(){if(Vv)return Ho;Vv=1;var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(a,s,l){var c=null;if(l!==void 0&&(c=""+l),s.key!==void 0&&(c=""+s.key),"key"in s){l={};for(var f in s)f!=="key"&&(l[f]=s[f])}else l=s;return s=l.ref,{$$typeof:r,type:a,key:c,ref:s!==void 0?s:null,props:l}}return Ho.Fragment=n,Ho.jsx=i,Ho.jsxs=i,Ho}var Iv;function Jx(){return Iv||(Iv=1,jf.exports=Qx()),jf.exports}var A=Jx(),Uf={exports:{}},Ge={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Yv;function e_(){if(Yv)return Ge;Yv=1;var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.iterator;function y(G){return G===null||typeof G!="object"?null:(G=v&&G[v]||G["@@iterator"],typeof G=="function"?G:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,E={};function T(G,P,k){this.props=G,this.context=P,this.refs=E,this.updater=k||b}T.prototype.isReactComponent={},T.prototype.setState=function(G,P){if(typeof G!="object"&&typeof G!="function"&&G!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,G,P,"setState")},T.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function M(){}M.prototype=T.prototype;function N(G,P,k){this.props=G,this.context=P,this.refs=E,this.updater=k||b}var L=N.prototype=new M;L.constructor=N,x(L,T.prototype),L.isPureReactComponent=!0;var C=Array.isArray,R={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function _(G,P,k,V,Q,re){return k=re.ref,{$$typeof:r,type:G,key:P,ref:k!==void 0?k:null,props:re}}function $(G,P){return _(G.type,P,void 0,void 0,void 0,G.props)}function z(G){return typeof G=="object"&&G!==null&&G.$$typeof===r}function F(G){var P={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(k){return P[k]})}var Y=/\/+/g;function I(G,P){return typeof G=="object"&&G!==null&&G.key!=null?F(""+G.key):P.toString(36)}function j(){}function J(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(j,j):(G.status="pending",G.then(function(P){G.status==="pending"&&(G.status="fulfilled",G.value=P)},function(P){G.status==="pending"&&(G.status="rejected",G.reason=P)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function ae(G,P,k,V,Q){var re=typeof G;(re==="undefined"||re==="boolean")&&(G=null);var de=!1;if(G===null)de=!0;else switch(re){case"bigint":case"string":case"number":de=!0;break;case"object":switch(G.$$typeof){case r:case n:de=!0;break;case m:return de=G._init,ae(de(G._payload),P,k,V,Q)}}if(de)return Q=Q(G),de=V===""?"."+I(G,0):V,C(Q)?(k="",de!=null&&(k=de.replace(Y,"$&/")+"/"),ae(Q,P,k,"",function(xe){return xe})):Q!=null&&(z(Q)&&(Q=$(Q,k+(Q.key==null||G&&G.key===Q.key?"":(""+Q.key).replace(Y,"$&/")+"/")+de)),P.push(Q)),1;de=0;var ge=V===""?".":V+":";if(C(G))for(var le=0;le>>1,G=H[se];if(0>>1;ses(V,D))Qs(re,V)?(H[se]=re,H[Q]=D,se=Q):(H[se]=V,H[k]=D,se=k);else if(Qs(re,D))H[se]=re,H[Q]=D,se=Q;else break e}}return U}function s(H,U){var D=H.sortIndex-U.sortIndex;return D!==0?D:H.id-U.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;r.unstable_now=function(){return l.now()}}else{var c=Date,f=c.now();r.unstable_now=function(){return c.now()-f}}var d=[],g=[],m=1,v=null,y=3,b=!1,x=!1,E=!1,T=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function L(H){for(var U=i(g);U!==null;){if(U.callback===null)a(g);else if(U.startTime<=H)a(g),U.sortIndex=U.expirationTime,n(d,U);else break;U=i(g)}}function C(H){if(E=!1,L(H),!x)if(i(d)!==null)x=!0,J();else{var U=i(g);U!==null&&ae(C,U.startTime-H)}}var R=!1,B=-1,_=5,$=-1;function z(){return!(r.unstable_now()-$<_)}function F(){if(R){var H=r.unstable_now();$=H;var U=!0;try{e:{x=!1,E&&(E=!1,M(B),B=-1),b=!0;var D=y;try{t:{for(L(H),v=i(d);v!==null&&!(v.expirationTime>H&&z());){var se=v.callback;if(typeof se=="function"){v.callback=null,y=v.priorityLevel;var G=se(v.expirationTime<=H);if(H=r.unstable_now(),typeof G=="function"){v.callback=G,L(H),U=!0;break t}v===i(d)&&a(d),L(H)}else a(d);v=i(d)}if(v!==null)U=!0;else{var P=i(g);P!==null&&ae(C,P.startTime-H),U=!1}}break e}finally{v=null,y=D,b=!1}U=void 0}}finally{U?Y():R=!1}}}var Y;if(typeof N=="function")Y=function(){N(F)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,j=I.port2;I.port1.onmessage=F,Y=function(){j.postMessage(null)}}else Y=function(){T(F,0)};function J(){R||(R=!0,Y())}function ae(H,U){B=T(function(){H(r.unstable_now())},U)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(H){H.callback=null},r.unstable_continueExecution=function(){x||b||(x=!0,J())},r.unstable_forceFrameRate=function(H){0>H||125se?(H.sortIndex=D,n(g,H),i(d)===null&&H===i(g)&&(E?(M(B),B=-1):E=!0,ae(C,D-se))):(H.sortIndex=G,n(d,H),x||b||(x=!0,J())),H},r.unstable_shouldYield=z,r.unstable_wrapCallback=function(H){var U=y;return function(){var D=y;y=U;try{return H.apply(this,arguments)}finally{y=D}}}}(Hf)),Hf}var Wv;function r_(){return Wv||(Wv=1,Ff.exports=n_()),Ff.exports}var Pf={exports:{}},Ut={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Kv;function i_(){if(Kv)return Ut;Kv=1;var r=du();function n(d){var g="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),Pf.exports=i_(),Pf.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Jv;function a_(){if(Jv)return Po;Jv=1;var r=r_(),n=du(),i=o0();function a(e){var t="https://react.dev/errors/"+e;if(1)":-1h||q[u]!==Z[h]){var oe=` `+q[u].replace(" at new "," at ");return e.displayName&&oe.includes("")&&(oe=oe.replace("",e.displayName)),oe}while(1<=u&&0<=h);break}}}finally{J=!1,Error.prepareStackTrace=o}return(o=e?e.displayName||e.name:"")?j(o):""}function H(e){switch(e.tag){case 26:case 27:case 5:return j(e.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 15:return e=ae(e.type,!1),e;case 11:return e=ae(e.type.render,!1),e;case 1:return e=ae(e.type,!0),e;default:return""}}function U(e){try{var t="";do t+=H(e),e=e.return;while(e);return t}catch(o){return` Error generating stack: `+o.message+` `+o.stack}}function D(e){var t=e,o=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(o=t.return),e=t.return;while(e)}return t.tag===3?o:null}function se(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function G(e){if(D(e)!==e)throw Error(a(188))}function P(e){var t=e.alternate;if(!t){if(t=D(e),t===null)throw Error(a(188));return t!==e?null:e}for(var o=e,u=t;;){var h=o.return;if(h===null)break;var p=h.alternate;if(p===null){if(u=h.return,u!==null){o=u;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===o)return G(h),e;if(p===u)return G(h),t;p=p.sibling}throw Error(a(188))}if(o.return!==u.return)o=h,u=p;else{for(var w=!1,O=h.child;O;){if(O===o){w=!0,o=h,u=p;break}if(O===u){w=!0,u=h,o=p;break}O=O.sibling}if(!w){for(O=p.child;O;){if(O===o){w=!0,o=p,u=h;break}if(O===u){w=!0,u=p,o=h;break}O=O.sibling}if(!w)throw Error(a(189))}}if(o.alternate!==u)throw Error(a(190))}if(o.tag!==3)throw Error(a(188));return o.stateNode.current===o?e:t}function k(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=k(e),t!==null)return t;e=e.sibling}return null}var V=Array.isArray,Q=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},de=[],ge=-1;function le(e){return{current:e}}function xe(e){0>ge||(e.current=de[ge],de[ge]=null,ge--)}function pe(e,t){ge++,de[ge]=e.current,e.current=t}var Ae=le(null),Te=le(null),Le=le(null),ve=le(null);function he(e,t){switch(pe(Le,t),pe(Te,e),pe(Ae,null),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)&&(t=t.namespaceURI)?wv(t):0;break;default:if(e=e===8?t.parentNode:t,t=e.tagName,e=e.namespaceURI)e=wv(e),t=Ev(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}xe(Ae),pe(Ae,t)}function K(){xe(Ae),xe(Te),xe(Le)}function Re(e){e.memoizedState!==null&&pe(ve,e);var t=Ae.current,o=Ev(t,e.type);t!==o&&(pe(Te,e),pe(Ae,o))}function Ve(e){Te.current===e&&(xe(Ae),xe(Te)),ve.current===e&&(xe(ve),Mo._currentValue=re)}var be=Object.prototype.hasOwnProperty,Se=r.unstable_scheduleCallback,ne=r.unstable_cancelCallback,et=r.unstable_shouldYield,ut=r.unstable_requestPaint,Ie=r.unstable_now,Et=r.unstable_getCurrentPriorityLevel,rt=r.unstable_ImmediatePriority,ct=r.unstable_UserBlockingPriority,Gt=r.unstable_NormalPriority,Ht=r.unstable_LowPriority,sn=r.unstable_IdlePriority,xn=r.log,ii=r.unstable_setDisableYieldValue,Mn=null,ft=null;function ji(e){if(ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(Mn,e,void 0,(e.current.flags&128)===128)}catch{}}function Zt(e){if(typeof xn=="function"&&ii(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(Mn,e)}catch{}}var Wt=Math.clz32?Math.clz32:G1,N1=Math.log,z1=Math.LN2;function G1(e){return e>>>=0,e===0?32:31-(N1(e)/z1|0)|0}var gs=128,ps=4194304;function ai(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ms(e,t){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,p=e.pingedLanes,w=e.warmLanes;e=e.finishedLanes!==0;var O=o&134217727;return O!==0?(o=O&~h,o!==0?u=ai(o):(p&=O,p!==0?u=ai(p):e||(w=O&~w,w!==0&&(u=ai(w))))):(O=o&~h,O!==0?u=ai(O):p!==0?u=ai(p):e||(w=o&~w,w!==0&&(u=ai(w)))),u===0?0:t!==0&&t!==u&&!(t&h)&&(h=u&-u,w=t&-t,h>=w||h===32&&(w&4194176)!==0)?t:u}function Va(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function M1(e,t){switch(e){case 1:case 2:case 4:case 8:return t+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dg(){var e=gs;return gs<<=1,!(gs&4194176)&&(gs=128),e}function hg(){var e=ps;return ps<<=1,!(ps&62914560)&&(ps=4194304),e}function ku(e){for(var t=[],o=0;31>o;o++)t.push(e);return t}function Ia(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function j1(e,t,o,u,h,p){var w=e.pendingLanes;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=o,e.entangledLanes&=o,e.errorRecoveryDisabledLanes&=o,e.shellSuspendCounter=0;var O=e.entanglements,q=e.expirationTimes,Z=e.hiddenUpdates;for(o=w&~o;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),H1=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Eg={},Sg={};function P1(e){return be.call(Sg,e)?!0:be.call(Eg,e)?!1:H1.test(e)?Sg[e]=!0:(Eg[e]=!0,!1)}function vs(e,t,o){if(P1(t))if(o===null)e.removeAttribute(t);else{switch(typeof o){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var u=t.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+o)}}function ys(e,t,o){if(o===null)e.removeAttribute(t);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+o)}}function Kn(e,t,o,u){if(u===null)e.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(o);return}e.setAttributeNS(t,o,""+u)}}function ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $1(e){var t=xg(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),u=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return h.call(this)},set:function(w){u=""+w,p.call(this,w)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bs(e){e._valueTracker||(e._valueTracker=$1(e))}function _g(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),u="";return e&&(u=xg(e)?e.checked?"true":"false":e.value),e=u,e!==o?(t.setValue(e),!0):!1}function ws(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var q1=/[\n"\\]/g;function un(e){return e.replace(q1,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function zu(e,t,o,u,h,p,w,O){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),t!=null?w==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ln(t)):e.value!==""+ln(t)&&(e.value=""+ln(t)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),t!=null?Gu(e,w,ln(t)):o!=null?Gu(e,w,ln(o)):u!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?e.name=""+ln(O):e.removeAttribute("name")}function Tg(e,t,o,u,h,p,w,O){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),t!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||t!=null))return;o=o!=null?""+ln(o):"",t=t!=null?""+ln(t):o,O||t===e.value||(e.value=t),e.defaultValue=t}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,e.checked=O?e.checked:!!u,e.defaultChecked=!!u,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w)}function Gu(e,t,o){t==="number"&&ws(e.ownerDocument)===e||e.defaultValue===""+o||(e.defaultValue=""+o)}function Pi(e,t,o,u){if(e=e.options,t){t={};for(var h=0;h=Ja),Ug=" ",Bg=!1;function Fg(e,t){switch(e){case"keyup":return yS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ii=!1;function wS(e,t){switch(e){case"compositionend":return Hg(t);case"keypress":return t.which!==32?null:(Bg=!0,Ug);case"textInput":return e=t.data,e===Ug&&Bg?null:e;default:return null}}function ES(e,t){if(Ii)return e==="compositionend"||!Iu&&Fg(e,t)?(e=Lg(),Ss=Hu=xr=null,Ii=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:o,offset:t-e};e=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Zg(o)}}function Kg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ws(e.document);t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}if(o)e=t.contentWindow;else break;t=ws(e.document)}return t}function Zu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function DS(e,t){var o=Qg(t);t=e.focusedElem;var u=e.selectionRange;if(o!==t&&t&&t.ownerDocument&&Kg(t.ownerDocument.documentElement,t)){if(u!==null&&Zu(t)){if(e=u.start,o=u.end,o===void 0&&(o=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(o,t.value.length);else if(o=(e=t.ownerDocument||document)&&e.defaultView||window,o.getSelection){o=o.getSelection();var h=t.textContent.length,p=Math.min(u.start,h);u=u.end===void 0?p:Math.min(u.end,h),!o.extend&&p>u&&(h=u,u=p,p=h),h=Wg(t,p);var w=Wg(t,u);h&&w&&(o.rangeCount!==1||o.anchorNode!==h.node||o.anchorOffset!==h.offset||o.focusNode!==w.node||o.focusOffset!==w.offset)&&(e=e.createRange(),e.setStart(h.node,h.offset),o.removeAllRanges(),p>u?(o.addRange(e),o.extend(w.node,w.offset)):(e.setEnd(w.node,w.offset),o.addRange(e)))}}for(e=[],o=t;o=o.parentNode;)o.nodeType===1&&e.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Yi=null,Wu=null,ro=null,Ku=!1;function Jg(e,t,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Ku||Yi==null||Yi!==ws(u)||(u=Yi,"selectionStart"in u&&Zu(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),ro&&no(ro,u)||(ro=u,u=ul(Wu,"onSelect"),0>=w,h-=w,Qn=1<<32-Wt(t)+h|o<Ne?(Tt=Oe,Oe=null):Tt=Oe.sibling;var qe=te(W,Oe,ee[Ne],ue);if(qe===null){Oe===null&&(Oe=Tt);break}e&&Oe&&qe.alternate===null&&t(W,Oe),X=p(qe,X,Ne),je===null?Ce=qe:je.sibling=qe,je=qe,Oe=Tt}if(Ne===ee.length)return o(W,Oe),$e&&di(W,Ne),Ce;if(Oe===null){for(;NeNe?(Tt=Oe,Oe=null):Tt=Oe.sibling;var $r=te(W,Oe,qe.value,ue);if($r===null){Oe===null&&(Oe=Tt);break}e&&Oe&&$r.alternate===null&&t(W,Oe),X=p($r,X,Ne),je===null?Ce=$r:je.sibling=$r,je=$r,Oe=Tt}if(qe.done)return o(W,Oe),$e&&di(W,Ne),Ce;if(Oe===null){for(;!qe.done;Ne++,qe=ee.next())qe=ce(W,qe.value,ue),qe!==null&&(X=p(qe,X,Ne),je===null?Ce=qe:je.sibling=qe,je=qe);return $e&&di(W,Ne),Ce}for(Oe=u(Oe);!qe.done;Ne++,qe=ee.next())qe=ie(Oe,W,Ne,qe.value,ue),qe!==null&&(e&&qe.alternate!==null&&Oe.delete(qe.key===null?Ne:qe.key),X=p(qe,X,Ne),je===null?Ce=qe:je.sibling=qe,je=qe);return e&&Oe.forEach(function(Yx){return t(W,Yx)}),$e&&di(W,Ne),Ce}function lt(W,X,ee,ue){if(typeof ee=="object"&&ee!==null&&ee.type===d&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case c:e:{for(var Ce=ee.key;X!==null;){if(X.key===Ce){if(Ce=ee.type,Ce===d){if(X.tag===7){o(W,X.sibling),ue=h(X,ee.props.children),ue.return=W,W=ue;break e}}else if(X.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===N&&mp(Ce)===X.type){o(W,X.sibling),ue=h(X,ee.props),co(ue,ee),ue.return=W,W=ue;break e}o(W,X);break}else t(W,X);X=X.sibling}ee.type===d?(ue=xi(ee.props.children,W.mode,ue,ee.key),ue.return=W,W=ue):(ue=Js(ee.type,ee.key,ee.props,null,W.mode,ue),co(ue,ee),ue.return=W,W=ue)}return w(W);case f:e:{for(Ce=ee.key;X!==null;){if(X.key===Ce)if(X.tag===4&&X.stateNode.containerInfo===ee.containerInfo&&X.stateNode.implementation===ee.implementation){o(W,X.sibling),ue=h(X,ee.children||[]),ue.return=W,W=ue;break e}else{o(W,X);break}else t(W,X);X=X.sibling}ue=Jc(ee,W.mode,ue),ue.return=W,W=ue}return w(W);case N:return Ce=ee._init,ee=Ce(ee._payload),lt(W,X,ee,ue)}if(V(ee))return De(W,X,ee,ue);if(B(ee)){if(Ce=B(ee),typeof Ce!="function")throw Error(a(150));return ee=Ce.call(ee),ze(W,X,ee,ue)}if(typeof ee.then=="function")return lt(W,X,zs(ee),ue);if(ee.$$typeof===b)return lt(W,X,Ws(W,ee),ue);Gs(W,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,X!==null&&X.tag===6?(o(W,X.sibling),ue=h(X,ee),ue.return=W,W=ue):(o(W,X),ue=Qc(ee,W.mode,ue),ue.return=W,W=ue),w(W)):o(W,X)}return function(W,X,ee,ue){try{uo=0;var Ce=lt(W,X,ee,ue);return Ji=null,Ce}catch(Oe){if(Oe===so)throw Oe;var je=vn(29,Oe,null,W.mode);return je.lanes=ue,je.return=W,je}finally{}}}var gi=vp(!0),yp=vp(!1),ea=le(null),Ms=le(0);function bp(e,t){e=cr,pe(Ms,e),pe(ea,t),cr=e|t.baseLanes}function ac(){pe(Ms,cr),pe(ea,ea.current)}function oc(){cr=Ms.current,xe(ea),xe(Ms)}var gn=le(null),Un=null;function Tr(e){var t=e.alternate;pe(vt,vt.current&1),pe(gn,e),Un===null&&(t===null||ea.current!==null||t.memoizedState!==null)&&(Un=e)}function wp(e){if(e.tag===22){if(pe(vt,vt.current),pe(gn,e),Un===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Un=e)}}else Cr()}function Cr(){pe(vt,vt.current),pe(gn,gn.current)}function er(e){xe(gn),Un===e&&(Un=null),xe(vt)}var vt=le(0);function js(e){for(var t=e;t!==null;){if(t.tag===13){var o=t.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zS=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(o,u){e.push(u)}};this.abort=function(){t.aborted=!0,e.forEach(function(o){return o()})}},GS=r.unstable_scheduleCallback,MS=r.unstable_NormalPriority,yt={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sc(){return{controller:new zS,data:new Map,refCount:0}}function fo(e){e.refCount--,e.refCount===0&&GS(MS,function(){e.controller.abort()})}var ho=null,lc=0,ta=0,na=null;function jS(e,t){if(ho===null){var o=ho=[];lc=0,ta=pf(),na={status:"pending",value:void 0,then:function(u){o.push(u)}}}return lc++,t.then(Ep,Ep),t}function Ep(){if(--lc===0&&ho!==null){na!==null&&(na.status="fulfilled");var e=ho;ho=null,ta=0,na=null;for(var t=0;tp?p:8;var w=z.T,O={};z.T=O,Tc(e,!1,t,o);try{var q=h(),Z=z.S;if(Z!==null&&Z(O,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var oe=US(q,u);mo(e,t,oe,tn(e))}else mo(e,t,u,tn(e))}catch(ce){mo(e,t,{then:function(){},status:"rejected",reason:ce},tn())}finally{Q.p=p,z.T=w}}function $S(){}function xc(e,t,o,u){if(e.tag!==5)throw Error(a(476));var h=Qp(e).queue;Kp(e,h,t,re,o===null?$S:function(){return Jp(e),o(u)})}function Qp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:re},next:null};var o={};return t.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:o},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Jp(e){var t=Qp(e).next.queue;mo(e,t,{},tn())}function _c(){return jt(Mo)}function em(){return pt().memoizedState}function tm(){return pt().memoizedState}function qS(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var o=tn();e=kr(o);var u=Lr(t,e,o);u!==null&&(Ft(u,t,o),bo(u,t,o)),t={cache:sc()},e.payload=t;return}t=t.return}}function VS(e,t,o){var u=tn();o={lane:u,revertLane:0,action:o,hasEagerState:!1,eagerState:null,next:null},Is(e)?rm(t,o):(o=ec(e,t,o,u),o!==null&&(Ft(o,e,u),im(o,t,u)))}function nm(e,t,o){var u=tn();mo(e,t,o,u)}function mo(e,t,o,u){var h={lane:u,revertLane:0,action:o,hasEagerState:!1,eagerState:null,next:null};if(Is(e))rm(t,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var w=t.lastRenderedState,O=p(w,o);if(h.hasEagerState=!0,h.eagerState=O,Kt(O,w))return Ds(e,t,h,0),tt===null&&Rs(),!1}catch{}finally{}if(o=ec(e,t,h,u),o!==null)return Ft(o,e,u),im(o,t,u),!0}return!1}function Tc(e,t,o,u){if(u={lane:2,revertLane:pf(),action:u,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(a(479))}else t=ec(e,o,u,2),t!==null&&Ft(t,e,2)}function Is(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function rm(e,t){ra=Bs=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function im(e,t,o){if(o&4194176){var u=t.lanes;u&=e.pendingLanes,o|=u,t.lanes=o,pg(e,o)}}var Bn={readContext:jt,use:Ps,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt};Bn.useCacheRefresh=dt,Bn.useMemoCache=dt,Bn.useHostTransitionStatus=dt,Bn.useFormState=dt,Bn.useActionState=dt,Bn.useOptimistic=dt;var vi={readContext:jt,use:Ps,useCallback:function(e,t){return qt().memoizedState=[e,t===void 0?null:t],e},useContext:jt,useEffect:$p,useImperativeHandle:function(e,t,o){o=o!=null?o.concat([e]):null,qs(4194308,4,Ip.bind(null,t,e),o)},useLayoutEffect:function(e,t){return qs(4194308,4,e,t)},useInsertionEffect:function(e,t){qs(4,2,e,t)},useMemo:function(e,t){var o=qt();t=t===void 0?null:t;var u=e();if(mi){Zt(!0);try{e()}finally{Zt(!1)}}return o.memoizedState=[u,t],u},useReducer:function(e,t,o){var u=qt();if(o!==void 0){var h=o(t);if(mi){Zt(!0);try{o(t)}finally{Zt(!1)}}}else h=t;return u.memoizedState=u.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},u.queue=e,e=e.dispatch=VS.bind(null,Me,e),[u.memoizedState,e]},useRef:function(e){var t=qt();return e={current:e},t.memoizedState=e},useState:function(e){e=yc(e);var t=e.queue,o=nm.bind(null,Me,t);return t.dispatch=o,[e.memoizedState,o]},useDebugValue:Ec,useDeferredValue:function(e,t){var o=qt();return Sc(o,e,t)},useTransition:function(){var e=yc(!1);return e=Kp.bind(null,Me,e.queue,!0,!1),qt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,o){var u=Me,h=qt();if($e){if(o===void 0)throw Error(a(407));o=o()}else{if(o=t(),tt===null)throw Error(a(349));He&60||Ap(u,t,o)}h.memoizedState=o;var p={value:o,getSnapshot:t};return h.queue=p,$p(Dp.bind(null,u,p,e),[e]),u.flags|=2048,aa(9,Rp.bind(null,u,p,o,t),{destroy:void 0},null),o},useId:function(){var e=qt(),t=tt.identifierPrefix;if($e){var o=Jn,u=Qn;o=(u&~(1<<32-Wt(u)-1)).toString(32)+o,t=":"+t+"R"+o,o=Fs++,0 title"))),kt(p,u,o),p[Mt]=e,St(p),u=p;break e;case"link":var w=kv("link","href",h).get(u+(o.href||""));if(w){for(var O=0;O<\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof u.is=="string"?h.createElement("select",{is:u.is}):h.createElement("select"),u.multiple?e.multiple=!0:u.size&&(e.size=u.size);break;default:e=typeof u.is=="string"?h.createElement(o,{is:u.is}):h.createElement(o)}}e[Mt]=t,e[Pt]=u;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)e.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=e;e:switch(kt(e,o,u),o){case"button":case"input":case"select":case"textarea":e=!!u.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&lr(t)}}return it(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==u&&lr(t);else{if(typeof u!="string"&&t.stateNode===null)throw Error(a(166));if(e=Le.current,io(t)){if(e=t.stateNode,o=t.memoizedProps,u=null,h=Bt,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}e[Mt]=t,e=!!(e.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||bv(e.nodeValue,o)),e||hi(t)}else e=fl(e).createTextNode(u),e[Mt]=t,t.stateNode=e}return it(t),null;case 13:if(u=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=io(t),u!==null&&u.dehydrated!==null){if(e===null){if(!h)throw Error(a(318));if(h=t.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[Mt]=t}else ao(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;it(t),h=!1}else Tn!==null&&(lf(Tn),Tn=null),h=!0;if(!h)return t.flags&256?(er(t),t):(er(t),null)}if(er(t),t.flags&128)return t.lanes=o,t;if(o=u!==null,e=e!==null&&e.memoizedState!==null,o){u=t.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool);var p=null;u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),p!==h&&(u.flags|=2048)}return o!==e&&o&&(t.child.flags|=8192),el(t,t.updateQueue),it(t),null;case 4:return K(),e===null&&bf(t.stateNode.containerInfo),it(t),null;case 10:return ir(t.type),it(t),null;case 19:if(xe(vt),h=t.memoizedState,h===null)return it(t),null;if(u=(t.flags&128)!==0,p=h.rendering,p===null)if(u)Co(h,!1);else{if(st!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(p=js(e),p!==null){for(t.flags|=128,Co(h,!1),e=p.updateQueue,t.updateQueue=e,el(t,e),t.subtreeFlags=0,e=o,o=t.child;o!==null;)Ym(o,e),o=o.sibling;return pe(vt,vt.current&1|2),t.child}e=e.sibling}h.tail!==null&&Ie()>tl&&(t.flags|=128,u=!0,Co(h,!1),t.lanes=4194304)}else{if(!u)if(e=js(p),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,el(t,e),Co(h,!0),h.tail===null&&h.tailMode==="hidden"&&!p.alternate&&!$e)return it(t),null}else 2*Ie()-h.renderingStartTime>tl&&o!==536870912&&(t.flags|=128,u=!0,Co(h,!1),t.lanes=4194304);h.isBackwards?(p.sibling=t.child,t.child=p):(e=h.last,e!==null?e.sibling=p:t.child=p,h.last=p)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Ie(),t.sibling=null,e=vt.current,pe(vt,u?e&1|2:e&1),t):(it(t),null);case 22:case 23:return er(t),oc(),u=t.memoizedState!==null,e!==null?e.memoizedState!==null!==u&&(t.flags|=8192):u&&(t.flags|=8192),u?o&536870912&&!(t.flags&128)&&(it(t),t.subtreeFlags&6&&(t.flags|=8192)):it(t),o=t.updateQueue,o!==null&&el(t,o.retryQueue),o=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(o=e.memoizedState.cachePool.pool),u=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(u=t.memoizedState.cachePool.pool),u!==o&&(t.flags|=2048),e!==null&&xe(pi),null;case 24:return o=null,e!==null&&(o=e.memoizedState.cache),t.memoizedState.cache!==o&&(t.flags|=2048),ir(yt),it(t),null;case 25:return null}throw Error(a(156,t.tag))}function QS(e,t){switch(nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(yt),K(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ve(t),null;case 13:if(er(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));ao()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(vt),null;case 4:return K(),null;case 10:return ir(t.type),null;case 22:case 23:return er(t),oc(),e!==null&&xe(pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ir(yt),null;case 25:return null;default:return null}}function Wm(e,t){switch(nc(t),t.tag){case 3:ir(yt),K();break;case 26:case 27:case 5:Ve(t);break;case 4:K();break;case 13:er(t);break;case 19:xe(vt);break;case 10:ir(t.type);break;case 22:case 23:er(t),oc(),e!==null&&xe(pi);break;case 24:ir(yt)}}var JS={getCacheForType:function(e){var t=jt(yt),o=t.data.get(e);return o===void 0&&(o=e(),t.data.set(e,o)),o}},ex=typeof WeakMap=="function"?WeakMap:Map,at=0,tt=null,Ue=null,He=0,nt=0,en=null,ur=!1,ua=!1,ef=!1,cr=0,st=0,jr=0,_i=0,tf=0,yn=0,ca=0,Ao=null,Fn=null,nf=!1,rf=0,tl=1/0,nl=null,Ur=null,rl=!1,Ti=null,Ro=0,af=0,of=null,Do=0,sf=null;function tn(){if(at&2&&He!==0)return He&-He;if(z.T!==null){var e=ta;return e!==0?e:pf()}return vg()}function Km(){yn===0&&(yn=!(He&536870912)||$e?dg():536870912);var e=gn.current;return e!==null&&(e.flags|=32),yn}function Ft(e,t,o){(e===tt&&nt===2||e.cancelPendingCommit!==null)&&(fa(e,0),fr(e,He,yn,!1)),Ia(e,o),(!(at&2)||e!==tt)&&(e===tt&&(!(at&2)&&(_i|=o),st===4&&fr(e,He,yn,!1)),Hn(e))}function Qm(e,t,o){if(at&6)throw Error(a(327));var u=!o&&(t&60)===0&&(t&e.expiredLanes)===0||Va(e,t),h=u?rx(e,t):ff(e,t,!0),p=u;do{if(h===0){ua&&!u&&fr(e,t,0,!1);break}else if(h===6)fr(e,t,0,!ur);else{if(o=e.current.alternate,p&&!tx(o)){h=ff(e,t,!1),p=!1;continue}if(h===2){if(p=t,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){t=w;e:{var O=e;h=Ao;var q=O.current.memoizedState.isDehydrated;if(q&&(fa(O,w).flags|=256),w=ff(O,w,!1),w!==2){if(ef&&!q){O.errorRecoveryDisabledLanes|=p,_i|=p,h=4;break e}p=Fn,Fn=h,p!==null&&lf(p)}h=w}if(p=!1,h!==2)continue}}if(h===1){fa(e,0),fr(e,t,0,!0);break}e:{switch(u=e,h){case 0:case 1:throw Error(a(345));case 4:if((t&4194176)===t){fr(u,t,yn,!ur);break e}break;case 2:Fn=null;break;case 3:case 5:break;default:throw Error(a(329))}if(u.finishedWork=o,u.finishedLanes=t,(t&62914560)===t&&(p=rf+300-Ie(),10o?32:o,z.T=null,Ti===null)var p=!1;else{o=of,of=null;var w=Ti,O=Ro;if(Ti=null,Ro=0,at&6)throw Error(a(331));var q=at;if(at|=4,Vm(w.current),Pm(w,w.current,O,o),at=q,Oo(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(Mn,w)}catch{}p=!0}return p}finally{Q.p=h,z.T=u,sv(e,t)}}return!1}function lv(e,t,o){t=fn(o,t),t=Rc(e.stateNode,t,2),e=Lr(e,t,2),e!==null&&(Ia(e,2),Hn(e))}function Qe(e,t,o){if(e.tag===3)lv(e,e,o);else for(;t!==null;){if(t.tag===3){lv(t,e,o);break}else if(t.tag===1){var u=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ur===null||!Ur.has(u))){e=fn(o,e),o=fm(2),u=Lr(t,o,2),u!==null&&(dm(o,u,t,e),Ia(u,2),Hn(u));break}}t=t.return}}function df(e,t,o){var u=e.pingCache;if(u===null){u=e.pingCache=new ex;var h=new Set;u.set(t,h)}else h=u.get(t),h===void 0&&(h=new Set,u.set(t,h));h.has(o)||(ef=!0,h.add(o),e=ox.bind(null,e,t,o),t.then(e,e))}function ox(e,t,o){var u=e.pingCache;u!==null&&u.delete(t),e.pingedLanes|=e.suspendedLanes&o,e.warmLanes&=~o,tt===e&&(He&o)===o&&(st===4||st===3&&(He&62914560)===He&&300>Ie()-rf?!(at&2)&&fa(e,0):tf|=o,ca===He&&(ca=0)),Hn(e)}function uv(e,t){t===0&&(t=hg()),e=_r(e,t),e!==null&&(Ia(e,t),Hn(e))}function sx(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),uv(e,o)}function lx(e,t){var o=0;switch(e.tag){case 13:var u=e.stateNode,h=e.memoizedState;h!==null&&(o=h.retryLane);break;case 19:u=e.stateNode;break;case 22:u=e.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(t),uv(e,o)}function ux(e,t){return Se(e,t)}var ol=null,ga=null,hf=!1,sl=!1,gf=!1,Ci=0;function Hn(e){e!==ga&&e.next===null&&(ga===null?ol=ga=e:ga=ga.next=e),sl=!0,hf||(hf=!0,fx(cx))}function Oo(e,t){if(!gf&&sl){gf=!0;do for(var o=!1,u=ol;u!==null;){if(e!==0){var h=u.pendingLanes;if(h===0)var p=0;else{var w=u.suspendedLanes,O=u.pingedLanes;p=(1<<31-Wt(42|e)+1)-1,p&=h&~(w&~O),p=p&201326677?p&201326677|1:p?p|2:0}p!==0&&(o=!0,dv(u,p))}else p=He,p=ms(u,u===tt?p:0),!(p&3)||Va(u,p)||(o=!0,dv(u,p));u=u.next}while(o);gf=!1}}function cx(){sl=hf=!1;var e=0;Ci!==0&&(bx()&&(e=Ci),Ci=0);for(var t=Ie(),o=null,u=ol;u!==null;){var h=u.next,p=cv(u,t);p===0?(u.next=null,o===null?ol=h:o.next=h,h===null&&(ga=o)):(o=u,(e!==0||p&3)&&(sl=!0)),u=h}Oo(e)}function cv(e,t){for(var o=e.suspendedLanes,u=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0"u"?null:document;function Av(e,t,o){var u=ma;if(u&&typeof t=="string"&&t){var h=un(t);h='link[rel="'+e+'"][href="'+h+'"]',typeof o=="string"&&(h+='[crossorigin="'+o+'"]'),Cv.has(h)||(Cv.add(h),e={rel:e,crossOrigin:o,href:t},u.querySelector(h)===null&&(t=u.createElement("link"),kt(t,"link",e),St(t),u.head.appendChild(t)))}}function Ax(e){dr.D(e),Av("dns-prefetch",e,null)}function Rx(e,t){dr.C(e,t),Av("preconnect",e,t)}function Dx(e,t,o){dr.L(e,t,o);var u=ma;if(u&&e&&t){var h='link[rel="preload"][as="'+un(t)+'"]';t==="image"&&o&&o.imageSrcSet?(h+='[imagesrcset="'+un(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(h+='[imagesizes="'+un(o.imageSizes)+'"]')):h+='[href="'+un(e)+'"]';var p=h;switch(t){case"style":p=va(e);break;case"script":p=ya(e)}bn.has(p)||(e=F({rel:"preload",href:t==="image"&&o&&o.imageSrcSet?void 0:e,as:t},o),bn.set(p,e),u.querySelector(h)!==null||t==="style"&&u.querySelector(No(p))||t==="script"&&u.querySelector(zo(p))||(t=u.createElement("link"),kt(t,"link",e),St(t),u.head.appendChild(t)))}}function Ox(e,t){dr.m(e,t);var o=ma;if(o&&e){var u=t&&typeof t.as=="string"?t.as:"script",h='link[rel="modulepreload"][as="'+un(u)+'"][href="'+un(e)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ya(e)}if(!bn.has(p)&&(e=F({rel:"modulepreload",href:e},t),bn.set(p,e),o.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(zo(p)))return}u=o.createElement("link"),kt(u,"link",e),St(u),o.head.appendChild(u)}}}function kx(e,t,o){dr.S(e,t,o);var u=ma;if(u&&e){var h=Fi(u).hoistableStyles,p=va(e);t=t||"default";var w=h.get(p);if(!w){var O={loading:0,preload:null};if(w=u.querySelector(No(p)))O.loading=5;else{e=F({rel:"stylesheet",href:e,"data-precedence":t},o),(o=bn.get(p))&&Rf(e,o);var q=w=u.createElement("link");St(q),kt(q,"link",e),q._p=new Promise(function(Z,oe){q.onload=Z,q.onerror=oe}),q.addEventListener("load",function(){O.loading|=1}),q.addEventListener("error",function(){O.loading|=2}),O.loading|=4,hl(w,t,u)}w={type:"stylesheet",instance:w,count:1,state:O},h.set(p,w)}}}function Lx(e,t){dr.X(e,t);var o=ma;if(o&&e){var u=Fi(o).hoistableScripts,h=ya(e),p=u.get(h);p||(p=o.querySelector(zo(h)),p||(e=F({src:e,async:!0},t),(t=bn.get(h))&&Df(e,t),p=o.createElement("script"),St(p),kt(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Nx(e,t){dr.M(e,t);var o=ma;if(o&&e){var u=Fi(o).hoistableScripts,h=ya(e),p=u.get(h);p||(p=o.querySelector(zo(h)),p||(e=F({src:e,async:!0,type:"module"},t),(t=bn.get(h))&&Df(e,t),p=o.createElement("script"),St(p),kt(p,"link",e),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Rv(e,t,o,u){var h=(h=Le.current)?dl(h):null;if(!h)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(t=va(o.href),o=Fi(h).hoistableStyles,u=o.get(t),u||(u={type:"style",instance:null,count:0,state:null},o.set(t,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){e=va(o.href);var p=Fi(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(No(e)))&&!p._p&&(w.instance=p,w.state.loading=5),bn.has(e)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},bn.set(e,o),p||zx(h,e,o,w.state))),t&&u===null)throw Error(a(528,""));return w}if(t&&u!==null)throw Error(a(529,""));return null;case"script":return t=o.async,o=o.src,typeof o=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ya(o),o=Fi(h).hoistableScripts,u=o.get(t),u||(u={type:"script",instance:null,count:0,state:null},o.set(t,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function va(e){return'href="'+un(e)+'"'}function No(e){return'link[rel="stylesheet"]['+e+"]"}function Dv(e){return F({},e,{"data-precedence":e.precedence,precedence:null})}function zx(e,t,o,u){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?u.loading=1:(t=e.createElement("link"),u.preload=t,t.addEventListener("load",function(){return u.loading|=1}),t.addEventListener("error",function(){return u.loading|=2}),kt(t,"link",o),St(t),e.head.appendChild(t))}function ya(e){return'[src="'+un(e)+'"]'}function zo(e){return"script[async]"+e}function Ov(e,t,o){if(t.count++,t.instance===null)switch(t.type){case"style":var u=e.querySelector('style[data-href~="'+un(o.href)+'"]');if(u)return t.instance=u,St(u),u;var h=F({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(e.ownerDocument||e).createElement("style"),St(u),kt(u,"style",h),hl(u,o.precedence,e),t.instance=u;case"stylesheet":h=va(o.href);var p=e.querySelector(No(h));if(p)return t.state.loading|=4,t.instance=p,St(p),p;u=Dv(o),(h=bn.get(h))&&Rf(u,h),p=(e.ownerDocument||e).createElement("link"),St(p);var w=p;return w._p=new Promise(function(O,q){w.onload=O,w.onerror=q}),kt(p,"link",u),t.state.loading|=4,hl(p,o.precedence,e),t.instance=p;case"script":return p=ya(o.src),(h=e.querySelector(zo(p)))?(t.instance=h,St(h),h):(u=o,(h=bn.get(p))&&(u=F({},o),Df(u,h)),e=e.ownerDocument||e,h=e.createElement("script"),St(h),kt(h,"link",u),e.head.appendChild(h),t.instance=h);case"void":return null;default:throw Error(a(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(u=t.instance,t.state.loading|=4,hl(u,o.precedence,e));return t.instance}function hl(e,t,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,p=h,w=0;w title"):null)}function Gx(e,t,o){if(o===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Nv(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Go=null;function Mx(){}function jx(e,t,o){if(Go===null)throw Error(a(475));var u=Go;if(t.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var h=va(o.href),p=e.querySelector(No(h));if(p){e=p._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(u.count++,u=pl.bind(u),e.then(u,u)),t.state.loading|=4,t.instance=p,St(p);return}p=e.ownerDocument||e,o=Dv(o),(h=bn.get(h))&&Rf(o,h),p=p.createElement("link"),St(p);var w=p;w._p=new Promise(function(O,q){w.onload=O,w.onerror=q}),kt(p,"link",o),t.instance=p}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(u.count++,t=pl.bind(u),e.addEventListener("load",t),e.addEventListener("error",t))}}function Ux(){if(Go===null)throw Error(a(475));var e=Go;return e.stylesheets&&e.count===0&&Of(e,e.stylesheets),0"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(n){console.error(n)}}return r(),Bf.exports=a_(),Bf.exports}var s_=o_();const ty=r=>{let n;const i=new Set,a=(g,m)=>{const v=typeof g=="function"?g(n):g;if(!Object.is(v,n)){const y=n;n=m??(typeof v!="object"||v===null)?v:Object.assign({},n,v),i.forEach(b=>b(n,y))}},s=()=>n,f={setState:a,getState:s,getInitialState:()=>d,subscribe:g=>(i.add(g),()=>i.delete(g))},d=n=r(a,s,f);return f},l_=r=>r?ty(r):ty,u_=r=>r;function c_(r,n=u_){const i=bt.useSyncExternalStore(r.subscribe,()=>n(r.getState()),()=>n(r.getInitialState()));return bt.useDebugValue(i),i}const f_=r=>{const n=l_(r),i=a=>c_(n,a);return Object.assign(i,n),i},yh=r=>f_;function s0(r,n){let i;try{i=r()}catch{return}return{getItem:s=>{var l;const c=d=>d===null?null:JSON.parse(d,void 0),f=(l=i.getItem(s))!=null?l:null;return f instanceof Promise?f.then(c):c(f)},setItem:(s,l)=>i.setItem(s,JSON.stringify(l,void 0)),removeItem:s=>i.removeItem(s)}}const qd=r=>n=>{try{const i=r(n);return i instanceof Promise?i:{then(a){return qd(a)(i)},catch(a){return this}}}catch(i){return{then(a){return this},catch(a){return qd(a)(i)}}}},d_=(r,n)=>(i,a,s)=>{let l={storage:s0(()=>localStorage),partialize:E=>E,version:0,merge:(E,T)=>({...T,...E}),...n},c=!1;const f=new Set,d=new Set;let g=l.storage;if(!g)return r((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),i(...E)},a,s);const m=()=>{const E=l.partialize({...a()});return g.setItem(l.name,{state:E,version:l.version})},v=s.setState;s.setState=(E,T)=>{v(E,T),m()};const y=r((...E)=>{i(...E),m()},a,s);s.getInitialState=()=>y;let b;const x=()=>{var E,T;if(!g)return;c=!1,f.forEach(N=>{var L;return N((L=a())!=null?L:y)});const M=((T=l.onRehydrateStorage)==null?void 0:T.call(l,(E=a())!=null?E:y))||void 0;return qd(g.getItem.bind(g))(l.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==l.version){if(l.migrate){const L=l.migrate(N.state,N.version);return L instanceof Promise?L.then(C=>[!0,C]):[!0,L]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var L;const[C,R]=N;if(b=l.merge(R,(L=a())!=null?L:y),i(b,!0),C)return m()}).then(()=>{M==null||M(b,void 0),b=a(),c=!0,d.forEach(N=>N(b))}).catch(N=>{M==null||M(void 0,N)})};return s.persist={setOptions:E=>{l={...l,...E},E.storage&&(g=E.storage)},clearStorage:()=>{g==null||g.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>x(),hasHydrated:()=>c,onHydrate:E=>(f.add(E),()=>{f.delete(E)}),onFinishHydration:E=>(d.add(E),()=>{d.delete(E)})},l.skipHydration||x(),b||y},h_=d_;function l0(r){var n,i,a="";if(typeof r=="string"||typeof r=="number")a+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(n=0;n{const n=m_(r),{conflictingClassGroups:i,conflictingClassGroupModifiers:a}=r;return{getClassGroupId:c=>{const f=c.split(bh);return f[0]===""&&f.length!==1&&f.shift(),c0(f,n)||p_(c)},getConflictingClassGroupIds:(c,f)=>{const d=i[c]||[];return f&&a[c]?[...d,...a[c]]:d}}},c0=(r,n)=>{var c;if(r.length===0)return n.classGroupId;const i=r[0],a=n.nextPart.get(i),s=a?c0(r.slice(1),a):void 0;if(s)return s;if(n.validators.length===0)return;const l=r.join(bh);return(c=n.validators.find(({validator:f})=>f(l)))==null?void 0:c.classGroupId},ny=/^\[(.+)\]$/,p_=r=>{if(ny.test(r)){const n=ny.exec(r)[1],i=n==null?void 0:n.substring(0,n.indexOf(":"));if(i)return"arbitrary.."+i}},m_=r=>{const{theme:n,classGroups:i}=r,a={nextPart:new Map,validators:[]};for(const s in i)Vd(i[s],a,s,n);return a},Vd=(r,n,i,a)=>{r.forEach(s=>{if(typeof s=="string"){const l=s===""?n:ry(n,s);l.classGroupId=i;return}if(typeof s=="function"){if(v_(s)){Vd(s(a),n,i,a);return}n.validators.push({validator:s,classGroupId:i});return}Object.entries(s).forEach(([l,c])=>{Vd(c,ry(n,l),i,a)})})},ry=(r,n)=>{let i=r;return n.split(bh).forEach(a=>{i.nextPart.has(a)||i.nextPart.set(a,{nextPart:new Map,validators:[]}),i=i.nextPart.get(a)}),i},v_=r=>r.isThemeGetter,y_=r=>{if(r<1)return{get:()=>{},set:()=>{}};let n=0,i=new Map,a=new Map;const s=(l,c)=>{i.set(l,c),n++,n>r&&(n=0,a=i,i=new Map)};return{get(l){let c=i.get(l);if(c!==void 0)return c;if((c=a.get(l))!==void 0)return s(l,c),c},set(l,c){i.has(l)?i.set(l,c):s(l,c)}}},Id="!",Yd=":",b_=Yd.length,w_=r=>{const{prefix:n,experimentalParseClassName:i}=r;let a=s=>{const l=[];let c=0,f=0,d=0,g;for(let x=0;xd?g-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:b}};if(n){const s=n+Yd,l=a;a=c=>c.startsWith(s)?l(c.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:c,maybePostfixModifierPosition:void 0}}if(i){const s=a;a=l=>i({className:l,parseClassName:s})}return a},E_=r=>r.endsWith(Id)?r.substring(0,r.length-1):r.startsWith(Id)?r.substring(1):r,S_=r=>{const n=Object.fromEntries(r.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const s=[];let l=[];return a.forEach(c=>{c[0]==="["||n[c]?(s.push(...l.sort(),c),l=[]):l.push(c)}),s.push(...l.sort()),s}},x_=r=>({cache:y_(r.cacheSize),parseClassName:w_(r),sortModifiers:S_(r),...g_(r)}),__=/\s+/,T_=(r,n)=>{const{parseClassName:i,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:l}=n,c=[],f=r.trim().split(__);let d="";for(let g=f.length-1;g>=0;g-=1){const m=f[g],{isExternal:v,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:E}=i(m);if(v){d=m+(d.length>0?" "+d:d);continue}let T=!!E,M=a(T?x.substring(0,E):x);if(!M){if(!T){d=m+(d.length>0?" "+d:d);continue}if(M=a(x),!M){d=m+(d.length>0?" "+d:d);continue}T=!1}const N=l(y).join(":"),L=b?N+Id:N,C=L+M;if(c.includes(C))continue;c.push(C);const R=s(M,T);for(let B=0;B0?" "+d:d)}return d};function C_(){let r=0,n,i,a="";for(;r{if(typeof r=="string")return r;let n,i="";for(let a=0;av(m),r());return i=x_(g),a=i.cache.get,s=i.cache.set,l=f,f(d)}function f(d){const g=a(d);if(g)return g;const m=T_(d,i);return s(d,m),m}return function(){return l(C_.apply(null,arguments))}}const Ct=r=>{const n=i=>i[r]||[];return n.isThemeGetter=!0,n},d0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,h0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,R_=/^\d+\/\d+$/,D_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,O_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,k_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,L_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,N_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ba=r=>R_.test(r),Be=r=>!!r&&!Number.isNaN(Number(r)),Ai=r=>!!r&&Number.isInteger(Number(r)),iy=r=>r.endsWith("%")&&Be(r.slice(0,-1)),qr=r=>D_.test(r),z_=()=>!0,G_=r=>O_.test(r)&&!k_.test(r),wh=()=>!1,M_=r=>L_.test(r),j_=r=>N_.test(r),U_=r=>!we(r)&&!Ee(r),B_=r=>Ga(r,m0,wh),we=r=>d0.test(r),Ri=r=>Ga(r,v0,G_),$f=r=>Ga(r,W_,Be),F_=r=>Ga(r,g0,wh),H_=r=>Ga(r,p0,j_),P_=r=>Ga(r,wh,M_),Ee=r=>h0.test(r),_l=r=>Ma(r,v0),$_=r=>Ma(r,K_),q_=r=>Ma(r,g0),V_=r=>Ma(r,m0),I_=r=>Ma(r,p0),Y_=r=>Ma(r,Q_,!0),Ga=(r,n,i)=>{const a=d0.exec(r);return a?a[1]?n(a[1]):i(a[2]):!1},Ma=(r,n,i=!1)=>{const a=h0.exec(r);return a?a[1]?n(a[1]):i:!1},g0=r=>r==="position",X_=new Set(["image","url"]),p0=r=>X_.has(r),Z_=new Set(["length","size","percentage"]),m0=r=>Z_.has(r),v0=r=>r==="length",W_=r=>r==="number",K_=r=>r==="family-name",Q_=r=>r==="shadow",J_=()=>{const r=Ct("color"),n=Ct("font"),i=Ct("text"),a=Ct("font-weight"),s=Ct("tracking"),l=Ct("leading"),c=Ct("breakpoint"),f=Ct("container"),d=Ct("spacing"),g=Ct("radius"),m=Ct("shadow"),v=Ct("inset-shadow"),y=Ct("drop-shadow"),b=Ct("blur"),x=Ct("perspective"),E=Ct("aspect"),T=Ct("ease"),M=Ct("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],C=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],B=()=>[ba,"px","full","auto",Ee,we,d],_=()=>[Ai,"none","subgrid",Ee,we],$=()=>["auto",{span:["full",Ai,Ee,we]},Ee,we],z=()=>[Ai,"auto",Ee,we],F=()=>["auto","min","max","fr",Ee,we],Y=()=>[Ee,we,d],I=()=>["start","end","center","between","around","evenly","stretch","baseline"],j=()=>["start","end","center","stretch"],J=()=>[Ee,we,d],ae=()=>["px",...J()],H=()=>["px","auto",...J()],U=()=>[ba,"auto","px","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",Ee,we,d],D=()=>[r,Ee,we],se=()=>[iy,Ri],G=()=>["","none","full",g,Ee,we],P=()=>["",Be,_l,Ri],k=()=>["solid","dashed","dotted","double"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["","none",b,Ee,we],re=()=>["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ee,we],de=()=>["none",Be,Ee,we],ge=()=>["none",Be,Ee,we],le=()=>[Be,Ee,we],xe=()=>[ba,"full","px",Ee,we,d];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qr],breakpoint:[qr],color:[z_],container:[qr],"drop-shadow":[qr],ease:["in","out","in-out"],font:[U_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qr],shadow:[qr],spacing:[Be],text:[qr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ba,we,Ee,E]}],container:["container"],columns:[{columns:[Be,we,Ee,f]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),we,Ee]}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{start:B()}],end:[{end:B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[Ai,"auto",Ee,we]}],basis:[{basis:[ba,"full","auto",Ee,we,f,d]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Be,ba,"auto","initial","none",we]}],grow:[{grow:["",Be,Ee,we]}],shrink:[{shrink:["",Be,Ee,we]}],order:[{order:[Ai,"first","last","none",Ee,we]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:Y()}],"gap-x":[{"gap-x":Y()}],"gap-y":[{"gap-y":Y()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...j(),"baseline"]}],"align-self":[{self:["auto",...j(),"baseline"]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:ae()}],px:[{px:ae()}],py:[{py:ae()}],ps:[{ps:ae()}],pe:[{pe:ae()}],pt:[{pt:ae()}],pr:[{pr:ae()}],pb:[{pb:ae()}],pl:[{pl:ae()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":J()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":J()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[f,"screen",...U()]}],"min-w":[{"min-w":[f,"screen","none",...U()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...U()]}],h:[{h:["screen",...U()]}],"min-h":[{"min-h":["screen","none",...U()]}],"max-h":[{"max-h":["screen",...U()]}],"font-size":[{text:["base",i,_l,Ri]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ee,$f]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",iy,we]}],"font-family":[{font:[$_,we,n]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ee,we]}],"line-clamp":[{"line-clamp":[Be,"none",Ee,$f]}],leading:[{leading:[Ee,we,l,d]}],"list-image":[{"list-image":["none",Ee,we]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,we]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:[Be,"from-font","auto",Ee,Ri]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Be,"auto",Ee,we]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:["px",...J()]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,we]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),q_,F_]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:["auto","cover","contain",V_,B_]}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ai,Ee,we],radial:["",Ee,we],conic:[Ai,Ee,we]},I_,H_]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...k(),"hidden","none"]}],"divide-style":[{divide:[...k(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...k(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Be,Ee,we]}],"outline-w":[{outline:["",Be,_l,Ri]}],"outline-color":[{outline:[r]}],shadow:[{shadow:["","none",m,Y_,P_]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",Ee,we,v]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Be,Ri]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":D()}],opacity:[{opacity:[Be,Ee,we]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none",Ee,we]}],blur:[{blur:Q()}],brightness:[{brightness:[Be,Ee,we]}],contrast:[{contrast:[Be,Ee,we]}],"drop-shadow":[{"drop-shadow":["","none",y,Ee,we]}],grayscale:[{grayscale:["",Be,Ee,we]}],"hue-rotate":[{"hue-rotate":[Be,Ee,we]}],invert:[{invert:["",Be,Ee,we]}],saturate:[{saturate:[Be,Ee,we]}],sepia:[{sepia:["",Be,Ee,we]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,we]}],"backdrop-blur":[{"backdrop-blur":Q()}],"backdrop-brightness":[{"backdrop-brightness":[Be,Ee,we]}],"backdrop-contrast":[{"backdrop-contrast":[Be,Ee,we]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Be,Ee,we]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Be,Ee,we]}],"backdrop-invert":[{"backdrop-invert":["",Be,Ee,we]}],"backdrop-opacity":[{"backdrop-opacity":[Be,Ee,we]}],"backdrop-saturate":[{"backdrop-saturate":[Be,Ee,we]}],"backdrop-sepia":[{"backdrop-sepia":["",Be,Ee,we]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":J()}],"border-spacing-x":[{"border-spacing-x":J()}],"border-spacing-y":[{"border-spacing-y":J()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,we]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Be,"initial",Ee,we]}],ease:[{ease:["linear","initial",T,Ee,we]}],delay:[{delay:[Be,Ee,we]}],animate:[{animate:["none",M,Ee,we]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Ee,we]}],"perspective-origin":[{"perspective-origin":re()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[Ee,we,"","none","gpu","cpu"]}],"transform-origin":[{origin:re()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,we]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":J()}],"scroll-mx":[{"scroll-mx":J()}],"scroll-my":[{"scroll-my":J()}],"scroll-ms":[{"scroll-ms":J()}],"scroll-me":[{"scroll-me":J()}],"scroll-mt":[{"scroll-mt":J()}],"scroll-mr":[{"scroll-mr":J()}],"scroll-mb":[{"scroll-mb":J()}],"scroll-ml":[{"scroll-ml":J()}],"scroll-p":[{"scroll-p":J()}],"scroll-px":[{"scroll-px":J()}],"scroll-py":[{"scroll-py":J()}],"scroll-ps":[{"scroll-ps":J()}],"scroll-pe":[{"scroll-pe":J()}],"scroll-pt":[{"scroll-pt":J()}],"scroll-pr":[{"scroll-pr":J()}],"scroll-pb":[{"scroll-pb":J()}],"scroll-pl":[{"scroll-pl":J()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,we]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Be,_l,Ri,$f]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["before","after","placeholder","file","marker","selection","first-line","first-letter","backdrop","*","**"]}},eT=A_(J_);function Xe(...r){return eT(u0(r))}function tT(){const r="0123456789abcdef";let n="#";for(let i=0;i<6;i++)n+=r.charAt(Math.floor(Math.random()*16));return n}function y0(r){return r instanceof Error?r.message:`${r}`}const Eh=r=>{const n=r;n.use={};for(const i of Object.keys(n.getState()))n.use[i]=()=>n(a=>a[i]);return n},nT="",qn="ghost",rT="#B2EBF2",iT="#000",aT="#E2E2E2",oT="#EEEEEE",sT="#F57F17",lT="#969696",uT="#F57F17",ay="#B2EBF2",qf=20,oy=4,cT=20,fT=15,sy="*",dT=yh()(h_(r=>({theme:"system",showPropertyPanel:!0,showNodeSearchBar:!0,showNodeLabel:!0,enableNodeDrag:!0,showEdgeLabel:!1,enableHideUnselectedEdges:!0,enableEdgeEvents:!1,queryLabel:sy,enableHealthCheck:!0,apiKey:null,setTheme:n=>r({theme:n}),setQueryLabel:n=>r({queryLabel:n}),setEnableHealthCheck:n=>r({enableHealthCheck:n}),setApiKey:n=>r({apiKey:n})}),{name:"settings-storage",storage:s0(()=>localStorage),version:4,migrate:(r,n)=>{n<2&&(r.showEdgeLabel=!1),n<3&&(r.queryLabel=sy),n<4&&(r.showPropertyPanel=!0,r.showNodeSearchBar=!0,r.showNodeLabel=!0,r.enableHealthCheck=!0,r.apiKey=null)}})),Pe=Eh(dT),hT={theme:"system",setTheme:()=>null},b0=S.createContext(hT);function gT({children:r,...n}){const[i,a]=S.useState(Pe.getState().theme);S.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),i==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c),a(c);return}l.classList.add(i)},[i]);const s={theme:i,setTheme:l=>{Pe.getState().setTheme(l),a(l)}};return A.jsx(b0.Provider,{...n,value:s,children:r})}const ly=r=>typeof r=="boolean"?`${r}`:r===0?"0":r,uy=u0,w0=(r,n)=>i=>{var a;if((n==null?void 0:n.variants)==null)return uy(r,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:s,defaultVariants:l}=n,c=Object.keys(s).map(g=>{const m=i==null?void 0:i[g],v=l==null?void 0:l[g];if(m===null)return null;const y=ly(m)||ly(v);return s[g][y]}),f=i&&Object.entries(i).reduce((g,m)=>{let[v,y]=m;return y===void 0||(g[v]=y),g},{}),d=n==null||(a=n.compoundVariants)===null||a===void 0?void 0:a.reduce((g,m)=>{let{class:v,className:y,...b}=m;return Object.entries(b).every(x=>{let[E,T]=x;return Array.isArray(T)?T.includes({...l,...f}[E]):{...l,...f}[E]===T})?[...g,v,y]:g},[]);return uy(r,c,d,i==null?void 0:i.class,i==null?void 0:i.className)},pT=w0("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),E0=S.forwardRef(({className:r,variant:n,...i},a)=>A.jsx("div",{ref:a,role:"alert",className:Xe(pT({variant:n}),r),...i}));E0.displayName="Alert";const S0=S.forwardRef(({className:r,...n},i)=>A.jsx("h5",{ref:i,className:Xe("mb-1 leading-none font-medium tracking-tight",r),...n}));S0.displayName="AlertTitle";const x0=S.forwardRef(({className:r,...n},i)=>A.jsx("div",{ref:i,className:Xe("text-sm [&_p]:leading-relaxed",r),...n}));x0.displayName="AlertDescription";const mT=async r=>{const n=r.headers.get("content-type");if(n)if(n.includes("application/json")){const i=await r.json();return JSON.stringify(i,void 0,2)}else{if(n.startsWith("text/"))return await r.text();if(n.includes("application/xml")||n.includes("text/xml"))return await r.text();if(n.includes("application/octet-stream")){const i=await r.arrayBuffer();return new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}).decode(i)}else try{return await r.text()}catch(i){return console.warn("Failed to decode as text, may be binary:",i),`[Could not decode response body. Content-Type: ${n}]`}}else try{return await r.text()}catch(i){return console.warn("Failed to decode as text, may be binary:",i),"[Could not decode response body. No Content-Type header.]"}return""},Sh=async(r,n={})=>{const i=Pe.getState().apiKey,a={...n.headers||{},...i?{"X-API-Key":i}:{}},s=await fetch(nT+r,{...n,headers:a});if(!s.ok)throw new Error(`${s.status} ${s.statusText} ${await mT(s)} ${s.url}`);return s},vT=async r=>await(await Sh(`/graphs?label=${r}`)).json(),yT=async()=>await(await Sh("/graph/label/list")).json(),bT=async()=>{try{return await(await Sh("/health")).json()}catch(r){return{status:"error",message:y0(r)}}},wT=yh()(r=>({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:null,check:async()=>{const n=await bT();return n.status==="healthy"?(r({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:n}),!0):(r({health:!1,message:n.message,messageTitle:"Backend Health Check Error!",lastCheckTime:Date.now(),status:null}),!1)},clear:()=>{r({health:!0,message:null,messageTitle:null})},setErrorMessage:(n,i)=>{r({health:!1,message:n,messageTitle:i})}})),kn=Eh(wT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_0=(...r)=>r.filter((n,i,a)=>!!n&&n.trim()!==""&&a.indexOf(n)===i).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var ST={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xT=S.forwardRef(({color:r="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:s="",children:l,iconNode:c,...f},d)=>S.createElement("svg",{ref:d,...ST,width:n,height:n,stroke:r,strokeWidth:a?Number(i)*24/Number(n):i,className:_0("lucide",s),...f},[...c.map(([g,m])=>S.createElement(g,m)),...Array.isArray(l)?l:[l]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zt=(r,n)=>{const i=S.forwardRef(({className:a,...s},l)=>S.createElement(xT,{ref:l,iconNode:n,className:_0(`lucide-${ET(r)}`,a),...s}));return i.displayName=`${r}`,i};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _T=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],T0=zt("Check",_T);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],CT=zt("ChevronsUpDown",TT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],RT=zt("CircleAlert",AT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]],OT=zt("Fullscreen",DT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kT=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],LT=zt("Grip",kT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],C0=zt("LoaderCircle",NT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],GT=zt("Maximize",zT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],jT=zt("Minimize",MT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],BT=zt("Moon",UT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],HT=zt("Pause",FT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PT=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],$T=zt("Play",PT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],VT=zt("Search",qT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IT=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],YT=zt("Settings",IT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ZT=zt("Sun",XT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],KT=zt("X",WT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],JT=zt("ZoomIn",QT);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eC=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],tC=zt("ZoomOut",eC),nC=()=>{const r=kn.use.health(),n=kn.use.message(),i=kn.use.messageTitle(),[a,s]=S.useState(!1);return S.useEffect(()=>{setTimeout(()=>{s(!0)},50)},[]),A.jsxs(E0,{variant:r?"default":"destructive",className:Xe("bg-background/90 absolute top-2 left-1/2 flex w-auto -translate-x-1/2 transform items-center gap-4 shadow-md backdrop-blur-lg transition-all duration-500 ease-in-out",a?"translate-y-0 opacity-100":"-translate-y-20 opacity-0"),children:[!r&&A.jsx("div",{children:A.jsx(RT,{className:"size-4"})}),A.jsxs("div",{children:[A.jsx(S0,{className:"font-bold",children:i}),A.jsx(x0,{children:n})]})]})};function ht(r,n,{checkForDefaultPrevented:i=!0}={}){return function(s){if(r==null||r(s),i===!1||!s.defaultPrevented)return n==null?void 0:n(s)}}function cy(r,n){if(typeof r=="function")return r(n);r!=null&&(r.current=n)}function A0(...r){return n=>{let i=!1;const a=r.map(s=>{const l=cy(s,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let s=0;s{const{children:c,...f}=l,d=S.useMemo(()=>f,Object.values(f));return A.jsx(i.Provider,{value:d,children:c})};a.displayName=r+"Provider";function s(l){const c=S.useContext(i);if(c)return c;if(n!==void 0)return n;throw new Error(`\`${l}\` must be used within \`${r}\``)}return[a,s]}function rs(r,n=[]){let i=[];function a(l,c){const f=S.createContext(c),d=i.length;i=[...i,c];const g=v=>{var M;const{scope:y,children:b,...x}=v,E=((M=y==null?void 0:y[r])==null?void 0:M[d])||f,T=S.useMemo(()=>x,Object.values(x));return A.jsx(E.Provider,{value:T,children:b})};g.displayName=l+"Provider";function m(v,y){var E;const b=((E=y==null?void 0:y[r])==null?void 0:E[d])||f,x=S.useContext(b);if(x)return x;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${l}\``)}return[g,m]}const s=()=>{const l=i.map(c=>S.createContext(c));return function(f){const d=(f==null?void 0:f[r])||l;return S.useMemo(()=>({[`__scope${r}`]:{...f,[r]:d}}),[f,d])}};return s.scopeName=r,[a,iC(s,...n)]}function iC(...r){const n=r[0];if(r.length===1)return n;const i=()=>{const a=r.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(l){const c=a.reduce((f,{useScope:d,scopeName:g})=>{const v=d(l)[`__scope${g}`];return{...f,...v}},{});return S.useMemo(()=>({[`__scope${n.scopeName}`]:c}),[c])}};return i.scopeName=n.scopeName,i}var xh=o0();const aC=on(xh);var is=S.forwardRef((r,n)=>{const{children:i,...a}=r,s=S.Children.toArray(i),l=s.find(oC);if(l){const c=l.props.children,f=s.map(d=>d===l?S.Children.count(c)>1?S.Children.only(null):S.isValidElement(c)?c.props.children:null:d);return A.jsx(Xd,{...a,ref:n,children:S.isValidElement(c)?S.cloneElement(c,void 0,f):null})}return A.jsx(Xd,{...a,ref:n,children:i})});is.displayName="Slot";var Xd=S.forwardRef((r,n)=>{const{children:i,...a}=r;if(S.isValidElement(i)){const s=lC(i),l=sC(a,i.props);return i.type!==S.Fragment&&(l.ref=n?A0(n,s):s),S.cloneElement(i,l)}return S.Children.count(i)>1?S.Children.only(null):null});Xd.displayName="SlotClone";var R0=({children:r})=>A.jsx(A.Fragment,{children:r});function oC(r){return S.isValidElement(r)&&r.type===R0}function sC(r,n){const i={...n};for(const a in n){const s=r[a],l=n[a];/^on[A-Z]/.test(a)?s&&l?i[a]=(...f)=>{l(...f),s(...f)}:s&&(i[a]=s):a==="style"?i[a]={...s,...l}:a==="className"&&(i[a]=[s,l].filter(Boolean).join(" "))}return{...r,...i}}function lC(r){var a,s;let n=(a=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:a.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?r.ref:(n=(s=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:s.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?r.props.ref:r.props.ref||r.ref)}var uC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Je=uC.reduce((r,n)=>{const i=S.forwardRef((a,s)=>{const{asChild:l,...c}=a,f=l?is:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),A.jsx(f,{...c,ref:s})});return i.displayName=`Primitive.${n}`,{...r,[n]:i}},{});function cC(r,n){r&&xh.flushSync(()=>r.dispatchEvent(n))}function Qr(r){const n=S.useRef(r);return S.useEffect(()=>{n.current=r}),S.useMemo(()=>(...i)=>{var a;return(a=n.current)==null?void 0:a.call(n,...i)},[])}function fC(r,n=globalThis==null?void 0:globalThis.document){const i=Qr(r);S.useEffect(()=>{const a=s=>{s.key==="Escape"&&i(s)};return n.addEventListener("keydown",a,{capture:!0}),()=>n.removeEventListener("keydown",a,{capture:!0})},[i,n])}var dC="DismissableLayer",Zd="dismissableLayer.update",hC="dismissableLayer.pointerDownOutside",gC="dismissableLayer.focusOutside",fy,D0=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hu=S.forwardRef((r,n)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:c,onDismiss:f,...d}=r,g=S.useContext(D0),[m,v]=S.useState(null),y=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=S.useState({}),x=Vt(n,_=>v(_)),E=Array.from(g.layers),[T]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),M=E.indexOf(T),N=m?E.indexOf(m):-1,L=g.layersWithOutsidePointerEventsDisabled.size>0,C=N>=M,R=vC(_=>{const $=_.target,z=[...g.branches].some(F=>F.contains($));!C||z||(s==null||s(_),c==null||c(_),_.defaultPrevented||f==null||f())},y),B=yC(_=>{const $=_.target;[...g.branches].some(F=>F.contains($))||(l==null||l(_),c==null||c(_),_.defaultPrevented||f==null||f())},y);return fC(_=>{N===g.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&f&&(_.preventDefault(),f()))},y),S.useEffect(()=>{if(m)return i&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(fy=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(m)),g.layers.add(m),dy(),()=>{i&&g.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=fy)}},[m,y,i,g]),S.useEffect(()=>()=>{m&&(g.layers.delete(m),g.layersWithOutsidePointerEventsDisabled.delete(m),dy())},[m,g]),S.useEffect(()=>{const _=()=>b({});return document.addEventListener(Zd,_),()=>document.removeEventListener(Zd,_)},[]),A.jsx(Je.div,{...d,ref:x,style:{pointerEvents:L?C?"auto":"none":void 0,...r.style},onFocusCapture:ht(r.onFocusCapture,B.onFocusCapture),onBlurCapture:ht(r.onBlurCapture,B.onBlurCapture),onPointerDownCapture:ht(r.onPointerDownCapture,R.onPointerDownCapture)})});hu.displayName=dC;var pC="DismissableLayerBranch",mC=S.forwardRef((r,n)=>{const i=S.useContext(D0),a=S.useRef(null),s=Vt(n,a);return S.useEffect(()=>{const l=a.current;if(l)return i.branches.add(l),()=>{i.branches.delete(l)}},[i.branches]),A.jsx(Je.div,{...r,ref:s})});mC.displayName=pC;function vC(r,n=globalThis==null?void 0:globalThis.document){const i=Qr(r),a=S.useRef(!1),s=S.useRef(()=>{});return S.useEffect(()=>{const l=f=>{if(f.target&&!a.current){let d=function(){O0(hC,i,g,{discrete:!0})};const g={originalEvent:f};f.pointerType==="touch"?(n.removeEventListener("click",s.current),s.current=d,n.addEventListener("click",s.current,{once:!0})):d()}else n.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{n.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),n.removeEventListener("pointerdown",l),n.removeEventListener("click",s.current)}},[n,i]),{onPointerDownCapture:()=>a.current=!0}}function yC(r,n=globalThis==null?void 0:globalThis.document){const i=Qr(r),a=S.useRef(!1);return S.useEffect(()=>{const s=l=>{l.target&&!a.current&&O0(gC,i,{originalEvent:l},{discrete:!1})};return n.addEventListener("focusin",s),()=>n.removeEventListener("focusin",s)},[n,i]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function dy(){const r=new CustomEvent(Zd);document.dispatchEvent(r)}function O0(r,n,i,{discrete:a}){const s=i.originalEvent.target,l=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:i});n&&s.addEventListener(r,n,{once:!0}),a?cC(s,l):s.dispatchEvent(l)}var Vf=0;function k0(){S.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??hy()),document.body.insertAdjacentElement("beforeend",r[1]??hy()),Vf++,()=>{Vf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Vf--}},[])}function hy(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var If="focusScope.autoFocusOnMount",Yf="focusScope.autoFocusOnUnmount",gy={bubbles:!1,cancelable:!0},bC="FocusScope",_h=S.forwardRef((r,n)=>{const{loop:i=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...c}=r,[f,d]=S.useState(null),g=Qr(s),m=Qr(l),v=S.useRef(null),y=Vt(n,E=>d(E)),b=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(a){let E=function(L){if(b.paused||!f)return;const C=L.target;f.contains(C)?v.current=C:Xr(v.current,{select:!0})},T=function(L){if(b.paused||!f)return;const C=L.relatedTarget;C!==null&&(f.contains(C)||Xr(v.current,{select:!0}))},M=function(L){if(document.activeElement===document.body)for(const R of L)R.removedNodes.length>0&&Xr(f)};document.addEventListener("focusin",E),document.addEventListener("focusout",T);const N=new MutationObserver(M);return f&&N.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",T),N.disconnect()}}},[a,f,b.paused]),S.useEffect(()=>{if(f){my.add(b);const E=document.activeElement;if(!f.contains(E)){const M=new CustomEvent(If,gy);f.addEventListener(If,g),f.dispatchEvent(M),M.defaultPrevented||(wC(TC(L0(f)),{select:!0}),document.activeElement===E&&Xr(f))}return()=>{f.removeEventListener(If,g),setTimeout(()=>{const M=new CustomEvent(Yf,gy);f.addEventListener(Yf,m),f.dispatchEvent(M),M.defaultPrevented||Xr(E??document.body,{select:!0}),f.removeEventListener(Yf,m),my.remove(b)},0)}}},[f,g,m,b]);const x=S.useCallback(E=>{if(!i&&!a||b.paused)return;const T=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,M=document.activeElement;if(T&&M){const N=E.currentTarget,[L,C]=EC(N);L&&C?!E.shiftKey&&M===C?(E.preventDefault(),i&&Xr(L,{select:!0})):E.shiftKey&&M===L&&(E.preventDefault(),i&&Xr(C,{select:!0})):M===N&&E.preventDefault()}},[i,a,b.paused]);return A.jsx(Je.div,{tabIndex:-1,...c,ref:y,onKeyDown:x})});_h.displayName=bC;function wC(r,{select:n=!1}={}){const i=document.activeElement;for(const a of r)if(Xr(a,{select:n}),document.activeElement!==i)return}function EC(r){const n=L0(r),i=py(n,r),a=py(n.reverse(),r);return[i,a]}function L0(r){const n=[],i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const s=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||s?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)n.push(i.currentNode);return n}function py(r,n){for(const i of r)if(!SC(i,{upTo:n}))return i}function SC(r,{upTo:n}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(n!==void 0&&r===n)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function xC(r){return r instanceof HTMLInputElement&&"select"in r}function Xr(r,{select:n=!1}={}){if(r&&r.focus){const i=document.activeElement;r.focus({preventScroll:!0}),r!==i&&xC(r)&&n&&r.select()}}var my=_C();function _C(){let r=[];return{add(n){const i=r[0];n!==i&&(i==null||i.pause()),r=vy(r,n),r.unshift(n)},remove(n){var i;r=vy(r,n),(i=r[0])==null||i.resume()}}}function vy(r,n){const i=[...r],a=i.indexOf(n);return a!==-1&&i.splice(a,1),i}function TC(r){return r.filter(n=>n.tagName!=="A")}var Li=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},CC=t_.useId||(()=>{}),AC=0;function Ln(r){const[n,i]=S.useState(CC());return Li(()=>{i(a=>a??String(AC++))},[r]),n?`radix-${n}`:""}const RC=["top","right","bottom","left"],Jr=Math.min,nn=Math.max,nu=Math.round,Tl=Math.floor,Vn=r=>({x:r,y:r}),DC={left:"right",right:"left",bottom:"top",top:"bottom"},OC={start:"end",end:"start"};function Wd(r,n,i){return nn(r,Jr(n,i))}function br(r,n){return typeof r=="function"?r(n):r}function wr(r){return r.split("-")[0]}function ja(r){return r.split("-")[1]}function Th(r){return r==="x"?"y":"x"}function Ch(r){return r==="y"?"height":"width"}function ei(r){return["top","bottom"].includes(wr(r))?"y":"x"}function Ah(r){return Th(ei(r))}function kC(r,n,i){i===void 0&&(i=!1);const a=ja(r),s=Ah(r),l=Ch(s);let c=s==="x"?a===(i?"end":"start")?"right":"left":a==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(c=ru(c)),[c,ru(c)]}function LC(r){const n=ru(r);return[Kd(r),n,Kd(n)]}function Kd(r){return r.replace(/start|end/g,n=>OC[n])}function NC(r,n,i){const a=["left","right"],s=["right","left"],l=["top","bottom"],c=["bottom","top"];switch(r){case"top":case"bottom":return i?n?s:a:n?a:s;case"left":case"right":return n?l:c;default:return[]}}function zC(r,n,i,a){const s=ja(r);let l=NC(wr(r),i==="start",a);return s&&(l=l.map(c=>c+"-"+s),n&&(l=l.concat(l.map(Kd)))),l}function ru(r){return r.replace(/left|right|bottom|top/g,n=>DC[n])}function GC(r){return{top:0,right:0,bottom:0,left:0,...r}}function N0(r){return typeof r!="number"?GC(r):{top:r,right:r,bottom:r,left:r}}function iu(r){const{x:n,y:i,width:a,height:s}=r;return{width:a,height:s,top:i,left:n,right:n+a,bottom:i+s,x:n,y:i}}function yy(r,n,i){let{reference:a,floating:s}=r;const l=ei(n),c=Ah(n),f=Ch(c),d=wr(n),g=l==="y",m=a.x+a.width/2-s.width/2,v=a.y+a.height/2-s.height/2,y=a[f]/2-s[f]/2;let b;switch(d){case"top":b={x:m,y:a.y-s.height};break;case"bottom":b={x:m,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:v};break;case"left":b={x:a.x-s.width,y:v};break;default:b={x:a.x,y:a.y}}switch(ja(n)){case"start":b[c]-=y*(i&&g?-1:1);break;case"end":b[c]+=y*(i&&g?-1:1);break}return b}const MC=async(r,n,i)=>{const{placement:a="bottom",strategy:s="absolute",middleware:l=[],platform:c}=i,f=l.filter(Boolean),d=await(c.isRTL==null?void 0:c.isRTL(n));let g=await c.getElementRects({reference:r,floating:n,strategy:s}),{x:m,y:v}=yy(g,a,d),y=a,b={},x=0;for(let E=0;E({name:"arrow",options:r,async fn(n){const{x:i,y:a,placement:s,rects:l,platform:c,elements:f,middlewareData:d}=n,{element:g,padding:m=0}=br(r,n)||{};if(g==null)return{};const v=N0(m),y={x:i,y:a},b=Ah(s),x=Ch(b),E=await c.getDimensions(g),T=b==="y",M=T?"top":"left",N=T?"bottom":"right",L=T?"clientHeight":"clientWidth",C=l.reference[x]+l.reference[b]-y[b]-l.floating[x],R=y[b]-l.reference[b],B=await(c.getOffsetParent==null?void 0:c.getOffsetParent(g));let _=B?B[L]:0;(!_||!await(c.isElement==null?void 0:c.isElement(B)))&&(_=f.floating[L]||l.floating[x]);const $=C/2-R/2,z=_/2-E[x]/2-1,F=Jr(v[M],z),Y=Jr(v[N],z),I=F,j=_-E[x]-Y,J=_/2-E[x]/2+$,ae=Wd(I,J,j),H=!d.arrow&&ja(s)!=null&&J!==ae&&l.reference[x]/2-(JJ<=0)){var Y,I;const J=(((Y=l.flip)==null?void 0:Y.index)||0)+1,ae=_[J];if(ae)return{data:{index:J,overflows:F},reset:{placement:ae}};let H=(I=F.filter(U=>U.overflows[0]<=0).sort((U,D)=>U.overflows[1]-D.overflows[1])[0])==null?void 0:I.placement;if(!H)switch(b){case"bestFit":{var j;const U=(j=F.filter(D=>{if(B){const se=ei(D.placement);return se===N||se==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(se=>se>0).reduce((se,G)=>se+G,0)]).sort((D,se)=>D[1]-se[1])[0])==null?void 0:j[0];U&&(H=U);break}case"initialPlacement":H=f;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function by(r,n){return{top:r.top-n.height,right:r.right-n.width,bottom:r.bottom-n.height,left:r.left-n.width}}function wy(r){return RC.some(n=>r[n]>=0)}const BC=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(n){const{rects:i}=n,{strategy:a="referenceHidden",...s}=br(r,n);switch(a){case"referenceHidden":{const l=await Jo(n,{...s,elementContext:"reference"}),c=by(l,i.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:wy(c)}}}case"escaped":{const l=await Jo(n,{...s,altBoundary:!0}),c=by(l,i.floating);return{data:{escapedOffsets:c,escaped:wy(c)}}}default:return{}}}}};async function FC(r,n){const{placement:i,platform:a,elements:s}=r,l=await(a.isRTL==null?void 0:a.isRTL(s.floating)),c=wr(i),f=ja(i),d=ei(i)==="y",g=["left","top"].includes(c)?-1:1,m=l&&d?-1:1,v=br(n,r);let{mainAxis:y,crossAxis:b,alignmentAxis:x}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof x=="number"&&(b=f==="end"?x*-1:x),d?{x:b*m,y:y*g}:{x:y*g,y:b*m}}const HC=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(n){var i,a;const{x:s,y:l,placement:c,middlewareData:f}=n,d=await FC(n,r);return c===((i=f.offset)==null?void 0:i.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:s+d.x,y:l+d.y,data:{...d,placement:c}}}}},PC=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(n){const{x:i,y:a,placement:s}=n,{mainAxis:l=!0,crossAxis:c=!1,limiter:f={fn:T=>{let{x:M,y:N}=T;return{x:M,y:N}}},...d}=br(r,n),g={x:i,y:a},m=await Jo(n,d),v=ei(wr(s)),y=Th(v);let b=g[y],x=g[v];if(l){const T=y==="y"?"top":"left",M=y==="y"?"bottom":"right",N=b+m[T],L=b-m[M];b=Wd(N,b,L)}if(c){const T=v==="y"?"top":"left",M=v==="y"?"bottom":"right",N=x+m[T],L=x-m[M];x=Wd(N,x,L)}const E=f.fn({...n,[y]:b,[v]:x});return{...E,data:{x:E.x-i,y:E.y-a,enabled:{[y]:l,[v]:c}}}}}},$C=function(r){return r===void 0&&(r={}),{options:r,fn(n){const{x:i,y:a,placement:s,rects:l,middlewareData:c}=n,{offset:f=0,mainAxis:d=!0,crossAxis:g=!0}=br(r,n),m={x:i,y:a},v=ei(s),y=Th(v);let b=m[y],x=m[v];const E=br(f,n),T=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(d){const L=y==="y"?"height":"width",C=l.reference[y]-l.floating[L]+T.mainAxis,R=l.reference[y]+l.reference[L]-T.mainAxis;bR&&(b=R)}if(g){var M,N;const L=y==="y"?"width":"height",C=["top","left"].includes(wr(s)),R=l.reference[v]-l.floating[L]+(C&&((M=c.offset)==null?void 0:M[v])||0)+(C?0:T.crossAxis),B=l.reference[v]+l.reference[L]+(C?0:((N=c.offset)==null?void 0:N[v])||0)-(C?T.crossAxis:0);xB&&(x=B)}return{[y]:b,[v]:x}}}},qC=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(n){var i,a;const{placement:s,rects:l,platform:c,elements:f}=n,{apply:d=()=>{},...g}=br(r,n),m=await Jo(n,g),v=wr(s),y=ja(s),b=ei(s)==="y",{width:x,height:E}=l.floating;let T,M;v==="top"||v==="bottom"?(T=v,M=y===(await(c.isRTL==null?void 0:c.isRTL(f.floating))?"start":"end")?"left":"right"):(M=v,T=y==="end"?"top":"bottom");const N=E-m.top-m.bottom,L=x-m.left-m.right,C=Jr(E-m[T],N),R=Jr(x-m[M],L),B=!n.middlewareData.shift;let _=C,$=R;if((i=n.middlewareData.shift)!=null&&i.enabled.x&&($=L),(a=n.middlewareData.shift)!=null&&a.enabled.y&&(_=N),B&&!y){const F=nn(m.left,0),Y=nn(m.right,0),I=nn(m.top,0),j=nn(m.bottom,0);b?$=x-2*(F!==0||Y!==0?F+Y:nn(m.left,m.right)):_=E-2*(I!==0||j!==0?I+j:nn(m.top,m.bottom))}await d({...n,availableWidth:$,availableHeight:_});const z=await c.getDimensions(f.floating);return x!==z.width||E!==z.height?{reset:{rects:!0}}:{}}}};function gu(){return typeof window<"u"}function Ua(r){return z0(r)?(r.nodeName||"").toLowerCase():"#document"}function rn(r){var n;return(r==null||(n=r.ownerDocument)==null?void 0:n.defaultView)||window}function Yn(r){var n;return(n=(z0(r)?r.ownerDocument:r.document)||window.document)==null?void 0:n.documentElement}function z0(r){return gu()?r instanceof Node||r instanceof rn(r).Node:!1}function Nn(r){return gu()?r instanceof Element||r instanceof rn(r).Element:!1}function In(r){return gu()?r instanceof HTMLElement||r instanceof rn(r).HTMLElement:!1}function Ey(r){return!gu()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof rn(r).ShadowRoot}function as(r){const{overflow:n,overflowX:i,overflowY:a,display:s}=zn(r);return/auto|scroll|overlay|hidden|clip/.test(n+a+i)&&!["inline","contents"].includes(s)}function VC(r){return["table","td","th"].includes(Ua(r))}function pu(r){return[":popover-open",":modal"].some(n=>{try{return r.matches(n)}catch{return!1}})}function Rh(r){const n=Dh(),i=Nn(r)?zn(r):r;return["transform","translate","scale","rotate","perspective"].some(a=>i[a]?i[a]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!n&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!n&&(i.filter?i.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(a=>(i.willChange||"").includes(a))||["paint","layout","strict","content"].some(a=>(i.contain||"").includes(a))}function IC(r){let n=ti(r);for(;In(n)&&!Oa(n);){if(Rh(n))return n;if(pu(n))return null;n=ti(n)}return null}function Dh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Oa(r){return["html","body","#document"].includes(Ua(r))}function zn(r){return rn(r).getComputedStyle(r)}function mu(r){return Nn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function ti(r){if(Ua(r)==="html")return r;const n=r.assignedSlot||r.parentNode||Ey(r)&&r.host||Yn(r);return Ey(n)?n.host:n}function G0(r){const n=ti(r);return Oa(n)?r.ownerDocument?r.ownerDocument.body:r.body:In(n)&&as(n)?n:G0(n)}function es(r,n,i){var a;n===void 0&&(n=[]),i===void 0&&(i=!0);const s=G0(r),l=s===((a=r.ownerDocument)==null?void 0:a.body),c=rn(s);if(l){const f=Qd(c);return n.concat(c,c.visualViewport||[],as(s)?s:[],f&&i?es(f):[])}return n.concat(s,es(s,[],i))}function Qd(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function M0(r){const n=zn(r);let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0;const s=In(r),l=s?r.offsetWidth:i,c=s?r.offsetHeight:a,f=nu(i)!==l||nu(a)!==c;return f&&(i=l,a=c),{width:i,height:a,$:f}}function Oh(r){return Nn(r)?r:r.contextElement}function Aa(r){const n=Oh(r);if(!In(n))return Vn(1);const i=n.getBoundingClientRect(),{width:a,height:s,$:l}=M0(n);let c=(l?nu(i.width):i.width)/a,f=(l?nu(i.height):i.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const YC=Vn(0);function j0(r){const n=rn(r);return!Dh()||!n.visualViewport?YC:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function XC(r,n,i){return n===void 0&&(n=!1),!i||n&&i!==rn(r)?!1:n}function Ni(r,n,i,a){n===void 0&&(n=!1),i===void 0&&(i=!1);const s=r.getBoundingClientRect(),l=Oh(r);let c=Vn(1);n&&(a?Nn(a)&&(c=Aa(a)):c=Aa(r));const f=XC(l,i,a)?j0(l):Vn(0);let d=(s.left+f.x)/c.x,g=(s.top+f.y)/c.y,m=s.width/c.x,v=s.height/c.y;if(l){const y=rn(l),b=a&&Nn(a)?rn(a):a;let x=y,E=Qd(x);for(;E&&a&&b!==x;){const T=Aa(E),M=E.getBoundingClientRect(),N=zn(E),L=M.left+(E.clientLeft+parseFloat(N.paddingLeft))*T.x,C=M.top+(E.clientTop+parseFloat(N.paddingTop))*T.y;d*=T.x,g*=T.y,m*=T.x,v*=T.y,d+=L,g+=C,x=rn(E),E=Qd(x)}}return iu({width:m,height:v,x:d,y:g})}function kh(r,n){const i=mu(r).scrollLeft;return n?n.left+i:Ni(Yn(r)).left+i}function U0(r,n,i){i===void 0&&(i=!1);const a=r.getBoundingClientRect(),s=a.left+n.scrollLeft-(i?0:kh(r,a)),l=a.top+n.scrollTop;return{x:s,y:l}}function ZC(r){let{elements:n,rect:i,offsetParent:a,strategy:s}=r;const l=s==="fixed",c=Yn(a),f=n?pu(n.floating):!1;if(a===c||f&&l)return i;let d={scrollLeft:0,scrollTop:0},g=Vn(1);const m=Vn(0),v=In(a);if((v||!v&&!l)&&((Ua(a)!=="body"||as(c))&&(d=mu(a)),In(a))){const b=Ni(a);g=Aa(a),m.x=b.x+a.clientLeft,m.y=b.y+a.clientTop}const y=c&&!v&&!l?U0(c,d,!0):Vn(0);return{width:i.width*g.x,height:i.height*g.y,x:i.x*g.x-d.scrollLeft*g.x+m.x+y.x,y:i.y*g.y-d.scrollTop*g.y+m.y+y.y}}function WC(r){return Array.from(r.getClientRects())}function KC(r){const n=Yn(r),i=mu(r),a=r.ownerDocument.body,s=nn(n.scrollWidth,n.clientWidth,a.scrollWidth,a.clientWidth),l=nn(n.scrollHeight,n.clientHeight,a.scrollHeight,a.clientHeight);let c=-i.scrollLeft+kh(r);const f=-i.scrollTop;return zn(a).direction==="rtl"&&(c+=nn(n.clientWidth,a.clientWidth)-s),{width:s,height:l,x:c,y:f}}function QC(r,n){const i=rn(r),a=Yn(r),s=i.visualViewport;let l=a.clientWidth,c=a.clientHeight,f=0,d=0;if(s){l=s.width,c=s.height;const g=Dh();(!g||g&&n==="fixed")&&(f=s.offsetLeft,d=s.offsetTop)}return{width:l,height:c,x:f,y:d}}function JC(r,n){const i=Ni(r,!0,n==="fixed"),a=i.top+r.clientTop,s=i.left+r.clientLeft,l=In(r)?Aa(r):Vn(1),c=r.clientWidth*l.x,f=r.clientHeight*l.y,d=s*l.x,g=a*l.y;return{width:c,height:f,x:d,y:g}}function Sy(r,n,i){let a;if(n==="viewport")a=QC(r,i);else if(n==="document")a=KC(Yn(r));else if(Nn(n))a=JC(n,i);else{const s=j0(r);a={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return iu(a)}function B0(r,n){const i=ti(r);return i===n||!Nn(i)||Oa(i)?!1:zn(i).position==="fixed"||B0(i,n)}function e2(r,n){const i=n.get(r);if(i)return i;let a=es(r,[],!1).filter(f=>Nn(f)&&Ua(f)!=="body"),s=null;const l=zn(r).position==="fixed";let c=l?ti(r):r;for(;Nn(c)&&!Oa(c);){const f=zn(c),d=Rh(c);!d&&f.position==="fixed"&&(s=null),(l?!d&&!s:!d&&f.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||as(c)&&!d&&B0(r,c))?a=a.filter(m=>m!==c):s=f,c=ti(c)}return n.set(r,a),a}function t2(r){let{element:n,boundary:i,rootBoundary:a,strategy:s}=r;const c=[...i==="clippingAncestors"?pu(n)?[]:e2(n,this._c):[].concat(i),a],f=c[0],d=c.reduce((g,m)=>{const v=Sy(n,m,s);return g.top=nn(v.top,g.top),g.right=Jr(v.right,g.right),g.bottom=Jr(v.bottom,g.bottom),g.left=nn(v.left,g.left),g},Sy(n,f,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function n2(r){const{width:n,height:i}=M0(r);return{width:n,height:i}}function r2(r,n,i){const a=In(n),s=Yn(n),l=i==="fixed",c=Ni(r,!0,l,n);let f={scrollLeft:0,scrollTop:0};const d=Vn(0);if(a||!a&&!l)if((Ua(n)!=="body"||as(s))&&(f=mu(n)),a){const y=Ni(n,!0,l,n);d.x=y.x+n.clientLeft,d.y=y.y+n.clientTop}else s&&(d.x=kh(s));const g=s&&!a&&!l?U0(s,f):Vn(0),m=c.left+f.scrollLeft-d.x-g.x,v=c.top+f.scrollTop-d.y-g.y;return{x:m,y:v,width:c.width,height:c.height}}function Xf(r){return zn(r).position==="static"}function xy(r,n){if(!In(r)||zn(r).position==="fixed")return null;if(n)return n(r);let i=r.offsetParent;return Yn(r)===i&&(i=i.ownerDocument.body),i}function F0(r,n){const i=rn(r);if(pu(r))return i;if(!In(r)){let s=ti(r);for(;s&&!Oa(s);){if(Nn(s)&&!Xf(s))return s;s=ti(s)}return i}let a=xy(r,n);for(;a&&VC(a)&&Xf(a);)a=xy(a,n);return a&&Oa(a)&&Xf(a)&&!Rh(a)?i:a||IC(r)||i}const i2=async function(r){const n=this.getOffsetParent||F0,i=this.getDimensions,a=await i(r.floating);return{reference:r2(r.reference,await n(r.floating),r.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function a2(r){return zn(r).direction==="rtl"}const o2={convertOffsetParentRelativeRectToViewportRelativeRect:ZC,getDocumentElement:Yn,getClippingRect:t2,getOffsetParent:F0,getElementRects:i2,getClientRects:WC,getDimensions:n2,getScale:Aa,isElement:Nn,isRTL:a2};function H0(r,n){return r.x===n.x&&r.y===n.y&&r.width===n.width&&r.height===n.height}function s2(r,n){let i=null,a;const s=Yn(r);function l(){var f;clearTimeout(a),(f=i)==null||f.disconnect(),i=null}function c(f,d){f===void 0&&(f=!1),d===void 0&&(d=1),l();const g=r.getBoundingClientRect(),{left:m,top:v,width:y,height:b}=g;if(f||n(),!y||!b)return;const x=Tl(v),E=Tl(s.clientWidth-(m+y)),T=Tl(s.clientHeight-(v+b)),M=Tl(m),L={rootMargin:-x+"px "+-E+"px "+-T+"px "+-M+"px",threshold:nn(0,Jr(1,d))||1};let C=!0;function R(B){const _=B[0].intersectionRatio;if(_!==d){if(!C)return c();_?c(!1,_):a=setTimeout(()=>{c(!1,1e-7)},1e3)}_===1&&!H0(g,r.getBoundingClientRect())&&c(),C=!1}try{i=new IntersectionObserver(R,{...L,root:s.ownerDocument})}catch{i=new IntersectionObserver(R,L)}i.observe(r)}return c(!0),l}function l2(r,n,i,a){a===void 0&&(a={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:d=!1}=a,g=Oh(r),m=s||l?[...g?es(g):[],...es(n)]:[];m.forEach(M=>{s&&M.addEventListener("scroll",i,{passive:!0}),l&&M.addEventListener("resize",i)});const v=g&&f?s2(g,i):null;let y=-1,b=null;c&&(b=new ResizeObserver(M=>{let[N]=M;N&&N.target===g&&b&&(b.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var L;(L=b)==null||L.observe(n)})),i()}),g&&!d&&b.observe(g),b.observe(n));let x,E=d?Ni(r):null;d&&T();function T(){const M=Ni(r);E&&!H0(E,M)&&i(),E=M,x=requestAnimationFrame(T)}return i(),()=>{var M;m.forEach(N=>{s&&N.removeEventListener("scroll",i),l&&N.removeEventListener("resize",i)}),v==null||v(),(M=b)==null||M.disconnect(),b=null,d&&cancelAnimationFrame(x)}}const u2=HC,c2=PC,f2=UC,d2=qC,h2=BC,_y=jC,g2=$C,p2=(r,n,i)=>{const a=new Map,s={platform:o2,...i},l={...s.platform,_c:a};return MC(r,n,{...s,platform:l})};var $l=typeof document<"u"?S.useLayoutEffect:S.useEffect;function au(r,n){if(r===n)return!0;if(typeof r!=typeof n)return!1;if(typeof r=="function"&&r.toString()===n.toString())return!0;let i,a,s;if(r&&n&&typeof r=="object"){if(Array.isArray(r)){if(i=r.length,i!==n.length)return!1;for(a=i;a--!==0;)if(!au(r[a],n[a]))return!1;return!0}if(s=Object.keys(r),i=s.length,i!==Object.keys(n).length)return!1;for(a=i;a--!==0;)if(!{}.hasOwnProperty.call(n,s[a]))return!1;for(a=i;a--!==0;){const l=s[a];if(!(l==="_owner"&&r.$$typeof)&&!au(r[l],n[l]))return!1}return!0}return r!==r&&n!==n}function P0(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Ty(r,n){const i=P0(r);return Math.round(n*i)/i}function Zf(r){const n=S.useRef(r);return $l(()=>{n.current=r}),n}function m2(r){r===void 0&&(r={});const{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:s,elements:{reference:l,floating:c}={},transform:f=!0,whileElementsMounted:d,open:g}=r,[m,v]=S.useState({x:0,y:0,strategy:i,placement:n,middlewareData:{},isPositioned:!1}),[y,b]=S.useState(a);au(y,a)||b(a);const[x,E]=S.useState(null),[T,M]=S.useState(null),N=S.useCallback(D=>{D!==B.current&&(B.current=D,E(D))},[]),L=S.useCallback(D=>{D!==_.current&&(_.current=D,M(D))},[]),C=l||x,R=c||T,B=S.useRef(null),_=S.useRef(null),$=S.useRef(m),z=d!=null,F=Zf(d),Y=Zf(s),I=Zf(g),j=S.useCallback(()=>{if(!B.current||!_.current)return;const D={placement:n,strategy:i,middleware:y};Y.current&&(D.platform=Y.current),p2(B.current,_.current,D).then(se=>{const G={...se,isPositioned:I.current!==!1};J.current&&!au($.current,G)&&($.current=G,xh.flushSync(()=>{v(G)}))})},[y,n,i,Y,I]);$l(()=>{g===!1&&$.current.isPositioned&&($.current.isPositioned=!1,v(D=>({...D,isPositioned:!1})))},[g]);const J=S.useRef(!1);$l(()=>(J.current=!0,()=>{J.current=!1}),[]),$l(()=>{if(C&&(B.current=C),R&&(_.current=R),C&&R){if(F.current)return F.current(C,R,j);j()}},[C,R,j,F,z]);const ae=S.useMemo(()=>({reference:B,floating:_,setReference:N,setFloating:L}),[N,L]),H=S.useMemo(()=>({reference:C,floating:R}),[C,R]),U=S.useMemo(()=>{const D={position:i,left:0,top:0};if(!H.floating)return D;const se=Ty(H.floating,m.x),G=Ty(H.floating,m.y);return f?{...D,transform:"translate("+se+"px, "+G+"px)",...P0(H.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:se,top:G}},[i,f,H.floating,m.x,m.y]);return S.useMemo(()=>({...m,update:j,refs:ae,elements:H,floatingStyles:U}),[m,j,ae,H,U])}const v2=r=>{function n(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:r,fn(i){const{element:a,padding:s}=typeof r=="function"?r(i):r;return a&&n(a)?a.current!=null?_y({element:a.current,padding:s}).fn(i):{}:a?_y({element:a,padding:s}).fn(i):{}}}},y2=(r,n)=>({...u2(r),options:[r,n]}),b2=(r,n)=>({...c2(r),options:[r,n]}),w2=(r,n)=>({...g2(r),options:[r,n]}),E2=(r,n)=>({...f2(r),options:[r,n]}),S2=(r,n)=>({...d2(r),options:[r,n]}),x2=(r,n)=>({...h2(r),options:[r,n]}),_2=(r,n)=>({...v2(r),options:[r,n]});var T2="Arrow",$0=S.forwardRef((r,n)=>{const{children:i,width:a=10,height:s=5,...l}=r;return A.jsx(Je.svg,{...l,ref:n,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?i:A.jsx("polygon",{points:"0,0 30,0 15,10"})})});$0.displayName=T2;var C2=$0;function q0(r){const[n,i]=S.useState(void 0);return Li(()=>{if(r){i({width:r.offsetWidth,height:r.offsetHeight});const a=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let c,f;if("borderBoxSize"in l){const d=l.borderBoxSize,g=Array.isArray(d)?d[0]:d;c=g.inlineSize,f=g.blockSize}else c=r.offsetWidth,f=r.offsetHeight;i({width:c,height:f})});return a.observe(r,{box:"border-box"}),()=>a.unobserve(r)}else i(void 0)},[r]),n}var Lh="Popper",[V0,vu]=rs(Lh),[A2,I0]=V0(Lh),Y0=r=>{const{__scopePopper:n,children:i}=r,[a,s]=S.useState(null);return A.jsx(A2,{scope:n,anchor:a,onAnchorChange:s,children:i})};Y0.displayName=Lh;var X0="PopperAnchor",Z0=S.forwardRef((r,n)=>{const{__scopePopper:i,virtualRef:a,...s}=r,l=I0(X0,i),c=S.useRef(null),f=Vt(n,c);return S.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||c.current)}),a?null:A.jsx(Je.div,{...s,ref:f})});Z0.displayName=X0;var Nh="PopperContent",[R2,D2]=V0(Nh),W0=S.forwardRef((r,n)=>{var ge,le,xe,pe,Ae,Te;const{__scopePopper:i,side:a="bottom",sideOffset:s=0,align:l="center",alignOffset:c=0,arrowPadding:f=0,avoidCollisions:d=!0,collisionBoundary:g=[],collisionPadding:m=0,sticky:v="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...E}=r,T=I0(Nh,i),[M,N]=S.useState(null),L=Vt(n,Le=>N(Le)),[C,R]=S.useState(null),B=q0(C),_=(B==null?void 0:B.width)??0,$=(B==null?void 0:B.height)??0,z=a+(l!=="center"?"-"+l:""),F=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},Y=Array.isArray(g)?g:[g],I=Y.length>0,j={padding:F,boundary:Y.filter(k2),altBoundary:I},{refs:J,floatingStyles:ae,placement:H,isPositioned:U,middlewareData:D}=m2({strategy:"fixed",placement:z,whileElementsMounted:(...Le)=>l2(...Le,{animationFrame:b==="always"}),elements:{reference:T.anchor},middleware:[y2({mainAxis:s+$,alignmentAxis:c}),d&&b2({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?w2():void 0,...j}),d&&E2({...j}),S2({...j,apply:({elements:Le,rects:ve,availableWidth:he,availableHeight:K})=>{const{width:Re,height:Ve}=ve.reference,be=Le.floating.style;be.setProperty("--radix-popper-available-width",`${he}px`),be.setProperty("--radix-popper-available-height",`${K}px`),be.setProperty("--radix-popper-anchor-width",`${Re}px`),be.setProperty("--radix-popper-anchor-height",`${Ve}px`)}}),C&&_2({element:C,padding:f}),L2({arrowWidth:_,arrowHeight:$}),y&&x2({strategy:"referenceHidden",...j})]}),[se,G]=J0(H),P=Qr(x);Li(()=>{U&&(P==null||P())},[U,P]);const k=(ge=D.arrow)==null?void 0:ge.x,V=(le=D.arrow)==null?void 0:le.y,Q=((xe=D.arrow)==null?void 0:xe.centerOffset)!==0,[re,de]=S.useState();return Li(()=>{M&&de(window.getComputedStyle(M).zIndex)},[M]),A.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:U?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(pe=D.transformOrigin)==null?void 0:pe.x,(Ae=D.transformOrigin)==null?void 0:Ae.y].join(" "),...((Te=D.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:A.jsx(R2,{scope:i,placedSide:se,onArrowChange:R,arrowX:k,arrowY:V,shouldHideArrow:Q,children:A.jsx(Je.div,{"data-side":se,"data-align":G,...E,ref:L,style:{...E.style,animation:U?void 0:"none"}})})})});W0.displayName=Nh;var K0="PopperArrow",O2={top:"bottom",right:"left",bottom:"top",left:"right"},Q0=S.forwardRef(function(n,i){const{__scopePopper:a,...s}=n,l=D2(K0,a),c=O2[l.placedSide];return A.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:A.jsx(C2,{...s,ref:i,style:{...s.style,display:"block"}})})});Q0.displayName=K0;function k2(r){return r!==null}var L2=r=>({name:"transformOrigin",options:r,fn(n){var T,M,N;const{placement:i,rects:a,middlewareData:s}=n,c=((T=s.arrow)==null?void 0:T.centerOffset)!==0,f=c?0:r.arrowWidth,d=c?0:r.arrowHeight,[g,m]=J0(i),v={start:"0%",center:"50%",end:"100%"}[m],y=(((M=s.arrow)==null?void 0:M.x)??0)+f/2,b=(((N=s.arrow)==null?void 0:N.y)??0)+d/2;let x="",E="";return g==="bottom"?(x=c?v:`${y}px`,E=`${-d}px`):g==="top"?(x=c?v:`${y}px`,E=`${a.floating.height+d}px`):g==="right"?(x=`${-d}px`,E=c?v:`${b}px`):g==="left"&&(x=`${a.floating.width+d}px`,E=c?v:`${b}px`),{data:{x,y:E}}}});function J0(r){const[n,i="center"]=r.split("-");return[n,i]}var ew=Y0,zh=Z0,tw=W0,nw=Q0,N2="Portal",Gh=S.forwardRef((r,n)=>{var f;const{container:i,...a}=r,[s,l]=S.useState(!1);Li(()=>l(!0),[]);const c=i||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?aC.createPortal(A.jsx(Je.div,{...a,ref:n}),c):null});Gh.displayName=N2;function z2(r,n){return S.useReducer((i,a)=>n[i][a]??i,r)}var ni=r=>{const{present:n,children:i}=r,a=G2(n),s=typeof i=="function"?i({present:a.isPresent}):S.Children.only(i),l=Vt(a.ref,M2(s));return typeof i=="function"||a.isPresent?S.cloneElement(s,{ref:l}):null};ni.displayName="Presence";function G2(r){const[n,i]=S.useState(),a=S.useRef({}),s=S.useRef(r),l=S.useRef("none"),c=r?"mounted":"unmounted",[f,d]=z2(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const g=Cl(a.current);l.current=f==="mounted"?g:"none"},[f]),Li(()=>{const g=a.current,m=s.current;if(m!==r){const y=l.current,b=Cl(g);r?d("MOUNT"):b==="none"||(g==null?void 0:g.display)==="none"?d("UNMOUNT"):d(m&&y!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=r}},[r,d]),Li(()=>{if(n){let g;const m=n.ownerDocument.defaultView??window,v=b=>{const E=Cl(a.current).includes(b.animationName);if(b.target===n&&E&&(d("ANIMATION_END"),!s.current)){const T=n.style.animationFillMode;n.style.animationFillMode="forwards",g=m.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=T)})}},y=b=>{b.target===n&&(l.current=Cl(a.current))};return n.addEventListener("animationstart",y),n.addEventListener("animationcancel",v),n.addEventListener("animationend",v),()=>{m.clearTimeout(g),n.removeEventListener("animationstart",y),n.removeEventListener("animationcancel",v),n.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[n,d]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:S.useCallback(g=>{g&&(a.current=getComputedStyle(g)),i(g)},[])}}function Cl(r){return(r==null?void 0:r.animationName)||"none"}function M2(r){var a,s;let n=(a=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:a.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?r.ref:(n=(s=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:s.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?r.props.ref:r.props.ref||r.ref)}function yu({prop:r,defaultProp:n,onChange:i=()=>{}}){const[a,s]=j2({defaultProp:n,onChange:i}),l=r!==void 0,c=l?r:a,f=Qr(i),d=S.useCallback(g=>{if(l){const v=typeof g=="function"?g(r):g;v!==r&&f(v)}else s(g)},[l,r,s,f]);return[c,d]}function j2({defaultProp:r,onChange:n}){const i=S.useState(r),[a]=i,s=S.useRef(a),l=Qr(n);return S.useEffect(()=>{s.current!==a&&(l(a),s.current=a)},[a,s,l]),i}var U2=function(r){if(typeof document>"u")return null;var n=Array.isArray(r)?r[0]:r;return n.ownerDocument.body},wa=new WeakMap,Al=new WeakMap,Rl={},Wf=0,rw=function(r){return r&&(r.host||rw(r.parentNode))},B2=function(r,n){return n.map(function(i){if(r.contains(i))return i;var a=rw(i);return a&&r.contains(a)?a:(console.error("aria-hidden",i,"in not contained inside",r,". Doing nothing"),null)}).filter(function(i){return!!i})},F2=function(r,n,i,a){var s=B2(n,Array.isArray(r)?r:[r]);Rl[i]||(Rl[i]=new WeakMap);var l=Rl[i],c=[],f=new Set,d=new Set(s),g=function(v){!v||f.has(v)||(f.add(v),g(v.parentNode))};s.forEach(g);var m=function(v){!v||d.has(v)||Array.prototype.forEach.call(v.children,function(y){if(f.has(y))m(y);else try{var b=y.getAttribute(a),x=b!==null&&b!=="false",E=(wa.get(y)||0)+1,T=(l.get(y)||0)+1;wa.set(y,E),l.set(y,T),c.push(y),E===1&&x&&Al.set(y,!0),T===1&&y.setAttribute(i,"true"),x||y.setAttribute(a,"true")}catch(M){console.error("aria-hidden: cannot operate on ",y,M)}})};return m(n),f.clear(),Wf++,function(){c.forEach(function(v){var y=wa.get(v)-1,b=l.get(v)-1;wa.set(v,y),l.set(v,b),y||(Al.has(v)||v.removeAttribute(a),Al.delete(v)),b||v.removeAttribute(i)}),Wf--,Wf||(wa=new WeakMap,wa=new WeakMap,Al=new WeakMap,Rl={})}},iw=function(r,n,i){i===void 0&&(i="data-aria-hidden");var a=Array.from(Array.isArray(r)?r:[r]),s=U2(r);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live]"))),F2(a,s,i,"aria-hidden")):function(){return null}},Pn=function(){return Pn=Object.assign||function(n){for(var i,a=1,s=arguments.length;a"u")return rA;var n=iA(r),i=document.documentElement.clientWidth,a=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,a-i+n[2]-n[0])}},oA=lw(),Ra="data-scroll-locked",sA=function(r,n,i,a){var s=r.left,l=r.top,c=r.right,f=r.gap;return i===void 0&&(i="margin"),` .`.concat(P2,` { overflow: hidden `).concat(a,`; padding-right: `).concat(f,"px ").concat(a,`; } body[`).concat(Ra,`] { overflow: hidden `).concat(a,`; overscroll-behavior: contain; `).concat([n&&"position: relative ".concat(a,";"),i==="margin"&&` padding-left: `.concat(s,`px; padding-top: `).concat(l,`px; padding-right: `).concat(c,`px; margin-left:0; margin-top:0; margin-right: `).concat(f,"px ").concat(a,`; `),i==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),` } .`).concat(ql,` { right: `).concat(f,"px ").concat(a,`; } .`).concat(Vl,` { margin-right: `).concat(f,"px ").concat(a,`; } .`).concat(ql," .").concat(ql,` { right: 0 `).concat(a,`; } .`).concat(Vl," .").concat(Vl,` { margin-right: 0 `).concat(a,`; } body[`).concat(Ra,`] { `).concat($2,": ").concat(f,`px; } `)},Ay=function(){var r=parseInt(document.body.getAttribute(Ra)||"0",10);return isFinite(r)?r:0},lA=function(){S.useEffect(function(){return document.body.setAttribute(Ra,(Ay()+1).toString()),function(){var r=Ay()-1;r<=0?document.body.removeAttribute(Ra):document.body.setAttribute(Ra,r.toString())}},[])},uA=function(r){var n=r.noRelative,i=r.noImportant,a=r.gapMode,s=a===void 0?"margin":a;lA();var l=S.useMemo(function(){return aA(s)},[s]);return S.createElement(oA,{styles:sA(l,!n,s,i?"":"!important")})},Jd=!1;if(typeof window<"u")try{var Dl=Object.defineProperty({},"passive",{get:function(){return Jd=!0,!0}});window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{Jd=!1}var Ea=Jd?{passive:!1}:!1,cA=function(r){return r.tagName==="TEXTAREA"},uw=function(r,n){if(!(r instanceof Element))return!1;var i=window.getComputedStyle(r);return i[n]!=="hidden"&&!(i.overflowY===i.overflowX&&!cA(r)&&i[n]==="visible")},fA=function(r){return uw(r,"overflowY")},dA=function(r){return uw(r,"overflowX")},Ry=function(r,n){var i=n.ownerDocument,a=n;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=cw(r,a);if(s){var l=fw(r,a),c=l[1],f=l[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==i.body);return!1},hA=function(r){var n=r.scrollTop,i=r.scrollHeight,a=r.clientHeight;return[n,i,a]},gA=function(r){var n=r.scrollLeft,i=r.scrollWidth,a=r.clientWidth;return[n,i,a]},cw=function(r,n){return r==="v"?fA(n):dA(n)},fw=function(r,n){return r==="v"?hA(n):gA(n)},pA=function(r,n){return r==="h"&&n==="rtl"?-1:1},mA=function(r,n,i,a,s){var l=pA(r,window.getComputedStyle(n).direction),c=l*a,f=i.target,d=n.contains(f),g=!1,m=c>0,v=0,y=0;do{var b=fw(r,f),x=b[0],E=b[1],T=b[2],M=E-T-l*x;(x||M)&&cw(r,f)&&(v+=M,y+=x),f instanceof ShadowRoot?f=f.host:f=f.parentNode}while(!d&&f!==document.body||d&&(n.contains(f)||n===f));return(m&&Math.abs(v)<1||!m&&Math.abs(y)<1)&&(g=!0),g},Ol=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Dy=function(r){return[r.deltaX,r.deltaY]},Oy=function(r){return r&&"current"in r?r.current:r},vA=function(r,n){return r[0]===n[0]&&r[1]===n[1]},yA=function(r){return` .block-interactivity-`.concat(r,` {pointer-events: none;} .allow-interactivity-`).concat(r,` {pointer-events: all;} `)},bA=0,Sa=[];function wA(r){var n=S.useRef([]),i=S.useRef([0,0]),a=S.useRef(),s=S.useState(bA++)[0],l=S.useState(lw)[0],c=S.useRef(r);S.useEffect(function(){c.current=r},[r]),S.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(s));var E=H2([r.lockRef.current],(r.shards||[]).map(Oy),!0).filter(Boolean);return E.forEach(function(T){return T.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),E.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(s))})}}},[r.inert,r.lockRef.current,r.shards]);var f=S.useCallback(function(E,T){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!c.current.allowPinchZoom;var M=Ol(E),N=i.current,L="deltaX"in E?E.deltaX:N[0]-M[0],C="deltaY"in E?E.deltaY:N[1]-M[1],R,B=E.target,_=Math.abs(L)>Math.abs(C)?"h":"v";if("touches"in E&&_==="h"&&B.type==="range")return!1;var $=Ry(_,B);if(!$)return!0;if($?R=_:(R=_==="v"?"h":"v",$=Ry(_,B)),!$)return!1;if(!a.current&&"changedTouches"in E&&(L||C)&&(a.current=R),!R)return!0;var z=a.current||R;return mA(z,T,E,z==="h"?L:C)},[]),d=S.useCallback(function(E){var T=E;if(!(!Sa.length||Sa[Sa.length-1]!==l)){var M="deltaY"in T?Dy(T):Ol(T),N=n.current.filter(function(R){return R.name===T.type&&(R.target===T.target||T.target===R.shadowParent)&&vA(R.delta,M)})[0];if(N&&N.should){T.cancelable&&T.preventDefault();return}if(!N){var L=(c.current.shards||[]).map(Oy).filter(Boolean).filter(function(R){return R.contains(T.target)}),C=L.length>0?f(T,L[0]):!c.current.noIsolation;C&&T.cancelable&&T.preventDefault()}}},[]),g=S.useCallback(function(E,T,M,N){var L={name:E,delta:T,target:M,should:N,shadowParent:EA(M)};n.current.push(L),setTimeout(function(){n.current=n.current.filter(function(C){return C!==L})},1)},[]),m=S.useCallback(function(E){i.current=Ol(E),a.current=void 0},[]),v=S.useCallback(function(E){g(E.type,Dy(E),E.target,f(E,r.lockRef.current))},[]),y=S.useCallback(function(E){g(E.type,Ol(E),E.target,f(E,r.lockRef.current))},[]);S.useEffect(function(){return Sa.push(l),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:y}),document.addEventListener("wheel",d,Ea),document.addEventListener("touchmove",d,Ea),document.addEventListener("touchstart",m,Ea),function(){Sa=Sa.filter(function(E){return E!==l}),document.removeEventListener("wheel",d,Ea),document.removeEventListener("touchmove",d,Ea),document.removeEventListener("touchstart",m,Ea)}},[]);var b=r.removeScrollBar,x=r.inert;return S.createElement(S.Fragment,null,x?S.createElement(l,{styles:yA(s)}):null,b?S.createElement(uA,{gapMode:r.gapMode}):null)}function EA(r){for(var n=null;r!==null;)r instanceof ShadowRoot&&(n=r.host,r=r.host),r=r.parentNode;return n}const SA=W2(sw,wA);var Mh=S.forwardRef(function(r,n){return S.createElement(bu,Pn({},r,{ref:n,sideCar:SA}))});Mh.classNames=bu.classNames;var jh="Popover",[dw,Az]=rs(jh,[vu]),os=vu(),[xA,ri]=dw(jh),hw=r=>{const{__scopePopover:n,children:i,open:a,defaultOpen:s,onOpenChange:l,modal:c=!1}=r,f=os(n),d=S.useRef(null),[g,m]=S.useState(!1),[v=!1,y]=yu({prop:a,defaultProp:s,onChange:l});return A.jsx(ew,{...f,children:A.jsx(xA,{scope:n,contentId:Ln(),triggerRef:d,open:v,onOpenChange:y,onOpenToggle:S.useCallback(()=>y(b=>!b),[y]),hasCustomAnchor:g,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:c,children:i})})};hw.displayName=jh;var gw="PopoverAnchor",_A=S.forwardRef((r,n)=>{const{__scopePopover:i,...a}=r,s=ri(gw,i),l=os(i),{onCustomAnchorAdd:c,onCustomAnchorRemove:f}=s;return S.useEffect(()=>(c(),()=>f()),[c,f]),A.jsx(zh,{...l,...a,ref:n})});_A.displayName=gw;var pw="PopoverTrigger",mw=S.forwardRef((r,n)=>{const{__scopePopover:i,...a}=r,s=ri(pw,i),l=os(i),c=Vt(n,s.triggerRef),f=A.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ew(s.open),...a,ref:c,onClick:ht(r.onClick,s.onOpenToggle)});return s.hasCustomAnchor?f:A.jsx(zh,{asChild:!0,...l,children:f})});mw.displayName=pw;var Uh="PopoverPortal",[TA,CA]=dw(Uh,{forceMount:void 0}),vw=r=>{const{__scopePopover:n,forceMount:i,children:a,container:s}=r,l=ri(Uh,n);return A.jsx(TA,{scope:n,forceMount:i,children:A.jsx(ni,{present:i||l.open,children:A.jsx(Gh,{asChild:!0,container:s,children:a})})})};vw.displayName=Uh;var ka="PopoverContent",yw=S.forwardRef((r,n)=>{const i=CA(ka,r.__scopePopover),{forceMount:a=i.forceMount,...s}=r,l=ri(ka,r.__scopePopover);return A.jsx(ni,{present:a||l.open,children:l.modal?A.jsx(AA,{...s,ref:n}):A.jsx(RA,{...s,ref:n})})});yw.displayName=ka;var AA=S.forwardRef((r,n)=>{const i=ri(ka,r.__scopePopover),a=S.useRef(null),s=Vt(n,a),l=S.useRef(!1);return S.useEffect(()=>{const c=a.current;if(c)return iw(c)},[]),A.jsx(Mh,{as:is,allowPinchZoom:!0,children:A.jsx(bw,{...r,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ht(r.onCloseAutoFocus,c=>{var f;c.preventDefault(),l.current||(f=i.triggerRef.current)==null||f.focus()}),onPointerDownOutside:ht(r.onPointerDownOutside,c=>{const f=c.detail.originalEvent,d=f.button===0&&f.ctrlKey===!0,g=f.button===2||d;l.current=g},{checkForDefaultPrevented:!1}),onFocusOutside:ht(r.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),RA=S.forwardRef((r,n)=>{const i=ri(ka,r.__scopePopover),a=S.useRef(!1),s=S.useRef(!1);return A.jsx(bw,{...r,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,f;(c=r.onCloseAutoFocus)==null||c.call(r,l),l.defaultPrevented||(a.current||(f=i.triggerRef.current)==null||f.focus(),l.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:l=>{var d,g;(d=r.onInteractOutside)==null||d.call(r,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=l.target;((g=i.triggerRef.current)==null?void 0:g.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),bw=S.forwardRef((r,n)=>{const{__scopePopover:i,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,...v}=r,y=ri(ka,i),b=os(i);return k0(),A.jsx(_h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:l,children:A.jsx(hu,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:m,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:g,onDismiss:()=>y.onOpenChange(!1),children:A.jsx(tw,{"data-state":Ew(y.open),role:"dialog",id:y.contentId,...b,...v,ref:n,style:{...v.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)"}})})})}),ww="PopoverClose",DA=S.forwardRef((r,n)=>{const{__scopePopover:i,...a}=r,s=ri(ww,i);return A.jsx(Je.button,{type:"button",...a,ref:n,onClick:ht(r.onClick,()=>s.onOpenChange(!1))})});DA.displayName=ww;var OA="PopoverArrow",kA=S.forwardRef((r,n)=>{const{__scopePopover:i,...a}=r,s=os(i);return A.jsx(nw,{...s,...a,ref:n})});kA.displayName=OA;function Ew(r){return r?"open":"closed"}var LA=hw,NA=mw,zA=vw,Sw=yw;const wu=LA,Eu=NA,ss=S.forwardRef(({className:r,align:n="center",sideOffset:i=4,...a},s)=>A.jsx(zA,{children:A.jsx(Sw,{ref:s,align:n,sideOffset:i,className:Xe("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",r),...a})}));ss.displayName=Sw.displayName;const GA=({status:r})=>r?A.jsxs("div",{className:"min-w-[300px] space-y-3 text-sm",children:[A.jsxs("div",{className:"space-y-1",children:[A.jsx("h4",{className:"font-medium",children:"Storage Info"}),A.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[A.jsx("span",{children:"Working Directory:"}),A.jsx("span",{className:"truncate",children:r.working_directory}),A.jsx("span",{children:"Input Directory:"}),A.jsx("span",{className:"truncate",children:r.input_directory}),A.jsx("span",{children:"Indexed Files:"}),A.jsx("span",{children:r.indexed_files_count})]})]}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("h4",{className:"font-medium",children:"LLM Configuration"}),A.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[A.jsx("span",{children:"LLM Binding:"}),A.jsx("span",{children:r.configuration.llm_binding}),A.jsx("span",{children:"LLM Binding Host:"}),A.jsx("span",{children:r.configuration.llm_binding_host}),A.jsx("span",{children:"LLM Model:"}),A.jsx("span",{children:r.configuration.llm_model}),A.jsx("span",{children:"Max Tokens:"}),A.jsx("span",{children:r.configuration.max_tokens})]})]}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("h4",{className:"font-medium",children:"Embedding Configuration"}),A.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[A.jsx("span",{children:"Embedding Binding:"}),A.jsx("span",{children:r.configuration.embedding_binding}),A.jsx("span",{children:"Embedding Binding Host:"}),A.jsx("span",{children:r.configuration.embedding_binding_host}),A.jsx("span",{children:"Embedding Model:"}),A.jsx("span",{children:r.configuration.embedding_model})]})]}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("h4",{className:"font-medium",children:"Storage Configuration"}),A.jsxs("div",{className:"text-muted-foreground grid grid-cols-2 gap-1",children:[A.jsx("span",{children:"KV Storage:"}),A.jsx("span",{children:r.configuration.kv_storage}),A.jsx("span",{children:"Doc Status Storage:"}),A.jsx("span",{children:r.configuration.doc_status_storage}),A.jsx("span",{children:"Graph Storage:"}),A.jsx("span",{children:r.configuration.graph_storage}),A.jsx("span",{children:"Vector Storage:"}),A.jsx("span",{children:r.configuration.vector_storage})]})]})]}):A.jsx("div",{className:"text-muted-foreground text-sm",children:"Status information unavailable"}),MA=()=>{const r=kn.use.health(),n=kn.use.lastCheckTime(),i=kn.use.status(),[a,s]=S.useState(!1);return S.useEffect(()=>{s(!0);const l=setTimeout(()=>s(!1),300);return()=>clearTimeout(l)},[n]),A.jsx("div",{className:"fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none",children:A.jsxs(wu,{children:[A.jsx(Eu,{asChild:!0,children:A.jsxs("div",{className:"flex cursor-help items-center gap-2",children:[A.jsx("div",{className:Xe("h-3 w-3 rounded-full transition-all duration-300","shadow-[0_0_8px_rgba(0,0,0,0.2)]",r?"bg-green-500":"bg-red-500",a&&"scale-125",a&&r&&"shadow-[0_0_12px_rgba(34,197,94,0.4)]",a&&!r&&"shadow-[0_0_12px_rgba(239,68,68,0.4)]")}),A.jsx("span",{className:"text-muted-foreground text-xs",children:r?"Connected":"Disconnected"})]})}),A.jsx(ss,{className:"w-auto",side:"top",align:"end",children:A.jsx(GA,{status:i})})]})})};var kl={exports:{}},ky;function jA(){if(ky)return kl.exports;ky=1;var r=typeof Reflect=="object"?Reflect:null,n=r&&typeof r.apply=="function"?r.apply:function(R,B,_){return Function.prototype.apply.call(R,B,_)},i;r&&typeof r.ownKeys=="function"?i=r.ownKeys:Object.getOwnPropertySymbols?i=function(R){return Object.getOwnPropertyNames(R).concat(Object.getOwnPropertySymbols(R))}:i=function(R){return Object.getOwnPropertyNames(R)};function a(C){console&&console.warn&&console.warn(C)}var s=Number.isNaN||function(R){return R!==R};function l(){l.init.call(this)}kl.exports=l,kl.exports.once=M,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var c=10;function f(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(C){if(typeof C!="number"||C<0||s(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");c=C}}),l.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},l.prototype.setMaxListeners=function(R){if(typeof R!="number"||R<0||s(R))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+R+".");return this._maxListeners=R,this};function d(C){return C._maxListeners===void 0?l.defaultMaxListeners:C._maxListeners}l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(R){for(var B=[],_=1;_0&&(F=B[0]),F instanceof Error)throw F;var Y=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw Y.context=F,Y}var I=z[R];if(I===void 0)return!1;if(typeof I=="function")n(I,this,B);else for(var j=I.length,J=x(I,j),_=0;_0&&F.length>$&&!F.warned){F.warned=!0;var Y=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(R)+" listeners added. Use emitter.setMaxListeners() to increase limit");Y.name="MaxListenersExceededWarning",Y.emitter=C,Y.type=R,Y.count=F.length,a(Y)}return C}l.prototype.addListener=function(R,B){return g(this,R,B,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(R,B){return g(this,R,B,!0)};function m(){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 v(C,R,B){var _={fired:!1,wrapFn:void 0,target:C,type:R,listener:B},$=m.bind(_);return $.listener=B,_.wrapFn=$,$}l.prototype.once=function(R,B){return f(B),this.on(R,v(this,R,B)),this},l.prototype.prependOnceListener=function(R,B){return f(B),this.prependListener(R,v(this,R,B)),this},l.prototype.removeListener=function(R,B){var _,$,z,F,Y;if(f(B),$=this._events,$===void 0)return this;if(_=$[R],_===void 0)return this;if(_===B||_.listener===B)--this._eventsCount===0?this._events=Object.create(null):(delete $[R],$.removeListener&&this.emit("removeListener",R,_.listener||B));else if(typeof _!="function"){for(z=-1,F=_.length-1;F>=0;F--)if(_[F]===B||_[F].listener===B){Y=_[F].listener,z=F;break}if(z<0)return this;z===0?_.shift():E(_,z),_.length===1&&($[R]=_[0]),$.removeListener!==void 0&&this.emit("removeListener",R,Y||B)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(R){var B,_,$;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[R]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[R]),this;if(arguments.length===0){var z=Object.keys(_),F;for($=0;$=0;$--)this.removeListener(R,B[$]);return this};function y(C,R,B){var _=C._events;if(_===void 0)return[];var $=_[R];return $===void 0?[]:typeof $=="function"?B?[$.listener||$]:[$]:B?T($):x($,$.length)}l.prototype.listeners=function(R){return y(this,R,!0)},l.prototype.rawListeners=function(R){return y(this,R,!1)},l.listenerCount=function(C,R){return typeof C.listenerCount=="function"?C.listenerCount(R):b.call(C,R)},l.prototype.listenerCount=b;function b(C){var R=this._events;if(R!==void 0){var B=R[C];if(typeof B=="function")return 1;if(B!==void 0)return B.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function x(C,R){for(var B=new Array(R),_=0;_r++}function yr(){const r=arguments;let n=null,i=-1;return{[Symbol.iterator](){return this},next(){let a=null;do{if(n===null){if(i++,i>=r.length)return{done:!0};n=r[i][Symbol.iterator]()}if(a=n.next(),a.done){n=null;continue}break}while(!0);return a}}}function Ba(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Bh extends Error{constructor(n){super(),this.name="GraphError",this.message=n}}class ye extends Bh{constructor(n){super(n),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ye.prototype.constructor)}}class me extends Bh{constructor(n){super(n),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,me.prototype.constructor)}}class ke extends Bh{constructor(n){super(n),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ke.prototype.constructor)}}function Tw(r,n){this.key=r,this.attributes=n,this.clear()}Tw.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 Cw(r,n){this.key=r,this.attributes=n,this.clear()}Cw.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Aw(r,n){this.key=r,this.attributes=n,this.clear()}Aw.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Fa(r,n,i,a,s){this.key=n,this.attributes=s,this.undirected=r,this.source=i,this.target=a}Fa.prototype.attach=function(){let r="out",n="in";this.undirected&&(r=n="undirected");const i=this.source.key,a=this.target.key;this.source[r][a]=this,!(this.undirected&&i===a)&&(this.target[n][i]=this)};Fa.prototype.attachMulti=function(){let r="out",n="in";const i=this.source.key,a=this.target.key;this.undirected&&(r=n="undirected");const s=this.source[r],l=s[a];if(typeof l>"u"){s[a]=this,this.undirected&&i===a||(this.target[n][i]=this);return}l.previous=this,this.next=l,s[a]=this,this.target[n][i]=this};Fa.prototype.detach=function(){const r=this.source.key,n=this.target.key;let i="out",a="in";this.undirected&&(i=a="undirected"),delete this.source[i][n],delete this.target[a][r]};Fa.prototype.detachMulti=function(){const r=this.source.key,n=this.target.key;let i="out",a="in";this.undirected&&(i=a="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[i][n],delete this.target[a][r]):(this.next.previous=void 0,this.source[i][n]=this.next,this.target[a][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Rw=0,Dw=1,FA=2,Ow=3;function Er(r,n,i,a,s,l,c){let f,d,g,m;if(a=""+a,i===Rw){if(f=r._nodes.get(a),!f)throw new me(`Graph.${n}: could not find the "${a}" node in the graph.`);g=s,m=l}else if(i===Ow){if(s=""+s,d=r._edges.get(s),!d)throw new me(`Graph.${n}: could not find the "${s}" edge in the graph.`);const v=d.source.key,y=d.target.key;if(a===v)f=d.target;else if(a===y)f=d.source;else throw new me(`Graph.${n}: the "${a}" node is not attached to the "${s}" edge (${v}, ${y}).`);g=l,m=c}else{if(d=r._edges.get(a),!d)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`);i===Dw?f=d.source:f=d.target,g=s,m=l}return[f,g,m]}function HA(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);return c.attributes[f]}}function PA(r,n,i){r.prototype[n]=function(a,s){const[l]=Er(this,n,i,a,s);return l.attributes}}function $A(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);return c.attributes.hasOwnProperty(f)}}function qA(r,n,i){r.prototype[n]=function(a,s,l,c){const[f,d,g]=Er(this,n,i,a,s,l,c);return f.attributes[d]=g,this.emit("nodeAttributesUpdated",{key:f.key,type:"set",attributes:f.attributes,name:d}),this}}function VA(r,n,i){r.prototype[n]=function(a,s,l,c){const[f,d,g]=Er(this,n,i,a,s,l,c);if(typeof g!="function")throw new ye(`Graph.${n}: updater should be a function.`);const m=f.attributes,v=g(m[d]);return m[d]=v,this.emit("nodeAttributesUpdated",{key:f.key,type:"set",attributes:f.attributes,name:d}),this}}function IA(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);return delete c.attributes[f],this.emit("nodeAttributesUpdated",{key:c.key,type:"remove",attributes:c.attributes,name:f}),this}}function YA(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);if(!Nt(f))throw new ye(`Graph.${n}: provided attributes are not a plain object.`);return c.attributes=f,this.emit("nodeAttributesUpdated",{key:c.key,type:"replace",attributes:c.attributes}),this}}function XA(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);if(!Nt(f))throw new ye(`Graph.${n}: provided attributes are not a plain object.`);return wt(c.attributes,f),this.emit("nodeAttributesUpdated",{key:c.key,type:"merge",attributes:c.attributes,data:f}),this}}function ZA(r,n,i){r.prototype[n]=function(a,s,l){const[c,f]=Er(this,n,i,a,s,l);if(typeof f!="function")throw new ye(`Graph.${n}: provided updater is not a function.`);return c.attributes=f(c.attributes),this.emit("nodeAttributesUpdated",{key:c.key,type:"update",attributes:c.attributes}),this}}const WA=[{name:r=>`get${r}Attribute`,attacher:HA},{name:r=>`get${r}Attributes`,attacher:PA},{name:r=>`has${r}Attribute`,attacher:$A},{name:r=>`set${r}Attribute`,attacher:qA},{name:r=>`update${r}Attribute`,attacher:VA},{name:r=>`remove${r}Attribute`,attacher:IA},{name:r=>`replace${r}Attributes`,attacher:YA},{name:r=>`merge${r}Attributes`,attacher:XA},{name:r=>`update${r}Attributes`,attacher:ZA}];function KA(r){WA.forEach(function({name:n,attacher:i}){i(r,n("Node"),Rw),i(r,n("Source"),Dw),i(r,n("Target"),FA),i(r,n("Opposite"),Ow)})}function QA(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}return l.attributes[s]}}function JA(r,n,i){r.prototype[n]=function(a){let s;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new ke(`Graph.${n}: 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=""+a,c=""+arguments[1];if(s=En(this,l,c,i),!s)throw new me(`Graph.${n}: could not find an edge for the given path ("${l}" - "${c}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,s=this._edges.get(a),!s)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}return s.attributes}}function eR(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}return l.attributes.hasOwnProperty(s)}}function tR(r,n,i){r.prototype[n]=function(a,s,l){let c;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ke(`Graph.${n}: 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 f=""+a,d=""+s;if(s=arguments[2],l=arguments[3],c=En(this,f,d,i),!c)throw new me(`Graph.${n}: could not find an edge for the given path ("${f}" - "${d}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,c=this._edges.get(a),!c)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}return c.attributes[s]=l,this.emit("edgeAttributesUpdated",{key:c.key,type:"set",attributes:c.attributes,name:s}),this}}function nR(r,n,i){r.prototype[n]=function(a,s,l){let c;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ke(`Graph.${n}: 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 f=""+a,d=""+s;if(s=arguments[2],l=arguments[3],c=En(this,f,d,i),!c)throw new me(`Graph.${n}: could not find an edge for the given path ("${f}" - "${d}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,c=this._edges.get(a),!c)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}if(typeof l!="function")throw new ye(`Graph.${n}: updater should be a function.`);return c.attributes[s]=l(c.attributes[s]),this.emit("edgeAttributesUpdated",{key:c.key,type:"set",attributes:c.attributes,name:s}),this}}function rR(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}return delete l.attributes[s],this.emit("edgeAttributesUpdated",{key:l.key,type:"remove",attributes:l.attributes,name:s}),this}}function iR(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}if(!Nt(s))throw new ye(`Graph.${n}: provided attributes are not a plain object.`);return l.attributes=s,this.emit("edgeAttributesUpdated",{key:l.key,type:"replace",attributes:l.attributes}),this}}function aR(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}if(!Nt(s))throw new ye(`Graph.${n}: provided attributes are not a plain object.`);return wt(l.attributes,s),this.emit("edgeAttributesUpdated",{key:l.key,type:"merge",attributes:l.attributes,data:s}),this}}function oR(r,n,i){r.prototype[n]=function(a,s){let l;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new ke(`Graph.${n}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ke(`Graph.${n}: 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 c=""+a,f=""+s;if(s=arguments[2],l=En(this,c,f,i),!l)throw new me(`Graph.${n}: could not find an edge for the given path ("${c}" - "${f}").`)}else{if(i!=="mixed")throw new ke(`Graph.${n}: 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(a=""+a,l=this._edges.get(a),!l)throw new me(`Graph.${n}: could not find the "${a}" edge in the graph.`)}if(typeof s!="function")throw new ye(`Graph.${n}: provided updater is not a function.`);return l.attributes=s(l.attributes),this.emit("edgeAttributesUpdated",{key:l.key,type:"update",attributes:l.attributes}),this}}const sR=[{name:r=>`get${r}Attribute`,attacher:QA},{name:r=>`get${r}Attributes`,attacher:JA},{name:r=>`has${r}Attribute`,attacher:eR},{name:r=>`set${r}Attribute`,attacher:tR},{name:r=>`update${r}Attribute`,attacher:nR},{name:r=>`remove${r}Attribute`,attacher:rR},{name:r=>`replace${r}Attributes`,attacher:iR},{name:r=>`merge${r}Attributes`,attacher:aR},{name:r=>`update${r}Attributes`,attacher:oR}];function lR(r){sR.forEach(function({name:n,attacher:i}){i(r,n("Edge"),"mixed"),i(r,n("DirectedEdge"),"directed"),i(r,n("UndirectedEdge"),"undirected")})}const uR=[{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 cR(r,n,i,a){let s=!1;for(const l in n){if(l===a)continue;const c=n[l];if(s=i(c.key,c.attributes,c.source.key,c.target.key,c.source.attributes,c.target.attributes,c.undirected),r&&s)return c.key}}function fR(r,n,i,a){let s,l,c,f=!1;for(const d in n)if(d!==a){s=n[d];do{if(l=s.source,c=s.target,f=i(s.key,s.attributes,l.key,c.key,l.attributes,c.attributes,s.undirected),r&&f)return s.key;s=s.next}while(s!==void 0)}}function ed(r,n){const i=Object.keys(r),a=i.length;let s,l=0;return{[Symbol.iterator](){return this},next(){do if(s)s=s.next;else{if(l>=a)return{done:!0};const c=i[l++];if(c===n){s=void 0;continue}s=r[c]}while(!s);return{done:!1,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}}}}}function dR(r,n,i,a){const s=n[i];if(!s)return;const l=s.source,c=s.target;if(a(s.key,s.attributes,l.key,c.key,l.attributes,c.attributes,s.undirected)&&r)return s.key}function hR(r,n,i,a){let s=n[i];if(!s)return;let l=!1;do{if(l=a(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),r&&l)return s.key;s=s.next}while(s!==void 0)}function td(r,n){let i=r[n];if(i.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!i)return{done:!0};const s={edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected};return i=i.next,{done:!1,value:s}}};let a=!1;return{[Symbol.iterator](){return this},next(){return a===!0?{done:!0}:(a=!0,{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}})}}}function gR(r,n){if(r.size===0)return[];if(n==="mixed"||n===r.type)return Array.from(r._edges.keys());const i=n==="undirected"?r.undirectedSize:r.directedSize,a=new Array(i),s=n==="undirected",l=r._edges.values();let c=0,f,d;for(;f=l.next(),f.done!==!0;)d=f.value,d.undirected===s&&(a[c++]=d.key);return a}function kw(r,n,i,a){if(n.size===0)return;const s=i!=="mixed"&&i!==n.type,l=i==="undirected";let c,f,d=!1;const g=n._edges.values();for(;c=g.next(),c.done!==!0;){if(f=c.value,s&&f.undirected!==l)continue;const{key:m,attributes:v,source:y,target:b}=f;if(d=a(m,v,y.key,b.key,y.attributes,b.attributes,f.undirected),r&&d)return m}}function pR(r,n){if(r.size===0)return Ba();const i=n!=="mixed"&&n!==r.type,a=n==="undirected",s=r._edges.values();return{[Symbol.iterator](){return this},next(){let l,c;for(;;){if(l=s.next(),l.done)return l;if(c=l.value,!(i&&c.undirected!==a))break}return{value:{edge:c.key,attributes:c.attributes,source:c.source.key,target:c.target.key,sourceAttributes:c.source.attributes,targetAttributes:c.target.attributes,undirected:c.undirected},done:!1}}}}function Fh(r,n,i,a,s,l){const c=n?fR:cR;let f;if(i!=="undirected"&&(a!=="out"&&(f=c(r,s.in,l),r&&f)||a!=="in"&&(f=c(r,s.out,l,a?void 0:s.key),r&&f))||i!=="directed"&&(f=c(r,s.undirected,l),r&&f))return f}function mR(r,n,i,a){const s=[];return Fh(!1,r,n,i,a,function(l){s.push(l)}),s}function vR(r,n,i){let a=Ba();return r!=="undirected"&&(n!=="out"&&typeof i.in<"u"&&(a=yr(a,ed(i.in))),n!=="in"&&typeof i.out<"u"&&(a=yr(a,ed(i.out,n?void 0:i.key)))),r!=="directed"&&typeof i.undirected<"u"&&(a=yr(a,ed(i.undirected))),a}function Hh(r,n,i,a,s,l,c){const f=i?hR:dR;let d;if(n!=="undirected"&&(typeof s.in<"u"&&a!=="out"&&(d=f(r,s.in,l,c),r&&d)||typeof s.out<"u"&&a!=="in"&&(a||s.key!==l)&&(d=f(r,s.out,l,c),r&&d))||n!=="directed"&&typeof s.undirected<"u"&&(d=f(r,s.undirected,l,c),r&&d))return d}function yR(r,n,i,a,s){const l=[];return Hh(!1,r,n,i,a,s,function(c){l.push(c)}),l}function bR(r,n,i,a){let s=Ba();return r!=="undirected"&&(typeof i.in<"u"&&n!=="out"&&a in i.in&&(s=yr(s,td(i.in,a))),typeof i.out<"u"&&n!=="in"&&a in i.out&&(n||i.key!==a)&&(s=yr(s,td(i.out,a)))),r!=="directed"&&typeof i.undirected<"u"&&a in i.undirected&&(s=yr(s,td(i.undirected,a))),s}function wR(r,n){const{name:i,type:a,direction:s}=n;r.prototype[i]=function(l,c){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return[];if(!arguments.length)return gR(this,a);if(arguments.length===1){l=""+l;const f=this._nodes.get(l);if(typeof f>"u")throw new me(`Graph.${i}: could not find the "${l}" node in the graph.`);return mR(this.multi,a==="mixed"?this.type:a,s,f)}if(arguments.length===2){l=""+l,c=""+c;const f=this._nodes.get(l);if(!f)throw new me(`Graph.${i}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new me(`Graph.${i}: could not find the "${c}" target node in the graph.`);return yR(a,this.multi,s,f,c)}throw new ye(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ER(r,n){const{name:i,type:a,direction:s}=n,l="forEach"+i[0].toUpperCase()+i.slice(1,-1);r.prototype[l]=function(g,m,v){if(!(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)){if(arguments.length===1)return v=g,kw(!1,this,a,v);if(arguments.length===2){g=""+g,v=m;const y=this._nodes.get(g);if(typeof y>"u")throw new me(`Graph.${l}: could not find the "${g}" node in the graph.`);return Fh(!1,this.multi,a==="mixed"?this.type:a,s,y,v)}if(arguments.length===3){g=""+g,m=""+m;const y=this._nodes.get(g);if(!y)throw new me(`Graph.${l}: could not find the "${g}" source node in the graph.`);if(!this._nodes.has(m))throw new me(`Graph.${l}: could not find the "${m}" target node in the graph.`);return Hh(!1,a,this.multi,s,y,m,v)}throw new ye(`Graph.${l}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const c="map"+i[0].toUpperCase()+i.slice(1);r.prototype[c]=function(){const g=Array.prototype.slice.call(arguments),m=g.pop();let v;if(g.length===0){let y=0;a!=="directed"&&(y+=this.undirectedSize),a!=="undirected"&&(y+=this.directedSize),v=new Array(y);let b=0;g.push((x,E,T,M,N,L,C)=>{v[b++]=m(x,E,T,M,N,L,C)})}else v=[],g.push((y,b,x,E,T,M,N)=>{v.push(m(y,b,x,E,T,M,N))});return this[l].apply(this,g),v};const f="filter"+i[0].toUpperCase()+i.slice(1);r.prototype[f]=function(){const g=Array.prototype.slice.call(arguments),m=g.pop(),v=[];return g.push((y,b,x,E,T,M,N)=>{m(y,b,x,E,T,M,N)&&v.push(y)}),this[l].apply(this,g),v};const d="reduce"+i[0].toUpperCase()+i.slice(1);r.prototype[d]=function(){let g=Array.prototype.slice.call(arguments);if(g.length<2||g.length>4)throw new ye(`Graph.${d}: invalid number of arguments (expecting 2, 3 or 4 and got ${g.length}).`);if(typeof g[g.length-1]=="function"&&typeof g[g.length-2]!="function")throw new ye(`Graph.${d}: 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,v;g.length===2?(m=g[0],v=g[1],g=[]):g.length===3?(m=g[1],v=g[2],g=[g[0]]):g.length===4&&(m=g[2],v=g[3],g=[g[0],g[1]]);let y=v;return g.push((b,x,E,T,M,N,L)=>{y=m(y,b,x,E,T,M,N,L)}),this[l].apply(this,g),y}}function SR(r,n){const{name:i,type:a,direction:s}=n,l="find"+i[0].toUpperCase()+i.slice(1,-1);r.prototype[l]=function(d,g,m){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return!1;if(arguments.length===1)return m=d,kw(!0,this,a,m);if(arguments.length===2){d=""+d,m=g;const v=this._nodes.get(d);if(typeof v>"u")throw new me(`Graph.${l}: could not find the "${d}" node in the graph.`);return Fh(!0,this.multi,a==="mixed"?this.type:a,s,v,m)}if(arguments.length===3){d=""+d,g=""+g;const v=this._nodes.get(d);if(!v)throw new me(`Graph.${l}: could not find the "${d}" source node in the graph.`);if(!this._nodes.has(g))throw new me(`Graph.${l}: could not find the "${g}" target node in the graph.`);return Hh(!0,a,this.multi,s,v,g,m)}throw new ye(`Graph.${l}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const c="some"+i[0].toUpperCase()+i.slice(1,-1);r.prototype[c]=function(){const d=Array.prototype.slice.call(arguments),g=d.pop();return d.push((v,y,b,x,E,T,M)=>g(v,y,b,x,E,T,M)),!!this[l].apply(this,d)};const f="every"+i[0].toUpperCase()+i.slice(1,-1);r.prototype[f]=function(){const d=Array.prototype.slice.call(arguments),g=d.pop();return d.push((v,y,b,x,E,T,M)=>!g(v,y,b,x,E,T,M)),!this[l].apply(this,d)}}function xR(r,n){const{name:i,type:a,direction:s}=n,l=i.slice(0,-1)+"Entries";r.prototype[l]=function(c,f){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return Ba();if(!arguments.length)return pR(this,a);if(arguments.length===1){c=""+c;const d=this._nodes.get(c);if(!d)throw new me(`Graph.${l}: could not find the "${c}" node in the graph.`);return vR(a,s,d)}if(arguments.length===2){c=""+c,f=""+f;const d=this._nodes.get(c);if(!d)throw new me(`Graph.${l}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(f))throw new me(`Graph.${l}: could not find the "${f}" target node in the graph.`);return bR(a,s,d,f)}throw new ye(`Graph.${l}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function _R(r){uR.forEach(n=>{wR(r,n),ER(r,n),SR(r,n),xR(r,n)})}const TR=[{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 Su(){this.A=null,this.B=null}Su.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)};Su.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function $o(r,n,i,a,s){for(const l in a){const c=a[l],f=c.source,d=c.target,g=f===i?d:f;if(n&&n.has(g.key))continue;const m=s(g.key,g.attributes);if(r&&m)return g.key}}function Ph(r,n,i,a,s){if(n!=="mixed"){if(n==="undirected")return $o(r,null,a,a.undirected,s);if(typeof i=="string")return $o(r,null,a,a[i],s)}const l=new Su;let c;if(n!=="undirected"){if(i!=="out"){if(c=$o(r,null,a,a.in,s),r&&c)return c;l.wrap(a.in)}if(i!=="in"){if(c=$o(r,l,a,a.out,s),r&&c)return c;l.wrap(a.out)}}if(n!=="directed"&&(c=$o(r,l,a,a.undirected,s),r&&c))return c}function CR(r,n,i){if(r!=="mixed"){if(r==="undirected")return Object.keys(i.undirected);if(typeof n=="string")return Object.keys(i[n])}const a=[];return Ph(!1,r,n,i,function(s){a.push(s)}),a}function qo(r,n,i){const a=Object.keys(i),s=a.length;let l=0;return{[Symbol.iterator](){return this},next(){let c=null;do{if(l>=s)return r&&r.wrap(i),{done:!0};const f=i[a[l++]],d=f.source,g=f.target;if(c=d===n?g:d,r&&r.has(c.key)){c=null;continue}}while(c===null);return{done:!1,value:{neighbor:c.key,attributes:c.attributes}}}}}function AR(r,n,i){if(r!=="mixed"){if(r==="undirected")return qo(null,i,i.undirected);if(typeof n=="string")return qo(null,i,i[n])}let a=Ba();const s=new Su;return r!=="undirected"&&(n!=="out"&&(a=yr(a,qo(s,i,i.in))),n!=="in"&&(a=yr(a,qo(s,i,i.out)))),r!=="directed"&&(a=yr(a,qo(s,i,i.undirected))),a}function RR(r,n){const{name:i,type:a,direction:s}=n;r.prototype[i]=function(l){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return[];l=""+l;const c=this._nodes.get(l);if(typeof c>"u")throw new me(`Graph.${i}: could not find the "${l}" node in the graph.`);return CR(a==="mixed"?this.type:a,s,c)}}function DR(r,n){const{name:i,type:a,direction:s}=n,l="forEach"+i[0].toUpperCase()+i.slice(1,-1);r.prototype[l]=function(g,m){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return;g=""+g;const v=this._nodes.get(g);if(typeof v>"u")throw new me(`Graph.${l}: could not find the "${g}" node in the graph.`);Ph(!1,a==="mixed"?this.type:a,s,v,m)};const c="map"+i[0].toUpperCase()+i.slice(1);r.prototype[c]=function(g,m){const v=[];return this[l](g,(y,b)=>{v.push(m(y,b))}),v};const f="filter"+i[0].toUpperCase()+i.slice(1);r.prototype[f]=function(g,m){const v=[];return this[l](g,(y,b)=>{m(y,b)&&v.push(y)}),v};const d="reduce"+i[0].toUpperCase()+i.slice(1);r.prototype[d]=function(g,m,v){if(arguments.length<3)throw new ye(`Graph.${d}: 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 y=v;return this[l](g,(b,x)=>{y=m(y,b,x)}),y}}function OR(r,n){const{name:i,type:a,direction:s}=n,l=i[0].toUpperCase()+i.slice(1,-1),c="find"+l;r.prototype[c]=function(g,m){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return;g=""+g;const v=this._nodes.get(g);if(typeof v>"u")throw new me(`Graph.${c}: could not find the "${g}" node in the graph.`);return Ph(!0,a==="mixed"?this.type:a,s,v,m)};const f="some"+l;r.prototype[f]=function(g,m){return!!this[c](g,m)};const d="every"+l;r.prototype[d]=function(g,m){return!this[c](g,(y,b)=>!m(y,b))}}function kR(r,n){const{name:i,type:a,direction:s}=n,l=i.slice(0,-1)+"Entries";r.prototype[l]=function(c){if(a!=="mixed"&&this.type!=="mixed"&&a!==this.type)return Ba();c=""+c;const f=this._nodes.get(c);if(typeof f>"u")throw new me(`Graph.${l}: could not find the "${c}" node in the graph.`);return AR(a==="mixed"?this.type:a,s,f)}}function LR(r){TR.forEach(n=>{RR(r,n),DR(r,n),OR(r,n),kR(r,n)})}function Ll(r,n,i,a,s){const l=a._nodes.values(),c=a.type;let f,d,g,m,v,y;for(;f=l.next(),f.done!==!0;){let b=!1;if(d=f.value,c!=="undirected"){m=d.out;for(g in m){v=m[g];do y=v.target,b=!0,s(d.key,y.key,d.attributes,y.attributes,v.key,v.attributes,v.undirected),v=v.next;while(v)}}if(c!=="directed"){m=d.undirected;for(g in m)if(!(n&&d.key>g)){v=m[g];do y=v.target,y.key!==g&&(y=v.source),b=!0,s(d.key,y.key,d.attributes,y.attributes,v.key,v.attributes,v.undirected),v=v.next;while(v)}}i&&!b&&s(d.key,null,d.attributes,null,null,null,null)}}function NR(r,n){const i={key:r};return _w(n.attributes)||(i.attributes=wt({},n.attributes)),i}function zR(r,n,i){const a={key:n,source:i.source.key,target:i.target.key};return _w(i.attributes)||(a.attributes=wt({},i.attributes)),r==="mixed"&&i.undirected&&(a.undirected=!0),a}function GR(r){if(!Nt(r))throw new ye('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new ye("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!Nt(r.attributes)||r.attributes===null))throw new ye("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function MR(r){if(!Nt(r))throw new ye('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new ye("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new ye("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!Nt(r.attributes)||r.attributes===null))throw new ye("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new ye("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const jR=BA(),UR=new Set(["directed","undirected","mixed"]),Ny=new Set(["domain","_events","_eventsCount","_maxListeners"]),BR=[{name:r=>`${r}Edge`,generateKey:!0},{name:r=>`${r}DirectedEdge`,generateKey:!0,type:"directed"},{name:r=>`${r}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:r=>`${r}EdgeWithKey`},{name:r=>`${r}DirectedEdgeWithKey`,type:"directed"},{name:r=>`${r}UndirectedEdgeWithKey`,type:"undirected"}],FR={allowSelfLoops:!0,multi:!1,type:"mixed"};function HR(r,n,i){if(i&&!Nt(i))throw new ye(`Graph.addNode: invalid attributes. Expecting an object but got "${i}"`);if(n=""+n,i=i||{},r._nodes.has(n))throw new ke(`Graph.addNode: the "${n}" node already exist in the graph.`);const a=new r.NodeDataClass(n,i);return r._nodes.set(n,a),r.emit("nodeAdded",{key:n,attributes:i}),a}function zy(r,n,i){const a=new r.NodeDataClass(n,i);return r._nodes.set(n,a),r.emit("nodeAdded",{key:n,attributes:i}),a}function Lw(r,n,i,a,s,l,c,f){if(!a&&r.type==="undirected")throw new ke(`Graph.${n}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(a&&r.type==="directed")throw new ke(`Graph.${n}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(f&&!Nt(f))throw new ye(`Graph.${n}: invalid attributes. Expecting an object but got "${f}"`);if(l=""+l,c=""+c,f=f||{},!r.allowSelfLoops&&l===c)throw new ke(`Graph.${n}: source & target are the same ("${l}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const d=r._nodes.get(l),g=r._nodes.get(c);if(!d)throw new me(`Graph.${n}: source node "${l}" not found.`);if(!g)throw new me(`Graph.${n}: target node "${c}" not found.`);const m={key:null,undirected:a,source:l,target:c,attributes:f};if(i)s=r._edgeKeyGenerator();else if(s=""+s,r._edges.has(s))throw new ke(`Graph.${n}: the "${s}" edge already exists in the graph.`);if(!r.multi&&(a?typeof d.undirected[c]<"u":typeof d.out[c]<"u"))throw new ke(`Graph.${n}: an edge linking "${l}" to "${c}" 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 v=new Fa(a,s,d,g,f);r._edges.set(s,v);const y=l===c;return a?(d.undirectedDegree++,g.undirectedDegree++,y&&(d.undirectedLoops++,r._undirectedSelfLoopCount++)):(d.outDegree++,g.inDegree++,y&&(d.directedLoops++,r._directedSelfLoopCount++)),r.multi?v.attachMulti():v.attach(),a?r._undirectedSize++:r._directedSize++,m.key=s,r.emit("edgeAdded",m),s}function PR(r,n,i,a,s,l,c,f,d){if(!a&&r.type==="undirected")throw new ke(`Graph.${n}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(a&&r.type==="directed")throw new ke(`Graph.${n}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(f){if(d){if(typeof f!="function")throw new ye(`Graph.${n}: invalid updater function. Expecting a function but got "${f}"`)}else if(!Nt(f))throw new ye(`Graph.${n}: invalid attributes. Expecting an object but got "${f}"`)}l=""+l,c=""+c;let g;if(d&&(g=f,f=void 0),!r.allowSelfLoops&&l===c)throw new ke(`Graph.${n}: source & target are the same ("${l}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let m=r._nodes.get(l),v=r._nodes.get(c),y,b;if(!i&&(y=r._edges.get(s),y)){if((y.source.key!==l||y.target.key!==c)&&(!a||y.source.key!==c||y.target.key!==l))throw new ke(`Graph.${n}: inconsistency detected when attempting to merge the "${s}" edge with "${l}" source & "${c}" target vs. ("${y.source.key}", "${y.target.key}").`);b=y}if(!b&&!r.multi&&m&&(b=a?m.undirected[c]:m.out[c]),b){const N=[b.key,!1,!1,!1];if(d?!g:!f)return N;if(d){const L=b.attributes;b.attributes=g(L),r.emit("edgeAttributesUpdated",{type:"replace",key:b.key,attributes:b.attributes})}else wt(b.attributes,f),r.emit("edgeAttributesUpdated",{type:"merge",key:b.key,attributes:b.attributes,data:f});return N}f=f||{},d&&g&&(f=g(f));const x={key:null,undirected:a,source:l,target:c,attributes:f};if(i)s=r._edgeKeyGenerator();else if(s=""+s,r._edges.has(s))throw new ke(`Graph.${n}: the "${s}" edge already exists in the graph.`);let E=!1,T=!1;m||(m=zy(r,l,{}),E=!0,l===c&&(v=m,T=!0)),v||(v=zy(r,c,{}),T=!0),y=new Fa(a,s,m,v,f),r._edges.set(s,y);const M=l===c;return a?(m.undirectedDegree++,v.undirectedDegree++,M&&(m.undirectedLoops++,r._undirectedSelfLoopCount++)):(m.outDegree++,v.inDegree++,M&&(m.directedLoops++,r._directedSelfLoopCount++)),r.multi?y.attachMulti():y.attach(),a?r._undirectedSize++:r._directedSize++,x.key=s,r.emit("edgeAdded",x),[s,!0,E,T]}function xa(r,n){r._edges.delete(n.key);const{source:i,target:a,attributes:s}=n,l=n.undirected,c=i===a;l?(i.undirectedDegree--,a.undirectedDegree--,c&&(i.undirectedLoops--,r._undirectedSelfLoopCount--)):(i.outDegree--,a.inDegree--,c&&(i.directedLoops--,r._directedSelfLoopCount--)),r.multi?n.detachMulti():n.detach(),l?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:n.key,attributes:s,source:i.key,target:a.key,undirected:l})}class Ke extends xw.EventEmitter{constructor(n){if(super(),n=wt({},FR,n),typeof n.multi!="boolean")throw new ye(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${n.multi}".`);if(!UR.has(n.type))throw new ye(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${n.type}".`);if(typeof n.allowSelfLoops!="boolean")throw new ye(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${n.allowSelfLoops}".`);const i=n.type==="mixed"?Tw:n.type==="directed"?Cw:Aw;wn(this,"NodeDataClass",i);const a="geid_"+jR()+"_";let s=0;const l=()=>{let c;do c=a+s++;while(this._edges.has(c));return c};wn(this,"_attributes",{}),wn(this,"_nodes",new Map),wn(this,"_edges",new Map),wn(this,"_directedSize",0),wn(this,"_undirectedSize",0),wn(this,"_directedSelfLoopCount",0),wn(this,"_undirectedSelfLoopCount",0),wn(this,"_edgeKeyGenerator",l),wn(this,"_options",n),Ny.forEach(c=>wn(this,c,this[c])),Rn(this,"order",()=>this._nodes.size),Rn(this,"size",()=>this._edges.size),Rn(this,"directedSize",()=>this._directedSize),Rn(this,"undirectedSize",()=>this._undirectedSize),Rn(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Rn(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Rn(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Rn(this,"multi",this._options.multi),Rn(this,"type",this._options.type),Rn(this,"allowSelfLoops",this._options.allowSelfLoops),Rn(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(n){return this._nodes.has(""+n)}hasDirectedEdge(n,i){if(this.type==="undirected")return!1;if(arguments.length===1){const a=""+n,s=this._edges.get(a);return!!s&&!s.undirected}else if(arguments.length===2){n=""+n,i=""+i;const a=this._nodes.get(n);return a?a.out.hasOwnProperty(i):!1}throw new ye(`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(n,i){if(this.type==="directed")return!1;if(arguments.length===1){const a=""+n,s=this._edges.get(a);return!!s&&s.undirected}else if(arguments.length===2){n=""+n,i=""+i;const a=this._nodes.get(n);return a?a.undirected.hasOwnProperty(i):!1}throw new ye(`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(n,i){if(arguments.length===1){const a=""+n;return this._edges.has(a)}else if(arguments.length===2){n=""+n,i=""+i;const a=this._nodes.get(n);return a?typeof a.out<"u"&&a.out.hasOwnProperty(i)||typeof a.undirected<"u"&&a.undirected.hasOwnProperty(i):!1}throw new ye(`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(n,i){if(this.type==="undirected")return;if(n=""+n,i=""+i,this.multi)throw new ke("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const a=this._nodes.get(n);if(!a)throw new me(`Graph.directedEdge: could not find the "${n}" source node in the graph.`);if(!this._nodes.has(i))throw new me(`Graph.directedEdge: could not find the "${i}" target node in the graph.`);const s=a.out&&a.out[i]||void 0;if(s)return s.key}undirectedEdge(n,i){if(this.type==="directed")return;if(n=""+n,i=""+i,this.multi)throw new ke("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const a=this._nodes.get(n);if(!a)throw new me(`Graph.undirectedEdge: could not find the "${n}" source node in the graph.`);if(!this._nodes.has(i))throw new me(`Graph.undirectedEdge: could not find the "${i}" target node in the graph.`);const s=a.undirected&&a.undirected[i]||void 0;if(s)return s.key}edge(n,i){if(this.multi)throw new ke("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.edge: could not find the "${n}" source node in the graph.`);if(!this._nodes.has(i))throw new me(`Graph.edge: could not find the "${i}" target node in the graph.`);const s=a.out&&a.out[i]||a.undirected&&a.undirected[i]||void 0;if(s)return s.key}areDirectedNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areDirectedNeighbors: could not find the "${n}" node in the graph.`);return this.type==="undirected"?!1:i in a.in||i in a.out}areOutNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areOutNeighbors: could not find the "${n}" node in the graph.`);return this.type==="undirected"?!1:i in a.out}areInNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areInNeighbors: could not find the "${n}" node in the graph.`);return this.type==="undirected"?!1:i in a.in}areUndirectedNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areUndirectedNeighbors: could not find the "${n}" node in the graph.`);return this.type==="directed"?!1:i in a.undirected}areNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areNeighbors: could not find the "${n}" node in the graph.`);return this.type!=="undirected"&&(i in a.in||i in a.out)||this.type!=="directed"&&i in a.undirected}areInboundNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areInboundNeighbors: could not find the "${n}" node in the graph.`);return this.type!=="undirected"&&i in a.in||this.type!=="directed"&&i in a.undirected}areOutboundNeighbors(n,i){n=""+n,i=""+i;const a=this._nodes.get(n);if(!a)throw new me(`Graph.areOutboundNeighbors: could not find the "${n}" node in the graph.`);return this.type!=="undirected"&&i in a.out||this.type!=="directed"&&i in a.undirected}inDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.inDegree: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.inDegree}outDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.outDegree: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.outDegree}directedDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.directedDegree: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.inDegree+i.outDegree}undirectedDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.undirectedDegree: could not find the "${n}" node in the graph.`);return this.type==="directed"?0:i.undirectedDegree}inboundDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.inboundDegree: could not find the "${n}" node in the graph.`);let a=0;return this.type!=="directed"&&(a+=i.undirectedDegree),this.type!=="undirected"&&(a+=i.inDegree),a}outboundDegree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.outboundDegree: could not find the "${n}" node in the graph.`);let a=0;return this.type!=="directed"&&(a+=i.undirectedDegree),this.type!=="undirected"&&(a+=i.outDegree),a}degree(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.degree: could not find the "${n}" node in the graph.`);let a=0;return this.type!=="directed"&&(a+=i.undirectedDegree),this.type!=="undirected"&&(a+=i.inDegree+i.outDegree),a}inDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.inDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.inDegree-i.directedLoops}outDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.outDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.outDegree-i.directedLoops}directedDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.directedDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);return this.type==="undirected"?0:i.inDegree+i.outDegree-i.directedLoops*2}undirectedDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);return this.type==="directed"?0:i.undirectedDegree-i.undirectedLoops*2}inboundDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);let a=0,s=0;return this.type!=="directed"&&(a+=i.undirectedDegree,s+=i.undirectedLoops*2),this.type!=="undirected"&&(a+=i.inDegree,s+=i.directedLoops),a-s}outboundDegreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);let a=0,s=0;return this.type!=="directed"&&(a+=i.undirectedDegree,s+=i.undirectedLoops*2),this.type!=="undirected"&&(a+=i.outDegree,s+=i.directedLoops),a-s}degreeWithoutSelfLoops(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.degreeWithoutSelfLoops: could not find the "${n}" node in the graph.`);let a=0,s=0;return this.type!=="directed"&&(a+=i.undirectedDegree,s+=i.undirectedLoops*2),this.type!=="undirected"&&(a+=i.inDegree+i.outDegree,s+=i.directedLoops*2),a-s}source(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.source: could not find the "${n}" edge in the graph.`);return i.source.key}target(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.target: could not find the "${n}" edge in the graph.`);return i.target.key}extremities(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.extremities: could not find the "${n}" edge in the graph.`);return[i.source.key,i.target.key]}opposite(n,i){n=""+n,i=""+i;const a=this._edges.get(i);if(!a)throw new me(`Graph.opposite: could not find the "${i}" edge in the graph.`);const s=a.source.key,l=a.target.key;if(n===s)return l;if(n===l)return s;throw new me(`Graph.opposite: the "${n}" node is not attached to the "${i}" edge (${s}, ${l}).`)}hasExtremity(n,i){n=""+n,i=""+i;const a=this._edges.get(n);if(!a)throw new me(`Graph.hasExtremity: could not find the "${n}" edge in the graph.`);return a.source.key===i||a.target.key===i}isUndirected(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.isUndirected: could not find the "${n}" edge in the graph.`);return i.undirected}isDirected(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.isDirected: could not find the "${n}" edge in the graph.`);return!i.undirected}isSelfLoop(n){n=""+n;const i=this._edges.get(n);if(!i)throw new me(`Graph.isSelfLoop: could not find the "${n}" edge in the graph.`);return i.source===i.target}addNode(n,i){return HR(this,n,i).key}mergeNode(n,i){if(i&&!Nt(i))throw new ye(`Graph.mergeNode: invalid attributes. Expecting an object but got "${i}"`);n=""+n,i=i||{};let a=this._nodes.get(n);return a?(i&&(wt(a.attributes,i),this.emit("nodeAttributesUpdated",{type:"merge",key:n,attributes:a.attributes,data:i})),[n,!1]):(a=new this.NodeDataClass(n,i),this._nodes.set(n,a),this.emit("nodeAdded",{key:n,attributes:i}),[n,!0])}updateNode(n,i){if(i&&typeof i!="function")throw new ye(`Graph.updateNode: invalid updater function. Expecting a function but got "${i}"`);n=""+n;let a=this._nodes.get(n);if(a){if(i){const l=a.attributes;a.attributes=i(l),this.emit("nodeAttributesUpdated",{type:"replace",key:n,attributes:a.attributes})}return[n,!1]}const s=i?i({}):{};return a=new this.NodeDataClass(n,s),this._nodes.set(n,a),this.emit("nodeAdded",{key:n,attributes:s}),[n,!0]}dropNode(n){n=""+n;const i=this._nodes.get(n);if(!i)throw new me(`Graph.dropNode: could not find the "${n}" node in the graph.`);let a;if(this.type!=="undirected"){for(const s in i.out){a=i.out[s];do xa(this,a),a=a.next;while(a)}for(const s in i.in){a=i.in[s];do xa(this,a),a=a.next;while(a)}}if(this.type!=="directed")for(const s in i.undirected){a=i.undirected[s];do xa(this,a),a=a.next;while(a)}this._nodes.delete(n),this.emit("nodeDropped",{key:n,attributes:i.attributes})}dropEdge(n){let i;if(arguments.length>1){const a=""+arguments[0],s=""+arguments[1];if(i=En(this,a,s,this.type),!i)throw new me(`Graph.dropEdge: could not find the "${a}" -> "${s}" edge in the graph.`)}else if(n=""+n,i=this._edges.get(n),!i)throw new me(`Graph.dropEdge: could not find the "${n}" edge in the graph.`);return xa(this,i),this}dropDirectedEdge(n,i){if(arguments.length<2)throw new ke("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 ke("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.");n=""+n,i=""+i;const a=En(this,n,i,"directed");if(!a)throw new me(`Graph.dropDirectedEdge: could not find a "${n}" -> "${i}" edge in the graph.`);return xa(this,a),this}dropUndirectedEdge(n,i){if(arguments.length<2)throw new ke("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 ke("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 a=En(this,n,i,"undirected");if(!a)throw new me(`Graph.dropUndirectedEdge: could not find a "${n}" -> "${i}" edge in the graph.`);return xa(this,a),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const n=this._nodes.values();let i;for(;i=n.next(),i.done!==!0;)i.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(n){return this._attributes[n]}getAttributes(){return this._attributes}hasAttribute(n){return this._attributes.hasOwnProperty(n)}setAttribute(n,i){return this._attributes[n]=i,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:n}),this}updateAttribute(n,i){if(typeof i!="function")throw new ye("Graph.updateAttribute: updater should be a function.");const a=this._attributes[n];return this._attributes[n]=i(a),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:n}),this}removeAttribute(n){return delete this._attributes[n],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:n}),this}replaceAttributes(n){if(!Nt(n))throw new ye("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=n,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(n){if(!Nt(n))throw new ye("Graph.mergeAttributes: provided attributes are not a plain object.");return wt(this._attributes,n),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:n}),this}updateAttributes(n){if(typeof n!="function")throw new ye("Graph.updateAttributes: provided updater is not a function.");return this._attributes=n(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(n,i){if(typeof n!="function")throw new ye("Graph.updateEachNodeAttributes: expecting an updater function.");if(i&&!Ly(i))throw new ye("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const a=this._nodes.values();let s,l;for(;s=a.next(),s.done!==!0;)l=s.value,l.attributes=n(l.key,l.attributes);this.emit("eachNodeAttributesUpdated",{hints:i||null})}updateEachEdgeAttributes(n,i){if(typeof n!="function")throw new ye("Graph.updateEachEdgeAttributes: expecting an updater function.");if(i&&!Ly(i))throw new ye("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const a=this._edges.values();let s,l,c,f;for(;s=a.next(),s.done!==!0;)l=s.value,c=l.source,f=l.target,l.attributes=n(l.key,l.attributes,c.key,f.key,c.attributes,f.attributes,l.undirected);this.emit("eachEdgeAttributesUpdated",{hints:i||null})}forEachAdjacencyEntry(n){if(typeof n!="function")throw new ye("Graph.forEachAdjacencyEntry: expecting a callback.");Ll(!1,!1,!1,this,n)}forEachAdjacencyEntryWithOrphans(n){if(typeof n!="function")throw new ye("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Ll(!1,!1,!0,this,n)}forEachAssymetricAdjacencyEntry(n){if(typeof n!="function")throw new ye("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Ll(!1,!0,!1,this,n)}forEachAssymetricAdjacencyEntryWithOrphans(n){if(typeof n!="function")throw new ye("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Ll(!1,!0,!0,this,n)}nodes(){return Array.from(this._nodes.keys())}forEachNode(n){if(typeof n!="function")throw new ye("Graph.forEachNode: expecting a callback.");const i=this._nodes.values();let a,s;for(;a=i.next(),a.done!==!0;)s=a.value,n(s.key,s.attributes)}findNode(n){if(typeof n!="function")throw new ye("Graph.findNode: expecting a callback.");const i=this._nodes.values();let a,s;for(;a=i.next(),a.done!==!0;)if(s=a.value,n(s.key,s.attributes))return s.key}mapNodes(n){if(typeof n!="function")throw new ye("Graph.mapNode: expecting a callback.");const i=this._nodes.values();let a,s;const l=new Array(this.order);let c=0;for(;a=i.next(),a.done!==!0;)s=a.value,l[c++]=n(s.key,s.attributes);return l}someNode(n){if(typeof n!="function")throw new ye("Graph.someNode: expecting a callback.");const i=this._nodes.values();let a,s;for(;a=i.next(),a.done!==!0;)if(s=a.value,n(s.key,s.attributes))return!0;return!1}everyNode(n){if(typeof n!="function")throw new ye("Graph.everyNode: expecting a callback.");const i=this._nodes.values();let a,s;for(;a=i.next(),a.done!==!0;)if(s=a.value,!n(s.key,s.attributes))return!1;return!0}filterNodes(n){if(typeof n!="function")throw new ye("Graph.filterNodes: expecting a callback.");const i=this._nodes.values();let a,s;const l=[];for(;a=i.next(),a.done!==!0;)s=a.value,n(s.key,s.attributes)&&l.push(s.key);return l}reduceNodes(n,i){if(typeof n!="function")throw new ye("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ye("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 a=i;const s=this._nodes.values();let l,c;for(;l=s.next(),l.done!==!0;)c=l.value,a=n(a,c.key,c.attributes);return a}nodeEntries(){const n=this._nodes.values();return{[Symbol.iterator](){return this},next(){const i=n.next();if(i.done)return i;const a=i.value;return{value:{node:a.key,attributes:a.attributes},done:!1}}}}export(){const n=new Array(this._nodes.size);let i=0;this._nodes.forEach((s,l)=>{n[i++]=NR(l,s)});const a=new Array(this._edges.size);return i=0,this._edges.forEach((s,l)=>{a[i++]=zR(this.type,l,s)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:n,edges:a}}import(n,i=!1){if(n instanceof Ke)return n.forEachNode((d,g)=>{i?this.mergeNode(d,g):this.addNode(d,g)}),n.forEachEdge((d,g,m,v,y,b,x)=>{i?x?this.mergeUndirectedEdgeWithKey(d,m,v,g):this.mergeDirectedEdgeWithKey(d,m,v,g):x?this.addUndirectedEdgeWithKey(d,m,v,g):this.addDirectedEdgeWithKey(d,m,v,g)}),this;if(!Nt(n))throw new ye("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(n.attributes){if(!Nt(n.attributes))throw new ye("Graph.import: invalid attributes. Expecting a plain object.");i?this.mergeAttributes(n.attributes):this.replaceAttributes(n.attributes)}let a,s,l,c,f;if(n.nodes){if(l=n.nodes,!Array.isArray(l))throw new ye("Graph.import: invalid nodes. Expecting an array.");for(a=0,s=l.length;a{const l=wt({},a.attributes);a=new i.NodeDataClass(s,l),i._nodes.set(s,a)}),i}copy(n){if(n=n||{},typeof n.type=="string"&&n.type!==this.type&&n.type!=="mixed")throw new ke(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${n.type}" because this would mean losing information about the current graph.`);if(typeof n.multi=="boolean"&&n.multi!==this.multi&&n.multi!==!0)throw new ke("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 n.allowSelfLoops=="boolean"&&n.allowSelfLoops!==this.allowSelfLoops&&n.allowSelfLoops!==!0)throw new ke("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 i=this.emptyCopy(n),a=this._edges.values();let s,l;for(;s=a.next(),s.done!==!0;)l=s.value,Lw(i,"copy",!1,l.undirected,l.key,l.source.key,l.target.key,wt({},l.attributes));return i}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const n={};this._nodes.forEach((l,c)=>{n[c]=l.attributes});const i={},a={};this._edges.forEach((l,c)=>{const f=l.undirected?"--":"->";let d="",g=l.source.key,m=l.target.key,v;l.undirected&&g>m&&(v=g,g=m,m=v);const y=`(${g})${f}(${m})`;c.startsWith("geid_")?this.multi&&(typeof a[y]>"u"?a[y]=0:a[y]++,d+=`${a[y]}. `):d+=`[${c}]: `,d+=y,i[d]=l.attributes});const s={};for(const l in this)this.hasOwnProperty(l)&&!Ny.has(l)&&typeof this[l]!="function"&&typeof l!="symbol"&&(s[l]=this[l]);return s.attributes=this._attributes,s.nodes=n,s.edges=i,wn(s,"constructor",this.constructor),s}}typeof Symbol<"u"&&(Ke.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ke.prototype.inspect);BR.forEach(r=>{["add","merge","update"].forEach(n=>{const i=r.name(n),a=n==="add"?Lw:PR;r.generateKey?Ke.prototype[i]=function(s,l,c){return a(this,i,!0,(r.type||this.type)==="undirected",null,s,l,c,n==="update")}:Ke.prototype[i]=function(s,l,c,f){return a(this,i,!1,(r.type||this.type)==="undirected",s,l,c,f,n==="update")}})});KA(Ke);lR(Ke);_R(Ke);LR(Ke);class ts extends Ke{constructor(n){const i=wt({type:"directed"},n);if("multi"in i&&i.multi!==!1)throw new ye("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(i.type!=="directed")throw new ye('DirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class Nw extends Ke{constructor(n){const i=wt({type:"undirected"},n);if("multi"in i&&i.multi!==!1)throw new ye("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(i.type!=="undirected")throw new ye('UndirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class zw extends Ke{constructor(n){const i=wt({multi:!0},n);if("multi"in i&&i.multi!==!0)throw new ye("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(i)}}class Gw extends Ke{constructor(n){const i=wt({type:"directed",multi:!0},n);if("multi"in i&&i.multi!==!0)throw new ye("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(i.type!=="directed")throw new ye('MultiDirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class Mw extends Ke{constructor(n){const i=wt({type:"undirected",multi:!0},n);if("multi"in i&&i.multi!==!0)throw new ye("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(i.type!=="undirected")throw new ye('MultiUndirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}function Ha(r){r.from=function(n,i){const a=wt({},n.options,i),s=new r(a);return s.import(n),s}}Ha(Ke);Ha(ts);Ha(Nw);Ha(zw);Ha(Gw);Ha(Mw);Ke.Graph=Ke;Ke.DirectedGraph=ts;Ke.UndirectedGraph=Nw;Ke.MultiGraph=zw;Ke.MultiDirectedGraph=Gw;Ke.MultiUndirectedGraph=Mw;Ke.InvalidArgumentsGraphError=ye;Ke.NotFoundGraphError=me;Ke.UsageGraphError=ke;function $R(r,n){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var a=i.call(r,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function Qo(r){var n=$R(r,"string");return typeof n=="symbol"?n:n+""}function At(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function Gy(r,n){for(var i=0;ir.length)&&(n=r.length);for(var i=0,a=Array(n);i>8&255,l=i>>16&255,c=i>>24&255;return[a,s,l,c]}var rd={};function Pw(r){if(typeof rd[r]<"u")return rd[r];var n=(r&16711680)>>>16,i=(r&65280)>>>8,a=r&255,s=255,l=Hw(n,i,a,s);return rd[r]=l,l}function My(r,n,i,a){return i+(n<<8)+(r<<16)}function jy(r,n,i,a,s,l){var c=Math.floor(i/l*s),f=Math.floor(r.drawingBufferHeight/l-a/l*s),d=new Uint8Array(4);r.bindFramebuffer(r.FRAMEBUFFER,n),r.readPixels(c,f,1,1,r.RGBA,r.UNSIGNED_BYTE,d);var g=Na(d,4),m=g[0],v=g[1],y=g[2],b=g[3];return[m,v,y,b]}function fe(r,n,i){return(n=Qo(n))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r}function Uy(r,n){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);n&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),i.push.apply(i,a)}return i}function _e(r){for(var n=1;nC){var B="…";for(g=g+B,R=r.measureText(g).width;R>C&&g.length>1;)g=g.slice(0,-2)+B,R=r.measureText(g).width;if(g.length<4)return}var _;N>0?L>0?_=Math.acos(N/C):_=Math.asin(L/C):L>0?_=Math.acos(N/C)+Math.PI:_=Math.asin(N/C)+Math.PI/2,r.save(),r.translate(T,M),r.rotate(_),r.fillText(g,-R/2,n.size/2+l),r.restore()}}}function Yw(r,n,i){if(n.label){var a=i.labelSize,s=i.labelFont,l=i.labelWeight,c=i.labelColor.attribute?n[i.labelColor.attribute]||i.labelColor.color||"#000":i.labelColor.color;r.fillStyle=c,r.font="".concat(l," ").concat(a,"px ").concat(s),r.fillText(n.label,n.x+n.size+3,n.y+a/3)}}function oD(r,n,i){var a=i.labelSize,s=i.labelFont,l=i.labelWeight;r.font="".concat(l," ").concat(a,"px ").concat(s),r.fillStyle="#FFF",r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=8,r.shadowColor="#000";var c=2;if(typeof n.label=="string"){var f=r.measureText(n.label).width,d=Math.round(f+5),g=Math.round(a+2*c),m=Math.max(n.size,a/2)+c,v=Math.asin(g/2/m),y=Math.sqrt(Math.abs(Math.pow(m,2)-Math.pow(g/2,2)));r.beginPath(),r.moveTo(n.x+y,n.y+g/2),r.lineTo(n.x+m+d,n.y+g/2),r.lineTo(n.x+m+d,n.y-g/2),r.lineTo(n.x+y,n.y-g/2),r.arc(n.x,n.y,m,v,-v),r.closePath(),r.fill()}else r.beginPath(),r.arc(n.x,n.y,n.size+c,0,Math.PI*2),r.closePath(),r.fill();r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=0,Yw(r,n,i)}var sD=` precision highp float; varying vec4 v_color; varying vec2 v_diffVector; varying float v_radius; uniform float u_correctionRatio; const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); void main(void) { float border = u_correctionRatio * 2.0; float dist = length(v_diffVector) - v_radius + border; // No antialiasing for picking mode: #ifdef PICKING_MODE if (dist > border) gl_FragColor = transparent; else gl_FragColor = v_color; #else float t = 0.0; if (dist > border) t = 1.0; else if (dist > 0.0) t = dist / border; gl_FragColor = mix(v_color, transparent, t); #endif } `,lD=sD,uD=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_position; attribute float a_size; attribute float a_angle; uniform mat3 u_matrix; uniform float u_sizeRatio; uniform float u_correctionRatio; varying vec4 v_color; varying vec2 v_diffVector; varying float v_radius; varying float v_border; const float bias = 255.0 / 254.0; void main() { float size = a_size * u_correctionRatio / u_sizeRatio * 4.0; vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle)); vec2 position = a_position + diffVector; gl_Position = vec4( (u_matrix * vec3(position, 1)).xy, 0, 1 ); v_diffVector = diffVector; v_radius = size / 2.0; #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,cD=uD,Xw=WebGLRenderingContext,Py=Xw.UNSIGNED_BYTE,ad=Xw.FLOAT,fD=["u_sizeRatio","u_correctionRatio","u_matrix"],us=function(r){function n(){return At(this,n),It(this,n,arguments)}return Yt(n,r),Rt(n,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:cD,FRAGMENT_SHADER_SOURCE:lD,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:fD,ATTRIBUTES:[{name:"a_position",size:2,type:ad},{name:"a_size",size:1,type:ad},{name:"a_color",size:4,type:Py,normalized:!0},{name:"a_id",size:4,type:Py,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:ad}],CONSTANT_DATA:[[n.ANGLE_1],[n.ANGLE_2],[n.ANGLE_3]]}}},{key:"processVisibleItem",value:function(a,s,l){var c=this.array,f=Xn(l.color);c[s++]=l.x,c[s++]=l.y,c[s++]=l.size,c[s++]=f,c[s++]=a}},{key:"setUniforms",value:function(a,s){var l=s.gl,c=s.uniformLocations,f=c.u_sizeRatio,d=c.u_correctionRatio,g=c.u_matrix;l.uniform1f(d,a.correctionRatio),l.uniform1f(f,a.sizeRatio),l.uniformMatrix3fv(g,!1,a.matrix)}}])}($h);fe(us,"ANGLE_1",0);fe(us,"ANGLE_2",2*Math.PI/3);fe(us,"ANGLE_3",4*Math.PI/3);var dD=` precision mediump float; varying vec4 v_color; void main(void) { gl_FragColor = v_color; } `,hD=dD,gD=` attribute vec2 a_position; attribute vec2 a_normal; attribute float a_radius; attribute vec3 a_barycentric; #ifdef PICKING_MODE attribute vec4 a_id; #else attribute vec4 a_color; #endif uniform mat3 u_matrix; uniform float u_sizeRatio; uniform float u_correctionRatio; uniform float u_minEdgeThickness; uniform float u_lengthToThicknessRatio; uniform float u_widenessToThicknessRatio; varying vec4 v_color; const float bias = 255.0 / 254.0; void main() { float minThickness = u_minEdgeThickness; float normalLength = length(a_normal); vec2 unitNormal = a_normal / normalLength; // These first computations are taken from edge.vert.glsl and // edge.clamped.vert.glsl. Please read it to get better comments on what's // happening: float pixelsThickness = max(normalLength / u_sizeRatio, minThickness); float webGLThickness = pixelsThickness * u_correctionRatio; float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio; float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio; float da = a_barycentric.x; float db = a_barycentric.y; float dc = a_barycentric.z; vec2 delta = vec2( da * (webGLNodeRadius * unitNormal.y) + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x) + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x), da * (-webGLNodeRadius * unitNormal.x) + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y) + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y) ); vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy; gl_Position = vec4(position, 0, 1); #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,pD=gD,Zw=WebGLRenderingContext,$y=Zw.UNSIGNED_BYTE,zl=Zw.FLOAT,mD=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],cs={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function ou(r){var n=_e(_e({},cs),r||{});return function(i){function a(){return At(this,a),It(this,a,arguments)}return Yt(a,i),Rt(a,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:pD,FRAGMENT_SHADER_SOURCE:hD,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:mD,ATTRIBUTES:[{name:"a_position",size:2,type:zl},{name:"a_normal",size:2,type:zl},{name:"a_radius",size:1,type:zl},{name:"a_color",size:4,type:$y,normalized:!0},{name:"a_id",size:4,type:$y,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:zl}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(l,c,f,d,g){if(n.extremity==="source"){var m=[d,f];f=m[0],d=m[1]}var v=g.size||1,y=d.size||1,b=f.x,x=f.y,E=d.x,T=d.y,M=Xn(g.color),N=E-b,L=T-x,C=N*N+L*L,R=0,B=0;C&&(C=1/Math.sqrt(C),R=-L*C*v,B=N*C*v);var _=this.array;_[c++]=E,_[c++]=T,_[c++]=-R,_[c++]=-B,_[c++]=y,_[c++]=M,_[c++]=l}},{key:"setUniforms",value:function(l,c){var f=c.gl,d=c.uniformLocations,g=d.u_matrix,m=d.u_sizeRatio,v=d.u_correctionRatio,y=d.u_minEdgeThickness,b=d.u_lengthToThicknessRatio,x=d.u_widenessToThicknessRatio;f.uniformMatrix3fv(g,!1,l.matrix),f.uniform1f(m,l.sizeRatio),f.uniform1f(v,l.correctionRatio),f.uniform1f(y,l.minEdgeThickness),f.uniform1f(b,n.lengthToThicknessRatio),f.uniform1f(x,n.widenessToThicknessRatio)}}])}(ls)}ou();var vD=` precision mediump float; varying vec4 v_color; varying vec2 v_normal; varying float v_thickness; varying float v_feather; const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); void main(void) { // We only handle antialiasing for normal mode: #ifdef PICKING_MODE gl_FragColor = v_color; #else float dist = length(v_normal) * v_thickness; float t = smoothstep( v_thickness - v_feather, v_thickness, dist ); gl_FragColor = mix(v_color, transparent, t); #endif } `,qh=vD,yD=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; attribute float a_normalCoef; attribute vec2 a_positionStart; attribute vec2 a_positionEnd; attribute float a_positionCoef; attribute float a_radius; attribute float a_radiusCoef; uniform mat3 u_matrix; uniform float u_zoomRatio; uniform float u_sizeRatio; uniform float u_pixelRatio; uniform float u_correctionRatio; uniform float u_minEdgeThickness; uniform float u_lengthToThicknessRatio; uniform float u_feather; varying vec4 v_color; varying vec2 v_normal; varying float v_thickness; varying float v_feather; const float bias = 255.0 / 254.0; void main() { float minThickness = u_minEdgeThickness; float radius = a_radius * a_radiusCoef; vec2 normal = a_normal * a_normalCoef; vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef; float normalLength = length(normal); vec2 unitNormal = normal / normalLength; // These first computations are taken from edge.vert.glsl. Please read it to // get better comments on what's happening: float pixelsThickness = max(normalLength, minThickness * u_sizeRatio); float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio; // Here, we move the point to leave space for the arrow head: float direction = sign(radius); float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio; float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength); // Here is the proper position of the vertex gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1); v_thickness = webGLThickness / u_zoomRatio; v_normal = unitNormal; v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0; #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,bD=yD,Ww=WebGLRenderingContext,qy=Ww.UNSIGNED_BYTE,Di=Ww.FLOAT,wD=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],ED={lengthToThicknessRatio:cs.lengthToThicknessRatio};function Kw(r){var n=_e(_e({},ED),{});return function(i){function a(){return At(this,a),It(this,a,arguments)}return Yt(a,i),Rt(a,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:bD,FRAGMENT_SHADER_SOURCE:qh,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:wD,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Di},{name:"a_positionEnd",size:2,type:Di},{name:"a_normal",size:2,type:Di},{name:"a_color",size:4,type:qy,normalized:!0},{name:"a_id",size:4,type:qy,normalized:!0},{name:"a_radius",size:1,type:Di}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Di},{name:"a_normalCoef",size:1,type:Di},{name:"a_radiusCoef",size:1,type:Di}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(l,c,f,d,g){var m=g.size||1,v=f.x,y=f.y,b=d.x,x=d.y,E=Xn(g.color),T=b-v,M=x-y,N=d.size||1,L=T*T+M*M,C=0,R=0;L&&(L=1/Math.sqrt(L),C=-M*L*m,R=T*L*m);var B=this.array;B[c++]=v,B[c++]=y,B[c++]=b,B[c++]=x,B[c++]=C,B[c++]=R,B[c++]=E,B[c++]=l,B[c++]=N}},{key:"setUniforms",value:function(l,c){var f=c.gl,d=c.uniformLocations,g=d.u_matrix,m=d.u_zoomRatio,v=d.u_feather,y=d.u_pixelRatio,b=d.u_correctionRatio,x=d.u_sizeRatio,E=d.u_minEdgeThickness,T=d.u_lengthToThicknessRatio;f.uniformMatrix3fv(g,!1,l.matrix),f.uniform1f(m,l.zoomRatio),f.uniform1f(x,l.sizeRatio),f.uniform1f(b,l.correctionRatio),f.uniform1f(y,l.pixelRatio),f.uniform1f(v,l.antiAliasingFeather),f.uniform1f(E,l.minEdgeThickness),f.uniform1f(T,n.lengthToThicknessRatio)}}])}(ls)}Kw();function SD(r){return Iw([Kw(),ou(r)])}var xD=SD(),Qw=xD,_D=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; attribute float a_normalCoef; attribute vec2 a_positionStart; attribute vec2 a_positionEnd; attribute float a_positionCoef; uniform mat3 u_matrix; uniform float u_sizeRatio; uniform float u_zoomRatio; uniform float u_pixelRatio; uniform float u_correctionRatio; uniform float u_minEdgeThickness; uniform float u_feather; varying vec4 v_color; varying vec2 v_normal; varying float v_thickness; varying float v_feather; const float bias = 255.0 / 254.0; void main() { float minThickness = u_minEdgeThickness; vec2 normal = a_normal * a_normalCoef; vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef; float normalLength = length(normal); vec2 unitNormal = normal / normalLength; // We require edges to be at least "minThickness" pixels thick *on screen* // (so we need to compensate the size ratio): float pixelsThickness = max(normalLength, minThickness * u_sizeRatio); // Then, we need to retrieve the normalized thickness of the edge in the WebGL // referential (in a ([0, 1], [0, 1]) space), using our "magic" correction // ratio: float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio; // Here is the proper position of the vertex gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1); // For the fragment shader though, we need a thickness that takes the "magic" // correction ratio into account (as in webGLThickness), but so that the // antialiasing effect does not depend on the zoom level. So here's yet // another thickness version: v_thickness = webGLThickness / u_zoomRatio; v_normal = unitNormal; v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0; #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,TD=_D,Jw=WebGLRenderingContext,Vy=Jw.UNSIGNED_BYTE,Vo=Jw.FLOAT,CD=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],AD=function(r){function n(){return At(this,n),It(this,n,arguments)}return Yt(n,r),Rt(n,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:TD,FRAGMENT_SHADER_SOURCE:qh,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:CD,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Vo},{name:"a_positionEnd",size:2,type:Vo},{name:"a_normal",size:2,type:Vo},{name:"a_color",size:4,type:Vy,normalized:!0},{name:"a_id",size:4,type:Vy,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Vo},{name:"a_normalCoef",size:1,type:Vo}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(a,s,l,c,f){var d=f.size||1,g=l.x,m=l.y,v=c.x,y=c.y,b=Xn(f.color),x=v-g,E=y-m,T=x*x+E*E,M=0,N=0;T&&(T=1/Math.sqrt(T),M=-E*T*d,N=x*T*d);var L=this.array;L[s++]=g,L[s++]=m,L[s++]=v,L[s++]=y,L[s++]=M,L[s++]=N,L[s++]=b,L[s++]=a}},{key:"setUniforms",value:function(a,s){var l=s.gl,c=s.uniformLocations,f=c.u_matrix,d=c.u_zoomRatio,g=c.u_feather,m=c.u_pixelRatio,v=c.u_correctionRatio,y=c.u_sizeRatio,b=c.u_minEdgeThickness;l.uniformMatrix3fv(f,!1,a.matrix),l.uniform1f(d,a.zoomRatio),l.uniform1f(y,a.sizeRatio),l.uniform1f(v,a.correctionRatio),l.uniform1f(m,a.pixelRatio),l.uniform1f(g,a.antiAliasingFeather),l.uniform1f(b,a.minEdgeThickness)}}])}(ls),Vh=function(r){function n(){var i;return At(this,n),i=It(this,n),i.rawEmitter=i,i}return Yt(n,r),Rt(n)}(xw.EventEmitter),od,Iy;function Zn(){return Iy||(Iy=1,od=function(n){return n!==null&&typeof n=="object"&&typeof n.addUndirectedEdgeWithKey=="function"&&typeof n.dropNode=="function"&&typeof n.multi=="boolean"}),od}var RD=Zn();const DD=on(RD);var OD=function(n){return n},kD=function(n){return n*n},LD=function(n){return n*(2-n)},ND=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},zD=function(n){return n*n*n},GD=function(n){return--n*n*n+1},MD=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},eE={linear:OD,quadraticIn:kD,quadraticOut:LD,quadraticInOut:ND,cubicIn:zD,cubicOut:GD,cubicInOut:MD},tE={easing:"quadraticInOut",duration:150};function jD(r,n,i,a){var s=Object.assign({},tE,i),l=typeof s.easing=="function"?s.easing:eE[s.easing],c=Date.now(),f={};for(var d in n){var g=n[d];f[d]={};for(var m in g)f[d][m]=r.getNodeAttribute(d,m)}var v=null,y=function(){v=null;var x=(Date.now()-c)/s.duration;if(x>=1){for(var E in n){var T=n[E];for(var M in T)r.setNodeAttribute(E,M,T[M])}return}x=l(x);for(var N in n){var L=n[N],C=f[N];for(var R in L)r.setNodeAttribute(N,R,L[R]*x+C[R]*(1-x))}v=requestAnimationFrame(y)};return y(),function(){v&&cancelAnimationFrame(v)}}function Dn(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function Gl(r,n,i){return r[0]=n,r[4]=typeof i=="number"?i:n,r}function Yy(r,n){var i=Math.sin(n),a=Math.cos(n);return r[0]=a,r[1]=i,r[3]=-i,r[4]=a,r}function Xy(r,n,i){return r[6]=n,r[7]=i,r}function Vr(r,n){var i=r[0],a=r[1],s=r[2],l=r[3],c=r[4],f=r[5],d=r[6],g=r[7],m=r[8],v=n[0],y=n[1],b=n[2],x=n[3],E=n[4],T=n[5],M=n[6],N=n[7],L=n[8];return r[0]=v*i+y*l+b*d,r[1]=v*a+y*c+b*g,r[2]=v*s+y*f+b*m,r[3]=x*i+E*l+T*d,r[4]=x*a+E*c+T*g,r[5]=x*s+E*f+T*m,r[6]=M*i+N*l+L*d,r[7]=M*a+N*c+L*g,r[8]=M*s+N*f+L*m,r}function rh(r,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,a=r[0],s=r[1],l=r[3],c=r[4],f=r[6],d=r[7],g=n.x,m=n.y;return{x:g*a+m*l+f*i,y:g*s+m*c+d*i}}function UD(r,n){var i=r.height/r.width,a=n.height/n.width;return i<1&&a>1||i>1&&a<1?1:Math.min(Math.max(a,1/a),Math.max(1/i,i))}function Io(r,n,i,a,s){var l=r.angle,c=r.ratio,f=r.x,d=r.y,g=n.width,m=n.height,v=Dn(),y=Math.min(g,m)-2*a,b=UD(n,i);return s?(Vr(v,Xy(Dn(),f,d)),Vr(v,Gl(Dn(),c)),Vr(v,Yy(Dn(),l)),Vr(v,Gl(Dn(),g/y/2/b,m/y/2/b))):(Vr(v,Gl(Dn(),2*(y/g)*b,2*(y/m)*b)),Vr(v,Yy(Dn(),-l)),Vr(v,Gl(Dn(),1/c)),Vr(v,Xy(Dn(),-f,-d))),v}function BD(r,n,i){var a=rh(r,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),s=a.x,l=a.y;return 1/Math.sqrt(Math.pow(s,2)+Math.pow(l,2))/i.width}function FD(r){if(!r.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,a=1/0,s=-1/0;return r.forEachNode(function(l,c){var f=c.x,d=c.y;fi&&(i=f),ds&&(s=d)}),{x:[n,i],y:[a,s]}}function HD(r){if(!DD(r))throw new Error("Sigma: invalid graph instance.");r.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function PD(r,n,i){var a=document.createElement(r);if(n)for(var s in n)a.style[s]=n[s];if(i)for(var l in i)a.setAttribute(l,i[l]);return a}function Zy(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function Wy(r,n,i){return i.sort(function(a,s){var l=n(a)||0,c=n(s)||0;return lc?1:0})}function Ky(r){var n=Na(r.x,2),i=n[0],a=n[1],s=Na(r.y,2),l=s[0],c=s[1],f=Math.max(a-i,c-l),d=(a+i)/2,g=(c+l)/2;(f===0||Math.abs(f)===1/0||isNaN(f))&&(f=1),isNaN(d)&&(d=0),isNaN(g)&&(g=0);var m=function(y){return{x:.5+(y.x-d)/f,y:.5+(y.y-g)/f}};return m.applyTo=function(v){v.x=.5+(v.x-d)/f,v.y=.5+(v.y-g)/f},m.inverse=function(v){return{x:d+f*(v.x-.5),y:g+f*(v.y-.5)}},m.ratio=f,m}function ih(r){"@babel/helpers - typeof";return ih=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ih(r)}function Qy(r,n){var i=n.size;if(i!==0){var a=r.length;r.length+=i;var s=0;n.forEach(function(l){r[a+s]=l,s++})}}function sd(r){r=r||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n1&&arguments[1]!==void 0?arguments[1]:{},c=arguments.length>2?arguments[2]:void 0;if(!c)return new Promise(function(b){return s.animate(a,l,b)});if(this.enabled){var f=_e(_e({},tE),l),d=this.validateState(a),g=typeof f.easing=="function"?f.easing:eE[f.easing],m=Date.now(),v=this.getState(),y=function(){var x=(Date.now()-m)/f.duration;if(x>=1){s.nextFrame=null,s.setState(d),s.animationCallback&&(s.animationCallback.call(null),s.animationCallback=void 0);return}var E=g(x),T={};typeof d.x=="number"&&(T.x=v.x+(d.x-v.x)*E),typeof d.y=="number"&&(T.y=v.y+(d.y-v.y)*E),s.enabledRotation&&typeof d.angle=="number"&&(T.angle=v.angle+(d.angle-v.angle)*E),typeof d.ratio=="number"&&(T.ratio=v.ratio+(d.ratio-v.ratio)*E),s.setState(T),s.nextFrame=requestAnimationFrame(y)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(y)):y(),this.animationCallback=c}}},{key:"animatedZoom",value:function(a){return a?typeof a=="number"?this.animate({ratio:this.ratio/a}):this.animate({ratio:this.ratio/(a.factor||Ml)},a):this.animate({ratio:this.ratio/Ml})}},{key:"animatedUnzoom",value:function(a){return a?typeof a=="number"?this.animate({ratio:this.ratio*a}):this.animate({ratio:this.ratio*(a.factor||Ml)},a):this.animate({ratio:this.ratio*Ml})}},{key:"animatedReset",value:function(a){return this.animate({x:.5,y:.5,ratio:1,angle:0},a)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(a){var s=new n;return s.setState(a)}}])}(Vh);function On(r,n){var i=n.getBoundingClientRect();return{x:r.clientX-i.left,y:r.clientY-i.top}}function mr(r,n){var i=_e(_e({},On(r,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:r});return i}function Yo(r){var n="x"in r?r:_e(_e({},r.touches[0]||r.previousTouches[0]),{},{original:r.original,sigmaDefaultPrevented:r.sigmaDefaultPrevented,preventSigmaDefault:function(){r.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function ID(r,n){return _e(_e({},mr(r,n)),{},{delta:nE(r)})}var YD=2;function Yl(r){for(var n=[],i=0,a=Math.min(r.length,YD);i0;s.draggedEvents=0,v&&s.renderer.getSetting("hideEdgesOnMove")&&s.renderer.refresh()},0),this.emit("mouseup",mr(a,this.container))}}},{key:"handleMove",value:function(a){var s=this;if(this.enabled){var l=mr(a,this.container);if(this.emit("mousemovebody",l),(a.target===this.container||a.composedPath()[0]===this.container)&&this.emit("mousemove",l),!l.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){s.movingTimeout=null,s.isMoving=!1},this.settings.dragTimeout);var c=this.renderer.getCamera(),f=On(a,this.container),d=f.x,g=f.y,m=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),v=this.renderer.viewportToFramedGraph({x:d,y:g}),y=m.x-v.x,b=m.y-v.y,x=c.getState(),E=x.x+y,T=x.y+b;c.setState({x:E,y:T}),this.lastMouseX=d,this.lastMouseY=g,a.preventDefault(),a.stopPropagation()}}}},{key:"handleLeave",value:function(a){this.emit("mouseleave",mr(a,this.container))}},{key:"handleEnter",value:function(a){this.emit("mouseenter",mr(a,this.container))}},{key:"handleWheel",value:function(a){var s=this,l=this.renderer.getCamera();if(!(!this.enabled||!l.enabledZooming)){var c=nE(a);if(c){var f=ID(a,this.container);if(this.emit("wheel",f),f.sigmaDefaultPrevented){a.preventDefault(),a.stopPropagation();return}var d=l.getState().ratio,g=c>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,m=l.getBoundedRatio(d*g),v=c>0?1:-1,y=Date.now();d!==m&&(a.preventDefault(),a.stopPropagation(),!(this.currentWheelDirection===v&&this.lastWheelTriggerTime&&y-this.lastWheelTriggerTimea.size?-1:i.sizea.key?1:-1}}])}(),nb=function(){function r(){At(this,r),fe(this,"width",0),fe(this,"height",0),fe(this,"cellSize",0),fe(this,"columns",0),fe(this,"rows",0),fe(this,"cells",{})}return Rt(r,[{key:"resizeAndClear",value:function(i,a){this.width=i.width,this.height=i.height,this.cellSize=a,this.columns=Math.ceil(i.width/a),this.rows=Math.ceil(i.height/a),this.cells={}}},{key:"getIndex",value:function(i){var a=Math.floor(i.x/this.cellSize),s=Math.floor(i.y/this.cellSize);return s*this.columns+a}},{key:"add",value:function(i,a,s){var l=new tb(i,a),c=this.getIndex(s),f=this.cells[c];f||(f=[],this.cells[c]=f),f.push(l)}},{key:"organize",value:function(){for(var i in this.cells){var a=this.cells[i];a.sort(tb.compare)}}},{key:"getLabelsToDisplay",value:function(i,a){var s=this.cellSize*this.cellSize,l=s/i/i,c=l*a/s,f=Math.ceil(c),d=[];for(var g in this.cells)for(var m=this.cells[g],v=0;v2&&arguments[2]!==void 0?arguments[2]:{};if(At(this,n),s=It(this,n),fe(s,"elements",{}),fe(s,"canvasContexts",{}),fe(s,"webGLContexts",{}),fe(s,"pickingLayers",new Set),fe(s,"textures",{}),fe(s,"frameBuffers",{}),fe(s,"activeListeners",{}),fe(s,"labelGrid",new nb),fe(s,"nodeDataCache",{}),fe(s,"edgeDataCache",{}),fe(s,"nodeProgramIndex",{}),fe(s,"edgeProgramIndex",{}),fe(s,"nodesWithForcedLabels",new Set),fe(s,"edgesWithForcedLabels",new Set),fe(s,"nodeExtent",{x:[0,1],y:[0,1]}),fe(s,"nodeZExtent",[1/0,-1/0]),fe(s,"edgeZExtent",[1/0,-1/0]),fe(s,"matrix",Dn()),fe(s,"invMatrix",Dn()),fe(s,"correctionRatio",1),fe(s,"customBBox",null),fe(s,"normalizationFunction",Ky({x:[0,1],y:[0,1]})),fe(s,"graphToViewportRatio",1),fe(s,"itemIDsIndex",{}),fe(s,"nodeIndices",{}),fe(s,"edgeIndices",{}),fe(s,"width",0),fe(s,"height",0),fe(s,"pixelRatio",Zy()),fe(s,"pickingDownSizingRatio",2*s.pixelRatio),fe(s,"displayedNodeLabels",new Set),fe(s,"displayedEdgeLabels",new Set),fe(s,"highlightedNodes",new Set),fe(s,"hoveredNode",null),fe(s,"hoveredEdge",null),fe(s,"renderFrame",null),fe(s,"renderHighlightedNodesFrame",null),fe(s,"needToProcess",!1),fe(s,"checkEdgesEventsFrame",null),fe(s,"nodePrograms",{}),fe(s,"nodeHoverPrograms",{}),fe(s,"edgePrograms",{}),s.settings=VD(l),ld(s.settings),HD(i),!(a instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");s.graph=i,s.container=a,s.createWebGLContext("edges",{picking:l.enableEdgeEvents}),s.createCanvasContext("edgeLabels"),s.createWebGLContext("nodes",{picking:!0}),s.createCanvasContext("labels"),s.createCanvasContext("hovers"),s.createWebGLContext("hoverNodes"),s.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),s.resize();for(var c in s.settings.nodeProgramClasses)s.registerNodeProgram(c,s.settings.nodeProgramClasses[c],s.settings.nodeHoverProgramClasses[c]);for(var f in s.settings.edgeProgramClasses)s.registerEdgeProgram(f,s.settings.edgeProgramClasses[f]);return s.camera=new Jy,s.bindCameraHandlers(),s.mouseCaptor=new WD(s.elements.mouse,s),s.mouseCaptor.setSettings(s.settings),s.touchCaptor=new JD(s.elements.mouse,s),s.touchCaptor.setSettings(s.settings),s.bindEventHandlers(),s.bindGraphHandlers(),s.handleSettingsUpdate(),s.refresh(),s}return Yt(n,r),Rt(n,[{key:"registerNodeProgram",value:function(a,s,l){return this.nodePrograms[a]&&this.nodePrograms[a].kill(),this.nodeHoverPrograms[a]&&this.nodeHoverPrograms[a].kill(),this.nodePrograms[a]=new s(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[a]=new(l||s)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(a,s){return this.edgePrograms[a]&&this.edgePrograms[a].kill(),this.edgePrograms[a]=new s(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(a){if(this.nodePrograms[a]){var s=this.nodePrograms,l=s[a],c=ud(s,[a].map(Qo));l.kill(),this.nodePrograms=c}if(this.nodeHoverPrograms[a]){var f=this.nodeHoverPrograms,d=f[a],g=ud(f,[a].map(Qo));d.kill(),this.nodePrograms=g}return this}},{key:"unregisterEdgeProgram",value:function(a){if(this.edgePrograms[a]){var s=this.edgePrograms,l=s[a],c=ud(s,[a].map(Qo));l.kill(),this.edgePrograms=c}return this}},{key:"resetWebGLTexture",value:function(a){var s=this.webGLContexts[a],l=this.frameBuffers[a],c=this.textures[a];c&&s.deleteTexture(c);var f=s.createTexture();return s.bindFramebuffer(s.FRAMEBUFFER,l),s.bindTexture(s.TEXTURE_2D,f),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,this.width,this.height,0,s.RGBA,s.UNSIGNED_BYTE,null),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,f,0),this.textures[a]=f,this}},{key:"bindCameraHandlers",value:function(){var a=this;return this.activeListeners.camera=function(){a.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(a){var s=a.x,l=a.y,c=jy(this.webGLContexts.nodes,this.frameBuffers.nodes,s,l,this.pixelRatio,this.pickingDownSizingRatio),f=My.apply(void 0,eb(c)),d=this.itemIDsIndex[f];return d&&d.type==="node"?d.id:null}},{key:"bindEventHandlers",value:function(){var a=this;this.activeListeners.handleResize=function(){a.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(l){var c=Yo(l),f={event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}},d=a.getNodeAtPosition(c);if(d&&a.hoveredNode!==d&&!a.nodeDataCache[d].hidden){a.hoveredNode&&a.emit("leaveNode",_e(_e({},f),{},{node:a.hoveredNode})),a.hoveredNode=d,a.emit("enterNode",_e(_e({},f),{},{node:d})),a.scheduleHighlightedNodesRender();return}if(a.hoveredNode&&a.getNodeAtPosition(c)!==a.hoveredNode){var g=a.hoveredNode;a.hoveredNode=null,a.emit("leaveNode",_e(_e({},f),{},{node:g})),a.scheduleHighlightedNodesRender();return}if(a.settings.enableEdgeEvents){var m=a.hoveredNode?null:a.getEdgeAtPoint(f.event.x,f.event.y);m!==a.hoveredEdge&&(a.hoveredEdge&&a.emit("leaveEdge",_e(_e({},f),{},{edge:a.hoveredEdge})),m&&a.emit("enterEdge",_e(_e({},f),{},{edge:m})),a.hoveredEdge=m)}},this.activeListeners.handleMoveBody=function(l){var c=Yo(l);a.emit("moveBody",{event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(l){var c=Yo(l),f={event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}};a.hoveredNode&&(a.emit("leaveNode",_e(_e({},f),{},{node:a.hoveredNode})),a.scheduleHighlightedNodesRender()),a.settings.enableEdgeEvents&&a.hoveredEdge&&(a.emit("leaveEdge",_e(_e({},f),{},{edge:a.hoveredEdge})),a.scheduleHighlightedNodesRender()),a.emit("leaveStage",_e({},f))},this.activeListeners.handleEnter=function(l){var c=Yo(l),f={event:c,preventSigmaDefault:function(){c.preventSigmaDefault()}};a.emit("enterStage",_e({},f))};var s=function(c){return function(f){var d=Yo(f),g={event:d,preventSigmaDefault:function(){d.preventSigmaDefault()}},m=a.getNodeAtPosition(d);if(m)return a.emit("".concat(c,"Node"),_e(_e({},g),{},{node:m}));if(a.settings.enableEdgeEvents){var v=a.getEdgeAtPoint(d.x,d.y);if(v)return a.emit("".concat(c,"Edge"),_e(_e({},g),{},{edge:v}))}return a.emit("".concat(c,"Stage"),g)}};return this.activeListeners.handleClick=s("click"),this.activeListeners.handleRightClick=s("rightClick"),this.activeListeners.handleDoubleClick=s("doubleClick"),this.activeListeners.handleWheel=s("wheel"),this.activeListeners.handleDown=s("down"),this.activeListeners.handleUp=s("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 a=this,s=this.graph,l=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(c){var f,d=(f=c.hints)===null||f===void 0?void 0:f.attributes;a.graph.forEachNode(function(m){return a.updateNode(m)});var g=!d||d.some(function(m){return l.has(m)});a.refresh({partialGraph:{nodes:s.nodes()},skipIndexation:!g,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(c){var f,d=(f=c.hints)===null||f===void 0?void 0:f.attributes;a.graph.forEachEdge(function(m){return a.updateEdge(m)});var g=d&&["zIndex","type"].some(function(m){return d==null?void 0:d.includes(m)});a.refresh({partialGraph:{edges:s.edges()},skipIndexation:!g,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(c){var f=c.key;a.addNode(f),a.refresh({partialGraph:{nodes:[f]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(c){var f=c.key;a.refresh({partialGraph:{nodes:[f]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(c){var f=c.key;a.removeNode(f),a.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(c){var f=c.key;a.addEdge(f),a.refresh({partialGraph:{edges:[f]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(c){var f=c.key;a.refresh({partialGraph:{edges:[f]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(c){var f=c.key;a.removeEdge(f),a.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){a.clearEdgeState(),a.clearEdgeIndices(),a.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){a.clearEdgeState(),a.clearNodeState(),a.clearEdgeIndices(),a.clearNodeIndices(),a.refresh({schedule:!0})},s.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),s.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),s.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),s.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),s.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),s.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),s.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),s.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),s.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),s.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var a=this.graph;a.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),a.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),a.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),a.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),a.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),a.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),a.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),a.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),a.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),a.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(a,s){var l=jy(this.webGLContexts.edges,this.frameBuffers.edges,a,s,this.pixelRatio,this.pickingDownSizingRatio),c=My.apply(void 0,eb(l)),f=this.itemIDsIndex[c];return f&&f.type==="edge"?f.id:null}},{key:"process",value:function(){var a=this;this.emit("beforeProcess");var s=this.graph,l=this.settings,c=this.getDimensions();if(this.nodeExtent=FD(this.graph),!this.settings.autoRescale){var f=c.width,d=c.height,g=this.nodeExtent,m=g.x,v=g.y;this.nodeExtent={x:[(m[0]+m[1])/2-f/2,(m[0]+m[1])/2+f/2],y:[(v[0]+v[1])/2-d/2,(v[0]+v[1])/2+d/2]}}this.normalizationFunction=Ky(this.customBBox||this.nodeExtent);var y=new Jy,b=Io(y.getState(),c,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(c,l.labelGridCellSize);for(var x={},E={},T={},M={},N=1,L=s.nodes(),C=0,R=L.length;C1&&arguments[1]!==void 0?arguments[1]:{},l=s.tolerance,c=l===void 0?0:l,f=s.boundaries,d=_e({},a),g=f||this.nodeExtent,m=Na(g.x,2),v=m[0],y=m[1],b=Na(g.y,2),x=b[0],E=b[1],T=[this.graphToViewport({x:v,y:x},{cameraState:a}),this.graphToViewport({x:y,y:x},{cameraState:a}),this.graphToViewport({x:v,y:E},{cameraState:a}),this.graphToViewport({x:y,y:E},{cameraState:a})],M=1/0,N=-1/0,L=1/0,C=-1/0;T.forEach(function(J){var ae=J.x,H=J.y;M=Math.min(M,ae),N=Math.max(N,ae),L=Math.min(L,H),C=Math.max(C,H)});var R=N-M,B=C-L,_=this.getDimensions(),$=_.width,z=_.height,F=0,Y=0;if(R>=$?N<$-c?F=N-($-c):M>c&&(F=M-c):N>$+c?F=N-($+c):M<-c&&(F=M+c),B>=z?Cc&&(Y=L-c):C>z+c?Y=C-(z+c):L<-c&&(Y=L+c),F||Y){var I=this.viewportToFramedGraph({x:0,y:0},{cameraState:a}),j=this.viewportToFramedGraph({x:F,y:Y},{cameraState:a});F=j.x-I.x,Y=j.y-I.y,d.x+=F,d.y+=Y}return d}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var a=this.camera.getState(),s=this.labelGrid.getLabelsToDisplay(a.ratio,this.settings.labelDensity);Qy(s,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var l=this.canvasContexts.labels,c=0,f=s.length;cthis.width+aO||y<-50||y>this.height+oO)){this.displayedNodeLabels.add(d);var x=this.settings.defaultDrawNodeLabel,E=this.nodePrograms[g.type],T=(E==null?void 0:E.drawLabel)||x;T(l,_e(_e({key:d},g),{},{size:b,x:v,y}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var a=this.canvasContexts.edgeLabels;a.clearRect(0,0,this.width,this.height);var s=iO({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});Qy(s,this.edgesWithForcedLabels);for(var l=new Set,c=0,f=s.length;cthis.nodeZExtent[1]&&(this.nodeZExtent[1]=l.zIndex))}},{key:"updateNode",value:function(a){this.addNode(a);var s=this.nodeDataCache[a];this.normalizationFunction.applyTo(s)}},{key:"removeNode",value:function(a){delete this.nodeDataCache[a],delete this.nodeProgramIndex[a],this.highlightedNodes.delete(a),this.hoveredNode===a&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(a)}},{key:"addEdge",value:function(a){var s=Object.assign({},this.graph.getEdgeAttributes(a));this.settings.edgeReducer&&(s=this.settings.edgeReducer(a,s));var l=lO(this.settings,a,s);this.edgeDataCache[a]=l,this.edgesWithForcedLabels.delete(a),l.forceLabel&&!l.hidden&&this.edgesWithForcedLabels.add(a),this.settings.zIndex&&(l.zIndexthis.edgeZExtent[1]&&(this.edgeZExtent[1]=l.zIndex))}},{key:"updateEdge",value:function(a){this.addEdge(a)}},{key:"removeEdge",value:function(a){delete this.edgeDataCache[a],delete this.edgeProgramIndex[a],this.hoveredEdge===a&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(a)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new nb,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(a,s,l){var c=this.nodeDataCache[a],f=this.nodePrograms[c.type];if(!f)throw new Error('Sigma: could not find a suitable program for node type "'.concat(c.type,'"!'));f.process(s,l,c),this.nodeProgramIndex[a]=l}},{key:"addEdgeToProgram",value:function(a,s,l){var c=this.edgeDataCache[a],f=this.edgePrograms[c.type];if(!f)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(c.type,'"!'));var d=this.graph.extremities(a),g=this.nodeDataCache[d[0]],m=this.nodeDataCache[d[1]];f.process(s,l,g,m,c),this.edgeProgramIndex[a]=l}},{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 a=this.settings,s=a.stagePadding,l=a.autoRescale;return l&&s||0}},{key:"createLayer",value:function(a,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[a])throw new Error('Sigma: a layer named "'.concat(a,'" already exists'));var c=PD(s,{position:"absolute"},{class:"sigma-".concat(a)});return l.style&&Object.assign(c.style,l.style),this.elements[a]=c,"beforeLayer"in l&&l.beforeLayer?this.elements[l.beforeLayer].before(c):"afterLayer"in l&&l.afterLayer?this.elements[l.afterLayer].after(c):this.container.appendChild(c),c}},{key:"createCanvas",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(a,"canvas",s)}},{key:"createCanvasContext",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=this.createCanvas(a,s),c={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[a]=l.getContext("2d",c),this}},{key:"createWebGLContext",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=(s==null?void 0:s.canvas)||this.createCanvas(a,s);s.hidden&&l.remove();var c=_e({preserveDrawingBuffer:!1,antialias:!1},s),f;f=l.getContext("webgl2",c),f||(f=l.getContext("webgl",c)),f||(f=l.getContext("experimental-webgl",c));var d=f;if(this.webGLContexts[a]=d,d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA),s.picking){this.pickingLayers.add(a);var g=d.createFramebuffer();if(!g)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(a));this.frameBuffers[a]=g}return d}},{key:"killLayer",value:function(a){var s=this.elements[a];if(!s)throw new Error("Sigma: cannot kill layer ".concat(a,", which does not exist"));if(this.webGLContexts[a]){var l,c=this.webGLContexts[a];(l=c.getExtension("WEBGL_lose_context"))===null||l===void 0||l.loseContext(),delete this.webGLContexts[a]}else this.canvasContexts[a]&&delete this.canvasContexts[a];return s.remove(),delete this.elements[a],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(a){this.unbindCameraHandlers(),this.camera=a,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(a){a!==this.graph&&(this.hoveredNode&&!a.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!a.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=a,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 a=this.customBBox||this.nodeExtent;return{width:a.x[1]-a.x[0]||1,height:a.y[1]-a.y[0]||1}}},{key:"getNodeDisplayData",value:function(a){var s=this.nodeDataCache[a];return s?Object.assign({},s):void 0}},{key:"getEdgeDisplayData",value:function(a){var s=this.edgeDataCache[a];return s?Object.assign({},s):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 _e({},this.settings)}},{key:"getSetting",value:function(a){return this.settings[a]}},{key:"setSetting",value:function(a,s){var l=_e({},this.settings);return this.settings[a]=s,ld(this.settings),this.handleSettingsUpdate(l),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(a,s){return this.setSetting(a,s(this.settings[a])),this}},{key:"setSettings",value:function(a){var s=_e({},this.settings);return this.settings=_e(_e({},this.settings),a),ld(this.settings),this.handleSettingsUpdate(s),this.scheduleRefresh(),this}},{key:"resize",value:function(a){var s=this.width,l=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=Zy(),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(!a&&s===this.width&&l===this.height)return this;for(var c in this.elements){var f=this.elements[c];f.style.width=this.width+"px",f.style.height=this.height+"px"}for(var d in this.canvasContexts)this.elements[d].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[d].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[d].scale(this.pixelRatio,this.pixelRatio);for(var g in this.webGLContexts){this.elements[g].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[g].setAttribute("height",this.height*this.pixelRatio+"px");var m=this.webGLContexts[g];if(m.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(g)){var v=this.textures[g];v&&m.deleteTexture(v)}}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(a){var s=this,l=(a==null?void 0:a.skipIndexation)!==void 0?a==null?void 0:a.skipIndexation:!1,c=(a==null?void 0:a.schedule)!==void 0?a.schedule:!1,f=!a||!a.partialGraph;if(f)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(C){return s.addNode(C)}),this.graph.forEachEdge(function(C){return s.addEdge(C)});else{for(var d,g,m=((d=a.partialGraph)===null||d===void 0?void 0:d.nodes)||[],v=0,y=(m==null?void 0:m.length)||0;v1&&arguments[1]!==void 0?arguments[1]:{},l=!!s.cameraState||!!s.viewportDimensions||!!s.graphDimensions,c=s.matrix?s.matrix:l?Io(s.cameraState||this.camera.getState(),s.viewportDimensions||this.getDimensions(),s.graphDimensions||this.getGraphDimensions(),s.padding||this.getStagePadding()):this.matrix,f=rh(c,a);return{x:(1+f.x)*this.width/2,y:(1-f.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=!!s.cameraState||!!s.viewportDimensions||!s.graphDimensions,c=s.matrix?s.matrix:l?Io(s.cameraState||this.camera.getState(),s.viewportDimensions||this.getDimensions(),s.graphDimensions||this.getGraphDimensions(),s.padding||this.getStagePadding(),!0):this.invMatrix,f=rh(c,{x:a.x/this.width*2-1,y:1-a.y/this.height*2});return isNaN(f.x)&&(f.x=0),isNaN(f.y)&&(f.y=0),f}},{key:"viewportToGraph",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(a,s))}},{key:"graphToViewport",value:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(a),s)}},{key:"getGraphToViewportRatio",value:function(){var a={x:0,y:0},s={x:1,y:1},l=Math.sqrt(Math.pow(a.x-s.x,2)+Math.pow(a.y-s.y,2)),c=this.graphToViewport(a),f=this.graphToViewport(s),d=Math.sqrt(Math.pow(c.x-f.x,2)+Math.pow(c.y-f.y,2));return d/l}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(a){return this.customBBox=a,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 a=this.container;a.firstChild;)a.removeChild(a.firstChild);this.canvasContexts={},this.webGLContexts={},this.elements={};for(var s in this.nodePrograms)this.nodePrograms[s].kill();for(var l in this.nodeHoverPrograms)this.nodeHoverPrograms[l].kill();for(var c in this.edgePrograms)this.edgePrograms[c].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var f in this.elements)this.killLayer(f)}},{key:"scaleSize",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return a/this.settings.zoomToSizeRatioFunction(s)*(this.getSetting("itemSizesReference")==="positions"?s*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var a={};for(var s in this.elements)this.elements[s]instanceof HTMLCanvasElement&&(a[s]=this.elements[s]);return a}}])}(Vh);const iE=S.createContext(null),cO=iE.Provider;function Yh(){const r=S.useContext(iE);if(r==null)throw new Error("No context provided: useSigmaContext() can only be used in a descendant of ");return r}function Sn(){return Yh().sigma}function aE(){const{sigma:r}=Yh();return S.useCallback(n=>{r&&Object.keys(n).forEach(i=>{r.setSetting(i,n[i])})},[r])}function xu(r){return new Set(Object.keys(r))}const rb=xu({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}),ib=xu({click:!0,rightClick:!0,doubleClick:!0,mouseup:!0,mousedown:!0,mousemove:!0,mousemovebody:!0,mouseleave:!0,mouseenter:!0,wheel:!0}),ab=xu({touchup:!0,touchdown:!0,touchmove:!0,touchmovebody:!0,tap:!0,doubletap:!0}),ob=xu({updated:!0});function oE(){const r=Sn(),n=aE(),[i,a]=S.useState({});return S.useEffect(()=>{if(!r||!i)return;const s=i,l=Object.keys(s);return l.forEach(c=>{const f=s[c];rb.has(c)&&r.on(c,f),ib.has(c)&&r.getMouseCaptor().on(c,f),ab.has(c)&&r.getTouchCaptor().on(c,f),ob.has(c)&&r.getCamera().on(c,f)}),()=>{r&&l.forEach(c=>{const f=s[c];rb.has(c)&&r.off(c,f),ib.has(c)&&r.getMouseCaptor().off(c,f),ab.has(c)&&r.getTouchCaptor().off(c,f),ob.has(c)&&r.getCamera().off(c,f)})}},[r,i,n]),a}function fO(){const r=Sn();return S.useCallback((n,i=!0)=>{r&&n&&(i&&r.getGraph().order>0&&r.getGraph().clear(),r.getGraph().import(n),r.refresh())},[r])}function fs(r,n){if(r===n)return!0;if(typeof r=="object"&&r!=null&&typeof n=="object"&&n!=null){if(Object.keys(r).length!=Object.keys(n).length)return!1;for(const i in r)if(!Object.hasOwn(n,i)||!fs(r[i],n[i]))return!1;return!0}return!1}function sE(r){const n=Sn(),[i,a]=S.useState(r||{});S.useEffect(()=>{a(g=>fs(g,r||{})?g:r||{})},[r]);const s=S.useCallback(g=>{n.getCamera().animatedZoom(Object.assign(Object.assign({},i),g))},[n,i]),l=S.useCallback(g=>{n.getCamera().animatedUnzoom(Object.assign(Object.assign({},i),g))},[n,i]),c=S.useCallback(g=>{n.getCamera().animatedReset(Object.assign(Object.assign({},i),g))},[n,i]),f=S.useCallback((g,m)=>{n.getCamera().animate(g,Object.assign(Object.assign({},i),m))},[n,i]),d=S.useCallback((g,m)=>{const v=n.getNodeDisplayData(g);v?n.getCamera().animate(v,Object.assign(Object.assign({},i),m)):console.warn(`Node ${g} not found`)},[n,i]);return{zoomIn:s,zoomOut:l,reset:c,goto:f,gotoNode:d}}function dO(r){const n=Yh(),[i,a]=S.useState(!1),[s,l]=S.useState(n.container),c=S.useCallback(()=>a(f=>!f),[]);return S.useEffect(()=>(document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)),[c]),S.useEffect(()=>{l(n.container)},[r,n.container]),{toggle:S.useCallback(()=>{var f;f=s,document.fullscreenElement!==f?f.requestFullscreen():document.exitFullscreen&&document.exitFullscreen()},[s]),isFullScreen:i}}const hO=S.forwardRef(({graph:r,id:n,className:i,style:a,settings:s={},children:l},c)=>{const f=S.useRef(null),d=S.useRef(null),g={className:`react-sigma ${i||""}`,id:n,style:a},[m,v]=S.useState(null),[y,b]=S.useState(s);S.useEffect(()=>{b(T=>fs(T,s)?T:s)},[s]),S.useEffect(()=>{v(T=>{let M=null;if(d.current!==null){let N=new Ke;r&&(N=typeof r=="function"?new r:r);let L=null;T&&(L=T.getCamera().getState(),T.kill()),M=new uO(N,d.current,y),L&&M.getCamera().setState(L)}return M})},[d,r,y]),S.useImperativeHandle(c,()=>m,[m]);const x=S.useMemo(()=>m&&f.current?{sigma:m,container:f.current}:null,[m,f]),E=x!==null?bt.createElement(cO,{value:x},l):null;return bt.createElement("div",Object.assign({},g,{ref:f}),bt.createElement("div",{className:"sigma-container",ref:d}),E)});var gO=` precision mediump float; varying vec4 v_color; varying float v_border; const float radius = 0.5; const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); void main(void) { vec2 m = gl_PointCoord - vec2(0.5, 0.5); float dist = radius - length(m); // No antialiasing for picking mode: #ifdef PICKING_MODE if (dist > v_border) gl_FragColor = v_color; else gl_FragColor = transparent; #else float t = 0.0; if (dist > v_border) t = 1.0; else if (dist > 0.0) t = dist / v_border; gl_FragColor = mix(transparent, v_color, t); #endif } `,pO=gO,mO=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_position; attribute float a_size; uniform float u_sizeRatio; uniform float u_pixelRatio; uniform mat3 u_matrix; varying vec4 v_color; varying float v_border; const float bias = 255.0 / 254.0; void main() { gl_Position = vec4( (u_matrix * vec3(a_position, 1)).xy, 0, 1 ); // Multiply the point size twice: // - x SCALING_RATIO to correct the canvas scaling // - x 2 to correct the formulae gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0; v_border = (0.5 / a_size) * u_sizeRatio; #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,vO=mO,lE=WebGLRenderingContext,sb=lE.UNSIGNED_BYTE,lb=lE.FLOAT,yO=["u_sizeRatio","u_pixelRatio","u_matrix"],bO=function(r){function n(){return At(this,n),It(this,n,arguments)}return Yt(n,r),Rt(n,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:vO,FRAGMENT_SHADER_SOURCE:pO,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:yO,ATTRIBUTES:[{name:"a_position",size:2,type:lb},{name:"a_size",size:1,type:lb},{name:"a_color",size:4,type:sb,normalized:!0},{name:"a_id",size:4,type:sb,normalized:!0}]}}},{key:"processVisibleItem",value:function(a,s,l){var c=this.array;c[s++]=l.x,c[s++]=l.y,c[s++]=l.size,c[s++]=Xn(l.color),c[s++]=a}},{key:"setUniforms",value:function(a,s){var l=a.sizeRatio,c=a.pixelRatio,f=a.matrix,d=s.gl,g=s.uniformLocations,m=g.u_sizeRatio,v=g.u_pixelRatio,y=g.u_matrix;d.uniform1f(v,c),d.uniform1f(m,l),d.uniformMatrix3fv(y,!1,f)}}])}($h),wO=` attribute vec4 a_id; attribute vec4 a_color; attribute vec2 a_normal; attribute float a_normalCoef; attribute vec2 a_positionStart; attribute vec2 a_positionEnd; attribute float a_positionCoef; attribute float a_sourceRadius; attribute float a_targetRadius; attribute float a_sourceRadiusCoef; attribute float a_targetRadiusCoef; uniform mat3 u_matrix; uniform float u_zoomRatio; uniform float u_sizeRatio; uniform float u_pixelRatio; uniform float u_correctionRatio; uniform float u_minEdgeThickness; uniform float u_lengthToThicknessRatio; uniform float u_feather; varying vec4 v_color; varying vec2 v_normal; varying float v_thickness; varying float v_feather; const float bias = 255.0 / 254.0; void main() { float minThickness = u_minEdgeThickness; vec2 normal = a_normal * a_normalCoef; vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef; float normalLength = length(normal); vec2 unitNormal = normal / normalLength; // These first computations are taken from edge.vert.glsl. Please read it to // get better comments on what's happening: float pixelsThickness = max(normalLength, minThickness * u_sizeRatio); float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio; // Here, we move the point to leave space for the arrow heads: // Source arrow head float sourceRadius = a_sourceRadius * a_sourceRadiusCoef; float sourceDirection = sign(sourceRadius); float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio; float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; vec2 sourceCompensationVector = vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x) * (webGLSourceRadius + webGLSourceArrowHeadLength); // Target arrow head float targetRadius = a_targetRadius * a_targetRadiusCoef; float targetDirection = sign(targetRadius); float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio; float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; vec2 targetCompensationVector = vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x) * (webGLTargetRadius + webGLTargetArrowHeadLength); // Here is the proper position of the vertex gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1); v_thickness = webGLThickness / u_zoomRatio; v_normal = unitNormal; v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0; #ifdef PICKING_MODE // For picking mode, we use the ID as the color: v_color = a_id; #else // For normal mode, we use the color: v_color = a_color; #endif v_color.a *= bias; } `,EO=wO,uE=WebGLRenderingContext,ub=uE.UNSIGNED_BYTE,gr=uE.FLOAT,SO=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],xO={lengthToThicknessRatio:cs.lengthToThicknessRatio};function cE(r){var n=_e(_e({},xO),{});return function(i){function a(){return At(this,a),It(this,a,arguments)}return Yt(a,i),Rt(a,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:EO,FRAGMENT_SHADER_SOURCE:qh,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:SO,ATTRIBUTES:[{name:"a_positionStart",size:2,type:gr},{name:"a_positionEnd",size:2,type:gr},{name:"a_normal",size:2,type:gr},{name:"a_color",size:4,type:ub,normalized:!0},{name:"a_id",size:4,type:ub,normalized:!0},{name:"a_sourceRadius",size:1,type:gr},{name:"a_targetRadius",size:1,type:gr}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:gr},{name:"a_normalCoef",size:1,type:gr},{name:"a_sourceRadiusCoef",size:1,type:gr},{name:"a_targetRadiusCoef",size:1,type:gr}],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(l,c,f,d,g){var m=g.size||1,v=f.x,y=f.y,b=d.x,x=d.y,E=Xn(g.color),T=b-v,M=x-y,N=f.size||1,L=d.size||1,C=T*T+M*M,R=0,B=0;C&&(C=1/Math.sqrt(C),R=-M*C*m,B=T*C*m);var _=this.array;_[c++]=v,_[c++]=y,_[c++]=b,_[c++]=x,_[c++]=R,_[c++]=B,_[c++]=E,_[c++]=l,_[c++]=N,_[c++]=L}},{key:"setUniforms",value:function(l,c){var f=c.gl,d=c.uniformLocations,g=d.u_matrix,m=d.u_zoomRatio,v=d.u_feather,y=d.u_pixelRatio,b=d.u_correctionRatio,x=d.u_sizeRatio,E=d.u_minEdgeThickness,T=d.u_lengthToThicknessRatio;f.uniformMatrix3fv(g,!1,l.matrix),f.uniform1f(m,l.zoomRatio),f.uniform1f(x,l.sizeRatio),f.uniform1f(b,l.correctionRatio),f.uniform1f(y,l.pixelRatio),f.uniform1f(v,l.antiAliasingFeather),f.uniform1f(E,l.minEdgeThickness),f.uniform1f(T,n.lengthToThicknessRatio)}}])}(ls)}cE();function _O(r){return Iw([cE(),ou(r),ou(_e(_e({},r),{},{extremity:"source"}))])}_O();function TO(r){if(Array.isArray(r))return r}function CO(r,n){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var a,s,l,c,f=[],d=!0,g=!1;try{if(l=(i=i.call(r)).next,n!==0)for(;!(d=(a=l.call(i)).done)&&(f.push(a.value),f.length!==n);d=!0);}catch(m){g=!0,s=m}finally{try{if(!d&&i.return!=null&&(c=i.return(),Object(c)!==c))return}finally{if(g)throw s}}return f}}function ah(r,n){(n==null||n>r.length)&&(n=r.length);for(var i=0,a=Array(n);i v_radius) gl_FragColor = transparent; else { gl_FragColor = v_color; gl_FragColor.a *= bias; } #else // Sizes: `).concat(n.flatMap(function(s,l){var c=s.size;if("fill"in c)return[];c=c;var f="attribute"in c?"v_borderSize_".concat(l+1):Fy(c.value),d=(c.mode||BO)==="pixels"?"u_correctionRatio":"v_radius";return[" float borderSize_".concat(l+1," = ").concat(d," * ").concat(f,";")]}).join(` `),` // Now, let's split the remaining space between "fill" borders: float fillBorderSize = (v_radius - (`).concat(n.flatMap(function(s,l){var c=s.size;return"fill"in c?[]:["borderSize_".concat(l+1)]}).join(" + "),") ) / ").concat(i,`; `).concat(n.flatMap(function(s,l){var c=s.size;return"fill"in c?[" float borderSize_".concat(l+1," = fillBorderSize;")]:[]}).join(` `),` // Finally, normalize all border sizes, to start from the full size and to end with the smallest: float adjustedBorderSize_0 = v_radius; `).concat(n.map(function(s,l){return" float adjustedBorderSize_".concat(l+1," = adjustedBorderSize_").concat(l," - borderSize_").concat(l+1,";")}).join(` `),` // Colors: vec4 borderColor_0 = transparent; `).concat(n.map(function(s,l){var c=s.color,f=[];return"attribute"in c?f.push(" vec4 borderColor_".concat(l+1," = v_borderColor_").concat(l+1,";")):"transparent"in c?f.push(" vec4 borderColor_".concat(l+1," = vec4(0.0, 0.0, 0.0, 0.0);")):f.push(" vec4 borderColor_".concat(l+1," = u_borderColor_").concat(l+1,";")),f.push(" borderColor_".concat(l+1,".a *= bias;")),f.push(" if (borderSize_".concat(l+1," <= 1.0 * u_correctionRatio) { borderColor_").concat(l+1," = borderColor_").concat(l,"; }")),f.join(` `)}).join(` `),` if (dist > adjustedBorderSize_0) { gl_FragColor = borderColor_0; } else `).concat(n.map(function(s,l){return"if (dist > adjustedBorderSize_".concat(l,` - aaBorder) { gl_FragColor = mix(borderColor_`).concat(l+1,", borderColor_").concat(l,", (dist - adjustedBorderSize_").concat(l,` + aaBorder) / aaBorder); } else if (dist > adjustedBorderSize_`).concat(l+1,`) { gl_FragColor = borderColor_`).concat(l+1,`; } else `)}).join(""),` { /* Nothing to add here */ } #endif } `);return a}function $O(r){var n=r.borders,i=` attribute vec2 a_position; attribute float a_size; attribute float a_angle; uniform mat3 u_matrix; uniform float u_sizeRatio; uniform float u_correctionRatio; varying vec2 v_diffVector; varying float v_radius; #ifdef PICKING_MODE attribute vec4 a_id; varying vec4 v_color; #else `.concat(n.flatMap(function(a,s){var l=a.size;return"attribute"in l?["attribute float a_borderSize_".concat(s+1,";"),"varying float v_borderSize_".concat(s+1,";")]:[]}).join(` `),` `).concat(n.flatMap(function(a,s){var l=a.color;return"attribute"in l?["attribute vec4 a_borderColor_".concat(s+1,";"),"varying vec4 v_borderColor_".concat(s+1,";")]:[]}).join(` `),` #endif const float bias = 255.0 / 254.0; const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); void main() { float size = a_size * u_correctionRatio / u_sizeRatio * 4.0; vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle)); vec2 position = a_position + diffVector; gl_Position = vec4( (u_matrix * vec3(position, 1)).xy, 0, 1 ); v_radius = size / 2.0; v_diffVector = diffVector; #ifdef PICKING_MODE v_color = a_id; #else `).concat(n.flatMap(function(a,s){var l=a.size;return"attribute"in l?[" v_borderSize_".concat(s+1," = a_borderSize_").concat(s+1,";")]:[]}).join(` `),` `).concat(n.flatMap(function(a,s){var l=a.color;return"attribute"in l?[" v_borderColor_".concat(s+1," = a_borderColor_").concat(s+1,";")]:[]}).join(` `),` #endif } `);return i}var gE=WebGLRenderingContext,db=gE.UNSIGNED_BYTE,jl=gE.FLOAT;function qO(r){var n,i=fb(fb({},FO),{}),a=i.borders,s=i.drawLabel,l=i.drawHover,c=["u_sizeRatio","u_correctionRatio","u_matrix"].concat(cd(a.flatMap(function(f,d){var g=f.color;return"value"in g?["u_borderColor_".concat(d+1)]:[]})));return n=function(f){GO(d,f);function d(){var g;DO(this,d);for(var m=arguments.length,v=new Array(m),y=0;yr.length)&&(n=r.length);for(var i=0,a=Array(n);iV){var Q="…";for(E=E+Q,k=l.measureText(E).width;k>V&&E.length>1;)E=E.slice(0,-2)+Q,k=l.measureText(E).width;if(E.length<4)return}for(var re={},de=0,ge=E.length;de{const i=this.nodeIdMap[n];if(i!==void 0)return this.nodes[i]});hr(this,"getEdge",(n,i=!0)=>{const a=i?this.edgeDynamicIdMap[n]:this.edgeIdMap[n];if(a!==void 0)return this.edges[a]});hr(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let n=0;n({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,rawGraph:null,sigmaGraph:null,setSelectedNode:(n,i)=>r({selectedNode:n,moveToSelectedNode:i}),setFocusedNode:n=>r({focusedNode:n}),setSelectedEdge:n=>r({selectedEdge:n}),setFocusedEdge:n=>r({focusedEdge:n}),clearSelection:()=>r({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>r({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,moveToSelectedNode:!1}),setRawGraph:n=>r({rawGraph:n}),setSigmaGraph:n=>r({sigmaGraph:n}),setMoveToSelectedNode:n=>r({moveToSelectedNode:n})})),Ye=Eh(fk),dk=({node:r,move:n})=>{const i=Sn(),{gotoNode:a}=sE();return S.useEffect(()=>{if(r)return i.getGraph().setNodeAttribute(r,"highlighted",!0),n&&(a(r),Ye.getState().setMoveToSelectedNode(!1)),()=>{i.getGraph().setNodeAttribute(r,"highlighted",!1)}},[r,n,i,a]),null};function Pa(r,n){const i=Sn(),a=S.useRef(n);return fs(a.current,n)||(a.current=n),{positions:S.useCallback(()=>a.current?r(i.getGraph(),a.current):{},[i,a,r]),assign:S.useCallback(()=>{a.current&&r.assign(i.getGraph(),a.current)},[i,a,r])}}function Zh(r,n){const i=Sn(),[a,s]=S.useState(!1),[l,c]=S.useState(null),f=S.useRef(n);return fs(f.current,n)||(f.current=n),S.useEffect(()=>{s(!1);let d=null;return f.current&&(d=new r(i.getGraph(),f.current)),c(d),()=>{d!==null&&d.kill()}},[i,f,c,s,r]),{stop:S.useCallback(()=>{l&&(l.stop(),s(!1))},[l,s]),start:S.useCallback(()=>{l&&(l.start(),s(!0))},[l,s]),kill:S.useCallback(()=>{l&&l.kill(),s(!1)},[l,s]),isRunning:a}}var dd,pb;function ds(){if(pb)return dd;pb=1;function r(i){return!i||typeof i!="object"||typeof i=="function"||Array.isArray(i)||i instanceof Set||i instanceof Map||i instanceof RegExp||i instanceof Date}function n(i,a){i=i||{};var s={};for(var l in a){var c=i[l],f=a[l];if(!r(f)){s[l]=n(c,f);continue}c===void 0?s[l]=f:s[l]=c}return s}return dd=n,dd}var hd,mb;function hk(){if(mb)return hd;mb=1;function r(i){return function(a,s){return a+Math.floor(i()*(s-a+1))}}var n=r(Math.random);return n.createRandom=r,hd=n,hd}var gd,vb;function gk(){if(vb)return gd;vb=1;var r=hk().createRandom;function n(a){var s=r(a);return function(l){for(var c=l.length,f=c-1,d=-1;++d0},s.prototype.addChild=function(_,$){this.children[_]=$,++this.countChildren},s.prototype.getChild=function(_){if(!this.children.hasOwnProperty(_)){var $=new s;this.children[_]=$,++this.countChildren}return this.children[_]},s.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var _=this;for(var $ in _.children){var z=_.children[$];z.x+=_.x,z.y+=_.y,z.applyPositionToChildren()}}};function l(_,$,z){for(var F in $.children){var Y=$.children[F];Y.hasChildren()?l(_,Y,z):z[Y.id]={x:Y.x,y:Y.y}}}function c(_,$){var z=_.r-$.r,F=$.x-_.x,Y=$.y-_.y;return z<0||z*z0&&z*z>F*F+Y*Y}function d(_,$){for(var z=0;z<$.length;++z)if(!f(_,$[z]))return!1;return!0}function g(_){return new s(null,_.x,_.y,_.r)}function m(_,$){var z=_.x,F=_.y,Y=_.r,I=$.x,j=$.y,J=$.r,ae=I-z,H=j-F,U=J-Y,D=Math.sqrt(ae*ae+H*H);return new s(null,(z+I+ae/D*U)/2,(F+j+H/D*U)/2,(D+Y+J)/2)}function v(_,$,z){var F=_.x,Y=_.y,I=_.r,j=$.x,J=$.y,ae=$.r,H=z.x,U=z.y,D=z.r,se=F-j,G=F-H,P=Y-J,k=Y-U,V=ae-I,Q=D-I,re=F*F+Y*Y-I*I,de=re-j*j-J*J+ae*ae,ge=re-H*H-U*U+D*D,le=G*P-se*k,xe=(P*ge-k*de)/(le*2)-F,pe=(k*V-P*Q)/le,Ae=(G*de-se*ge)/(le*2)-Y,Te=(se*Q-G*V)/le,Le=pe*pe+Te*Te-1,ve=2*(I+xe*pe+Ae*Te),he=xe*xe+Ae*Ae-I*I,K=-(Le?(ve+Math.sqrt(ve*ve-4*Le*he))/(2*Le):he/ve);return new s(null,F+xe+pe*K,Y+Ae+Te*K,K)}function y(_){switch(_.length){case 1:return g(_[0]);case 2:return m(_[0],_[1]);case 3:return v(_[0],_[1],_[2]);default:throw new Error("graphology-layout/circlepack: Invalid basis length "+_.length)}}function b(_,$){var z,F;if(d($,_))return[$];for(z=0;z<_.length;++z)if(c($,_[z])&&d(m(_[z],$),_))return[_[z],$];for(z=0;z<_.length-1;++z)for(F=z+1;F<_.length;++F)if(c(m(_[z],_[F]),$)&&c(m(_[z],$),_[F])&&c(m(_[F],$),_[z])&&d(v(_[z],_[F],$),_))return[_[z],_[F],$];throw new Error("graphology-layout/circlepack: extendBasis failure !")}function x(_){var $=_.wrappedCircle,z=_.next.wrappedCircle,F=$.r+z.r,Y=($.x*z.r+z.x*$.r)/F,I=($.y*z.r+z.y*$.r)/F;return Y*Y+I*I}function E(_,$){var z=0,F=_.slice(),Y=_.length,I=[],j,J;for($(F);zae?(Y=(H+ae-I)/(2*H),J=Math.sqrt(Math.max(0,ae/H-Y*Y)),z.x=_.x-Y*F-J*j,z.y=_.y-Y*j+J*F):(Y=(H+I-ae)/(2*H),J=Math.sqrt(Math.max(0,I/H-Y*Y)),z.x=$.x+Y*F-J*j,z.y=$.y+Y*j+J*F)):(z.x=$.x+z.r,z.y=$.y)}function M(_,$){var z=_.r+$.r-1e-6,F=$.x-_.x,Y=$.y-_.y;return z>0&&z*z>F*F+Y*Y}function N(_,$){var z=_.length;if(z===0)return 0;var F,Y,I,j,J,ae,H,U,D,se;if(F=_[0],F.x=0,F.y=0,z<=1)return F.r;if(Y=_[1],F.x=-Y.r,Y.x=F.r,Y.y=0,z<=2)return F.r+Y.r;I=_[2],T(Y,F,I),F=new s(null,null,null,null,F),Y=new s(null,null,null,null,Y),I=new s(null,null,null,null,I),F.next=I.previous=Y,Y.next=F.previous=I,I.next=Y.previous=F;e:for(ae=3;ae"u"?s:g};typeof s=="function"&&(c=s);var f=function(g){return c(g[a])},d=function(){return c(void 0)};return typeof a=="string"?(l.fromAttributes=f,l.fromGraph=function(g,m){return f(g.getNodeAttributes(m))},l.fromEntry=function(g,m){return f(m)}):typeof a=="function"?(l.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},l.fromGraph=function(g,m){return c(a(m,g.getNodeAttributes(m)))},l.fromEntry=function(g,m){return c(a(g,m))}):(l.fromAttributes=d,l.fromGraph=d,l.fromEntry=d),l}function i(a,s){var l={},c=function(g){return typeof g>"u"?s:g};typeof s=="function"&&(c=s);var f=function(g){return c(g[a])},d=function(){return c(void 0)};return typeof a=="string"?(l.fromAttributes=f,l.fromGraph=function(g,m){return f(g.getEdgeAttributes(m))},l.fromEntry=function(g,m){return f(m)},l.fromPartialEntry=l.fromEntry,l.fromMinimalEntry=l.fromEntry):typeof a=="function"?(l.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},l.fromGraph=function(g,m){var v=g.extremities(m);return c(a(m,g.getEdgeAttributes(m),v[0],v[1],g.getNodeAttributes(v[0]),g.getNodeAttributes(v[1]),g.isUndirected(m)))},l.fromEntry=function(g,m,v,y,b,x,E){return c(a(g,m,v,y,b,x,E))},l.fromPartialEntry=function(g,m,v,y){return c(a(g,m,v,y))},l.fromMinimalEntry=function(g,m){return c(a(g,m))}):(l.fromAttributes=d,l.fromGraph=d,l.fromEntry=d,l.fromMinimalEntry=d),l}return Zo.createNodeValueGetter=n,Zo.createEdgeValueGetter=i,Zo.createEdgeWeightGetter=function(a){return i(a,r)},Zo}var vd,Eb;function SE(){if(Eb)return vd;Eb=1;const{createNodeValueGetter:r,createEdgeValueGetter:n}=Wh();return vd=function(a,s,l){const{nodeXAttribute:c,nodeYAttribute:f}=l,{attraction:d,repulsion:g,gravity:m,inertia:v,maxMove:y}=l.settings;let{shouldSkipNode:b,shouldSkipEdge:x,isNodeFixed:E}=l;E=r(E),b=r(b,!1),x=n(x,!1);const T=a.filterNodes((L,C)=>!b.fromEntry(L,C)),M=T.length;for(let L=0;L{if(R===B||b.fromEntry(R,_)||b.fromEntry(B,$)||x.fromEntry(L,C,R,B,_,$,z))return;const F=s[R],Y=s[B],I=Y.x-F.x,j=Y.y-F.y,J=Math.sqrt(I*I+j*j)||1,ae=d*J*I,H=d*J*j;F.dx+=ae,F.dy+=H,Y.dx-=ae,Y.dy-=H}),m)for(let L=0;Ly&&(R.dx*=y/B,R.dy*=y/B),E.fromGraph(a,C)?R.fixed=!0:(R.x+=R.dx,R.y+=R.dy,R.fixed=!1)}return{converged:N}},vd}var Ul={},Sb;function xE(){return Sb||(Sb=1,Ul.assignLayoutChanges=function(r,n,i){const{nodeXAttribute:a,nodeYAttribute:s}=i;r.updateEachNodeAttributes((l,c)=>{const f=n[l];return!f||f.fixed||(c[a]=f.x,c[s]=f.y),c},{attributes:["x","y"]})},Ul.collectLayoutChanges=function(r){const n={};for(const i in r){const a=r[i];n[i]={x:a.x,y:a.y}}return n}),Ul}var yd,xb;function _E(){return xb||(xb=1,yd={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),yd}var bd,_b;function xk(){if(_b)return bd;_b=1;const r=Zn(),n=ds(),i=SE(),a=xE(),s=_E();function l(f,d,g){if(!r(d))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof g=="number"?g={maxIterations:g}:g=g||{};const m=g.maxIterations;if(g=n(g,s),typeof m!="number"||m<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const v={};let y=null,b;for(b=0;bthis.runFrame())},l.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},l.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},l.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},wd=l,wd}var Ak=Ck();const Rk=on(Ak);function Dk(r={maxIterations:100}){return Pa(Tk,r)}function Ok(r={}){return Zh(Rk,r)}var Ed,Cb;function kk(){if(Cb)return Ed;Cb=1;var r=0,n=1,i=2,a=3,s=4,l=5,c=6,f=7,d=8,g=9,m=0,v=1,y=2,b=0,x=1,E=2,T=3,M=4,N=5,L=6,C=7,R=8,B=3,_=10,$=3,z=9,F=10;return Ed=function(I,j,J){var ae,H,U,D,se,G,P,k,V,Q,re=j.length,de=J.length,ge=I.adjustSizes,le=I.barnesHutTheta*I.barnesHutTheta,xe,pe,Ae,Te,Le,ve,he,K=[];for(U=0;UEt?(be-=(Ie-Et)/2,Se=be+Ie):(Re-=(Et-Ie)/2,Ve=Re+Et),K[0+b]=-1,K[0+x]=(Re+Ve)/2,K[0+E]=(be+Se)/2,K[0+T]=Math.max(Ve-Re,Se-be),K[0+M]=-1,K[0+N]=-1,K[0+L]=0,K[0+C]=0,K[0+R]=0,ae=1,U=0;U=0){j[U+r]=0)if(ve=Math.pow(j[U+r]-K[H+C],2)+Math.pow(j[U+n]-K[H+R],2),Q=K[H+T],4*Q*Q/ve0?(he=pe*j[U+c]*K[H+L]/ve,j[U+i]+=Ae*he,j[U+a]+=Te*he):ve<0&&(he=-pe*j[U+c]*K[H+L]/Math.sqrt(ve),j[U+i]+=Ae*he,j[U+a]+=Te*he):ve>0&&(he=pe*j[U+c]*K[H+L]/ve,j[U+i]+=Ae*he,j[U+a]+=Te*he),H=K[H+M],H<0)break;continue}else{H=K[H+N];continue}else{if(G=K[H+b],G>=0&&G!==U&&(Ae=j[U+r]-j[G+r],Te=j[U+n]-j[G+n],ve=Ae*Ae+Te*Te,ge===!0?ve>0?(he=pe*j[U+c]*j[G+c]/ve,j[U+i]+=Ae*he,j[U+a]+=Te*he):ve<0&&(he=-pe*j[U+c]*j[G+c]/Math.sqrt(ve),j[U+i]+=Ae*he,j[U+a]+=Te*he):ve>0&&(he=pe*j[U+c]*j[G+c]/ve,j[U+i]+=Ae*he,j[U+a]+=Te*he)),H=K[H+M],H<0)break;continue}else for(pe=I.scalingRatio,D=0;D0?(he=pe*j[D+c]*j[se+c]/ve/ve,j[D+i]+=Ae*he,j[D+a]+=Te*he,j[se+i]-=Ae*he,j[se+a]-=Te*he):ve<0&&(he=100*pe*j[D+c]*j[se+c],j[D+i]+=Ae*he,j[D+a]+=Te*he,j[se+i]-=Ae*he,j[se+a]-=Te*he)):(ve=Math.sqrt(Ae*Ae+Te*Te),ve>0&&(he=pe*j[D+c]*j[se+c]/ve/ve,j[D+i]+=Ae*he,j[D+a]+=Te*he,j[se+i]-=Ae*he,j[se+a]-=Te*he));for(V=I.gravity/I.scalingRatio,pe=I.scalingRatio,U=0;U0&&(he=pe*j[U+c]*V):ve>0&&(he=pe*j[U+c]*V/ve),j[U+i]-=Ae*he,j[U+a]-=Te*he;for(pe=1*(I.outboundAttractionDistribution?xe:1),P=0;P0&&(he=-pe*Le*Math.log(1+ve)/ve/j[D+c]):ve>0&&(he=-pe*Le*Math.log(1+ve)/ve):I.outboundAttractionDistribution?ve>0&&(he=-pe*Le/j[D+c]):ve>0&&(he=-pe*Le)):(ve=Math.sqrt(Math.pow(Ae,2)+Math.pow(Te,2)),I.linLogMode?I.outboundAttractionDistribution?ve>0&&(he=-pe*Le*Math.log(1+ve)/ve/j[D+c]):ve>0&&(he=-pe*Le*Math.log(1+ve)/ve):I.outboundAttractionDistribution?(ve=1,he=-pe*Le/j[D+c]):(ve=1,he=-pe*Le)),ve>0&&(j[D+i]+=Ae*he,j[D+a]+=Te*he,j[se+i]-=Ae*he,j[se+a]-=Te*he);var rt,ct,Gt,Ht,sn,xn;if(ge===!0)for(U=0;UF&&(j[U+i]=j[U+i]*F/rt,j[U+a]=j[U+a]*F/rt),ct=j[U+c]*Math.sqrt((j[U+s]-j[U+i])*(j[U+s]-j[U+i])+(j[U+l]-j[U+a])*(j[U+l]-j[U+a])),Gt=Math.sqrt((j[U+s]+j[U+i])*(j[U+s]+j[U+i])+(j[U+l]+j[U+a])*(j[U+l]+j[U+a]))/2,Ht=.1*Math.log(1+Gt)/(1+Math.sqrt(ct)),sn=j[U+r]+j[U+i]*(Ht/I.slowDown),j[U+r]=sn,xn=j[U+n]+j[U+a]*(Ht/I.slowDown),j[U+n]=xn);else for(U=0;U=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in i&&typeof i.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in i&&!(typeof i.gravity=="number"&&i.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in i&&!(typeof i.slowDown=="number"||i.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in i&&typeof i.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in i&&!(typeof i.barnesHutTheta=="number"&&i.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},pr.graphToByteArrays=function(i,a){var s=i.order,l=i.size,c={},f,d=new Float32Array(s*r),g=new Float32Array(l*n);return f=0,i.forEachNode(function(m,v){c[m]=f,d[f]=v.x,d[f+1]=v.y,d[f+2]=0,d[f+3]=0,d[f+4]=0,d[f+5]=0,d[f+6]=1,d[f+7]=1,d[f+8]=v.size||1,d[f+9]=v.fixed?1:0,f+=r}),f=0,i.forEachEdge(function(m,v,y,b,x,E,T){var M=c[y],N=c[b],L=a(m,v,y,b,x,E,T);d[M+6]+=L,d[N+6]+=L,g[f]=M,g[f+1]=N,g[f+2]=L,f+=n}),{nodes:d,edges:g}},pr.assignLayoutChanges=function(i,a,s){var l=0;i.updateEachNodeAttributes(function(c,f){return f.x=a[l],f.y=a[l+1],l+=r,s?s(c,f):f})},pr.readGraphPositions=function(i,a){var s=0;i.forEachNode(function(l,c){a[s]=c.x,a[s+1]=c.y,s+=r})},pr.collectLayoutChanges=function(i,a,s){for(var l=i.nodes(),c={},f=0,d=0,g=a.length;f2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(g)}}var f=l.bind(null,!1);return f.assign=l.bind(null,!0),f.inferSettings=c,xd=f,xd}var Nk=Lk();const zk=on(Nk);var _d,Ob;function Gk(){return Ob||(Ob=1,_d=function(){var n,i,a={};(function(){var l=0,c=1,f=2,d=3,g=4,m=5,v=6,y=7,b=8,x=9,E=0,T=1,M=2,N=0,L=1,C=2,R=3,B=4,_=5,$=6,z=7,F=8,Y=3,I=10,j=3,J=9,ae=10;a.exports=function(U,D,se){var G,P,k,V,Q,re,de,ge,le,xe,pe=D.length,Ae=se.length,Te=U.adjustSizes,Le=U.barnesHutTheta*U.barnesHutTheta,ve,he,K,Re,Ve,be,Se,ne=[];for(k=0;ksn?(Ie-=(Ht-sn)/2,Et=Ie+Ht):(et-=(sn-Ht)/2,ut=et+sn),ne[0+N]=-1,ne[0+L]=(et+ut)/2,ne[0+C]=(Ie+Et)/2,ne[0+R]=Math.max(ut-et,Et-Ie),ne[0+B]=-1,ne[0+_]=-1,ne[0+$]=0,ne[0+z]=0,ne[0+F]=0,G=1,k=0;k=0){D[k+l]=0)if(be=Math.pow(D[k+l]-ne[P+z],2)+Math.pow(D[k+c]-ne[P+F],2),xe=ne[P+R],4*xe*xe/be0?(Se=he*D[k+v]*ne[P+$]/be,D[k+f]+=K*Se,D[k+d]+=Re*Se):be<0&&(Se=-he*D[k+v]*ne[P+$]/Math.sqrt(be),D[k+f]+=K*Se,D[k+d]+=Re*Se):be>0&&(Se=he*D[k+v]*ne[P+$]/be,D[k+f]+=K*Se,D[k+d]+=Re*Se),P=ne[P+B],P<0)break;continue}else{P=ne[P+_];continue}else{if(re=ne[P+N],re>=0&&re!==k&&(K=D[k+l]-D[re+l],Re=D[k+c]-D[re+c],be=K*K+Re*Re,Te===!0?be>0?(Se=he*D[k+v]*D[re+v]/be,D[k+f]+=K*Se,D[k+d]+=Re*Se):be<0&&(Se=-he*D[k+v]*D[re+v]/Math.sqrt(be),D[k+f]+=K*Se,D[k+d]+=Re*Se):be>0&&(Se=he*D[k+v]*D[re+v]/be,D[k+f]+=K*Se,D[k+d]+=Re*Se)),P=ne[P+B],P<0)break;continue}else for(he=U.scalingRatio,V=0;V0?(Se=he*D[V+v]*D[Q+v]/be/be,D[V+f]+=K*Se,D[V+d]+=Re*Se,D[Q+f]-=K*Se,D[Q+d]-=Re*Se):be<0&&(Se=100*he*D[V+v]*D[Q+v],D[V+f]+=K*Se,D[V+d]+=Re*Se,D[Q+f]-=K*Se,D[Q+d]-=Re*Se)):(be=Math.sqrt(K*K+Re*Re),be>0&&(Se=he*D[V+v]*D[Q+v]/be/be,D[V+f]+=K*Se,D[V+d]+=Re*Se,D[Q+f]-=K*Se,D[Q+d]-=Re*Se));for(le=U.gravity/U.scalingRatio,he=U.scalingRatio,k=0;k0&&(Se=he*D[k+v]*le):be>0&&(Se=he*D[k+v]*le/be),D[k+f]-=K*Se,D[k+d]-=Re*Se;for(he=1*(U.outboundAttractionDistribution?ve:1),de=0;de0&&(Se=-he*Ve*Math.log(1+be)/be/D[V+v]):be>0&&(Se=-he*Ve*Math.log(1+be)/be):U.outboundAttractionDistribution?be>0&&(Se=-he*Ve/D[V+v]):be>0&&(Se=-he*Ve)):(be=Math.sqrt(Math.pow(K,2)+Math.pow(Re,2)),U.linLogMode?U.outboundAttractionDistribution?be>0&&(Se=-he*Ve*Math.log(1+be)/be/D[V+v]):be>0&&(Se=-he*Ve*Math.log(1+be)/be):U.outboundAttractionDistribution?(be=1,Se=-he*Ve/D[V+v]):(be=1,Se=-he*Ve)),be>0&&(D[V+f]+=K*Se,D[V+d]+=Re*Se,D[Q+f]-=K*Se,D[Q+d]-=Re*Se);var xn,ii,Mn,ft,ji,Zt;if(Te===!0)for(k=0;kae&&(D[k+f]=D[k+f]*ae/xn,D[k+d]=D[k+d]*ae/xn),ii=D[k+v]*Math.sqrt((D[k+g]-D[k+f])*(D[k+g]-D[k+f])+(D[k+m]-D[k+d])*(D[k+m]-D[k+d])),Mn=Math.sqrt((D[k+g]+D[k+f])*(D[k+g]+D[k+f])+(D[k+m]+D[k+d])*(D[k+m]+D[k+d]))/2,ft=.1*Math.log(1+Mn)/(1+Math.sqrt(ii)),ji=D[k+l]+D[k+f]*(ft/U.slowDown),D[k+l]=ji,Zt=D[k+c]+D[k+d]*(ft/U.slowDown),D[k+c]=Zt);else for(k=0;k1&&Ae.has(Se))&&(D>1&&Ae.add(Se),he=d[Le+r],Re=d[Le+n],be=d[Le+i],ne=he-ve,et=Re-K,ut=Math.sqrt(ne*ne+et*et),Ie=ut0?(_[Le]+=ne/ut*(1+Ve),$[Le]+=et/ut*(1+Ve)):(_[Le]+=j*l(),$[Le]+=J*l())));for(x=0,E=0;x1&&he.has(Ie))&&(k>1&&he.add(Ie),be=y[Re+s],ne=y[Re+l],ut=y[Re+c],Et=be-Ve,rt=ne-Se,ct=Math.sqrt(Et*Et+rt*rt),Gt=ct0?(Y[Re]+=Et/ct*(1+et),I[Re]+=rt/ct*(1+et)):(Y[Re]+=U*g(),I[Re]+=D*g())));for(N=0,L=0;NA.jsx(Je.span,{...r,ref:n,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",...r.style}}));OE.displayName=eL;var tL=OE,[_u,Rz]=rs("Tooltip",[vu]),Tu=vu(),kE="TooltipProvider",nL=700,ch="tooltip.open",[rL,Kh]=_u(kE),LE=r=>{const{__scopeTooltip:n,delayDuration:i=nL,skipDelayDuration:a=300,disableHoverableContent:s=!1,children:l}=r,[c,f]=S.useState(!0),d=S.useRef(!1),g=S.useRef(0);return S.useEffect(()=>{const m=g.current;return()=>window.clearTimeout(m)},[]),A.jsx(rL,{scope:n,isOpenDelayed:c,delayDuration:i,onOpen:S.useCallback(()=>{window.clearTimeout(g.current),f(!1)},[]),onClose:S.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>f(!0),a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:S.useCallback(m=>{d.current=m},[]),disableHoverableContent:s,children:l})};LE.displayName=kE;var Cu="Tooltip",[iL,Au]=_u(Cu),NE=r=>{const{__scopeTooltip:n,children:i,open:a,defaultOpen:s=!1,onOpenChange:l,disableHoverableContent:c,delayDuration:f}=r,d=Kh(Cu,r.__scopeTooltip),g=Tu(n),[m,v]=S.useState(null),y=Ln(),b=S.useRef(0),x=c??d.disableHoverableContent,E=f??d.delayDuration,T=S.useRef(!1),[M=!1,N]=yu({prop:a,defaultProp:s,onChange:_=>{_?(d.onOpen(),document.dispatchEvent(new CustomEvent(ch))):d.onClose(),l==null||l(_)}}),L=S.useMemo(()=>M?T.current?"delayed-open":"instant-open":"closed",[M]),C=S.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T.current=!1,N(!0)},[N]),R=S.useCallback(()=>{window.clearTimeout(b.current),b.current=0,N(!1)},[N]),B=S.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{T.current=!0,N(!0),b.current=0},E)},[E,N]);return S.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),A.jsx(ew,{...g,children:A.jsx(iL,{scope:n,contentId:y,open:M,stateAttribute:L,trigger:m,onTriggerChange:v,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayed?B():C()},[d.isOpenDelayed,B,C]),onTriggerLeave:S.useCallback(()=>{x?R():(window.clearTimeout(b.current),b.current=0)},[R,x]),onOpen:C,onClose:R,disableHoverableContent:x,children:i})})};NE.displayName=Cu;var fh="TooltipTrigger",zE=S.forwardRef((r,n)=>{const{__scopeTooltip:i,...a}=r,s=Au(fh,i),l=Kh(fh,i),c=Tu(i),f=S.useRef(null),d=Vt(n,f,s.onTriggerChange),g=S.useRef(!1),m=S.useRef(!1),v=S.useCallback(()=>g.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),A.jsx(zh,{asChild:!0,...c,children:A.jsx(Je.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...a,ref:d,onPointerMove:ht(r.onPointerMove,y=>{y.pointerType!=="touch"&&!m.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:ht(r.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:ht(r.onPointerDown,()=>{g.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:ht(r.onFocus,()=>{g.current||s.onOpen()}),onBlur:ht(r.onBlur,s.onClose),onClick:ht(r.onClick,s.onClose)})})});zE.displayName=fh;var aL="TooltipPortal",[Dz,oL]=_u(aL,{forceMount:void 0}),za="TooltipContent",GE=S.forwardRef((r,n)=>{const i=oL(za,r.__scopeTooltip),{forceMount:a=i.forceMount,side:s="top",...l}=r,c=Au(za,r.__scopeTooltip);return A.jsx(ni,{present:a||c.open,children:c.disableHoverableContent?A.jsx(ME,{side:s,...l,ref:n}):A.jsx(sL,{side:s,...l,ref:n})})}),sL=S.forwardRef((r,n)=>{const i=Au(za,r.__scopeTooltip),a=Kh(za,r.__scopeTooltip),s=S.useRef(null),l=Vt(n,s),[c,f]=S.useState(null),{trigger:d,onClose:g}=i,m=s.current,{onPointerInTransitChange:v}=a,y=S.useCallback(()=>{f(null),v(!1)},[v]),b=S.useCallback((x,E)=>{const T=x.currentTarget,M={x:x.clientX,y:x.clientY},N=fL(M,T.getBoundingClientRect()),L=dL(M,N),C=hL(E.getBoundingClientRect()),R=pL([...L,...C]);f(R),v(!0)},[v]);return S.useEffect(()=>()=>y(),[y]),S.useEffect(()=>{if(d&&m){const x=T=>b(T,m),E=T=>b(T,d);return d.addEventListener("pointerleave",x),m.addEventListener("pointerleave",E),()=>{d.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",E)}}},[d,m,b,y]),S.useEffect(()=>{if(c){const x=E=>{const T=E.target,M={x:E.clientX,y:E.clientY},N=(d==null?void 0:d.contains(T))||(m==null?void 0:m.contains(T)),L=!gL(M,c);N?y():L&&(y(),g())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,m,c,g,y]),A.jsx(ME,{...r,ref:l})}),[lL,uL]=_u(Cu,{isInside:!1}),ME=S.forwardRef((r,n)=>{const{__scopeTooltip:i,children:a,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:c,...f}=r,d=Au(za,i),g=Tu(i),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(ch,m),()=>document.removeEventListener(ch,m)),[m]),S.useEffect(()=>{if(d.trigger){const v=y=>{const b=y.target;b!=null&&b.contains(d.trigger)&&m()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[d.trigger,m]),A.jsx(hu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:v=>v.preventDefault(),onDismiss:m,children:A.jsxs(tw,{"data-state":d.stateAttribute,...g,...f,ref:n,style:{...f.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:[A.jsx(R0,{children:a}),A.jsx(lL,{scope:i,isInside:!0,children:A.jsx(tL,{id:d.contentId,role:"tooltip",children:s||a})})]})})});GE.displayName=za;var jE="TooltipArrow",cL=S.forwardRef((r,n)=>{const{__scopeTooltip:i,...a}=r,s=Tu(i);return uL(jE,i).isInside?null:A.jsx(nw,{...s,...a,ref:n})});cL.displayName=jE;function fL(r,n){const i=Math.abs(n.top-r.y),a=Math.abs(n.bottom-r.y),s=Math.abs(n.right-r.x),l=Math.abs(n.left-r.x);switch(Math.min(i,a,s,l)){case l:return"left";case s:return"right";case i:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function dL(r,n,i=5){const a=[];switch(n){case"top":a.push({x:r.x-i,y:r.y+i},{x:r.x+i,y:r.y+i});break;case"bottom":a.push({x:r.x-i,y:r.y-i},{x:r.x+i,y:r.y-i});break;case"left":a.push({x:r.x+i,y:r.y-i},{x:r.x+i,y:r.y+i});break;case"right":a.push({x:r.x-i,y:r.y-i},{x:r.x-i,y:r.y+i});break}return a}function hL(r){const{top:n,right:i,bottom:a,left:s}=r;return[{x:s,y:n},{x:i,y:n},{x:i,y:a},{x:s,y:a}]}function gL(r,n){const{x:i,y:a}=r;let s=!1;for(let l=0,c=n.length-1;la!=m>a&&i<(g-f)*(a-d)/(m-d)+f&&(s=!s)}return s}function pL(r){const n=r.slice();return n.sort((i,a)=>i.xa.x?1:i.ya.y?1:0),mL(n)}function mL(r){if(r.length<=1)return r.slice();const n=[];for(let a=0;a=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(s.y-c.y)>=(l.y-c.y)*(s.x-c.x))n.pop();else break}n.push(s)}n.pop();const i=[];for(let a=r.length-1;a>=0;a--){const s=r[a];for(;i.length>=2;){const l=i[i.length-1],c=i[i.length-2];if((l.x-c.x)*(s.y-c.y)>=(l.y-c.y)*(s.x-c.x))i.pop();else break}i.push(s)}return i.pop(),n.length===1&&i.length===1&&n[0].x===i[0].x&&n[0].y===i[0].y?n:n.concat(i)}var vL=LE,yL=NE,bL=zE,UE=GE;const BE=vL,FE=yL,HE=bL,Qh=S.forwardRef(({className:r,sideOffset:n=4,...i},a)=>A.jsx(UE,{ref:a,sideOffset:n,className:Xe("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 overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md",r),...i}));Qh.displayName=UE.displayName;const Bb=w0("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"}}),an=S.forwardRef(({className:r,variant:n,tooltip:i,size:a,side:s="right",asChild:l=!1,...c},f)=>{const d=l?is:"button";return i?A.jsx(BE,{children:A.jsxs(FE,{children:[A.jsx(HE,{asChild:!0,children:A.jsx(d,{className:Xe(Bb({variant:n,size:a,className:r}),"cursor-pointer"),ref:f,...c})}),A.jsx(Qh,{side:s,children:i})]})}):A.jsx(d,{className:Xe(Bb({variant:n,size:a,className:r}),"cursor-pointer"),ref:f,...c})});an.displayName="Button";var Fb=1,wL=.9,EL=.8,SL=.17,Ld=.1,Nd=.999,xL=.9999,_L=.99,TL=/[\\\/_+.#"@\[\(\{&]/,CL=/[\\\/_+.#"@\[\(\{&]/g,AL=/[\s-]/,PE=/[\s-]/g;function dh(r,n,i,a,s,l,c){if(l===n.length)return s===r.length?Fb:_L;var f=`${s},${l}`;if(c[f]!==void 0)return c[f];for(var d=a.charAt(l),g=i.indexOf(d,s),m=0,v,y,b,x;g>=0;)v=dh(r,n,i,a,g+1,l+1,c),v>m&&(g===s?v*=Fb:TL.test(r.charAt(g-1))?(v*=EL,b=r.slice(s,g-1).match(CL),b&&s>0&&(v*=Math.pow(Nd,b.length))):AL.test(r.charAt(g-1))?(v*=wL,x=r.slice(s,g-1).match(PE),x&&s>0&&(v*=Math.pow(Nd,x.length))):(v*=SL,s>0&&(v*=Math.pow(Nd,g-s))),r.charAt(g)!==n.charAt(l)&&(v*=xL)),(vv&&(v=y*Ld)),v>m&&(m=v),g=i.indexOf(d,g+1);return c[f]=m,m}function Hb(r){return r.toLowerCase().replace(PE," ")}function RL(r,n,i){return r=i&&i.length>0?`${r+" "+i.join(" ")}`:r,dh(r,n,Hb(r),Hb(n),0,0,{})}var Jh="Dialog",[$E,Oz]=rs(Jh),[DL,Gn]=$E(Jh),qE=r=>{const{__scopeDialog:n,children:i,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=r,f=S.useRef(null),d=S.useRef(null),[g=!1,m]=yu({prop:a,defaultProp:s,onChange:l});return A.jsx(DL,{scope:n,triggerRef:f,contentRef:d,contentId:Ln(),titleId:Ln(),descriptionId:Ln(),open:g,onOpenChange:m,onOpenToggle:S.useCallback(()=>m(v=>!v),[m]),modal:c,children:i})};qE.displayName=Jh;var VE="DialogTrigger",OL=S.forwardRef((r,n)=>{const{__scopeDialog:i,...a}=r,s=Gn(VE,i),l=Vt(n,s.triggerRef);return A.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":ng(s.open),...a,ref:l,onClick:ht(r.onClick,s.onOpenToggle)})});OL.displayName=VE;var eg="DialogPortal",[kL,IE]=$E(eg,{forceMount:void 0}),YE=r=>{const{__scopeDialog:n,forceMount:i,children:a,container:s}=r,l=Gn(eg,n);return A.jsx(kL,{scope:n,forceMount:i,children:S.Children.map(a,c=>A.jsx(ni,{present:i||l.open,children:A.jsx(Gh,{asChild:!0,container:s,children:c})}))})};YE.displayName=eg;var cu="DialogOverlay",XE=S.forwardRef((r,n)=>{const i=IE(cu,r.__scopeDialog),{forceMount:a=i.forceMount,...s}=r,l=Gn(cu,r.__scopeDialog);return l.modal?A.jsx(ni,{present:a||l.open,children:A.jsx(LL,{...s,ref:n})}):null});XE.displayName=cu;var LL=S.forwardRef((r,n)=>{const{__scopeDialog:i,...a}=r,s=Gn(cu,i);return A.jsx(Mh,{as:is,allowPinchZoom:!0,shards:[s.contentRef],children:A.jsx(Je.div,{"data-state":ng(s.open),...a,ref:n,style:{pointerEvents:"auto",...a.style}})})}),zi="DialogContent",ZE=S.forwardRef((r,n)=>{const i=IE(zi,r.__scopeDialog),{forceMount:a=i.forceMount,...s}=r,l=Gn(zi,r.__scopeDialog);return A.jsx(ni,{present:a||l.open,children:l.modal?A.jsx(NL,{...s,ref:n}):A.jsx(zL,{...s,ref:n})})});ZE.displayName=zi;var NL=S.forwardRef((r,n)=>{const i=Gn(zi,r.__scopeDialog),a=S.useRef(null),s=Vt(n,i.contentRef,a);return S.useEffect(()=>{const l=a.current;if(l)return iw(l)},[]),A.jsx(WE,{...r,ref:s,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ht(r.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=i.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ht(r.onPointerDownOutside,l=>{const c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&l.preventDefault()}),onFocusOutside:ht(r.onFocusOutside,l=>l.preventDefault())})}),zL=S.forwardRef((r,n)=>{const i=Gn(zi,r.__scopeDialog),a=S.useRef(!1),s=S.useRef(!1);return A.jsx(WE,{...r,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,f;(c=r.onCloseAutoFocus)==null||c.call(r,l),l.defaultPrevented||(a.current||(f=i.triggerRef.current)==null||f.focus(),l.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:l=>{var d,g;(d=r.onInteractOutside)==null||d.call(r,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=l.target;((g=i.triggerRef.current)==null?void 0:g.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),WE=S.forwardRef((r,n)=>{const{__scopeDialog:i,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,...c}=r,f=Gn(zi,i),d=S.useRef(null),g=Vt(n,d);return k0(),A.jsxs(A.Fragment,{children:[A.jsx(_h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:l,children:A.jsx(hu,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":ng(f.open),...c,ref:g,onDismiss:()=>f.onOpenChange(!1)})}),A.jsxs(A.Fragment,{children:[A.jsx(GL,{titleId:f.titleId}),A.jsx(jL,{contentRef:d,descriptionId:f.descriptionId})]})]})}),tg="DialogTitle",KE=S.forwardRef((r,n)=>{const{__scopeDialog:i,...a}=r,s=Gn(tg,i);return A.jsx(Je.h2,{id:s.titleId,...a,ref:n})});KE.displayName=tg;var QE="DialogDescription",JE=S.forwardRef((r,n)=>{const{__scopeDialog:i,...a}=r,s=Gn(QE,i);return A.jsx(Je.p,{id:s.descriptionId,...a,ref:n})});JE.displayName=QE;var e1="DialogClose",t1=S.forwardRef((r,n)=>{const{__scopeDialog:i,...a}=r,s=Gn(e1,i);return A.jsx(Je.button,{type:"button",...a,ref:n,onClick:ht(r.onClick,()=>s.onOpenChange(!1))})});t1.displayName=e1;function ng(r){return r?"open":"closed"}var n1="DialogTitleWarning",[kz,r1]=rC(n1,{contentName:zi,titleName:tg,docsSlug:"dialog"}),GL=({titleId:r})=>{const n=r1(n1),i=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return S.useEffect(()=>{r&&(document.getElementById(r)||console.error(i))},[i,r]),null},ML="DialogDescriptionWarning",jL=({contentRef:r,descriptionId:n})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r1(ML).contentName}}.`;return S.useEffect(()=>{var l;const s=(l=r.current)==null?void 0:l.getAttribute("aria-describedby");n&&s&&(document.getElementById(n)||console.warn(a))},[a,r,n]),null},UL=qE,i1=YE,rg=XE,ig=ZE,a1=KE,o1=JE,BL=t1,zd={exports:{}},Gd={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Pb;function FL(){if(Pb)return Gd;Pb=1;var r=du();function n(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var i=typeof Object.is=="function"?Object.is:n,a=r.useState,s=r.useEffect,l=r.useLayoutEffect,c=r.useDebugValue;function f(v,y){var b=y(),x=a({inst:{value:b,getSnapshot:y}}),E=x[0].inst,T=x[1];return l(function(){E.value=b,E.getSnapshot=y,d(E)&&T({inst:E})},[v,b,y]),s(function(){return d(E)&&T({inst:E}),v(function(){d(E)&&T({inst:E})})},[v]),c(b),b}function d(v){var y=v.getSnapshot;v=v.value;try{var b=y();return!i(v,b)}catch{return!0}}function g(v,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:f;return Gd.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:m,Gd}var $b;function HL(){return $b||($b=1,zd.exports=FL()),zd.exports}var PL=HL(),Wo='[cmdk-group=""]',Md='[cmdk-group-items=""]',$L='[cmdk-group-heading=""]',ag='[cmdk-item=""]',qb=`${ag}:not([aria-disabled="true"])`,hh="cmdk-item-select",ki="data-value",qL=(r,n,i)=>RL(r,n,i),s1=S.createContext(void 0),hs=()=>S.useContext(s1),l1=S.createContext(void 0),og=()=>S.useContext(l1),u1=S.createContext(void 0),c1=S.forwardRef((r,n)=>{let i=Ca(()=>{var k,V;return{search:"",value:(V=(k=r.value)!=null?k:r.defaultValue)!=null?V:"",filtered:{count:0,items:new Map,groups:new Set}}}),a=Ca(()=>new Set),s=Ca(()=>new Map),l=Ca(()=>new Map),c=Ca(()=>new Set),f=f1(r),{label:d,children:g,value:m,onValueChange:v,filter:y,shouldFilter:b,loop:x,disablePointerSelection:E=!1,vimBindings:T=!0,...M}=r,N=Ln(),L=Ln(),C=Ln(),R=S.useRef(null),B=tN();Gi(()=>{if(m!==void 0){let k=m.trim();i.current.value=k,_.emit()}},[m]),Gi(()=>{B(6,j)},[]);let _=S.useMemo(()=>({subscribe:k=>(c.current.add(k),()=>c.current.delete(k)),snapshot:()=>i.current,setState:(k,V,Q)=>{var re,de,ge;if(!Object.is(i.current[k],V)){if(i.current[k]=V,k==="search")I(),F(),B(1,Y);else if(k==="value"&&(Q||B(5,j),((re=f.current)==null?void 0:re.value)!==void 0)){let le=V??"";(ge=(de=f.current).onValueChange)==null||ge.call(de,le);return}_.emit()}},emit:()=>{c.current.forEach(k=>k())}}),[]),$=S.useMemo(()=>({value:(k,V,Q)=>{var re;V!==((re=l.current.get(k))==null?void 0:re.value)&&(l.current.set(k,{value:V,keywords:Q}),i.current.filtered.items.set(k,z(V,Q)),B(2,()=>{F(),_.emit()}))},item:(k,V)=>(a.current.add(k),V&&(s.current.has(V)?s.current.get(V).add(k):s.current.set(V,new Set([k]))),B(3,()=>{I(),F(),i.current.value||Y(),_.emit()}),()=>{l.current.delete(k),a.current.delete(k),i.current.filtered.items.delete(k);let Q=J();B(4,()=>{I(),(Q==null?void 0:Q.getAttribute("id"))===k&&Y(),_.emit()})}),group:k=>(s.current.has(k)||s.current.set(k,new Set),()=>{l.current.delete(k),s.current.delete(k)}),filter:()=>f.current.shouldFilter,label:d||r["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:N,inputId:C,labelId:L,listInnerRef:R}),[]);function z(k,V){var Q,re;let de=(re=(Q=f.current)==null?void 0:Q.filter)!=null?re:qL;return k?de(k,i.current.search,V):0}function F(){if(!i.current.search||f.current.shouldFilter===!1)return;let k=i.current.filtered.items,V=[];i.current.filtered.groups.forEach(re=>{let de=s.current.get(re),ge=0;de.forEach(le=>{let xe=k.get(le);ge=Math.max(xe,ge)}),V.push([re,ge])});let Q=R.current;ae().sort((re,de)=>{var ge,le;let xe=re.getAttribute("id"),pe=de.getAttribute("id");return((ge=k.get(pe))!=null?ge:0)-((le=k.get(xe))!=null?le:0)}).forEach(re=>{let de=re.closest(Md);de?de.appendChild(re.parentElement===de?re:re.closest(`${Md} > *`)):Q.appendChild(re.parentElement===Q?re:re.closest(`${Md} > *`))}),V.sort((re,de)=>de[1]-re[1]).forEach(re=>{var de;let ge=(de=R.current)==null?void 0:de.querySelector(`${Wo}[${ki}="${encodeURIComponent(re[0])}"]`);ge==null||ge.parentElement.appendChild(ge)})}function Y(){let k=ae().find(Q=>Q.getAttribute("aria-disabled")!=="true"),V=k==null?void 0:k.getAttribute(ki);_.setState("value",V||void 0)}function I(){var k,V,Q,re;if(!i.current.search||f.current.shouldFilter===!1){i.current.filtered.count=a.current.size;return}i.current.filtered.groups=new Set;let de=0;for(let ge of a.current){let le=(V=(k=l.current.get(ge))==null?void 0:k.value)!=null?V:"",xe=(re=(Q=l.current.get(ge))==null?void 0:Q.keywords)!=null?re:[],pe=z(le,xe);i.current.filtered.items.set(ge,pe),pe>0&&de++}for(let[ge,le]of s.current)for(let xe of le)if(i.current.filtered.items.get(xe)>0){i.current.filtered.groups.add(ge);break}i.current.filtered.count=de}function j(){var k,V,Q;let re=J();re&&(((k=re.parentElement)==null?void 0:k.firstChild)===re&&((Q=(V=re.closest(Wo))==null?void 0:V.querySelector($L))==null||Q.scrollIntoView({block:"nearest"})),re.scrollIntoView({block:"nearest"}))}function J(){var k;return(k=R.current)==null?void 0:k.querySelector(`${ag}[aria-selected="true"]`)}function ae(){var k;return Array.from(((k=R.current)==null?void 0:k.querySelectorAll(qb))||[])}function H(k){let V=ae()[k];V&&_.setState("value",V.getAttribute(ki))}function U(k){var V;let Q=J(),re=ae(),de=re.findIndex(le=>le===Q),ge=re[de+k];(V=f.current)!=null&&V.loop&&(ge=de+k<0?re[re.length-1]:de+k===re.length?re[0]:re[de+k]),ge&&_.setState("value",ge.getAttribute(ki))}function D(k){let V=J(),Q=V==null?void 0:V.closest(Wo),re;for(;Q&&!re;)Q=k>0?JL(Q,Wo):eN(Q,Wo),re=Q==null?void 0:Q.querySelector(qb);re?_.setState("value",re.getAttribute(ki)):U(k)}let se=()=>H(ae().length-1),G=k=>{k.preventDefault(),k.metaKey?se():k.altKey?D(1):U(1)},P=k=>{k.preventDefault(),k.metaKey?H(0):k.altKey?D(-1):U(-1)};return S.createElement(Je.div,{ref:n,tabIndex:-1,...M,"cmdk-root":"",onKeyDown:k=>{var V;if((V=M.onKeyDown)==null||V.call(M,k),!k.defaultPrevented)switch(k.key){case"n":case"j":{T&&k.ctrlKey&&G(k);break}case"ArrowDown":{G(k);break}case"p":case"k":{T&&k.ctrlKey&&P(k);break}case"ArrowUp":{P(k);break}case"Home":{k.preventDefault(),H(0);break}case"End":{k.preventDefault(),se();break}case"Enter":if(!k.nativeEvent.isComposing&&k.keyCode!==229){k.preventDefault();let Q=J();if(Q){let re=new Event(hh);Q.dispatchEvent(re)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:rN},d),Ru(r,k=>S.createElement(l1.Provider,{value:_},S.createElement(s1.Provider,{value:$},k))))}),VL=S.forwardRef((r,n)=>{var i,a;let s=Ln(),l=S.useRef(null),c=S.useContext(u1),f=hs(),d=f1(r),g=(a=(i=d.current)==null?void 0:i.forceMount)!=null?a:c==null?void 0:c.forceMount;Gi(()=>{if(!g)return f.item(s,c==null?void 0:c.id)},[g]);let m=d1(s,l,[r.value,r.children,l],r.keywords),v=og(),y=Mi(B=>B.value&&B.value===m.current),b=Mi(B=>g||f.filter()===!1?!0:B.search?B.filtered.items.get(s)>0:!0);S.useEffect(()=>{let B=l.current;if(!(!B||r.disabled))return B.addEventListener(hh,x),()=>B.removeEventListener(hh,x)},[b,r.onSelect,r.disabled]);function x(){var B,_;E(),(_=(B=d.current).onSelect)==null||_.call(B,m.current)}function E(){v.setState("value",m.current,!0)}if(!b)return null;let{disabled:T,value:M,onSelect:N,forceMount:L,keywords:C,...R}=r;return S.createElement(Je.div,{ref:ns([l,n]),...R,id:s,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!y,"data-disabled":!!T,"data-selected":!!y,onPointerMove:T||f.getDisablePointerSelection()?void 0:E,onClick:T?void 0:x},r.children)}),IL=S.forwardRef((r,n)=>{let{heading:i,children:a,forceMount:s,...l}=r,c=Ln(),f=S.useRef(null),d=S.useRef(null),g=Ln(),m=hs(),v=Mi(b=>s||m.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);Gi(()=>m.group(c),[]),d1(c,f,[r.value,r.heading,d]);let y=S.useMemo(()=>({id:c,forceMount:s}),[s]);return S.createElement(Je.div,{ref:ns([f,n]),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},i&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:g},i),Ru(r,b=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?g:void 0},S.createElement(u1.Provider,{value:y},b))))}),YL=S.forwardRef((r,n)=>{let{alwaysRender:i,...a}=r,s=S.useRef(null),l=Mi(c=>!c.search);return!i&&!l?null:S.createElement(Je.div,{ref:ns([s,n]),...a,"cmdk-separator":"",role:"separator"})}),XL=S.forwardRef((r,n)=>{let{onValueChange:i,...a}=r,s=r.value!=null,l=og(),c=Mi(m=>m.search),f=Mi(m=>m.value),d=hs(),g=S.useMemo(()=>{var m;let v=(m=d.listInnerRef.current)==null?void 0:m.querySelector(`${ag}[${ki}="${encodeURIComponent(f)}"]`);return v==null?void 0:v.getAttribute("id")},[]);return S.useEffect(()=>{r.value!=null&&l.setState("search",r.value)},[r.value]),S.createElement(Je.input,{ref:n,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":g,id:d.inputId,type:"text",value:s?r.value:c,onChange:m=>{s||l.setState("search",m.target.value),i==null||i(m.target.value)}})}),ZL=S.forwardRef((r,n)=>{let{children:i,label:a="Suggestions",...s}=r,l=S.useRef(null),c=S.useRef(null),f=hs();return S.useEffect(()=>{if(c.current&&l.current){let d=c.current,g=l.current,m,v=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let y=d.offsetHeight;g.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return v.observe(d),()=>{cancelAnimationFrame(m),v.unobserve(d)}}},[]),S.createElement(Je.div,{ref:ns([l,n]),...s,"cmdk-list":"",role:"listbox","aria-label":a,id:f.listId},Ru(r,d=>S.createElement("div",{ref:ns([c,f.listInnerRef]),"cmdk-list-sizer":""},d)))}),WL=S.forwardRef((r,n)=>{let{open:i,onOpenChange:a,overlayClassName:s,contentClassName:l,container:c,...f}=r;return S.createElement(UL,{open:i,onOpenChange:a},S.createElement(i1,{container:c},S.createElement(rg,{"cmdk-overlay":"",className:s}),S.createElement(ig,{"aria-label":r.label,"cmdk-dialog":"",className:l},S.createElement(c1,{ref:n,...f}))))}),KL=S.forwardRef((r,n)=>Mi(i=>i.filtered.count===0)?S.createElement(Je.div,{ref:n,...r,"cmdk-empty":"",role:"presentation"}):null),QL=S.forwardRef((r,n)=>{let{progress:i,children:a,label:s="Loading...",...l}=r;return S.createElement(Je.div,{ref:n,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Ru(r,c=>S.createElement("div",{"aria-hidden":!0},c)))}),Xt=Object.assign(c1,{List:ZL,Item:VL,Input:XL,Group:IL,Separator:YL,Dialog:WL,Empty:KL,Loading:QL});function JL(r,n){let i=r.nextElementSibling;for(;i;){if(i.matches(n))return i;i=i.nextElementSibling}}function eN(r,n){let i=r.previousElementSibling;for(;i;){if(i.matches(n))return i;i=i.previousElementSibling}}function f1(r){let n=S.useRef(r);return Gi(()=>{n.current=r}),n}var Gi=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Ca(r){let n=S.useRef();return n.current===void 0&&(n.current=r()),n}function ns(r){return n=>{r.forEach(i=>{typeof i=="function"?i(n):i!=null&&(i.current=n)})}}function Mi(r){let n=og(),i=()=>r(n.snapshot());return PL.useSyncExternalStore(n.subscribe,i,i)}function d1(r,n,i,a=[]){let s=S.useRef(),l=hs();return Gi(()=>{var c;let f=(()=>{var g;for(let m of i){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(g=m.current.textContent)==null?void 0:g.trim():s.current}})(),d=a.map(g=>g.trim());l.value(r,f,d),(c=n.current)==null||c.setAttribute(ki,f),s.current=f}),s}var tN=()=>{let[r,n]=S.useState(),i=Ca(()=>new Map);return Gi(()=>{i.current.forEach(a=>a()),i.current=new Map},[r]),(a,s)=>{i.current.set(a,s),n({})}};function nN(r){let n=r.type;return typeof n=="function"?n(r.props):"render"in n?n.render(r.props):r}function Ru({asChild:r,children:n},i){return r&&S.isValidElement(n)?S.cloneElement(nN(n),{ref:n.ref},i(n.props.children)):i(n)}var rN={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const iN=i1,h1=S.forwardRef(({className:r,...n},i)=>A.jsx(rg,{ref:i,className:Xe("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",r),...n}));h1.displayName=rg.displayName;const aN=S.forwardRef(({className:r,children:n,...i},a)=>A.jsxs(iN,{children:[A.jsx(h1,{}),A.jsxs(ig,{ref:a,className:Xe("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-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 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",r),...i,children:[n,A.jsxs(BL,{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:[A.jsx(KT,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));aN.displayName=ig.displayName;const oN=S.forwardRef(({className:r,...n},i)=>A.jsx(a1,{ref:i,className:Xe("text-lg leading-none font-semibold tracking-tight",r),...n}));oN.displayName=a1.displayName;const sN=S.forwardRef(({className:r,...n},i)=>A.jsx(o1,{ref:i,className:Xe("text-muted-foreground text-sm",r),...n}));sN.displayName=o1.displayName;const Du=S.forwardRef(({className:r,...n},i)=>A.jsx(Xt,{ref:i,className:Xe("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",r),...n}));Du.displayName=Xt.displayName;const sg=S.forwardRef(({className:r,...n},i)=>A.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[A.jsx(VT,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),A.jsx(Xt.Input,{ref:i,className:Xe("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",r),...n})]}));sg.displayName=Xt.Input.displayName;const Ou=S.forwardRef(({className:r,...n},i)=>A.jsx(Xt.List,{ref:i,className:Xe("max-h-[300px] overflow-x-hidden overflow-y-auto",r),...n}));Ou.displayName=Xt.List.displayName;const lg=S.forwardRef((r,n)=>A.jsx(Xt.Empty,{ref:n,className:"py-6 text-center text-sm",...r}));lg.displayName=Xt.Empty.displayName;const $a=S.forwardRef(({className:r,...n},i)=>A.jsx(Xt.Group,{ref:i,className:Xe("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",r),...n}));$a.displayName=Xt.Group.displayName;const lN=S.forwardRef(({className:r,...n},i)=>A.jsx(Xt.Separator,{ref:i,className:Xe("bg-border -mx-1 h-px",r),...n}));lN.displayName=Xt.Separator.displayName;const qa=S.forwardRef(({className:r,...n},i)=>A.jsx(Xt.Item,{ref:i,className:Xe("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",r),...n}));qa.displayName=Xt.Item.displayName;const uN=({layout:r,autoRunFor:n})=>{const i=Sn(),{stop:a,start:s,isRunning:l}=r;return S.useEffect(()=>{if(!i)return;let c=null;return n!==void 0&&n>-1&&i.getGraph().order>0&&(s(),c=n>0?window.setTimeout(()=>{a()},n):null),()=>{a(),c&&clearTimeout(c)}},[n,s,a,i]),A.jsx(an,{size:"icon",onClick:()=>l?a():s(),tooltip:l?"Stop the layout animation":"Start the layout animation",variant:qn,children:l?A.jsx(HT,{}):A.jsx($T,{})})},cN=()=>{const r=Sn(),[n,i]=S.useState("Circular"),[a,s]=S.useState(!1),l=Sk(),c=yk(),f=Jk(),d=Xk({settings:{margin:1}}),g=Dk({maxIterations:20}),m=AE({iterations:20}),v=Zk(),y=Ok(),b=Bk(),x=S.useMemo(()=>({Circular:{layout:l},Circlepack:{layout:c},Random:{layout:f},Noverlaps:{layout:d,worker:v},"Force Directed":{layout:g,worker:y},"Force Atlas":{layout:m,worker:b}}),[c,l,g,m,d,f,y,v,b]),E=S.useCallback(T=>{console.debug(T);const{positions:M}=x[T].layout;jD(r.getGraph(),M(),{duration:500}),i(T)},[x,r]);return A.jsxs(A.Fragment,{children:[A.jsx("div",{children:x[n]&&"worker"in x[n]&&A.jsx(uN,{layout:x[n].worker})}),A.jsx("div",{children:A.jsxs(wu,{open:a,onOpenChange:s,children:[A.jsx(Eu,{asChild:!0,children:A.jsx(an,{size:"icon",variant:qn,onClick:()=>s(T=>!T),tooltip:"Layout Graph",children:A.jsx(LT,{})})}),A.jsx(ss,{side:"right",align:"center",className:"p-1",children:A.jsx(Du,{children:A.jsx(Ou,{children:A.jsx($a,{children:Object.keys(x).map(T=>A.jsx(qa,{onSelect:()=>{E(T)},className:"cursor-pointer text-xs",children:T},T))})})})})]})})]})};var Xl={exports:{}},fN=Xl.exports,Vb;function dN(){return Vb||(Vb=1,function(r){(function(n,i,a){function s(d){var g=this,m=f();g.next=function(){var v=2091639*g.s0+g.c*23283064365386963e-26;return g.s0=g.s1,g.s1=g.s2,g.s2=v-(g.c=v|0)},g.c=1,g.s0=m(" "),g.s1=m(" "),g.s2=m(" "),g.s0-=m(d),g.s0<0&&(g.s0+=1),g.s1-=m(d),g.s1<0&&(g.s1+=1),g.s2-=m(d),g.s2<0&&(g.s2+=1),m=null}function l(d,g){return g.c=d.c,g.s0=d.s0,g.s1=d.s1,g.s2=d.s2,g}function c(d,g){var m=new s(d),v=g&&g.state,y=m.next;return y.int32=function(){return m.next()*4294967296|0},y.double=function(){return y()+(y()*2097152|0)*11102230246251565e-32},y.quick=y,v&&(typeof v=="object"&&l(v,m),y.state=function(){return l(m,{})}),y}function f(){var d=4022871197,g=function(m){m=String(m);for(var v=0;v>>0,y-=d,y*=d,d=y>>>0,y-=d,d+=y*4294967296}return(d>>>0)*23283064365386963e-26};return g}i&&i.exports?i.exports=c:this.alea=c})(fN,r)}(Xl)),Xl.exports}var Zl={exports:{}},hN=Zl.exports,Ib;function gN(){return Ib||(Ib=1,function(r){(function(n,i,a){function s(f){var d=this,g="";d.x=0,d.y=0,d.z=0,d.w=0,d.next=function(){var v=d.x^d.x<<11;return d.x=d.y,d.y=d.z,d.z=d.w,d.w^=d.w>>>19^v^v>>>8},f===(f|0)?d.x=f:g+=f;for(var m=0;m>>0)/4294967296};return v.double=function(){do var y=g.next()>>>11,b=(g.next()>>>0)/4294967296,x=(y+b)/(1<<21);while(x===0);return x},v.int32=g.next,v.quick=v,m&&(typeof m=="object"&&l(m,g),v.state=function(){return l(g,{})}),v}i&&i.exports?i.exports=c:this.xor128=c})(hN,r)}(Zl)),Zl.exports}var Wl={exports:{}},pN=Wl.exports,Yb;function mN(){return Yb||(Yb=1,function(r){(function(n,i,a){function s(f){var d=this,g="";d.next=function(){var v=d.x^d.x>>>2;return d.x=d.y,d.y=d.z,d.z=d.w,d.w=d.v,(d.d=d.d+362437|0)+(d.v=d.v^d.v<<4^(v^v<<1))|0},d.x=0,d.y=0,d.z=0,d.w=0,d.v=0,f===(f|0)?d.x=f:g+=f;for(var m=0;m>>4),d.next()}function l(f,d){return d.x=f.x,d.y=f.y,d.z=f.z,d.w=f.w,d.v=f.v,d.d=f.d,d}function c(f,d){var g=new s(f),m=d&&d.state,v=function(){return(g.next()>>>0)/4294967296};return v.double=function(){do var y=g.next()>>>11,b=(g.next()>>>0)/4294967296,x=(y+b)/(1<<21);while(x===0);return x},v.int32=g.next,v.quick=v,m&&(typeof m=="object"&&l(m,g),v.state=function(){return l(g,{})}),v}i&&i.exports?i.exports=c:this.xorwow=c})(pN,r)}(Wl)),Wl.exports}var Kl={exports:{}},vN=Kl.exports,Xb;function yN(){return Xb||(Xb=1,function(r){(function(n,i,a){function s(f){var d=this;d.next=function(){var m=d.x,v=d.i,y,b;return y=m[v],y^=y>>>7,b=y^y<<24,y=m[v+1&7],b^=y^y>>>10,y=m[v+3&7],b^=y^y>>>3,y=m[v+4&7],b^=y^y<<7,y=m[v+7&7],y=y^y<<13,b^=y^y<<9,m[v]=b,d.i=v+1&7,b};function g(m,v){var y,b=[];if(v===(v|0))b[0]=v;else for(v=""+v,y=0;y0;--y)m.next()}g(d,f)}function l(f,d){return d.x=f.x.slice(),d.i=f.i,d}function c(f,d){f==null&&(f=+new Date);var g=new s(f),m=d&&d.state,v=function(){return(g.next()>>>0)/4294967296};return v.double=function(){do var y=g.next()>>>11,b=(g.next()>>>0)/4294967296,x=(y+b)/(1<<21);while(x===0);return x},v.int32=g.next,v.quick=v,m&&(m.x&&l(m,g),v.state=function(){return l(g,{})}),v}i&&i.exports?i.exports=c:this.xorshift7=c})(vN,r)}(Kl)),Kl.exports}var Ql={exports:{}},bN=Ql.exports,Zb;function wN(){return Zb||(Zb=1,function(r){(function(n,i,a){function s(f){var d=this;d.next=function(){var m=d.w,v=d.X,y=d.i,b,x;return d.w=m=m+1640531527|0,x=v[y+34&127],b=v[y=y+1&127],x^=x<<13,b^=b<<17,x^=x>>>15,b^=b>>>12,x=v[y]=x^b,d.i=y,x+(m^m>>>16)|0};function g(m,v){var y,b,x,E,T,M=[],N=128;for(v===(v|0)?(b=v,v=null):(v=v+"\0",b=0,N=Math.max(N,v.length)),x=0,E=-32;E>>15,b^=b<<4,b^=b>>>13,E>=0&&(T=T+1640531527|0,y=M[E&127]^=b+T,x=y==0?x+1:0);for(x>=128&&(M[(v&&v.length||0)&127]=-1),x=127,E=4*128;E>0;--E)b=M[x+34&127],y=M[x=x+1&127],b^=b<<13,y^=y<<17,b^=b>>>15,y^=y>>>12,M[x]=b^y;m.w=T,m.X=M,m.i=x}g(d,f)}function l(f,d){return d.i=f.i,d.w=f.w,d.X=f.X.slice(),d}function c(f,d){f==null&&(f=+new Date);var g=new s(f),m=d&&d.state,v=function(){return(g.next()>>>0)/4294967296};return v.double=function(){do var y=g.next()>>>11,b=(g.next()>>>0)/4294967296,x=(y+b)/(1<<21);while(x===0);return x},v.int32=g.next,v.quick=v,m&&(m.X&&l(m,g),v.state=function(){return l(g,{})}),v}i&&i.exports?i.exports=c:this.xor4096=c})(bN,r)}(Ql)),Ql.exports}var Jl={exports:{}},EN=Jl.exports,Wb;function SN(){return Wb||(Wb=1,function(r){(function(n,i,a){function s(f){var d=this,g="";d.next=function(){var v=d.b,y=d.c,b=d.d,x=d.a;return v=v<<25^v>>>7^y,y=y-b|0,b=b<<24^b>>>8^x,x=x-v|0,d.b=v=v<<20^v>>>12^y,d.c=y=y-b|0,d.d=b<<16^y>>>16^x,d.a=x-v|0},d.a=0,d.b=0,d.c=-1640531527,d.d=1367130551,f===Math.floor(f)?(d.a=f/4294967296|0,d.b=f|0):g+=f;for(var m=0;m>>0)/4294967296};return v.double=function(){do var y=g.next()>>>11,b=(g.next()>>>0)/4294967296,x=(y+b)/(1<<21);while(x===0);return x},v.int32=g.next,v.quick=v,m&&(typeof m=="object"&&l(m,g),v.state=function(){return l(g,{})}),v}i&&i.exports?i.exports=c:this.tychei=c})(EN,r)}(Jl)),Jl.exports}var eu={exports:{}};const xN={},_N=Object.freeze(Object.defineProperty({__proto__:null,default:xN},Symbol.toStringTag,{value:"Module"})),TN=Kx(_N);var CN=eu.exports,Kb;function AN(){return Kb||(Kb=1,function(r){(function(n,i,a){var s=256,l=6,c=52,f="random",d=a.pow(s,l),g=a.pow(2,c),m=g*2,v=s-1,y;function b(C,R,B){var _=[];R=R==!0?{entropy:!0}:R||{};var $=M(T(R.entropy?[C,L(i)]:C??N(),3),_),z=new x(_),F=function(){for(var Y=z.g(l),I=d,j=0;Y=m;)Y/=2,I/=2,j>>>=1;return(Y+j)/I};return F.int32=function(){return z.g(4)|0},F.quick=function(){return z.g(4)/4294967296},F.double=F,M(L(z.S),i),(R.pass||B||function(Y,I,j,J){return J&&(J.S&&E(J,z),Y.state=function(){return E(z,{})}),j?(a[f]=Y,I):Y})(F,$,"global"in R?R.global:this==a,R.state)}function x(C){var R,B=C.length,_=this,$=0,z=_.i=_.j=0,F=_.S=[];for(B||(C=[B++]);${if(!r||!Array.isArray(r.nodes)||!Array.isArray(r.edges))return!1;for(const n of r.nodes)if(!n.id||!n.labels||!n.properties)return!1;for(const n of r.edges)if(!n.id||!n.source||!n.target||!n.type||!n.properties)return!1;for(const n of r.edges){const i=r.getNode(n.source),a=r.getNode(n.target);if(i==null||a==null)return!1}return!0},LN=async r=>{let n=null;try{n=await vT(r)}catch(a){return kn.getState().setErrorMessage(y0(a),"Query Graphs Error!"),null}let i=null;if(n){const a={},s={};for(let d=0;d0){const d=cT-oy;for(const g of n.nodes)g.size=Math.round(oy+d*Math.pow((g.degree-l)/f,.5))}i=new ck,i.nodes=n.nodes,i.edges=n.edges,i.nodeIdMap=a,i.edgeIdMap=s,kN(i)||(i=null,console.error("Invalid graph data")),console.log("Graph data loaded")}return i},NN=r=>{const n=new ts;for(const i of(r==null?void 0:r.nodes)??[])n.addNode(i.id,{label:i.labels.join(", "),color:i.color,x:i.x,y:i.y,size:i.size,borderColor:oT,borderSize:.2});for(const i of(r==null?void 0:r.edges)??[])i.dynamicId=n.addDirectedEdge(i.source,i.target,{label:i.type});return n},Jb={label:""},g1=()=>{const r=Pe.use.queryLabel(),n=Ye.use.rawGraph(),i=Ye.use.sigmaGraph(),a=S.useCallback(c=>(n==null?void 0:n.getNode(c))||null,[n]),s=S.useCallback((c,f=!0)=>(n==null?void 0:n.getEdge(c,f))||null,[n]);return S.useEffect(()=>{if(r){if(Jb.label!==r){Jb.label=r;const c=Ye.getState();c.reset(),LN(r).then(f=>{c.setSigmaGraph(NN(f)),f==null||f.buildDynamicMap(),c.setRawGraph(f)})}}else{const c=Ye.getState();c.reset(),c.setSigmaGraph(new ts)}},[r]),{lightrageGraph:S.useCallback(()=>{if(i)return i;const c=new ts;return Ye.getState().setSigmaGraph(c),c},[i]),getNode:a,getEdge:s}},p1=()=>{const r=S.useContext(b0);if(r===void 0)throw new Error("useTheme must be used within a ThemeProvider");return r},Bl=r=>!!(r.type.startsWith("mouse")&&r.buttons!==0),zN=({disableHoverEffect:r})=>{const{lightrageGraph:n}=g1(),i=Sn(),a=oE(),s=aE(),l=fO(),{assign:c}=AE({iterations:20}),{theme:f}=p1(),d=Pe.use.enableHideUnselectedEdges(),g=Ye.use.selectedNode(),m=Ye.use.focusedNode(),v=Ye.use.selectedEdge(),y=Ye.use.focusedEdge();return S.useEffect(()=>{const b=n();l(b),b.__force_applied||(c(),Object.assign(b,{__force_applied:!0}));const{setFocusedNode:x,setSelectedNode:E,setFocusedEdge:T,setSelectedEdge:M,clearSelection:N}=Ye.getState();a({enterNode:L=>{Bl(L.event.original)||x(L.node)},leaveNode:L=>{Bl(L.event.original)||x(null)},clickNode:L=>{E(L.node),M(null)},clickEdge:L=>{M(L.edge),E(null)},enterEdge:L=>{Bl(L.event.original)||T(L.edge)},leaveEdge:L=>{Bl(L.event.original)||T(null)},clickStage:()=>N()})},[c,l,a,n]),S.useEffect(()=>{const b=f==="dark",x=b?rT:void 0,E=b?lT:void 0;s({nodeReducer:(T,M)=>{const N=i.getGraph(),L={...M,highlighted:M.highlighted||!1,labelColor:x};if(!r){L.highlighted=!1;const C=m||g,R=y||v;if(C)(T===C||N.neighbors(C).includes(T))&&(L.highlighted=!0,T===g&&(L.borderColor=sT));else if(R)N.extremities(R).includes(T)&&(L.highlighted=!0,L.size=3);else return L;L.highlighted?b&&(L.labelColor=iT):L.color=aT}return L},edgeReducer:(T,M)=>{const N=i.getGraph(),L={...M,hidden:!1,labelColor:x,color:E};if(!r){const C=m||g;C?d?N.extremities(T).includes(C)||(L.hidden=!0):N.extremities(T).includes(C)&&(L.color=ay):(y||v)&&(T===v?L.color=uT:T===y?L.color=ay:d&&(L.hidden=!0))}return L}})},[g,m,v,y,s,i,r,f,d]),null};function GN(){const{theme:r,setTheme:n}=p1(),i=S.useCallback(()=>n("light"),[n]),a=S.useCallback(()=>n("dark"),[n]);return r==="dark"?A.jsx(an,{onClick:i,variant:qn,tooltip:"Switch to light theme",size:"icon",children:A.jsx(BT,{})}):A.jsx(an,{onClick:a,variant:qn,tooltip:"Switch to dark theme",size:"icon",children:A.jsx(ZT,{})})}const MN=()=>{const{zoomIn:r,zoomOut:n,reset:i}=sE({duration:200,factor:1.5}),a=S.useCallback(()=>r(),[r]),s=S.useCallback(()=>n(),[n]),l=S.useCallback(()=>i(),[i]);return A.jsxs(A.Fragment,{children:[A.jsx(an,{variant:qn,onClick:a,tooltip:"Zoom In",size:"icon",children:A.jsx(JT,{})}),A.jsx(an,{variant:qn,onClick:s,tooltip:"Zoom Out",size:"icon",children:A.jsx(tC,{})}),A.jsx(an,{variant:qn,onClick:l,tooltip:"Reset Zoom",size:"icon",children:A.jsx(OT,{})})]})},jN=()=>{const{isFullScreen:r,toggle:n}=dO();return A.jsx(A.Fragment,{children:r?A.jsx(an,{variant:qn,onClick:n,tooltip:"Windowed",size:"icon",children:A.jsx(jT,{})}):A.jsx(an,{variant:qn,onClick:n,tooltip:"Full Screen",size:"icon",children:A.jsx(GT,{})})})};function UN(r){const n=S.useRef({value:r,previous:r});return S.useMemo(()=>(n.current.value!==r&&(n.current.previous=n.current.value,n.current.value=r),n.current.previous),[r])}var ug="Checkbox",[BN,Lz]=rs(ug),[FN,HN]=BN(ug),m1=S.forwardRef((r,n)=>{const{__scopeCheckbox:i,name:a,checked:s,defaultChecked:l,required:c,disabled:f,value:d="on",onCheckedChange:g,form:m,...v}=r,[y,b]=S.useState(null),x=Vt(n,C=>b(C)),E=S.useRef(!1),T=y?m||!!y.closest("form"):!0,[M=!1,N]=yu({prop:s,defaultProp:l,onChange:g}),L=S.useRef(M);return S.useEffect(()=>{const C=y==null?void 0:y.form;if(C){const R=()=>N(L.current);return C.addEventListener("reset",R),()=>C.removeEventListener("reset",R)}},[y,N]),A.jsxs(FN,{scope:i,state:M,disabled:f,children:[A.jsx(Je.button,{type:"button",role:"checkbox","aria-checked":Wr(M)?"mixed":M,"aria-required":c,"data-state":b1(M),"data-disabled":f?"":void 0,disabled:f,value:d,...v,ref:x,onKeyDown:ht(r.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ht(r.onClick,C=>{N(R=>Wr(R)?!0:!R),T&&(E.current=C.isPropagationStopped(),E.current||C.stopPropagation())})}),T&&A.jsx(PN,{control:y,bubbles:!E.current,name:a,value:d,checked:M,required:c,disabled:f,form:m,style:{transform:"translateX(-100%)"},defaultChecked:Wr(l)?!1:l})]})});m1.displayName=ug;var v1="CheckboxIndicator",y1=S.forwardRef((r,n)=>{const{__scopeCheckbox:i,forceMount:a,...s}=r,l=HN(v1,i);return A.jsx(ni,{present:a||Wr(l.state)||l.state===!0,children:A.jsx(Je.span,{"data-state":b1(l.state),"data-disabled":l.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...r.style}})})});y1.displayName=v1;var PN=r=>{const{control:n,checked:i,bubbles:a=!0,defaultChecked:s,...l}=r,c=S.useRef(null),f=UN(i),d=q0(n);S.useEffect(()=>{const m=c.current,v=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(v,"checked").set;if(f!==i&&b){const x=new Event("click",{bubbles:a});m.indeterminate=Wr(i),b.call(m,Wr(i)?!1:i),m.dispatchEvent(x)}},[f,i,a]);const g=S.useRef(Wr(i)?!1:i);return A.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??g.current,...l,tabIndex:-1,ref:c,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Wr(r){return r==="indeterminate"}function b1(r){return Wr(r)?"indeterminate":r?"checked":"unchecked"}var w1=m1,$N=y1;const E1=S.forwardRef(({className:r,...n},i)=>A.jsx(w1,{ref:i,className:Xe("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",r),...n,children:A.jsx($N,{className:Xe("flex items-center justify-center text-current"),children:A.jsx(T0,{className:"h-4 w-4"})})}));E1.displayName=w1.displayName;var qN="Separator",e0="horizontal",VN=["horizontal","vertical"],S1=S.forwardRef((r,n)=>{const{decorative:i,orientation:a=e0,...s}=r,l=IN(a)?a:e0,f=i?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return A.jsx(Je.div,{"data-orientation":l,...f,...s,ref:n})});S1.displayName=qN;function IN(r){return VN.includes(r)}var x1=S1;const Ko=S.forwardRef(({className:r,orientation:n="horizontal",decorative:i=!0,...a},s)=>A.jsx(x1,{ref:s,decorative:i,orientation:n,className:Xe("bg-border shrink-0",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",r),...a}));Ko.displayName=x1.displayName;const _1=S.forwardRef(({className:r,type:n,...i},a)=>A.jsx("input",{type:n,className:Xe("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",r),ref:a,...i}));_1.displayName="Input";const Yr=({checked:r,onCheckedChange:n,label:i})=>A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx(E1,{checked:r,onCheckedChange:n}),A.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:i})]});function YN(){const[r,n]=S.useState(!1),[i,a]=S.useState(""),s=Pe.use.showPropertyPanel(),l=Pe.use.showNodeSearchBar(),c=Pe.use.showNodeLabel(),f=Pe.use.enableEdgeEvents(),d=Pe.use.enableNodeDrag(),g=Pe.use.enableHideUnselectedEdges(),m=Pe.use.showEdgeLabel(),v=Pe.use.enableHealthCheck(),y=Pe.use.apiKey();S.useEffect(()=>{a(y||"")},[y,r]);const b=S.useCallback(()=>Pe.setState(_=>({enableNodeDrag:!_.enableNodeDrag})),[]),x=S.useCallback(()=>Pe.setState(_=>({enableEdgeEvents:!_.enableEdgeEvents})),[]),E=S.useCallback(()=>Pe.setState(_=>({enableHideUnselectedEdges:!_.enableHideUnselectedEdges})),[]),T=S.useCallback(()=>Pe.setState(_=>({showEdgeLabel:!_.showEdgeLabel})),[]),M=S.useCallback(()=>Pe.setState(_=>({showPropertyPanel:!_.showPropertyPanel})),[]),N=S.useCallback(()=>Pe.setState(_=>({showNodeSearchBar:!_.showNodeSearchBar})),[]),L=S.useCallback(()=>Pe.setState(_=>({showNodeLabel:!_.showNodeLabel})),[]),C=S.useCallback(()=>Pe.setState(_=>({enableHealthCheck:!_.enableHealthCheck})),[]),R=S.useCallback(async()=>{Pe.setState({apiKey:i||null}),await kn.getState().check(),n(!1)},[i]),B=S.useCallback(_=>{a(_.target.value)},[a]);return A.jsxs(wu,{open:r,onOpenChange:n,children:[A.jsx(Eu,{asChild:!0,children:A.jsx(an,{variant:qn,tooltip:"Settings",size:"icon",children:A.jsx(YT,{})})}),A.jsx(ss,{side:"right",align:"start",className:"mb-2 p-2",onCloseAutoFocus:_=>_.preventDefault(),children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsx(Yr,{checked:s,onCheckedChange:M,label:"Show Property Panel"}),A.jsx(Yr,{checked:l,onCheckedChange:N,label:"Show Search Bar"}),A.jsx(Ko,{}),A.jsx(Yr,{checked:c,onCheckedChange:L,label:"Show Node Label"}),A.jsx(Yr,{checked:d,onCheckedChange:b,label:"Node Draggable"}),A.jsx(Ko,{}),A.jsx(Yr,{checked:m,onCheckedChange:T,label:"Show Edge Label"}),A.jsx(Yr,{checked:g,onCheckedChange:E,label:"Hide Unselected Edges"}),A.jsx(Yr,{checked:f,onCheckedChange:x,label:"Edge Events"}),A.jsx(Ko,{}),A.jsx(Yr,{checked:v,onCheckedChange:C,label:"Health Check"}),A.jsx(Ko,{}),A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsx("label",{className:"text-sm font-medium",children:"API Key"}),A.jsxs("form",{className:"flex h-6 gap-2",onSubmit:_=>_.preventDefault(),children:[A.jsx("div",{className:"w-0 flex-1",children:A.jsx(_1,{type:"password",value:i,onChange:B,placeholder:"Enter your API key",className:"max-h-full w-full min-w-0",autoComplete:"off"})}),A.jsx(an,{onClick:R,variant:"outline",size:"sm",className:"max-h-full shrink-0",children:"Save"})]})]})]})})]})}function tu(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function f(m){try{g(a.next(m))}catch(v){c(v)}}function d(m){try{g(a.throw(m))}catch(v){c(v)}}function g(m){m.done?l(m.value):s(m.value).then(f,d)}g((a=a.apply(r,[])).next())})}const XN="ENTRIES",T1="KEYS",C1="VALUES",Lt="";class Ud{constructor(n,i){const a=n._tree,s=Array.from(a.keys());this.set=n,this._type=i,this._path=s.length>0?[{node:a,keys:s}]:[]}next(){const n=this.dive();return this.backtrack(),n}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:n,keys:i}=_a(this._path);if(_a(i)===Lt)return{done:!1,value:this.result()};const a=n.get(_a(i));return this._path.push({node:a,keys:Array.from(a.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const n=_a(this._path).keys;n.pop(),!(n.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:n})=>_a(n)).filter(n=>n!==Lt).join("")}value(){return _a(this._path).node.get(Lt)}result(){switch(this._type){case C1:return this.value();case T1:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const _a=r=>r[r.length-1],ZN=(r,n,i)=>{const a=new Map;if(n===void 0)return a;const s=n.length+1,l=s+i,c=new Uint8Array(l*s).fill(i+1);for(let f=0;f{const d=l*c;e:for(const g of r.keys())if(g===Lt){const m=s[d-1];m<=i&&a.set(f,[r.get(g),m])}else{let m=l;for(let v=0;vi)continue e}A1(r.get(g),n,i,a,s,m,c,f+g)}};class Zr{constructor(n=new Map,i=""){this._size=void 0,this._tree=n,this._prefix=i}atPrefix(n){if(!n.startsWith(this._prefix))throw new Error("Mismatched prefix");const[i,a]=fu(this._tree,n.slice(this._prefix.length));if(i===void 0){const[s,l]=cg(a);for(const c of s.keys())if(c!==Lt&&c.startsWith(l)){const f=new Map;return f.set(c.slice(l.length),s.get(c)),new Zr(f,n)}}return new Zr(i,n)}clear(){this._size=void 0,this._tree.clear()}delete(n){return this._size=void 0,WN(this._tree,n)}entries(){return new Ud(this,XN)}forEach(n){for(const[i,a]of this)n(i,a,this)}fuzzyGet(n,i){return ZN(this._tree,n,i)}get(n){const i=gh(this._tree,n);return i!==void 0?i.get(Lt):void 0}has(n){const i=gh(this._tree,n);return i!==void 0&&i.has(Lt)}keys(){return new Ud(this,T1)}set(n,i){if(typeof n!="string")throw new Error("key must be a string");return this._size=void 0,Bd(this._tree,n).set(Lt,i),this}get size(){if(this._size)return this._size;this._size=0;const n=this.entries();for(;!n.next().done;)this._size+=1;return this._size}update(n,i){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;const a=Bd(this._tree,n);return a.set(Lt,i(a.get(Lt))),this}fetch(n,i){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;const a=Bd(this._tree,n);let s=a.get(Lt);return s===void 0&&a.set(Lt,s=i()),s}values(){return new Ud(this,C1)}[Symbol.iterator](){return this.entries()}static from(n){const i=new Zr;for(const[a,s]of n)i.set(a,s);return i}static fromObject(n){return Zr.from(Object.entries(n))}}const fu=(r,n,i=[])=>{if(n.length===0||r==null)return[r,i];for(const a of r.keys())if(a!==Lt&&n.startsWith(a))return i.push([r,a]),fu(r.get(a),n.slice(a.length),i);return i.push([r,n]),fu(void 0,"",i)},gh=(r,n)=>{if(n.length===0||r==null)return r;for(const i of r.keys())if(i!==Lt&&n.startsWith(i))return gh(r.get(i),n.slice(i.length))},Bd=(r,n)=>{const i=n.length;e:for(let a=0;r&&a{const[i,a]=fu(r,n);if(i!==void 0){if(i.delete(Lt),i.size===0)R1(a);else if(i.size===1){const[s,l]=i.entries().next().value;D1(a,s,l)}}},R1=r=>{if(r.length===0)return;const[n,i]=cg(r);if(n.delete(i),n.size===0)R1(r.slice(0,-1));else if(n.size===1){const[a,s]=n.entries().next().value;a!==Lt&&D1(r.slice(0,-1),a,s)}},D1=(r,n,i)=>{if(r.length===0)return;const[a,s]=cg(r);a.set(s+n,i),a.delete(s)},cg=r=>r[r.length-1],fg="or",O1="and",KN="and_not";class Kr{constructor(n){if((n==null?void 0:n.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const i=n.autoVacuum==null||n.autoVacuum===!0?Pd:n.autoVacuum;this._options=Object.assign(Object.assign(Object.assign({},Hd),n),{autoVacuum:i,searchOptions:Object.assign(Object.assign({},t0),n.searchOptions||{}),autoSuggestOptions:Object.assign(Object.assign({},nz),n.autoSuggestOptions||{})}),this._index=new Zr,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=mh,this.addFields(this._options.fields)}add(n){const{extractField:i,tokenize:a,processTerm:s,fields:l,idField:c}=this._options,f=i(n,c);if(f==null)throw new Error(`MiniSearch: document does not have ID field "${c}"`);if(this._idToShortId.has(f))throw new Error(`MiniSearch: duplicate ID ${f}`);const d=this.addDocumentId(f);this.saveStoredFields(d,n);for(const g of l){const m=i(n,g);if(m==null)continue;const v=a(m.toString(),g),y=this._fieldIds[g],b=new Set(v).size;this.addFieldLength(d,y,this._documentCount-1,b);for(const x of v){const E=s(x,g);if(Array.isArray(E))for(const T of E)this.addTerm(y,d,T);else E&&this.addTerm(y,d,E)}}}addAll(n){for(const i of n)this.add(i)}addAllAsync(n,i={}){const{chunkSize:a=10}=i,s={chunk:[],promise:Promise.resolve()},{chunk:l,promise:c}=n.reduce(({chunk:f,promise:d},g,m)=>(f.push(g),(m+1)%a===0?{chunk:[],promise:d.then(()=>new Promise(v=>setTimeout(v,0))).then(()=>this.addAll(f))}:{chunk:f,promise:d}),s);return c.then(()=>this.addAll(l))}remove(n){const{tokenize:i,processTerm:a,extractField:s,fields:l,idField:c}=this._options,f=s(n,c);if(f==null)throw new Error(`MiniSearch: document does not have ID field "${c}"`);const d=this._idToShortId.get(f);if(d==null)throw new Error(`MiniSearch: cannot remove document with ID ${f}: it is not in the index`);for(const g of l){const m=s(n,g);if(m==null)continue;const v=i(m.toString(),g),y=this._fieldIds[g],b=new Set(v).size;this.removeFieldLength(d,y,this._documentCount,b);for(const x of v){const E=a(x,g);if(Array.isArray(E))for(const T of E)this.removeTerm(y,d,T);else E&&this.removeTerm(y,d,E)}}this._storedFields.delete(d),this._documentIds.delete(d),this._idToShortId.delete(f),this._fieldLength.delete(d),this._documentCount-=1}removeAll(n){if(n)for(const i of n)this.remove(i);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Zr,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(n){const i=this._idToShortId.get(n);if(i==null)throw new Error(`MiniSearch: cannot discard document with ID ${n}: it is not in the index`);this._idToShortId.delete(n),this._documentIds.delete(i),this._storedFields.delete(i),(this._fieldLength.get(i)||[]).forEach((a,s)=>{this.removeFieldLength(i,s,this._documentCount,a)}),this._fieldLength.delete(i),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:n,minDirtCount:i,batchSize:a,batchWait:s}=this._options.autoVacuum;this.conditionalVacuum({batchSize:a,batchWait:s},{minDirtCount:i,minDirtFactor:n})}discardAll(n){const i=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const a of n)this.discard(a)}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()}replace(n){const{idField:i,extractField:a}=this._options,s=a(n,i);this.discard(s),this.add(n)}vacuum(n={}){return this.conditionalVacuum(n)}conditionalVacuum(n,i){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&i,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const a=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=mh,this.performVacuuming(n,a)}),this._enqueuedVacuum)):this.vacuumConditionsMet(i)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(n),this._currentVacuum)}performVacuuming(n,i){return tu(this,void 0,void 0,function*(){const a=this._dirtCount;if(this.vacuumConditionsMet(i)){const s=n.batchSize||ph.batchSize,l=n.batchWait||ph.batchWait;let c=1;for(const[f,d]of this._index){for(const[g,m]of d)for(const[v]of m)this._documentIds.has(v)||(m.size<=1?d.delete(g):m.delete(v));this._index.get(f).size===0&&this._index.delete(f),c%s===0&&(yield new Promise(g=>setTimeout(g,l))),c+=1}this._dirtCount-=a}yield null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null})}vacuumConditionsMet(n){if(n==null)return!0;let{minDirtCount:i,minDirtFactor:a}=n;return i=i||Pd.minDirtCount,a=a||Pd.minDirtFactor,this.dirtCount>=i&&this.dirtFactor>=a}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(n){return this._idToShortId.has(n)}getStoredFields(n){const i=this._idToShortId.get(n);if(i!=null)return this._storedFields.get(i)}search(n,i={}){const{searchOptions:a}=this._options,s=Object.assign(Object.assign({},a),i),l=this.executeQuery(n,i),c=[];for(const[f,{score:d,terms:g,match:m}]of l){const v=g.length||1,y={id:this._documentIds.get(f),score:d*v,terms:Object.keys(m),queryTerms:g,match:m};Object.assign(y,this._storedFields.get(f)),(s.filter==null||s.filter(y))&&c.push(y)}return n===Kr.wildcard&&s.boostDocument==null||c.sort(r0),c}autoSuggest(n,i={}){i=Object.assign(Object.assign({},this._options.autoSuggestOptions),i);const a=new Map;for(const{score:l,terms:c}of this.search(n,i)){const f=c.join(" "),d=a.get(f);d!=null?(d.score+=l,d.count+=1):a.set(f,{score:l,terms:c,count:1})}const s=[];for(const[l,{score:c,terms:f,count:d}]of a)s.push({suggestion:l,terms:f,score:c/d});return s.sort(r0),s}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(n,i){if(i==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(n),i)}static loadJSONAsync(n,i){return tu(this,void 0,void 0,function*(){if(i==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(n),i)})}static getDefault(n){if(Hd.hasOwnProperty(n))return Fd(Hd,n);throw new Error(`MiniSearch: unknown option "${n}"`)}static loadJS(n,i){const{index:a,documentIds:s,fieldLength:l,storedFields:c,serializationVersion:f}=n,d=this.instantiateMiniSearch(n,i);d._documentIds=Fl(s),d._fieldLength=Fl(l),d._storedFields=Fl(c);for(const[g,m]of d._documentIds)d._idToShortId.set(m,g);for(const[g,m]of a){const v=new Map;for(const y of Object.keys(m)){let b=m[y];f===1&&(b=b.ds),v.set(parseInt(y,10),Fl(b))}d._index.set(g,v)}return d}static loadJSAsync(n,i){return tu(this,void 0,void 0,function*(){const{index:a,documentIds:s,fieldLength:l,storedFields:c,serializationVersion:f}=n,d=this.instantiateMiniSearch(n,i);d._documentIds=yield Hl(s),d._fieldLength=yield Hl(l),d._storedFields=yield Hl(c);for(const[m,v]of d._documentIds)d._idToShortId.set(v,m);let g=0;for(const[m,v]of a){const y=new Map;for(const b of Object.keys(v)){let x=v[b];f===1&&(x=x.ds),y.set(parseInt(b,10),yield Hl(x))}++g%1e3===0&&(yield k1(0)),d._index.set(m,y)}return d})}static instantiateMiniSearch(n,i){const{documentCount:a,nextId:s,fieldIds:l,averageFieldLength:c,dirtCount:f,serializationVersion:d}=n;if(d!==1&&d!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const g=new Kr(i);return g._documentCount=a,g._nextId=s,g._idToShortId=new Map,g._fieldIds=l,g._avgFieldLength=c,g._dirtCount=f||0,g._index=new Zr,g}executeQuery(n,i={}){if(n===Kr.wildcard)return this.executeWildcardQuery(i);if(typeof n!="string"){const y=Object.assign(Object.assign(Object.assign({},i),n),{queries:void 0}),b=n.queries.map(x=>this.executeQuery(x,y));return this.combineResults(b,y.combineWith)}const{tokenize:a,processTerm:s,searchOptions:l}=this._options,c=Object.assign(Object.assign({tokenize:a,processTerm:s},l),i),{tokenize:f,processTerm:d}=c,v=f(n).flatMap(y=>d(y)).filter(y=>!!y).map(tz(c)).map(y=>this.executeQuerySpec(y,c));return this.combineResults(v,c.combineWith)}executeQuerySpec(n,i){const a=Object.assign(Object.assign({},this._options.searchOptions),i),s=(a.fields||this._options.fields).reduce((E,T)=>Object.assign(Object.assign({},E),{[T]:Fd(a.boost,T)||1}),{}),{boostDocument:l,weights:c,maxFuzzy:f,bm25:d}=a,{fuzzy:g,prefix:m}=Object.assign(Object.assign({},t0.weights),c),v=this._index.get(n.term),y=this.termResults(n.term,n.term,1,n.termBoost,v,s,l,d);let b,x;if(n.prefix&&(b=this._index.atPrefix(n.term)),n.fuzzy){const E=n.fuzzy===!0?.2:n.fuzzy,T=E<1?Math.min(f,Math.round(n.term.length*E)):E;T&&(x=this._index.fuzzyGet(n.term,T))}if(b)for(const[E,T]of b){const M=E.length-n.term.length;if(!M)continue;x==null||x.delete(E);const N=m*E.length/(E.length+.3*M);this.termResults(n.term,E,N,n.termBoost,T,s,l,d,y)}if(x)for(const E of x.keys()){const[T,M]=x.get(E);if(!M)continue;const N=g*E.length/(E.length+M);this.termResults(n.term,E,N,n.termBoost,T,s,l,d,y)}return y}executeWildcardQuery(n){const i=new Map,a=Object.assign(Object.assign({},this._options.searchOptions),n);for(const[s,l]of this._documentIds){const c=a.boostDocument?a.boostDocument(l,"",this._storedFields.get(s)):1;i.set(s,{score:c,terms:[],match:{}})}return i}combineResults(n,i=fg){if(n.length===0)return new Map;const a=i.toLowerCase(),s=QN[a];if(!s)throw new Error(`Invalid combination operator: ${i}`);return n.reduce(s)||new Map}toJSON(){const n=[];for(const[i,a]of this._index){const s={};for(const[l,c]of a)s[l]=Object.fromEntries(c);n.push([i,s])}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:n,serializationVersion:2}}termResults(n,i,a,s,l,c,f,d,g=new Map){if(l==null)return g;for(const m of Object.keys(c)){const v=c[m],y=this._fieldIds[m],b=l.get(y);if(b==null)continue;let x=b.size;const E=this._avgFieldLength[y];for(const T of b.keys()){if(!this._documentIds.has(T)){this.removeTerm(y,T,i),x-=1;continue}const M=f?f(this._documentIds.get(T),i,this._storedFields.get(T)):1;if(!M)continue;const N=b.get(T),L=this._fieldLength.get(T)[y],C=ez(N,x,this._documentCount,L,E,d),R=a*s*v*M*C,B=g.get(T);if(B){B.score+=R,rz(B.terms,n);const _=Fd(B.match,i);_?_.push(m):B.match[i]=[m]}else g.set(T,{score:R,terms:[n],match:{[i]:[m]}})}}return g}addTerm(n,i,a){const s=this._index.fetch(a,i0);let l=s.get(n);if(l==null)l=new Map,l.set(i,1),s.set(n,l);else{const c=l.get(i);l.set(i,(c||0)+1)}}removeTerm(n,i,a){if(!this._index.has(a)){this.warnDocumentChanged(i,n,a);return}const s=this._index.fetch(a,i0),l=s.get(n);l==null||l.get(i)==null?this.warnDocumentChanged(i,n,a):l.get(i)<=1?l.size<=1?s.delete(n):l.delete(i):l.set(i,l.get(i)-1),this._index.get(a).size===0&&this._index.delete(a)}warnDocumentChanged(n,i,a){for(const s of Object.keys(this._fieldIds))if(this._fieldIds[s]===i){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(n)} has changed before removal: term "${a}" was not present in field "${s}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(n){const i=this._nextId;return this._idToShortId.set(n,i),this._documentIds.set(i,n),this._documentCount+=1,this._nextId+=1,i}addFields(n){for(let i=0;iObject.prototype.hasOwnProperty.call(r,n)?r[n]:void 0,QN={[fg]:(r,n)=>{for(const i of n.keys()){const a=r.get(i);if(a==null)r.set(i,n.get(i));else{const{score:s,terms:l,match:c}=n.get(i);a.score=a.score+s,a.match=Object.assign(a.match,c),n0(a.terms,l)}}return r},[O1]:(r,n)=>{const i=new Map;for(const a of n.keys()){const s=r.get(a);if(s==null)continue;const{score:l,terms:c,match:f}=n.get(a);n0(s.terms,c),i.set(a,{score:s.score+l,terms:s.terms,match:Object.assign(s.match,f)})}return i},[KN]:(r,n)=>{for(const i of n.keys())r.delete(i);return r}},JN={k:1.2,b:.7,d:.5},ez=(r,n,i,a,s,l)=>{const{k:c,b:f,d}=l;return Math.log(1+(i-n+.5)/(n+.5))*(d+r*(c+1)/(r+c*(1-f+f*a/s)))},tz=r=>(n,i,a)=>{const s=typeof r.fuzzy=="function"?r.fuzzy(n,i,a):r.fuzzy||!1,l=typeof r.prefix=="function"?r.prefix(n,i,a):r.prefix===!0,c=typeof r.boostTerm=="function"?r.boostTerm(n,i,a):1;return{term:n,fuzzy:s,prefix:l,termBoost:c}},Hd={idField:"id",extractField:(r,n)=>r[n],tokenize:r=>r.split(iz),processTerm:r=>r.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(r,n)=>{typeof(console==null?void 0:console[r])=="function"&&console[r](n)},autoVacuum:!0},t0={combineWith:fg,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:JN},nz={combineWith:O1,prefix:(r,n,i)=>n===i.length-1},ph={batchSize:1e3,batchWait:10},mh={minDirtFactor:.1,minDirtCount:20},Pd=Object.assign(Object.assign({},ph),mh),rz=(r,n)=>{r.includes(n)||r.push(n)},n0=(r,n)=>{for(const i of n)r.includes(i)||r.push(i)},r0=({score:r},{score:n})=>n-r,i0=()=>new Map,Fl=r=>{const n=new Map;for(const i of Object.keys(r))n.set(parseInt(i,10),r[i]);return n},Hl=r=>tu(void 0,void 0,void 0,function*(){const n=new Map;let i=0;for(const a of Object.keys(r))n.set(parseInt(a,10),r[a]),++i%1e3===0&&(yield k1(0));return n}),k1=r=>new Promise(n=>setTimeout(n,r)),iz=/[\n\r\p{Z}\p{P}]+/u,az={index:new Kr({fields:[]})};S.createContext(az);const vh=({label:r,color:n,hidden:i,labels:a={}})=>bt.createElement("div",{className:"node"},bt.createElement("span",{className:"render "+(i?"circle":"disc"),style:{backgroundColor:n||"#000"}}),bt.createElement("span",{className:`label ${i?"text-muted":""} ${r?"":"text-italic"}`},r||a.no_label||"No label")),oz=({id:r,labels:n})=>{const i=Sn(),a=S.useMemo(()=>{const s=i.getGraph().getNodeAttributes(r),l=i.getSetting("nodeReducer");return Object.assign(Object.assign({color:i.getSetting("defaultNodeColor")},s),l?l(r,s):{})},[i,r]);return bt.createElement(vh,Object.assign({},a,{labels:n}))},sz=({label:r,color:n,source:i,target:a,hidden:s,directed:l,labels:c={}})=>bt.createElement("div",{className:"edge"},bt.createElement(vh,Object.assign({},i,{labels:c})),bt.createElement("div",{className:"body"},bt.createElement("div",{className:"render"},bt.createElement("span",{className:s?"dotted":"dash",style:{borderColor:n||"#000"}})," ",l&&bt.createElement("span",{className:"arrow",style:{borderTopColor:n||"#000"}})),bt.createElement("span",{className:`label ${s?"text-muted":""} ${r?"":"fst-italic"}`},r||c.no_label||"No label")),bt.createElement(vh,Object.assign({},a,{labels:c}))),lz=({id:r,labels:n})=>{const i=Sn(),a=S.useMemo(()=>{const s=i.getGraph().getEdgeAttributes(r),l=i.getSetting("nodeReducer"),c=i.getSetting("edgeReducer"),f=i.getGraph().getNodeAttributes(i.getGraph().source(r)),d=i.getGraph().getNodeAttributes(i.getGraph().target(r));return Object.assign(Object.assign(Object.assign({color:i.getSetting("defaultEdgeColor"),directed:i.getGraph().isDirected(r)},s),c?c(r,s):{}),{source:Object.assign(Object.assign({color:i.getSetting("defaultNodeColor")},f),l?l(r,f):{}),target:Object.assign(Object.assign({color:i.getSetting("defaultNodeColor")},d),l?l(r,d):{})})},[i,r]);return bt.createElement(sz,Object.assign({},a,{labels:n}))};function L1(r,n){const[i,a]=S.useState(r);return S.useEffect(()=>{const s=setTimeout(()=>{a(r)},n);return()=>{clearTimeout(s)}},[r,n]),i}function uz({fetcher:r,preload:n,filterFn:i,renderOption:a,getOptionValue:s,notFound:l,loadingSkeleton:c,label:f,placeholder:d="Select...",value:g,onChange:m,onFocus:v,disabled:y=!1,className:b,noResultsMessage:x}){const[E,T]=S.useState(!1),[M,N]=S.useState(!1),[L,C]=S.useState([]),[R,B]=S.useState(!1),[_,$]=S.useState(null),[z,F]=S.useState(g),[Y,I]=S.useState(null),[j,J]=S.useState(""),ae=L1(j,n?0:150),[H,U]=S.useState([]);S.useEffect(()=>{T(!0),F(g)},[g]),S.useEffect(()=>{E||(async()=>{try{B(!0),$(null);const P=g!==null?await r(g):[];U(P),C(P)}catch(P){$(P instanceof Error?P.message:"Failed to fetch options")}finally{B(!1)}})()},[E,r,g]),S.useEffect(()=>{const G=async()=>{try{B(!0),$(null);const P=await r(ae);U(P),C(P)}catch(P){$(P instanceof Error?P.message:"Failed to fetch options")}finally{B(!1)}};E&&n?n&&C(ae?H.filter(P=>i?i(P,ae):!0):H):G()},[r,ae,E,n,i]);const D=S.useCallback(G=>{G!==z&&(F(G),m(G)),N(!1)},[z,F,N,m]),se=S.useCallback(G=>{G!==Y&&(I(G),v(G))},[Y,I,v]);return A.jsx("div",{className:Xe(y&&"cursor-not-allowed opacity-50",b),onFocus:()=>{N(!0)},onBlur:()=>N(!1),children:A.jsxs(Du,{shouldFilter:!1,className:"bg-transparent",children:[A.jsxs("div",{children:[A.jsx(sg,{placeholder:d,value:j,className:"max-h-8",onValueChange:G=>{J(G),G&&!M&&N(!0)}}),R&&L.length>0&&A.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:A.jsx(C0,{className:"h-4 w-4 animate-spin"})})]}),A.jsxs(Ou,{className:"max-h-auto",hidden:!M||ae.length===0,children:[_&&A.jsx("div",{className:"text-destructive p-4 text-center",children:_}),R&&L.length===0&&(c||A.jsx(cz,{})),!R&&!_&&L.length===0&&(l||A.jsx(lg,{children:x??`No ${f.toLowerCase()} found.`})),A.jsx($a,{children:L.map((G,P)=>A.jsxs(A.Fragment,{children:[A.jsx(qa,{value:s(G),onSelect:D,onMouseEnter:()=>se(s(G)),className:"truncate",children:a(G)},s(G)+`${P}`),P!==L.length-1&&A.jsx("div",{className:"bg-foreground/10 h-[1px]"},P)]}))})]})]})})}function cz(){return A.jsx($a,{children:A.jsx(qa,{disabled:!0,children:A.jsxs("div",{className:"flex w-full items-center gap-2",children:[A.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),A.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[A.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),A.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}function fz(r){return A.jsxs("div",{children:[r.type==="nodes"&&A.jsx(oz,{id:r.id}),r.type==="edges"&&A.jsx(lz,{id:r.id}),r.type==="message"&&A.jsx("div",{children:r.message})]})}const $d="__message_item",Pl={graph:null,searchEngine:null},dz=({onChange:r,onFocus:n,value:i})=>{const a=Ye.use.sigmaGraph(),s=S.useMemo(()=>{if(Pl.graph==a)return Pl.searchEngine;if(!a||a.nodes().length==0)return;Pl.graph=a;const c=new Kr({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),f=a.nodes().map(d=>({id:d,label:a.getNodeAttribute(d,"label")}));return c.addAll(f),Pl.searchEngine=c,c},[a]),l=S.useCallback(async c=>{if(n&&n(null),!c||!s)return[];const f=s.search(c).map(d=>({id:d.id,type:"nodes"}));return f.length<=qf?f:[...f.slice(0,qf),{type:"message",id:$d,message:`And ${f.length-qf} others`}]},[s,n]);return A.jsx(uz,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:l,renderOption:fz,getOptionValue:c=>c.id,value:i&&i.type!=="message"?i.id:null,onChange:c=>{c!==$d&&r(c?{id:c,type:"nodes"}:null)},onFocus:c=>{c!==$d&&n&&n(c?{id:c,type:"nodes"}:null)},label:"item",placeholder:"Search nodes..."})},hz=({...r})=>A.jsx(dz,{...r});function gz({fetcher:r,preload:n,filterFn:i,renderOption:a,getOptionValue:s,getDisplayValue:l,notFound:c,loadingSkeleton:f,label:d,placeholder:g="Select...",value:m,onChange:v,disabled:y=!1,className:b,triggerClassName:x,searchInputClassName:E,noResultsMessage:T,triggerTooltip:M,clearable:N=!0}){const[L,C]=S.useState(!1),[R,B]=S.useState(!1),[_,$]=S.useState([]),[z,F]=S.useState(!1),[Y,I]=S.useState(null),[j,J]=S.useState(m),[ae,H]=S.useState(null),[U,D]=S.useState(""),se=L1(U,n?0:150),[G,P]=S.useState([]);S.useEffect(()=>{C(!0),J(m)},[m]),S.useEffect(()=>{if(m&&_.length>0){const V=_.find(Q=>s(Q)===m);V&&H(V)}},[m,_,s]),S.useEffect(()=>{L||(async()=>{try{F(!0),I(null);const Q=await r(m);P(Q),$(Q)}catch(Q){I(Q instanceof Error?Q.message:"Failed to fetch options")}finally{F(!1)}})()},[L,r,m]),S.useEffect(()=>{const V=async()=>{try{F(!0),I(null);const Q=await r(se);P(Q),$(Q)}catch(Q){I(Q instanceof Error?Q.message:"Failed to fetch options")}finally{F(!1)}};L&&n?n&&$(se?G.filter(Q=>i?i(Q,se):!0):G):V()},[r,se,L,n,i]);const k=S.useCallback(V=>{const Q=N&&V===j?"":V;J(Q),H(_.find(re=>s(re)===Q)||null),v(Q),B(!1)},[j,v,N,_,s]);return A.jsxs(wu,{open:R,onOpenChange:B,children:[A.jsx(Eu,{asChild:!0,children:A.jsxs(an,{variant:"outline",role:"combobox","aria-expanded":R,className:Xe("justify-between",y&&"cursor-not-allowed opacity-50",x),disabled:y,tooltip:M,side:"bottom",children:[ae?l(ae):g,A.jsx(CT,{className:"opacity-50",size:10})]})}),A.jsx(ss,{className:Xe("p-0",b),onCloseAutoFocus:V=>V.preventDefault(),children:A.jsxs(Du,{shouldFilter:!1,children:[A.jsxs("div",{className:"relative w-full border-b",children:[A.jsx(sg,{placeholder:`Search ${d.toLowerCase()}...`,value:U,onValueChange:V=>{D(V)},className:E}),z&&_.length>0&&A.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:A.jsx(C0,{className:"h-4 w-4 animate-spin"})})]}),A.jsxs(Ou,{children:[Y&&A.jsx("div",{className:"text-destructive p-4 text-center",children:Y}),z&&_.length===0&&(f||A.jsx(pz,{})),!z&&!Y&&_.length===0&&(c||A.jsx(lg,{children:T??`No ${d.toLowerCase()} found.`})),A.jsx($a,{children:_.map(V=>A.jsxs(qa,{value:s(V),onSelect:k,className:"truncate",children:[a(V),A.jsx(T0,{className:Xe("ml-auto h-3 w-3",j===s(V)?"opacity-100":"opacity-0")})]},s(V)))})]})]})})]})}function pz(){return A.jsx($a,{children:A.jsx(qa,{disabled:!0,children:A.jsxs("div",{className:"flex w-full items-center gap-2",children:[A.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),A.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[A.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),A.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const mz=()=>{const r=Pe.use.queryLabel(),[n,i]=S.useState({labels:[],searchEngine:null}),[a,s]=S.useState(!1),l=S.useCallback(async f=>{let d=n.labels,g=n.searchEngine;if(!a||!g){d=["*"].concat(await yT()),d.includes(Pe.getState().queryLabel)||Pe.getState().setQueryLabel(d[0]),g=new Kr({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}});const m=d.map((v,y)=>({id:y,value:v}));g.addAll(m),i({labels:d,searchEngine:g}),s(!0)}return f?g.search(f).map(m=>d[m.id]):d},[n,a,i,s]),c=S.useCallback(f=>{Pe.getState().setQueryLabel(f)},[]);return A.jsx(gz,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:"Select query label",fetcher:l,renderOption:f=>A.jsx("div",{children:f}),getOptionValue:f=>f,getDisplayValue:f=>A.jsx("div",{children:f}),notFound:A.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:"Label",placeholder:"Search labels...",value:r!==null?r:"",onChange:c})},vz=({text:r,className:n,tooltipClassName:i,tooltip:a,side:s,onClick:l})=>a?A.jsx(BE,{delayDuration:200,children:A.jsxs(FE,{children:[A.jsx(HE,{asChild:!0,children:A.jsx("label",{className:Xe(n,l!==void 0?"cursor-pointer":void 0),onClick:l,children:r})}),A.jsx(Qh,{side:s,className:i,children:a})]})}):A.jsx("label",{className:Xe(n,l!==void 0?"cursor-pointer":void 0),onClick:l,children:r}),yz=()=>{const{getNode:r,getEdge:n}=g1(),i=Ye.use.selectedNode(),a=Ye.use.focusedNode(),s=Ye.use.selectedEdge(),l=Ye.use.focusedEdge(),[c,f]=S.useState(null),[d,g]=S.useState(null);return S.useEffect(()=>{let m=null,v=null;a?(m="node",v=r(a)):i?(m="node",v=r(i)):l?(m="edge",v=n(l,!0)):s&&(m="edge",v=n(s,!0)),v?(m=="node"?f(bz(v)):f(wz(v)),g(m)):(f(null),g(null))},[a,i,l,s,f,g,r,n]),c?A.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:d=="node"?A.jsx(Ez,{node:c}):A.jsx(Sz,{edge:c})}):A.jsx(A.Fragment,{})},bz=r=>{const n=Ye.getState(),i=[];if(n.sigmaGraph&&n.rawGraph)for(const a of n.sigmaGraph.edges(r.id)){const s=n.rawGraph.getEdge(a,!0);if(s){const l=r.id===s.source,c=l?s.target:s.source,f=n.rawGraph.getNode(c);f&&i.push({type:l?"Target":"Source",id:c,label:f.labels.join(", ")})}}return{...r,relationships:i}},wz=r=>{var s,l;const n=Ye.getState(),i=(s=n.rawGraph)==null?void 0:s.getNode(r.source),a=(l=n.rawGraph)==null?void 0:l.getNode(r.target);return{...r,sourceNode:i,targetNode:a}},$n=({name:r,value:n,onClick:i,tooltip:a})=>A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("label",{className:"text-primary/60 tracking-wide",children:r}),":",A.jsx(vz,{className:"hover:bg-primary/20 rounded p-1 text-ellipsis",tooltipClassName:"max-w-80",text:n,tooltip:a||n,side:"left",onClick:i})]}),Ez=({node:r})=>A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-sky-300",children:"Node"}),A.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[A.jsx($n,{name:"Id",value:r.id}),A.jsx($n,{name:"Labels",value:r.labels.join(", "),onClick:()=>{Ye.getState().setSelectedNode(r.id,!0)}}),A.jsx($n,{name:"Degree",value:r.degree})]}),A.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-yellow-400/90",children:"Properties"}),A.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(r.properties).sort().map(n=>A.jsx($n,{name:n,value:r.properties[n]},n))}),r.relationships.length>0&&A.jsxs(A.Fragment,{children:[A.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-teal-600/90",children:"Relationships"}),A.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:r.relationships.map(({type:n,id:i,label:a})=>A.jsx($n,{name:n,value:a,onClick:()=>{Ye.getState().setSelectedNode(i,!0)}},i))})]})]}),Sz=({edge:r})=>A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-teal-600",children:"Relationship"}),A.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[A.jsx($n,{name:"Id",value:r.id}),A.jsx($n,{name:"Type",value:r.type}),A.jsx($n,{name:"Source",value:r.sourceNode?r.sourceNode.labels.join(", "):r.source,onClick:()=>{Ye.getState().setSelectedNode(r.source,!0)}}),A.jsx($n,{name:"Target",value:r.targetNode?r.targetNode.labels.join(", "):r.target,onClick:()=>{Ye.getState().setSelectedNode(r.target,!0)}})]}),A.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-yellow-400/90",children:"Properties"}),A.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(r.properties).sort().map(n=>A.jsx($n,{name:n,value:r.properties[n]},n))})]}),a0={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:Qw,curvedArrow:uk,curvedNoArrow:lk},nodeProgramClasses:{default:VO,circel:us,point:bO},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},xz=()=>{const r=oE(),n=Sn(),[i,a]=S.useState(null);return S.useEffect(()=>{r({downNode:s=>{a(s.node),n.getGraph().setNodeAttribute(s.node,"highlighted",!0)},mousemovebody:s=>{if(!i)return;const l=n.viewportToGraph(s);n.getGraph().setNodeAttribute(i,"x",l.x),n.getGraph().setNodeAttribute(i,"y",l.y),s.preventSigmaDefault(),s.original.preventDefault(),s.original.stopPropagation()},mouseup:()=>{i&&(a(null),n.getGraph().removeNodeAttribute(i,"highlighted"))},mousedown:()=>{n.getCustomBBox()||n.setCustomBBox(n.getBBox())}})},[r,n,i]),null},_z=()=>{const[r,n]=S.useState(a0),i=Ye.use.selectedNode(),a=Ye.use.focusedNode(),s=Ye.use.moveToSelectedNode(),l=Pe.use.showPropertyPanel(),c=Pe.use.showNodeSearchBar(),f=Pe.use.showNodeLabel(),d=Pe.use.enableEdgeEvents(),g=Pe.use.enableNodeDrag(),m=Pe.use.showEdgeLabel();S.useEffect(()=>{n({...a0,enableEdgeEvents:d,renderEdgeLabels:m,renderLabels:f})},[f,d,m]);const v=S.useCallback(E=>{E===null?Ye.getState().setFocusedNode(null):E.type==="nodes"&&Ye.getState().setFocusedNode(E.id)},[]),y=S.useCallback(E=>{E===null?Ye.getState().setSelectedNode(null):E.type==="nodes"&&Ye.getState().setSelectedNode(E.id,!0)},[]),b=S.useMemo(()=>a??i,[a,i]),x=S.useMemo(()=>i?{type:"nodes",id:i}:null,[i]);return A.jsxs(hO,{settings:r,className:"!bg-background !size-full overflow-hidden",children:[A.jsx(zN,{}),g&&A.jsx(xz,{}),A.jsx(dk,{node:b,move:s}),A.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[A.jsx(mz,{}),c&&A.jsx(hz,{value:x,onFocus:v,onChange:y})]}),A.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[A.jsx(YN,{}),A.jsx(MN,{}),A.jsx(cN,{}),A.jsx(jN,{}),A.jsx(GN,{})]}),l&&A.jsx("div",{className:"absolute top-2 right-2",children:A.jsx(yz,{})})]})};function Tz(){const r=kn.use.message(),n=Pe.use.enableHealthCheck();return S.useEffect(()=>{if(!n)return;kn.getState().check();const i=setInterval(async()=>{await kn.getState().check()},fT*1e3);return()=>clearInterval(i)},[n]),A.jsxs(gT,{children:[A.jsx("div",{className:"h-screen w-screen",children:A.jsx(_z,{})}),n&&A.jsx(MA,{}),r!==null&&A.jsx(nC,{})]})}s_.createRoot(document.getElementById("root")).render(A.jsx(S.StrictMode,{children:A.jsx(Tz,{})}));