@cotal-ai/web 0.163.4 → 0.163.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{AgentPage-BO-a5SVf.js → AgentPage-OQYeLRkK.js} +1 -1
- package/dist/web/assets/{controller-BaMk71YT.js → controller-BJZKC9Sf.js} +1 -1
- package/dist/web/assets/{index-BebiP5PA.js → index-C1HUdk9w.js} +3 -3
- package/dist/web/assets/{index-BBa-4iuW.css → index-CNIubIs4.css} +1 -1
- package/dist/web/index.html +3 -3
- package/dist/web.js +1 -1
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentPage-
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{$ as n,$n as r,A as i,An as a,Ar as o,At as s,B as c,Bn as l,Bt as u,Cn as d,Cr as f,Ct as p,D as m,Dn as h,Dr as g,Dt as _,E as v,En as y,Er as b,Et as x,F as S,Fn as ee,Fr as te,Ft as C,G as ne,Gn as w,Gt as T,H as re,Hn as ie,Ht as E,I as ae,In as oe,Ir as se,It as ce,J as le,Jn as ue,Jt as de,K as fe,Kn as pe,Kt as me,L as he,Ln as ge,Lt as _e,M as ve,Mn as ye,Mr as be,Mt as xe,N as Se,Nn as D,Nr as O,Nt as Ce,O as we,On as Te,Or as Ee,Ot as De,P as k,Pn as Oe,Pt as ke,Q as Ae,Qn as je,Qt as Me,R as Ne,Rn as Pe,Rt as Fe,S as Ie,Sn as Le,Sr as Re,St as ze,T as Be,Tn as Ve,Tr as He,Tt as Ue,U as We,Un as Ge,Ut as Ke,V as qe,Vn as Je,Vt as Ye,W as Xe,Wn as Ze,Wt as Qe,X as $e,Xn as et,Xt as tt,Yn as nt,Yt as rt,Z as it,Zn as at,_ as ot,_n as st,_t as ct,an as lt,ar as ut,at as dt,b as ft,bn as pt,br as mt,bt as ht,c as gt,cr as _t,ct as vt,d as yt,dn as bt,dr as xt,dt as St,en as Ct,er as A,et as wt,f as Tt,fn as Et,fr as Dt,ft as Ot,g as kt,gn as At,gr as jt,gt as Mt,h as Nt,hn as Pt,hr as Ft,ht as It,i as Lt,ir as Rt,it as zt,j as Bt,jn as Vt,jr as Ht,jt as Ut,k as Wt,kn as Gt,kr as Kt,kt as qt,l as Jt,ln as Yt,lr as Xt,lt as Zt,m as Qt,mn as j,mr as $t,n as en,nn as tn,nr as nn,nt as rn,on as an,or as on,ot as sn,p as cn,pn as ln,pr as un,q as dn,qn as fn,qt as pn,r as mn,rr as hn,rt as gn,s as _n,sn as vn,sr as yn,st as bn,tn as xn,tr as M,tt as Sn,u as Cn,ur as wn,ut as Tn,v as En,vn as Dn,vr as On,vt as kn,w as An,wn as jn,wt as Mn,x as Nn,xn as Pn,xr as Fn,xt as N,y as In,yn as Ln,yt as Rn,z as zn,zn as Bn,zt as Vn}from"./controller-BaMk71YT.js";var Hn=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,T());else{var t=n(l);t!==null&&E(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,C=-1;function ne(){return g?!0:!(e.unstable_now()-C<te)}function w(){if(g=!1,S){var t=e.unstable_now();C=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&E(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?T():S=!1}}}var T;if(typeof y==`function`)T=function(){y(w)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=w,T=function(){ie.postMessage(null)}}else T=function(){_(w,0)};function E(t,n){ee=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,E(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,T()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Un=t(((e,t)=>{t.exports=Hn()})),Wn=t((e=>{var t=Un(),n=se(),r=te();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var C=Object.assign,ne=Symbol.for(`react.element`),w=Symbol.for(`react.transitional.element`),T=Symbol.for(`react.portal`),re=Symbol.for(`react.fragment`),ie=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),fe=Symbol.for(`react.lazy`),pe=Symbol.for(`react.activity`),me=Symbol.for(`react.legacy_hidden`),he=Symbol.for(`react.memo_cache_sentinel`),ge=Symbol.for(`react.view_transition`),_e=Symbol.for(`react.recoverable`),ve=Symbol.iterator;function ye(e){return typeof e!=`object`||!e?null:(e=ve&&e[ve]||e[`@@iterator`],typeof e==`function`?e:null)}var be=Symbol.for(`react.client.reference`);function xe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case re:return`Fragment`;case E:return`Profiler`;case ie:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case pe:return`Activity`;case ge:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case T:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?xe(e.type)||`Memo`:t;case fe:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var Se=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},we=[],Te=-1;function Ee(e){return{current:e}}function De(e){0>Te||(e.current=we[Te],we[Te]=null,Te--)}function k(e,t){Te++,we[Te]=e.current,e.current=t}var Oe=Ee(null),ke=Ee(null),Ae=Ee(null),je=Ee(null);function Me(e,t){switch(k(Ae,t),k(ke,e),k(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(Oe),k(Oe,e)}function Ne(){De(Oe),De(ke),De(Ae)}function Pe(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(je,e)),t=Oe.current;var n=dp(t,e.type);t!==n&&(k(ke,e),k(Oe,n))}function Fe(e){ke.current===e&&(De(Oe),De(ke)),je.current===e&&(De(je),sh._currentValue=Ce)}var Ie,Le;function Re(e){if(Ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||``,Le=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentPage-OQYeLRkK.js","assets/rolldown-runtime-XKyaHtl9.js","assets/controller-BJZKC9Sf.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{$ as n,$n as r,A as i,An as a,Ar as o,At as s,B as c,Bn as l,Bt as u,Cn as d,Cr as f,Ct as p,D as m,Dn as h,Dr as g,Dt as _,E as v,En as y,Er as b,Et as x,F as S,Fn as ee,Fr as te,Ft as C,G as ne,Gn as w,Gt as T,H as re,Hn as ie,Ht as E,I as ae,In as oe,Ir as se,It as ce,J as le,Jn as ue,Jt as de,K as fe,Kn as pe,Kt as me,L as he,Ln as ge,Lt as _e,M as ve,Mn as ye,Mr as be,Mt as xe,N as Se,Nn as D,Nr as O,Nt as Ce,O as we,On as Te,Or as Ee,Ot as De,P as k,Pn as Oe,Pt as ke,Q as Ae,Qn as je,Qt as Me,R as Ne,Rn as Pe,Rt as Fe,S as Ie,Sn as Le,Sr as Re,St as ze,T as Be,Tn as Ve,Tr as He,Tt as Ue,U as We,Un as Ge,Ut as Ke,V as qe,Vn as Je,Vt as Ye,W as Xe,Wn as Ze,Wt as Qe,X as $e,Xn as et,Xt as tt,Yn as nt,Yt as rt,Z as it,Zn as at,_ as ot,_n as st,_t as ct,an as lt,ar as ut,at as dt,b as ft,bn as pt,br as mt,bt as ht,c as gt,cr as _t,ct as vt,d as yt,dn as bt,dr as xt,dt as St,en as Ct,er as A,et as wt,f as Tt,fn as Et,fr as Dt,ft as Ot,g as kt,gn as At,gr as jt,gt as Mt,h as Nt,hn as Pt,hr as Ft,ht as It,i as Lt,ir as Rt,it as zt,j as Bt,jn as Vt,jr as Ht,jt as Ut,k as Wt,kn as Gt,kr as Kt,kt as qt,l as Jt,ln as Yt,lr as Xt,lt as Zt,m as Qt,mn as j,mr as $t,n as en,nn as tn,nr as nn,nt as rn,on as an,or as on,ot as sn,p as cn,pn as ln,pr as un,q as dn,qn as fn,qt as pn,r as mn,rr as hn,rt as gn,s as _n,sn as vn,sr as yn,st as bn,tn as xn,tr as M,tt as Sn,u as Cn,ur as wn,ut as Tn,v as En,vn as Dn,vr as On,vt as kn,w as An,wn as jn,wt as Mn,x as Nn,xn as Pn,xr as Fn,xt as N,y as In,yn as Ln,yt as Rn,z as zn,zn as Bn,zt as Vn}from"./controller-BJZKC9Sf.js";var Hn=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,T());else{var t=n(l);t!==null&&E(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,C=-1;function ne(){return g?!0:!(e.unstable_now()-C<te)}function w(){if(g=!1,S){var t=e.unstable_now();C=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&E(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?T():S=!1}}}var T;if(typeof y==`function`)T=function(){y(w)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=w,T=function(){ie.postMessage(null)}}else T=function(){_(w,0)};function E(t,n){ee=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,E(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,T()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Un=t(((e,t)=>{t.exports=Hn()})),Wn=t((e=>{var t=Un(),n=se(),r=te();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var C=Object.assign,ne=Symbol.for(`react.element`),w=Symbol.for(`react.transitional.element`),T=Symbol.for(`react.portal`),re=Symbol.for(`react.fragment`),ie=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),fe=Symbol.for(`react.lazy`),pe=Symbol.for(`react.activity`),me=Symbol.for(`react.legacy_hidden`),he=Symbol.for(`react.memo_cache_sentinel`),ge=Symbol.for(`react.view_transition`),_e=Symbol.for(`react.recoverable`),ve=Symbol.iterator;function ye(e){return typeof e!=`object`||!e?null:(e=ve&&e[ve]||e[`@@iterator`],typeof e==`function`?e:null)}var be=Symbol.for(`react.client.reference`);function xe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case re:return`Fragment`;case E:return`Profiler`;case ie:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case pe:return`Activity`;case ge:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case T:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?xe(e.type)||`Memo`:t;case fe:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var Se=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},we=[],Te=-1;function Ee(e){return{current:e}}function De(e){0>Te||(e.current=we[Te],we[Te]=null,Te--)}function k(e,t){Te++,we[Te]=e.current,e.current=t}var Oe=Ee(null),ke=Ee(null),Ae=Ee(null),je=Ee(null);function Me(e,t){switch(k(Ae,t),k(ke,e),k(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(Oe),k(Oe,e)}function Ne(){De(Oe),De(ke),De(Ae)}function Pe(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(je,e)),t=Oe.current;var n=dp(t,e.type);t!==n&&(k(ke,e),k(Oe,n))}function Fe(e){ke.current===e&&(De(Oe),De(ke)),je.current===e&&(De(je),sh._currentValue=Ce)}var Ie,Le;function Re(e){if(Ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||``,Le=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ie+e+Le}var ze=!1;function Be(e,t){if(!e||ze)return``;ze=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -11,4 +11,4 @@ Error generating stack: `+e.message+`
|
|
|
11
11
|
`);e.push(t+i[0]);for(let t=1;t<i.length;t+=1)e.push(n+i[t])}function or(e,t,n,r,i,a){let o=t.get(n);o!==void 0&&o.length>0&&ar(e,r,i,o+(a||``)),t.delete(n)}function sr(e){let t=[],n=new Map,r=new Map,i=new Map,a=new Map;for(let o of e){let e=o,s=typeof e==`object`&&e?ir(e.type):void 0;switch(s){case`RUN_STARTED`:ar(t,`▸ `,$n,`run ${ir(e.runId)??`?`} started`);break;case`RUN_FINISHED`:{let n=ir(e.outcome?.type);ar(t,`◂ `,$n,`run ${ir(e.runId)??`?`} finished${n?` (${n})`:``}`);break}case`RUN_ERROR`:{let n=ir(e.code);ar(t,`✗ `,$n,`run error${n?` [${n}]`:``}: ${ir(e.message)??`(no message)`}`);break}case`TEXT_MESSAGE_START`:n.set(ir(e.messageId)??``,``);break;case`TEXT_MESSAGE_CONTENT`:{let t=ir(e.messageId)??``;n.set(t,(n.get(t)??``)+(ir(e.delta)??``));break}case`TEXT_MESSAGE_END`:or(t,n,ir(e.messageId)??``,er,er);break;case`REASONING_MESSAGE_START`:r.set(ir(e.messageId)??``,``);break;case`REASONING_MESSAGE_CONTENT`:{let t=ir(e.messageId)??``;r.set(t,(r.get(t)??``)+(ir(e.delta)??``));break}case`REASONING_MESSAGE_END`:or(t,r,ir(e.messageId)??``,tr,$n);break;case`TOOL_CALL_START`:{let t=ir(e.toolCallId)??``;i.set(t,ir(e.toolCallName)??`?`),a.set(t,``);break}case`TOOL_CALL_ARGS`:{let t=ir(e.toolCallId)??``;a.set(t,(a.get(t)??``)+(ir(e.delta)??``));break}case`TOOL_CALL_END`:{let n=ir(e.toolCallId)??``;ar(t,nr,$n,`${i.get(n)??`?`}(${a.get(n)??``})`),i.delete(n),a.delete(n);break}case`TOOL_CALL_RESULT`:ar(t,rr,$n,ir(e.content)??`(no content)`);break;case`CUSTOM`:{let n=f(e);n===void 0?ar(t,`• `,$n,`custom ${ir(e.name)??`(unnamed)`}`):ar(t,rr,$n,n.isError?`failed`:`done`);break}default:ar(t,`• `,$n,`unrecognised event ${JSON.stringify(s===void 0?null:s)}`)}}for(let e of[...n.keys()])or(t,n,e,er,er,` …`);for(let e of[...r.keys()])or(t,r,e,tr,$n,` …`);for(let e of[...i.keys()])ar(t,nr,$n,`${i.get(e)??`?`}(${a.get(e)??``}) …`);return t}function cr(e){let t=e;if(typeof t!=`object`||!t||t.kind!==Qn)return`[not an AG-UI frame]`;let n=t.events;if(!Array.isArray(n)||n.length===0)return`[AG-UI frame carrying no events]`;let r=sr(n);return r.length>0?r.join(`
|
|
12
12
|
`):`[AG-UI frame with ${n.length} event(s) and nothing to show]`}He(Qn,cr);function lr(e=1e3,t){if(!Number.isFinite(e)||e<=0)throw Error(`createRate needs a positive number of ms, got ${e}`);if(t!==void 0&&!Number.isFinite(t))throw Error(`createRate needs a finite start time, got ${t}`);let n=n=>t===void 0?e:Math.min(e,Math.max(n-t,1e3)),r=[];return{hit(e){if(!Number.isFinite(e))return;let t=r.length>0&&e<r[r.length-1];r.push(e),t&&r.sort((e,t)=>e-t),r.length>1e4&&r.shift()},perSecond(t){let i=t-e,a=0;for(;a<r.length&&r[a]<=i;)a++;a>0&&(r=r.slice(a));let o=0;for(let e of r)e<=t&&o++;return o*1e3/n(t)}}}function ur(e){let t=g(e);return{hidden:!t,text:t,title:e.map(e=>`${e.name}: ${e.reason}`).join(`
|
|
13
13
|
`)}}var dr=e=>String(e).padStart(2,`0`),fr=e=>{let t=new Date(e);return`${dr(t.getHours())}:${dr(t.getMinutes())}`},pr=e=>`${fr(e)}:${dr(new Date(e).getSeconds())}`;function mr(e){let t=[],n=e.filter(e=>e.kind!==`partial`&&e.name!==`roster`);if(n.length){let e=n.map(e=>e.lastRead).filter(e=>typeof e==`number`&&Number.isFinite(e));t.push(e.length?`Showing what we last read at ${fr(Math.min(...e))}. Retrying.`:`Retrying.`)}let r=e.find(e=>e.kind!==`partial`&&e.name===`roster`);r?.since!==void 0&&Number.isFinite(r.since)&&t.push(`No presence updates since ${pr(r.since)}. Showing the last roster we heard.`);for(let n of e)n.kind===`partial`&&n.read!==void 0&&n.of!==void 0&&t.push(`${n.read} of ${n.of} sources answered`);return t}var hr={"direct messages":`Direct messages didn't load in time, so this page shows channel messages only.`,chat:`Channel messages didn't load in time, so this page shows direct messages only.`};function gr(e){let t=e.find(e=>e.kind===`partial`&&e.name===`activity`);if(!t)return;let n=t.missing??[];return{label:`partial: ${t.name}`,count:t.read!==void 0&&t.of!==void 0?`${t.read} of ${t.of} sources answered`:void 0,body:n.length===1&&Object.hasOwn(hr,n[0])?hr[n[0]]:void 0,title:t.reason}}function _r(e){let t=e.filter(e=>e.type===`gap`),n=e.filter(e=>e.type===`boundary-hole`),r=e.filter(e=>e.type===`prefix-incomplete`),i=e.filter(e=>e.type===`backfill-failed`),a=[];if(t.length){let e=t.reduce((e,t)=>e+(t.missing||0),0);a.push(`${e} event frame${e===1?``:`s`} missing (${t.length} break${t.length===1?``:`s`} in the stream)`)}if(n.length&&a.push(`${n.length} possible ordering race${n.length===1?``:`s`} at start-up, unconfirmed`),r.length&&a.push(`${r.length} stream${r.length===1?``:`s`} joined after the start, earlier frames not retained`),i.length&&a.push(`history unavailable, so ordering is based on live frames only`),a.length)return{text:a.join(` · `),fault:t.length>0}}function vr(e){return e===null?`Cotal`:`Cotal · ${e}`}function yr(e){return`${Math.round(e*10)/10} msg/s`}function br(e){return e.view===`channel`?e.channel:null}function xr(e,t){e?.open(t).catch(e=>console.error(`opening a channel failed:`,e))}var F=et(),Sr=Object.defineProperty,Cr=(e,t)=>Sr(e,`name`,{value:t,configurable:!0}),[wr,Tr]=fn(`AlertDialog`,[a]),Er=a(),Dr=Cr(e=>{let{__scopeAlertDialog:t,...n}=e,r=Er(t);return(0,F.jsx)(Le,{...r,...n,modal:!0})},`AlertDialog`),Or=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Er(n);return(0,F.jsx)(Gt,{...i,...r,ref:t})},`AlertDialogTrigger`)),kr=Cr(e=>{let{__scopeAlertDialog:t,...n}=e,r=Er(t);return(0,F.jsx)(h,{...r,...n})},`AlertDialogPortal`),Ar=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Er(n);return(0,F.jsx)(y,{...i,...r,ref:t})},`AlertDialogOverlay`)),[jr,Mr]=wr(`AlertDialogContent`),Nr=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,children:i,...a}=e,o=Er(n),s=P.useRef(null),c=r(t,s),l=P.useRef(null);return(0,F.jsx)(jr,{scope:n,cancelRef:l,children:(0,F.jsx)(jn,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:w(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:i})})},`AlertDialogContent`)),Pr=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Er(n);return(0,F.jsx)(Te,{...i,...r,ref:t})},`AlertDialogTitle`)),Fr=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Er(n);return(0,F.jsx)(Ve,{...i,...r,ref:t})},`AlertDialogDescription`)),Ir=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Er(n);return(0,F.jsx)(d,{...i,...r,ref:t})},`AlertDialogAction`)),Lr=`AlertDialogCancel`,Rr=P.forwardRef(Cr(function(e,t){let{__scopeAlertDialog:n,...i}=e,{cancelRef:a}=Mr(Lr,n),o=Er(n),s=r(t,a);return(0,F.jsx)(d,{...o,...i,ref:s})},`AlertDialogCancel`)),zr=Object.defineProperty,I=(e,t)=>zr(e,`name`,{value:t,configurable:!0}),Br=[`Enter`,` `],Vr=[`ArrowDown`,`PageUp`,`Home`],Hr=[`ArrowUp`,`PageDown`,`End`],Ur=[...Vr,...Hr];[...Br],[...Br];var Wr=`Menu`,[Gr,Kr,qr]=pe(Wr),[Jr,Yr]=fn(Wr,[qr,Pn,st]),Xr=Pn(),Zr=st(),[Qr,$r]=Jr(Wr),[ei,ti]=Jr(Wr),ni=I(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xr(t),[c,u]=P.useState(null),d=P.useRef(!1),f=l(a),p=Je(i);return P.useEffect(()=>{let e=I(()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=I(()=>d.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),P.useEffect(()=>{if(!n)return;let e=I(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,F.jsx)(Dn,{...s,children:(0,F.jsx)(Qr,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:(0,F.jsx)(ei,{scope:t,onClose:P.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})},`Menu`),ri=P.forwardRef(I(function(e,t){let{__scopeMenu:n,...r}=e,i=Xr(n);return(0,F.jsx)(Ln,{...i,...r,ref:t})},`MenuAnchor`)),ii=`MenuPortal`,[ai,oi]=Jr(ii,{forceMount:void 0}),si=I(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$r(ii,t);return(0,F.jsx)(ai,{scope:t,forceMount:n,children:(0,F.jsx)(Ge,{present:n||a.open,children:(0,F.jsx)(Oe,{asChild:!0,container:i,children:r})})})},`MenuPortal`),ci=`MenuContent`,[li,ui]=Jr(ci),di=P.forwardRef(I(function(e,t){let n=oi(ci,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$r(ci,e.__scopeMenu),o=ti(ci,e.__scopeMenu);return(0,F.jsx)(Gr.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(Ge,{present:r||a.open,children:(0,F.jsx)(Gr.Slot,{scope:e.__scopeMenu,children:o.modal?(0,F.jsx)(fi,{...i,ref:t}):(0,F.jsx)(pi,{...i,ref:t})})})})},`MenuContent`)),fi=P.forwardRef(I(function(e,t){let n=$r(ci,e.__scopeMenu),i=P.useRef(null),a=r(t,i);return P.useEffect(()=>{let e=i.current;if(e)return Vt(e)},[]),(0,F.jsx)(hi,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),pi=P.forwardRef(I(function(e,t){let n=$r(ci,e.__scopeMenu);return(0,F.jsx)(hi,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),mi=je(`MenuContent.ScrollLock`),hi=P.forwardRef(I(function(e,t){let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=$r(ci,n),v=ti(ci,n),y=Xr(n),b=Zr(n),x=Kr(n),[S,te]=P.useState(null),C=P.useRef(null),[ne,T]=P.useState(null);ge(ne);let{nodes:re,registry:ie}=Pe(),E=!!(a||h),ae=r(t,C,_.onContentChange,T),se=P.useRef(0),ce=P.useRef(``),le=P.useRef(0),ue=P.useRef(null),de=P.useRef(`right`),fe=P.useRef(0),pe=P.useMemo(()=>h?[C,...re.map(e=>({current:e}))]:[],[C,re,h]),me=h?ye:P.Fragment,he=h?{as:mi,allowPinchZoom:!0,shards:pe}:void 0,_e=I(e=>{let t=ce.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ri(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){ce.current=e,window.clearTimeout(se.current),e!==``&&(se.current=window.setTimeout(()=>s(``),1e3))}I(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);P.useEffect(()=>()=>window.clearTimeout(se.current),[]),D();let ve=P.useCallback(e=>de.current===ue.current?.side&&Bi(e,ue.current?.area),[]);return(0,F.jsx)(li,{scope:n,searchRef:ce,onItemEnter:P.useCallback(e=>{ve(e)&&e.preventDefault()},[ve]),onItemLeave:P.useCallback(e=>{ve(e)||(C.current?.focus(),te(null))},[ve]),onTriggerLeave:P.useCallback(e=>{ve(e)&&e.preventDefault()},[ve]),pointerGraceTimerRef:le,onPointerGraceIntentChange:P.useCallback(e=>{ue.current=e},[]),children:(0,F.jsx)(oe,{registry:E?ie:null,children:(0,F.jsx)(me,{...he,children:(0,F.jsx)(ee,{asChild:!0,trapped:a,branches:re,onMountAutoFocus:w(o,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,F.jsx)(Bn,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,F.jsx)(Pt,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:i,currentTabStopId:S,onCurrentTabStopIdChange:te,onEntryFocus:w(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,F.jsx)(pt,{role:`menu`,"aria-orientation":`vertical`,"data-state":Ni(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:ae,style:{outline:`none`,...g.style},onKeyDown:w(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&_e(e.key));let i=C.current;if(e.target!==i||!Ur.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Hr.includes(e.key)&&a.reverse(),Ii(a)}),onBlur:w(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(se.current),ce.current=``)}),onPointerMove:w(e.onPointerMove,Vi(e=>{let t=e.target,n=fe.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>fe.current?`right`:`left`;de.current=t,fe.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),gi=P.forwardRef(I(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(ue.div,{role:`group`,...r,ref:t})},`MenuGroup`)),_i=P.forwardRef(I(function(e,t){let{__scopeMenu:n,...r}=e;return(0,F.jsx)(ue.div,{...r,ref:t})},`MenuLabel`)),vi=`MenuItem`,yi=`menu.itemSelect`,bi=P.forwardRef(I(function(e,t){let{disabled:n=!1,onSelect:i,...a}=e,o=P.useRef(null),s=ti(vi,e.__scopeMenu),c=ui(vi,e.__scopeMenu),l=r(t,o),u=P.useRef(!1),d=I(()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(yi,{bubbles:!0,cancelable:!0});e.addEventListener(yi,e=>i?.(e),{once:!0}),nt(e,t),t.defaultPrevented?u.current=!1:s.onClose()}},`handleSelect`);return(0,F.jsx)(xi,{...a,ref:l,disabled:n,onClick:w(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:w(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:w(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(c.searchRef.current===``||e.key!==` `)&&Br.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),xi=P.forwardRef(I(function(e,t){let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=ui(vi,n),c=Zr(n),l=P.useRef(null),u=r(t,l),[d,f]=P.useState(!1),[p,m]=P.useState(``);return P.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,F.jsx)(Gr.ItemSlot,{scope:n,disabled:i,textValue:a??p,children:(0,F.jsx)(At,{asChild:!0,...c,focusable:!i,children:(0,F.jsx)(ue.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:w(e.onPointerMove,Vi(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:w(e.onPointerLeave,Vi(e=>s.onItemLeave(e))),onFocus:w(e.onFocus,()=>f(!0)),onBlur:w(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),[Si,Ci]=Jr(`MenuRadioGroup`,{value:void 0,onValueChange:I(()=>{},`onValueChange`)}),wi=P.forwardRef(I(function(e,t){let{value:n,onValueChange:r,...i}=e,a=l(r);return(0,F.jsx)(Si,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,F.jsx)(gi,{...i,ref:t})})},`MenuRadioGroup`)),Ti=`MenuRadioItem`,Ei=P.forwardRef(I(function(e,t){let{value:n,...r}=e,i=Ci(Ti,e.__scopeMenu),a=n===i.value;return(0,F.jsx)(Oi,{scope:e.__scopeMenu,checked:a,children:(0,F.jsx)(bi,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Fi(a),onSelect:w(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Di=`MenuItemIndicator`,[Oi,ki]=Jr(Di,{checked:!1}),Ai=P.forwardRef(I(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=ki(Di,n);return(0,F.jsx)(Ge,{present:r||Pi(a.checked)||a.checked===!0,children:(0,F.jsx)(ue.span,{...i,ref:t,"data-state":Fi(a.checked)})})},`MenuItemIndicator`)),[ji,Mi]=Jr(`MenuSub`);function Ni(e){return e?`open`:`closed`}I(Ni,`getOpenState`);function Pi(e){return e===`indeterminate`}I(Pi,`isIndeterminate`);function Fi(e){return Pi(e)?`indeterminate`:e?`checked`:`unchecked`}I(Fi,`getCheckedState`);function Ii(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}I(Ii,`focusFirst`);function Li(e,t){return e.map((n,r)=>e[(t+r)%e.length])}I(Li,`wrapArray`);function Ri(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Li(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}I(Ri,`getNextMatch`);function zi(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}I(zi,`isPointInPolygon`);function Bi(e,t){return t?zi({x:e.clientX,y:e.clientY},t):!1}I(Bi,`isPointerInGraceArea`);function Vi(e){return t=>t.pointerType===`mouse`?e(t):void 0}I(Vi,`whenMouse`);var Hi=Object.defineProperty,Ui=(e,t)=>Hi(e,`name`,{value:t,configurable:!0}),Wi=`DropdownMenu`,[Gi,Ki]=fn(Wi,[Yr]),qi=Yr(),[Ji,Yi]=Gi(Wi),Xi=Ui(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=qi(t),l=P.useRef(null),[u,d]=Ze({prop:i,defaultProp:a??!1,onChange:o,caller:Wi});return(0,F.jsx)(Ji,{scope:t,triggerId:ie(),triggerRef:l,contentId:ie(),open:u,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,F.jsx)(ni,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Zi=`DropdownMenuTrigger`,Qi=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Yi(Zi,n),s=qi(n),c=r(t,o.triggerRef);return(0,F.jsx)(ri,{asChild:!0,...s,children:(0,F.jsx)(ue.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:w(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:w(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),$i=Ui(e=>{let{__scopeDropdownMenu:t,...n}=e,r=qi(t);return(0,F.jsx)(si,{...r,...n})},`DropdownMenuPortal`),ea=`DropdownMenuContent`,ta=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Yi(ea,n),a=qi(n),o=P.useRef(!1);return(0,F.jsx)(di,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:w(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),na=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=qi(n);return(0,F.jsx)(gi,{...i,...r,ref:t})},`DropdownMenuGroup`)),ra=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=qi(n);return(0,F.jsx)(_i,{...i,...r,ref:t})},`DropdownMenuLabel`)),ia=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=qi(n);return(0,F.jsx)(wi,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),aa=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=qi(n);return(0,F.jsx)(Ei,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),oa=P.forwardRef(Ui(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=qi(n);return(0,F.jsx)(Ai,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),sa=`ToggleGroup`,ca={Single:`single`,Multiple:`multiple`},[la,ua]=fn(sa,[st]),da=st(),fa=P.forwardRef(R(function(e,t){let{type:n,...r}=e;if(n===ca.Single)return(0,F.jsx)(ha,{role:`radiogroup`,...r,ref:t});if(n===ca.Multiple)return(0,F.jsx)(ga,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${sa}\``)},`ToggleGroup`)),[pa,ma]=la(sa),ha=P.forwardRef(R(function(e,t){let{value:n,defaultValue:r,onValueChange:i=R(()=>{},`onValueChange`),...a}=e,[o,s]=Ze({prop:n,defaultProp:r??``,onChange:i,caller:sa});return(0,F.jsx)(pa,{scope:e.__scopeToggleGroup,type:ca.Single,value:P.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:P.useCallback(()=>s(``),[s]),children:(0,F.jsx)(ya,{...a,ref:t})})},`ToggleGroupImplSingle`)),ga=P.forwardRef(R(function(e,t){let{value:n,defaultValue:r,onValueChange:i=R(()=>{},`onValueChange`),...a}=e,[o,s]=Ze({prop:n,defaultProp:r??[],onChange:i,caller:sa}),c=P.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=P.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,F.jsx)(pa,{scope:e.__scopeToggleGroup,type:ca.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,F.jsx)(ya,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[_a,va]=la(sa),ya=P.forwardRef(R(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=da(n),u=Je(o),d={dir:u,...c};return(0,F.jsx)(_a,{scope:n,rovingFocus:i,disabled:r,children:i?(0,F.jsx)(Pt,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,F.jsx)(ue.div,{...d,ref:t})}):(0,F.jsx)(ue.div,{...d,ref:t})})},`ToggleGroupImpl`)),ba=`ToggleGroupItem`,xa=P.forwardRef(R(function(e,t){let n=ma(ba,e.__scopeToggleGroup),r=va(ba,e.__scopeToggleGroup),i=da(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=P.useRef(null);return r.rovingFocus?(0,F.jsx)(At,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,F.jsx)(Sa,{...s,ref:t})}):(0,F.jsx)(Sa,{...s,ref:t})},`ToggleGroupItem`)),Sa=P.forwardRef(R(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=ma(ba,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===ca.Single?o:void 0;return(0,F.jsx)(j,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),Ca=[[`path`,{d:`M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 9V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],wa=[[`path`,{d:`M18.8516 16.3743L19.5 6H4.5L5.14839 16.3743C5.315 19.0401 5.39831 20.373 6.26426 21.1865C7.13021 22 8.46571 22 11.1367 22H12.8633C15.5343 22 16.8698 22 17.7357 21.1865C18.6017 20.373 18.685 19.0401 18.8516 16.3743Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M16 6H21M16 6L15.3778 4.34082C15.0007 3.33524 14.8122 2.83245 14.4402 2.50292C14.3213 2.39765 14.1904 2.3069 14.0501 2.2326C13.6109 2 13.074 2 12 2C10.926 2 10.3891 2 9.9499 2.2326C9.8096 2.3069 9.67865 2.39765 9.55982 2.50292C9.18783 2.83245 8.99928 3.33524 8.62219 4.34082L8 6M16 6H8M3 6H8`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M9.5 11V17M14.5 11V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Ta=[[`path`,{d:`M15.5 2V6M8.5 6V2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6.00446 7.61331C5.93719 6.74273 6.63957 6 7.53014 6H16.4699C17.3604 6 18.0628 6.74273 17.9955 7.61331L17.8117 9.99197C17.6796 11.7019 17.1011 13.3498 16.132 14.7773L15.5312 15.6622C14.9638 16.4979 14.0077 17 12.9838 17H11.0162C9.99228 17 9.03617 16.4979 8.46881 15.6622L7.86803 14.7773C6.89885 13.3498 6.32041 11.7019 6.18827 9.99197L6.00446 7.61331Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 17V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11 9H13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Ea=[[`path`,{d:`M19 4H5C4.06812 4 3.60218 4 3.23463 4.15224C2.74458 4.35523 2.35523 4.74458 2.15224 5.23463C2 5.60218 2 6.06812 2 7C2 7.93188 2 8.39782 2.15224 8.76537C2.35523 9.25542 2.74458 9.64477 3.23463 9.84776C3.60218 10 4.06812 10 5 10H19C19.9319 10 20.3978 10 20.7654 9.84776C21.2554 9.64477 21.6448 9.25542 21.8478 8.76537C22 8.39782 22 7.93188 22 7C22 6.06812 22 5.60218 21.8478 5.23463C21.6448 4.74458 21.2554 4.35523 20.7654 4.15224C20.3978 4 19.9319 4 19 4Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M19 14H5C4.06812 14 3.60218 14 3.23463 14.1522C2.74458 14.3552 2.35523 14.7446 2.15224 15.2346C2 15.6022 2 16.0681 2 17C2 17.9319 2 18.3978 2.15224 18.7654C2.35523 19.2554 2.74458 19.6448 3.23463 19.8478C3.60218 20 4.06812 20 5 20H19C19.9319 20 20.3978 20 20.7654 19.8478C21.2554 19.6448 21.6448 19.2554 21.8478 18.7654C22 18.3978 22 17.9319 22 17C22 16.0681 22 15.6022 21.8478 15.2346C21.6448 14.7446 21.2554 14.3552 20.7654 14.1522C20.3978 14 19.9319 14 19 14Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M6.125 7H6M6.25 7C6.25 7.13807 6.13807 7.25 6 7.25C5.86193 7.25 5.75 7.13807 5.75 7C5.75 6.86193 5.86193 6.75 6 6.75C6.13807 6.75 6.25 6.86193 6.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M10.125 7H10M10.25 7C10.25 7.13807 10.1381 7.25 10 7.25C9.86193 7.25 9.75 7.13807 9.75 7C9.75 6.86193 9.86193 6.75 10 6.75C10.1381 6.75 10.25 6.86193 10.25 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M6.125 17H6M6.25 17C6.25 17.1381 6.13807 17.25 6 17.25C5.86193 17.25 5.75 17.1381 5.75 17C5.75 16.8619 5.86193 16.75 6 16.75C6.13807 16.75 6.25 16.8619 6.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10.125 17H10M10.25 17C10.25 17.1381 10.1381 17.25 10 17.25C9.86193 17.25 9.75 17.1381 9.75 17C9.75 16.8619 9.86193 16.75 10 16.75C10.1381 16.75 10.25 16.8619 10.25 17Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}]],Da=[[`path`,{d:`M3.95631 10.5829L3.03254 9.07084C2.74505 8.60024 2.7389 8.00978 3.01652 7.5333L3.63533 6.47124C3.90953 6.00064 4.41721 5.71571 4.96162 5.7269L6.69131 5.76245C6.92616 5.76728 7.15379 5.68727 7.34333 5.54846C7.79531 5.21745 8.28334 4.93276 8.80042 4.70139C9.01191 4.60675 9.19222 4.45165 9.30469 4.24903L10.1203 2.77965C10.3847 2.30328 10.8865 2.00781 11.4312 2.00781H12.6937C13.2384 2.00781 13.7403 2.30329 14.0047 2.77966L14.8202 4.24902C14.9327 4.45165 15.113 4.60675 15.3245 4.70139C15.8416 4.93274 16.3296 5.2174 16.7815 5.54838C16.9711 5.68718 17.1987 5.76718 17.4336 5.76235L19.1634 5.72676C19.7078 5.71557 20.2155 6.00049 20.4897 6.47111L21.1085 7.53314C21.3862 8.00963 21.38 8.60009 21.0925 9.07068L20.1687 10.5828C20.0481 10.7803 20.002 11.0134 20.0235 11.2439C20.0707 11.7486 20.0707 12.267 20.0235 12.7717C20.002 13.0022 20.0481 13.2353 20.1687 13.4329L21.0924 14.9448C21.3799 15.4154 21.3861 16.0058 21.1084 16.4823L20.4896 17.5444C20.2154 18.015 19.7077 18.2999 19.1633 18.2887L17.4338 18.2531C17.1989 18.2483 16.9713 18.3283 16.7817 18.4671C16.3297 18.7982 15.8416 19.0829 15.3245 19.3142C15.113 19.4089 14.9327 19.564 14.8202 19.7666L14.0047 21.236C13.7403 21.7123 13.2384 22.0078 12.6937 22.0078H11.4312C10.8866 22.0078 10.3847 21.7123 10.1203 21.236L9.30468 19.7665C9.19222 19.5639 9.01191 19.4088 8.80042 19.3142C8.28329 19.0828 7.79519 18.798 7.34316 18.467C7.15362 18.3282 6.92597 18.2482 6.69111 18.253L4.96175 18.2886C4.41733 18.2998 3.90963 18.0148 3.63543 17.5442L3.01663 16.4822C2.739 16.0057 2.74515 15.4152 3.03264 14.9446L3.95631 13.4327C4.07699 13.2351 4.12309 13.002 4.10154 12.7715C4.05437 12.267 4.05438 11.7486 4.10154 11.244C4.12308 11.0135 4.07699 10.7805 3.95631 10.5829Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12.0625`,cy:`12.0078`,r:`3.5`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}]];function Oa({...e}){return(0,F.jsx)(Xi,{"data-slot":`dropdown-menu`,...e})}function ka({...e}){return(0,F.jsx)(Qi,{"data-slot":`dropdown-menu-trigger`,...e})}function Aa({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,F.jsx)($i,{children:(0,F.jsx)(ta,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:A(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 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 data-[state=closed]:overflow-hidden dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function ja({...e}){return(0,F.jsx)(na,{"data-slot":`dropdown-menu-group`,...e})}function Ma({...e}){return(0,F.jsx)(ia,{"data-slot":`dropdown-menu-radio-group`,...e})}function Na({className:e,children:t,inset:n,...r}){return(0,F.jsxs)(aa,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:A(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,F.jsx)(oa,{children:(0,F.jsx)(bt,{icon:Me,strokeWidth:2})})}),t]})}function Pa({className:e,inset:t,...n}){return(0,F.jsx)(ra,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:A(`px-2 py-1 text-xs text-muted-foreground data-inset:pl-7`,e),...n})}var Fa={activity:(0,F.jsx)(`path`,{d:`M22 12h-4l-3 8L9 4l-3 8H2`}),hash:(0,F.jsx)(`path`,{d:`M4 9h16M4 15h16M10 3 8 21M16 3l-2 18`}),dm:(0,F.jsx)(`path`,{d:`M20 11.5a8 8 0 0 1-11.7 7.1L4 20l1.4-4.1A8 8 0 1 1 20 11.5z`}),agents:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,F.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,F.jsx)(`path`,{d:`M16 4.5a3.5 3.5 0 0 1 0 7M18 14a6 6 0 0 1 3.5 6`})]}),graph:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:`6`,cy:`6`,r:`2.5`}),(0,F.jsx)(`circle`,{cx:`18`,cy:`8`,r:`2.5`}),(0,F.jsx)(`circle`,{cx:`10`,cy:`18`,r:`2.5`}),(0,F.jsx)(`path`,{d:`M8.4 6.4 15.5 7.6M6.9 8.4l2.3 7.2M16.6 10.1l-4.9 6`})]}),inbox:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{d:`M3 13h5l1.5 3h5L16 13h5`}),(0,F.jsx)(`path`,{d:`M5 5h14l2 8v6H3v-6z`})]}),search:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,F.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),chev:(0,F.jsx)(`path`,{d:`m7 10 5 5 5-5`}),gear:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,F.jsx)(`path`,{d:`M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1`})]}),server:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`7`,rx:`1.5`}),(0,F.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`7`,rx:`1.5`}),(0,F.jsx)(`path`,{d:`M7 7.5h.01M7 16.5h.01`})]})};function Ia({name:e,size:t=18}){return(0,F.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:Fa[e]})}var La=[`system`,`light`,`dark`],Ra=(0,P.createContext)({theme:`system`,setTheme:()=>null});function za({children:e,defaultTheme:t=`system`,storageKey:n=`vite-ui-theme`,...r}){let[i,a]=(0,P.useState)(()=>{try{return La.find(e=>e===localStorage.getItem(n))??t}catch{return t}});(0,P.useEffect)(()=>{let e=window.document.documentElement,t=()=>{if(e.classList.remove(`light`,`dark`),i===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t)}else e.classList.add(i)};if(t(),i!==`system`)return;let n=window.matchMedia(`(prefers-color-scheme: dark)`);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[i]);let o={theme:i,setTheme:e=>{try{localStorage.setItem(n,e)}catch{}a(e)}};return(0,F.jsx)(Ra.Provider,{...r,value:o,children:e})}var Ba=()=>{let e=(0,P.useContext)(Ra);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},Va=[{label:`Activity`,icon:`activity`,view:`activity`},{label:`Channels`,icon:`hash`,view:`channel`},{label:`Direct messages`,icon:`dm`,view:`dm`},{label:`Agents`,icon:`agents`,view:`agents`},{label:`Topology`,icon:`graph`,view:`topology`}],Ha={channel:`No channels yet. One appears with its first message.`,dm:`No direct messages yet.`};function Ua(e,t,n){if(t.view===e)return t;switch(e){case`channel`:return n.channel===null?null:{view:e,channel:n.channel};case`dm`:return n.dm===null?null:{view:e,...n.dm};case`agents`:return{view:e,group:`status`};case`activity`:case`topology`:case`needs`:return{view:e};case`agent`:return null}}var Wa=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function Ga(){let e=(0,P.useId)(),{theme:t,setTheme:n}=Ba();return(0,F.jsxs)(Oa,{children:[(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(ka,{asChild:!0,children:(0,F.jsxs)(ce,{children:[(0,F.jsx)(Ia,{name:`gear`}),(0,F.jsx)(`span`,{children:`Settings`})]})})}),(0,F.jsx)(E,{side:`right`,children:`Settings`})]}),(0,F.jsx)(Aa,{side:`right`,align:`end`,loop:!0,children:(0,F.jsxs)(ja,{"aria-labelledby":e,children:[(0,F.jsx)(Pa,{id:e,children:`Theme`}),(0,F.jsx)(Ma,{value:t,onValueChange:e=>{let t=Wa.find(t=>t.value===e);t&&n(t.value)},children:Wa.map(e=>(0,F.jsx)(Na,{value:e.value,children:e.label},e.value))})]})})]})}function Ka({route:e,places:t}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(xe,{children:(0,F.jsx)(`span`,{className:`ui-rail-mark self-center`,dangerouslySetInnerHTML:{__html:p(`currentColor`)}})}),(0,F.jsx)(_,{children:(0,F.jsx)(qt,{children:(0,F.jsx)(s,{children:(0,F.jsx)(ke,{children:Va.map(({label:n,icon:r,view:i})=>{let a=Ua(i,e,t),o=e.view===i||i===`agents`&&e.view===`agent`,s=Ha[i];return(0,F.jsx)(_e,{children:a?(0,F.jsx)(ce,{asChild:!0,isActive:o,tooltip:{children:n,hidden:!1},children:(0,F.jsxs)(`a`,{href:jt(a),"aria-current":o?`page`:void 0,children:[(0,F.jsx)(Ia,{name:r}),(0,F.jsx)(`span`,{children:n})]})}):(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(`span`,{className:`flex`,children:(0,F.jsxs)(ce,{type:`button`,"aria-disabled":!0,"aria-label":n,"aria-describedby":`rail-why-${i}`,children:[(0,F.jsx)(Ia,{name:r}),(0,F.jsx)(`span`,{children:n}),(0,F.jsx)(`span`,{id:`rail-why-${i}`,className:`ui-sr`,children:s})]})})}),(0,F.jsx)(E,{side:`right`,children:s})]})},i)})})})})}),(0,F.jsx)(De,{children:(0,F.jsx)(ke,{children:(0,F.jsx)(_e,{children:(0,F.jsx)(Ga,{})})})})]})}var qa=[{label:`Channels`,icon:`hash`,view:`channel`},{label:`DMs`,icon:`dm`,view:`dm`},{label:`Agents`,icon:`agents`,view:`agents`},{label:`Activity`,icon:`activity`,view:`activity`}];function Ja({route:e,places:t,waiting:n,working:r}){return(0,F.jsx)(`nav`,{className:`v3-tabbar`,"aria-label":`Sections`,children:qa.map(({label:i,icon:a,view:o})=>{let s=Ua(o,e,t),c=e.view===o||o===`agents`&&e.view===`needs`||o===`agents`&&e.view===`agent`,l=s?`a`:`button`,u=s?void 0:Ha[o],d=(0,F.jsxs)(l,{href:s?jt(s):void 0,type:s?void 0:`button`,"aria-disabled":!s||void 0,"aria-current":c?`page`:void 0,"aria-label":u?i:void 0,"aria-describedby":u?`tab-why-${o}`:void 0,children:[(0,F.jsx)(Ia,{name:a,size:22}),i,u&&(0,F.jsx)(`span`,{id:`tab-why-${o}`,className:`ui-sr`,children:u}),o===`agents`&&n>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,children:n}),(0,F.jsx)(`span`,{className:`ui-sr`,children:`${n} agent${n===1?``:`s`} waiting`})]})}),(0,F.jsx)(E,{children:`${n} agent${n===1?``:`s`} waiting`})]}),o===`agents`&&n===0&&r>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(`span`,{className:`ox-sbw ox-tabw`,children:[(0,F.jsx)(N,{icon:tn,size:16,className:`ui-ic ox-spin`}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:r}),(0,F.jsx)(`span`,{className:`ui-sr`,children:`${r} agent${r===1?``:`s`} working`})]})}),(0,F.jsx)(E,{children:`${r} agent${r===1?``:`s`} working`})]})]},o);return u?(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:d}),(0,F.jsx)(E,{side:`top`,children:u})]},o):d})})}var Ya={"--sidebar-width":`350px`};function Xa(e){let{route:t,controller:n,paneOpen:r,phone:i}=e,a=br(t);(0,P.useEffect)(()=>{xr(n,a)},[n,a]);let o=ze(),s=e.stale?`stale`:void 0;return(0,F.jsxs)(Vn,{className:A(`h-dvh`,i&&`ui-phone flex-col`),style:Ya,"data-view":t.view,"data-presence":s,children:[(0,F.jsxs)(x,{collapsible:`icon`,className:`overflow-hidden *:data-[sidebar=sidebar]:flex-row`,children:[(0,F.jsx)(x,{collapsible:`none`,role:`navigation`,"aria-label":`Views`,className:`hidden w-[calc(var(--sidebar-width-icon)+1px)]! border-r md:flex`,children:(0,F.jsx)(Ka,{route:t,places:e.places})}),(0,F.jsx)(x,{collapsible:`none`,role:`complementary`,"aria-label":`Space`,"data-presence":s,className:`min-w-0 flex-1 group-data-[collapsible=icon]:hidden`,children:e.sidebar})]}),(0,F.jsx)(Ce,{className:`min-h-0 min-w-0`,children:e.children}),i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ja,{route:t,places:e.places,waiting:e.waiting,working:e.working}),(0,F.jsx)(de,{open:r,onOpenChange:t=>!t&&e.onPanelClose(),children:(0,F.jsxs)(rt,{side:`right`,showCloseButton:!1,"aria-describedby":void 0,"data-presence":s,...o,children:[(0,F.jsx)(tt,{className:`sr-only`,children:`Details`}),e.panel]})})]}):r&&(0,F.jsx)(`section`,{className:`ui-pane`,"aria-label":`Details`,children:e.panel})]})}var Za=ln(`group/item flex w-full flex-wrap items-center rounded-2xl border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-3.5 px-4 py-3.5`,sm:`gap-3.5 px-3.5 py-3`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Qa({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?at:`div`;return(0,F.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:A(Za({variant:t,size:n,className:e})),...i})}var $a=ln(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-xl group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 group-data-[size=xs]/item:rounded-lg [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function eo({className:e,variant:t=`default`,...n}){return(0,F.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:A($a({variant:t,className:e})),...n})}function to({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`item-content`,className:A(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function no({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`item-title`,className:A(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function ro({className:e,...t}){return(0,F.jsx)(`p`,{"data-slot":`item-description`,className:A(`line-clamp-2 text-left text-sm font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function io({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`item-actions`,className:A(`flex items-center gap-2`,e),...t})}var ao=[{rows:2},{heading:`Channels`,rows:3},{heading:`Direct messages`,rows:1}];function oo({lines:e}){return(0,F.jsxs)(`div`,{className:`ui-skel-msg`,children:[(0,F.jsx)(T,{className:`size-8.5`}),(0,F.jsx)(`div`,{style:{display:`grid`,gap:8,paddingTop:4},children:e.map((e,t)=>(0,F.jsx)(T,{className:`h-2.5`,style:{width:e}},t))})]})}function so(){return(0,F.jsx)(_,{role:`navigation`,"aria-label":`Places`,"aria-busy":`true`,children:ao.map(({heading:e,rows:t})=>(0,F.jsxs)(qt,{"aria-hidden":`true`,children:[e&&(0,F.jsx)(Ut,{children:e}),(0,F.jsx)(ke,{children:Array.from({length:t},(e,t)=>(0,F.jsx)(_e,{children:(0,F.jsx)(Fe,{showIcon:!0})},t))})]},e??``))})}function co(){return(0,F.jsxs)(`div`,{"aria-hidden":`true`,style:{display:`contents`},children:[(0,F.jsx)(`header`,{className:`ui-bar`,children:(0,F.jsx)(T,{className:`h-3 w-30`})}),(0,F.jsxs)(`div`,{className:`ui-col`,style:{width:`100%`},children:[(0,F.jsx)(oo,{lines:[`30%`,`85%`]}),(0,F.jsx)(oo,{lines:[`24%`,`70%`,`52%`]})]})]})}function lo({store:e,inHeader:t=!1}){let n=M(e,e=>e.stale),r=ur(n);if(r.hidden)return null;let i=t?[]:mr(n);return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(m,{role:`note`,id:t?void 0:`stale`,className:t?`w-auto`:`mx-2 my-1 w-auto`,children:[(0,F.jsx)(N,{icon:Ca}),(0,F.jsx)(Wt,{children:r.text}),i.length>0&&(0,F.jsx)(we,{children:i.map(e=>(0,F.jsx)(`div`,{children:e},e))}),r.title&&(0,F.jsx)(`div`,{className:`ui-sr`,children:r.title})]})}),r.title&&(0,F.jsx)(E,{className:`flex-col items-start`,children:r.title.split(`
|
|
14
|
-
`).map(e=>(0,F.jsx)(`span`,{children:e},e))})]})}var uo=1e3,fo=e=>e.startsWith(`run.`),po={connecting:{text:`Connecting`,title:`Connecting to cotal web`},reconnecting:{text:`Reconnecting`,title:`Reconnecting to cotal web`},closed:{text:`Disconnected`,title:`The live feed closed and will not retry. Reload the page, or open the link cotal web printed when it started.`}},mo=e=>`${e.length} member${e.length===1?``:`s`} working: ${e.map(e=>e.name).join(`, `)}`;function ho({to:e,here:t,tip:n,badge:r,link:i,children:a}){let{isMobile:o}=u();return(0,F.jsxs)(_e,{children:[(0,F.jsx)(ce,{asChild:!0,isActive:t,className:r===void 0?void 0:`pr-8`,tooltip:n===void 0||o?void 0:{children:n,hidden:!1},children:(0,F.jsx)(`a`,{ref:i,href:jt(e),"aria-current":t?`page`:void 0,children:a})}),r!==void 0&&(0,F.jsx)(C,{"aria-hidden":`true`,children:r})]})}function go({connection:e}){let{text:t,title:n}=e===`connected`?{text:`Connected`,title:`Connected to cotal web`}:po[e];return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:e===`closed`?`destructive`:`outline`,children:[(0,F.jsx)(`i`,{className:e===`connected`?`ui-mdot ui-mdot-live`:`ui-mdot ui-mdot-down`}),t,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${n}`})]})}),(0,F.jsx)(E,{children:n})]})}function _o({store:e,route:t,msgPerSecond:n}){let r=M(e,e=>e.space),i=M(e,e=>e.channels),a=M(e,e=>e.unread),s=M(e,e=>e.roster),c=M(e,e=>e.dms),l=M(e,e=>e.membership),d=M(e,e=>e.connection),f=M(e,e=>e.loading),p=M(e,e=>e.post),m=M(e,e=>e.operatorId),[,h]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>h(e=>e+1),uo);return()=>clearInterval(e)},[]);let{isMobile:g,setOpenMobile:v}=u(),y=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{g&&y.current?.focus()},[g]);let b=jt(t),x=(0,P.useRef)(b);(0,P.useEffect)(()=>{x.current!==b&&(x.current=b,v(!1))},[b,v]);let S=(0,P.useMemo)(()=>Rt(s,{includeOffline:!0}),[s]),ee=(0,P.useMemo)(()=>xt(s),[s]),te=(0,P.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),C=ae(),w=(0,P.useMemo)(()=>{let e=i.map(e=>e.channel);return new Map(i.map(t=>[t.channel,$e(t.channel,l,e,[]).map(e=>te.get(e.id)).filter(e=>e?.status===`working`)]))},[i,l,te]),T=on(S).length,re=`${T} agent${T===1?``:`s`} waiting`,ie=yr(n()),oe=o(p,m!==null&&s.some(e=>e.card.id===m)),se=(0,P.useMemo)(()=>yn(c),[c]),[le,ue]=(0,P.useState)(!1),de=t.view===`dm`&&t.with!==void 0?Xt(t.peer,t.with):null,pe=(0,P.useMemo)(()=>le?se:se.filter((e,t)=>t<10||e.key===de),[se,le,de]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(xe,{children:(0,F.jsx)(`span`,{className:`ui-space px-2 py-1.5`,children:r})}),(0,F.jsx)(lo,{store:e}),f.roster||f.channels?(0,F.jsx)(so,{}):(0,F.jsxs)(_,{role:`navigation`,"aria-label":`Places`,children:[(0,F.jsx)(qt,{children:(0,F.jsxs)(ke,{children:[(0,F.jsxs)(ho,{to:{view:`needs`},here:t.view===`needs`,tip:T>0?re:void 0,badge:T>0?T:void 0,link:y,children:[(0,F.jsx)(Ia,{name:`inbox`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`Needs you`}),T>0&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${re}`})]}),(0,F.jsxs)(ho,{to:{view:`activity`},here:t.view===`activity`,badge:ie,children:[(0,F.jsx)(Ia,{name:`activity`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`Activity`}),(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${ie}`})]})]})}),(0,F.jsxs)(qt,{children:[(0,F.jsx)(Ut,{children:`Channels`}),i.length===0&&(0,F.jsx)(We,{className:`p-4`,children:(0,F.jsx)(fe,{children:(0,F.jsx)(ne,{children:`No channels yet. One appears with its first message.`})})}),(0,F.jsx)(ke,{children:i.map(e=>{let n=a[e.channel]??0,r=fo(e.channel)?`Events from run ${e.channel.slice(4)}`:void 0,i=w.get(e.channel)??[];return(0,F.jsxs)(ho,{to:{view:`channel`,channel:e.channel},here:t.view===`channel`&&t.channel===e.channel,tip:r,badge:n>0?n:void 0,children:[r?(0,F.jsx)(N,{icon:Ta}):(0,F.jsx)(Ia,{name:`hash`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:e.channel}),i.length>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(`span`,{className:`ox-sbw`,children:[(0,F.jsx)(N,{icon:tn,className:`ox-spin`}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:i.length}),(0,F.jsx)(`span`,{className:`ui-sr`,children:mo(i)})]})}),(0,F.jsx)(E,{children:mo(i)})]}),n>0&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${n}`}),r&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${r}`})]},e.channel)})})]}),(0,F.jsxs)(qt,{children:[(0,F.jsx)(Ut,{children:`Direct messages`}),(0,F.jsxs)(ke,{children:[pe.map(({key:e,parts:t,opener:n,verified:r})=>{let i=t[0]===n?t[1]:t[0];return(0,F.jsxs)(ho,{to:{view:`dm`,peer:n,with:i},here:e===de,children:[(0,F.jsx)(`span`,{className:`ui-stack`,"aria-hidden":`true`,children:[n,i].map(e=>(0,F.jsx)(he,{vendor:te.get(e)?.harness,status:te.get(e)?.status??`offline`,size:18,dot:te.has(e),badge:te.has(e)?C(e):void 0},e))}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`${wn(n,ee,m)}, ${wn(i,ee,m)}`}),!r&&(0,F.jsx)(Bt,{})]},e)}),se.length>10&&(0,F.jsx)(_e,{children:(0,F.jsx)(ce,{type:`button`,"aria-expanded":le,onClick:()=>ue(e=>!e),children:(0,F.jsx)(`span`,{children:le?`Show fewer`:`Show all ${se.length}`})})})]})]})]}),(0,F.jsx)(De,{children:(0,F.jsxs)(Qa,{size:`xs`,children:[(0,F.jsx)(eo,{children:(0,F.jsx)(kn,{size:`sm`,children:(0,F.jsx)(Rn,{children:`OP`})})}),(0,F.jsxs)(to,{children:[(0,F.jsx)(no,{children:`operator`}),oe&&(0,F.jsxs)(ro,{children:[(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(`span`,{tabIndex:0,"aria-describedby":`operator-line-why`,children:oe.text})}),(0,F.jsx)(E,{children:oe.title})]}),(0,F.jsx)(`span`,{id:`operator-line-why`,className:`ui-sr`,children:oe.title})]})]}),(0,F.jsx)(io,{children:(0,F.jsx)(go,{connection:d})})]})})]})}var vo=P.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function yo({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,F.jsx)(fa,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:A(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[spacing=0]:data-[variant=outline]:rounded-2xl data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,F.jsx)(vo.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function bo({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=P.useContext(vo);return(0,F.jsx)(xa,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:A(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-2xl group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-2xl group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-2xl group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-2xl data-[state=on]:bg-muted group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,v({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function xo(e,t){if(e){for(let{msg:n,senderId:r}of t)if(n.replyTo===e)return r===void 0?{id:n.from.id,verified:!1}:{id:r,verified:!0}}}function So({space:e}){return(0,F.jsxs)(We,{children:[(0,F.jsxs)(fe,{children:[(0,F.jsx)(dn,{"data-wave":`claude`,dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 150 150" width="150" height="150" overflow="visible" aria-hidden="true">${Mn(`claude`)}</svg>`}}),(0,F.jsx)(le,{children:e===null?`No agents here yet.`:`No agents on ${e} yet.`}),(0,F.jsx)(ne,{children:`Start one from your terminal. It shows up here when it joins.`})]}),(0,F.jsxs)(Xe,{children:[(0,F.jsx)(dt,{command:`cotal spawn`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(dt,{command:`cotal personas`}),` lists the others.`]})]})]})}var Co=e=>e.some(e=>e.card.kind===`agent`),wo=[{label:`All`,value:`all`},{label:`Channels`,value:`chat`},{label:`Direct`,value:`unicast`},{label:`Roles`,value:`anycast`}];function To(e,t){return e.mode===`chat`?typeof e.channel==`string`?`#${e.channel}`:null:e.mode===`anycast`?typeof e.msg.toService==`string`?`to role ${e.msg.toService}`:null:typeof e.msg.to==`string`?`to ${wn(e.msg.to,t)}`:null}function Eo({banner:e}){return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(m,{role:`status`,children:[(0,F.jsx)(N,{icon:Ca}),(0,F.jsx)(Wt,{children:e.label}),(e.count||e.body)&&(0,F.jsxs)(we,{children:[e.count&&(0,F.jsx)(`div`,{children:e.count}),e.body&&(0,F.jsx)(`div`,{children:e.body})]}),(0,F.jsx)(`div`,{className:`ui-sr`,children:e.title})]})}),(0,F.jsx)(E,{children:e.title})]})}function Do({store:e}){let t=M(e,e=>e.activity),n=M(e,e=>e.roster),r=M(e,e=>e.space),a=M(e,e=>e.operatorId),o=gr(M(e,e=>e.stale)),[s,c]=(0,P.useState)(`all`),l=(0,P.useMemo)(()=>xt(n),[n]),u=(0,P.useMemo)(()=>Rt(n,{includeOffline:!0}),[n]),d=(0,P.useMemo)(()=>new Map(u.map(e=>[e.id,e])),[u]),f=(0,P.useMemo)(()=>{let e=t.map(e=>({msg:e.msg,senderId:e.senderId}));return t.map((t,n)=>({e:t,claim:t.mode===`anycast`?xo(t.msg.id,e.slice(n+1)):void 0})).reverse()},[t]),p=s===`all`?f:f.filter(({e})=>e.mode===s);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Activity`}),!o&&(0,F.jsx)(lo,{store:e,inHeader:!0}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(yo,{type:`single`,size:`sm`,"aria-label":`Show`,value:s,onValueChange:e=>{let t=wo.find(t=>t.value===e);t&&c(t.value)},children:wo.map(e=>(0,F.jsx)(bo,{value:e.value,children:e.label},e.value))})]}),(0,F.jsxs)(`div`,{className:`ui-scroll`,children:[!Co(n)&&(0,F.jsx)(So,{space:r}),(0,F.jsxs)(`div`,{className:`ui-col flex flex-col gap-8`,children:[o&&(0,F.jsx)(Eo,{banner:o}),p.map(({e,claim:t})=>{let n=e.senderId;return(0,F.jsx)(i,{msg:e.msg,senderId:n,mode:e.mode,idx:l,peers:d,own:n!==void 0&&n===a,mention:`operator`,claim:t,place:To(e,l)},`${e.msg.id}\u0001${n??``}`)})]})]})]})}function Oo({className:e,size:t=`default`,...n}){return(0,F.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:A(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-[min(var(--radius-4xl),24px)] bg-card py-(--card-spacing) text-sm text-card-foreground shadow-sm ring-1 ring-foreground/5 [--card-spacing:--spacing(5)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] dark:ring-foreground/10 *:[img:first-child]:rounded-t-[min(var(--radius-4xl),24px)] *:[img:last-child]:rounded-b-[min(var(--radius-4xl),24px)]`,e),...n})}function ko({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-header`,className:A(`group/card-header @container/card-header grid auto-rows-min items-start gap-1.5 rounded-t-[min(var(--radius-4xl),24px)] px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function Ao({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-title`,className:A(`text-base font-medium`,e),...t})}function jo({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-description`,className:A(`text-sm text-muted-foreground`,e),...t})}function Mo({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-action`,className:A(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function No({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-footer`,className:A(`flex items-center rounded-b-[min(var(--radius-4xl),24px)] px-(--card-spacing) [.border-t]:pt-(--card-spacing)`,e),...t})}var Po=`cotal.needs.dismissed`,Fo=`Dismiss until the status changes`,Io=e=>`${e.id} ${e.statusSince??``}`,Lo=new Set;function Ro(){let e=[];try{let t=JSON.parse(globalThis.localStorage?.getItem(Po)??`[]`);Array.isArray(t)&&(e=t.filter(e=>typeof e==`string`))}catch{}return[...new Set([...e,...Lo])]}function zo(e){try{globalThis.localStorage?.setItem(Po,JSON.stringify(e.slice(-100)))}catch{}}function Bo(){let[e,t]=(0,P.useState)([]);return(0,P.useLayoutEffect)(()=>t(Ro()),[]),[new Set(e),n=>{Lo.add(n);let r=[...e.filter(e=>e!==n),n];t(r),zo(r)}]}function Vo(e){let t=typeof e.statusSince==`number`&&Number.isFinite(e.statusSince)?`Reported ${Re(new Date(e.statusSince))}`:void 0,n=[e.activity?.trim().replace(/\.$/,``),t].filter(e=>!!e);return n.length?`${n.join(`. `)}.`:``}function Ho(e,t=Date.now()){return e.condition?In({condition:e.condition},t):``}function Uo({row:e,onViewAgent:t,onDismiss:n,post:r=null,selfId:i=null}){let a=ae(),o=Ho(e);return(0,F.jsxs)(Oo,{size:`sm`,children:[(0,F.jsxs)(ko,{children:[(0,F.jsxs)(Ao,{className:`flex items-center gap-2`,children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:22,badge:a(e.id)}),`${e.name} is waiting`]}),(0,F.jsx)(jo,{className:`line-clamp-2`,children:Vo(e)}),o&&(0,F.jsx)(jo,{children:o}),(0,F.jsx)(Mo,{children:(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Et,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Fo,onClick:n,children:(0,F.jsx)(N,{icon:vn})})}),(0,F.jsx)(E,{children:Fo})]})})]}),(0,F.jsxs)(No,{className:`flex-wrap gap-2`,children:[(0,F.jsx)(Et,{type:`button`,variant:`outline`,disabled:!t,onClick:()=>t?.(e.id),children:`View agent`}),r?.mode===`off`?(0,F.jsxs)(Et,{type:`button`,variant:`outline`,onClick:()=>sn(be({kind:`dm`,to:e.id})),children:[(0,F.jsx)(N,{icon:lt,"data-icon":`inline-start`}),`Copy command`]}):(0,F.jsx)(Et,{asChild:!0,children:(0,F.jsx)(`a`,{href:jt(Ht(e.id,i)),onClick:()=>zt({kind:`dm`,to:e.id}),children:`Message ${e.name}`})})]})]})}function Wo({rows:e}){let t=ae(),n=u().isMobile;if(e.length===0)return null;let r=e.length-3;return(0,F.jsxs)(`div`,{className:`ox-typing`,role:`status`,"aria-live":`polite`,children:[e.slice(0,3).map(e=>(0,F.jsxs)(Nn,{className:`ox-wline`,children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:18,dot:!1,badge:t(e.id)}),(0,F.jsxs)(Ie,{className:`ox-wline-c`,children:[(0,F.jsx)(`b`,{children:e.name}),` is ${ut(e)}`,e.activity&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{className:`ox-shimmer`,children:e.activity})]})]}),(0,F.jsx)(`a`,{className:`ox-act`,href:jt({view:`agent`,id:e.id,tab:`work`}),children:n?`View`:(0,F.jsxs)(F.Fragment,{children:[`View work`,(0,F.jsx)(N,{icon:Yt,size:16})]})})]},e.id)),r>0&&(0,F.jsx)(`div`,{className:`ox-wmore`,children:`and ${r} more`})]})}var z=4,B=[],Go=e=>typeof e.toService==`string`?`anycast`:typeof e.to==`string`?`unicast`:`chat`,Ko={s:[`second`,`seconds`],m:[`minute`,`minutes`],h:[`hour`,`hours`],d:[`day`,`days`]};function qo(e){let t=[];if(e?.deliveryClass===`durable`&&t.push({text:`durable`,title:`Kept for members who are offline`}),e?.replay===!0){let n=e.replayWindow;if(n===void 0)t.push({text:`replay`,title:`New members see every message the channel keeps`});else{let e=/^(\d+)(s|m|h|d)$/.exec(n.trim()),r=e?Number(e[1])===1?Ko[e[2]][0]:`${e[1]} ${Ko[e[2]][1]}`:n;t.push({text:`replay ${n}`,title:`New members see the last ${r}`})}}return t}function Jo(e,t){let n=e=>{let t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()},r=n(t),i=n(e);if(i===r)return`Today`;if(i===n(r-432e5))return`Yesterday`;let a=new Date(e),o=a.getFullYear()===new Date(t).getFullYear();return a.toLocaleDateString(`en-GB`,o?{day:`numeric`,month:`long`}:{day:`numeric`,month:`long`,year:`numeric`})}var Yo=({msg:e,senderId:t})=>`${e.id}\u0001${t??``}`;function Xo({messages:e,idx:t,peers:n,self:r}){let a=Date.now(),o=[],s=[],c=()=>{if(s.length===0)return;let a=s;s=[],o.push((0,F.jsx)(Tn,{messageId:Yo(e[a[0]]),children:(0,F.jsx)(It,{children:a.map((o,s)=>{let{msg:c,senderId:l}=e[o],u=Go(c);return(0,F.jsx)(i,{msg:c,senderId:l,mode:u,idx:t,peers:n,run:a.length===1?`alone`:s===0?`first`:s===a.length-1?`last`:`middle`,own:l!==void 0&&l===r,mention:`operator`,claim:u===`anycast`?xo(c.id,e.slice(o+1)):void 0},Yo(e[o]))})})},Yo(e[a[0]])))},l;return e.forEach(({msg:t,senderId:n},r)=>{let i=Number.isFinite(t.ts)?Jo(t.ts,a):void 0,u=i!==void 0&&i!==l;(u||n===void 0||e[r-1]?.senderId!==n)&&c(),u&&o.push((0,F.jsx)(Tn,{children:(0,F.jsx)(Nn,{variant:`separator`,children:(0,F.jsx)(Ie,{children:i})})},`day\u0001${Yo(e[r])}`)),i!==void 0&&(l=i),s.push(r)}),c(),(0,F.jsx)(F.Fragment,{children:o})}function Zo(){return(0,F.jsx)(vt,{behavior:En()?`auto`:`smooth`})}function Qo({store:e,channel:t,onMembers:n,onViewAgent:r,panelOpen:i=!1,onTogglePanel:a}){let o=M(e,e=>e.open),s=M(e,e=>e.channels),c=M(e,e=>e.roster),l=M(e,e=>e.membership),d=M(e,e=>e.post),f=M(e,e=>e.operatorId),p=o?.channel===t?o.messages:B,m=(0,P.useMemo)(()=>({kind:`msg`,channel:t}),[t]),h=(0,P.useMemo)(()=>new Set(p.map(e=>e.msg.id)),[p]),g=(0,P.useMemo)(()=>xt(c),[c]),_=(0,P.useMemo)(()=>Rt(c,{includeOffline:!0}),[c]),v=(0,P.useMemo)(()=>new Map(_.map(e=>[e.id,e])),[_]),y=ae(),b=s.find(e=>e.channel===t),x=(0,P.useMemo)(()=>$e(t,l,s.map(e=>e.channel),p),[t,l,s,p]),S=x.map(e=>v.get(e.id)).filter(e=>e?.status===`working`),[ee,te]=Bo(),C=on(_).find(e=>!ee.has(Io(e))),ne=x.length,w=u().isMobile,T=w?`Open agent panel`:`Toggle panel`,re=`${ne} member${ne===1?``:`s`}`,ie=`Working now: ${S.map(e=>e.name).join(`, `)}`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`# ${t}`}),b?.description&&(0,F.jsx)(`span`,{className:`ui-topic`,children:b.description}),(0,F.jsx)(`span`,{className:`ui-sp`}),!w&&qo(b).map(e=>(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:`outline`,children:[e.text,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${e.title}`})]})}),(0,F.jsx)(E,{children:e.title})]},e.text)),S.length>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(`span`,{className:`ox-hchip`,children:[(0,F.jsx)(N,{icon:tn,size:16,className:`ui-ic ox-spin`}),w?S.length:`${S.length} working`,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${ie}`})]})}),(0,F.jsx)(E,{children:ie})]}),(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(`span`,{className:`inline-flex`,tabIndex:n?void 0:0,children:(0,F.jsxs)(Et,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":re,disabled:!n,onClick:n,children:[(0,F.jsx)(`span`,{className:`ui-stack`,"aria-hidden":`true`,children:x.slice(0,z).map(e=>{let t=v.get(e.id);return(0,F.jsx)(he,{vendor:t?.harness,status:t?.status??`offline`,badge:t?y(e.id):void 0,size:22},e.id)})}),ne]})})}),(0,F.jsx)(E,{children:re})]}),a&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Be,{"aria-label":T,pressed:i,onPressedChange:a,children:(0,F.jsx)(N,{icon:Ct})})}),(0,F.jsx)(E,{children:T})]})]}),(0,F.jsx)(St,{autoScroll:!0,children:(0,F.jsxs)(bn,{className:`flex-1`,children:[(0,F.jsx)(Ot,{children:(0,F.jsxs)(Zt,{className:`ui-col`,children:[(0,F.jsx)(Xo,{messages:p,idx:g,peers:v,self:f}),(0,F.jsx)(gn,{store:e,target:m,shown:h}),S.length>0&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Wo,{rows:S})})]})}),(0,F.jsx)(Zo,{})]})},t),(C||d)&&(0,F.jsx)(`div`,{className:`ui-dock`,children:(0,F.jsxs)(`div`,{className:`ui-dock-in`,children:[C&&(0,F.jsx)(Uo,{row:C,onViewAgent:r,onDismiss:()=>te(Io(C)),post:d,selfId:f}),(0,F.jsx)(rn,{store:e,target:m,where:`#${t}`,to:w?`to #${t}`:`to #${t} · ${ne} member${ne===1?``:`s`}`})]})})]})}function $o({store:e,peer:t,with:n}){let r=M(e,e=>e.dms),i=M(e,e=>e.roster),a=M(e,e=>e.post),o=M(e,e=>e.operatorId),s=(0,P.useMemo)(()=>xt(i),[i]),c=(0,P.useMemo)(()=>Rt(i,{includeOffline:!0}),[i]),l=(0,P.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),u=M(e,e=>e.dmsCut),d=n??o??void 0,f=(0,P.useMemo)(()=>{if(d===void 0)return;let e=Xt(t,d);return yn(r).find(t=>t.key===e)},[r,t,d]),p=l.get(t),m=ae(),h=wn(t,s,o),g=[p?.role,p?.harness&&ve(p.harness)].filter(Boolean).join(` · `),_=(0,P.useMemo)(()=>Kt({view:`dm`,peer:t,with:n},o),[t,n,o]),v=(0,P.useMemo)(()=>new Set(r.map(e=>e.msg.id)),[r]),y=M(e,e=>_?e.drafts[Ee(_)]?.outgoing.length??0:0),b=_?.kind===`dm`?wn(_.to,s,o):``,x=[...new Set([t,d])].map(e=>e===void 0?void 0:l.get(e)).filter(e=>e?.status===`working`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(he,{vendor:p?.harness,status:p?.status??`offline`,size:22,badge:p?m(t):void 0}),(0,F.jsx)(`h1`,{children:h}),g&&(0,F.jsx)(`span`,{className:`ui-topic`,children:g}),f&&d!==void 0&&(0,F.jsx)(`span`,{className:`ui-topic`,children:`with ${wn(d,s,o)}`}),f&&!f.verified&&(0,F.jsx)(Bt,{})]}),(0,F.jsx)(St,{autoScroll:!0,children:(0,F.jsxs)(bn,{className:`flex-1`,children:[(0,F.jsx)(Ot,{children:(0,F.jsx)(Zt,{className:`ui-col`,children:f||y>0?(0,F.jsxs)(F.Fragment,{children:[f&&u&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Nn,{children:(0,F.jsx)(Ie,{children:`Earlier messages aren't loaded`})})}),f&&(0,F.jsx)(Xo,{messages:f.messages,idx:s,peers:l,self:o}),_&&(0,F.jsx)(gn,{store:e,target:_,shown:v}),x.length>0&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Wo,{rows:x})})]}):(0,F.jsx)(Tn,{children:(0,F.jsx)(We,{children:(0,F.jsx)(fe,{children:(0,F.jsx)(le,{children:`No direct messages with ${h} yet.`})})})})})}),(0,F.jsx)(Zo,{})]})},`${t}\u0001${d??``}`),a&&(_||n!==void 0)&&(0,F.jsx)(`div`,{className:`ui-dock`,children:(0,F.jsx)(`div`,{className:`ui-dock-in`,children:_?(0,F.jsx)(rn,{store:e,target:_,where:b,to:`to ${b}`}):(0,F.jsx)(wt,{peer:t,name:h,selfId:o})})})]})}var es=`cotal.agents.group`,ts=1e3;function ns(){try{let e=globalThis.localStorage?.getItem(es);return e===`status`||e===`host`?e:void 0}catch{return}}function rs(e){try{globalThis.localStorage?.setItem(es,e)}catch{}}function is(e){let t=[...new Set(e.map(e=>e.status).filter(e=>!nn.includes(e)))].sort();return[...nn,...t].map(t=>({key:t,label:re(t),rows:e.filter(e=>e.status===t)})).filter(e=>e.rows.length>0)}function as(e){let t=[...new Set(e.map(e=>e.host).filter(e=>e!==void 0))].sort((e,t)=>e.localeCompare(t)).map(t=>({key:`host:${t}`,label:t,rows:e.filter(e=>e.host===t)})),n=e.filter(e=>e.host===void 0);return n.length>0?[...t,{key:`host:`,label:`No host reported`,rows:n}]:t}var os=e=>[e.role,e.harness===void 0?void 0:ve(e.harness)].filter(Boolean).join(` · `);function ss(e,t){return e.status===`offline`?`Last heartbeat ${Re(new Date(e.ts))}`:e.status===`waiting`&&t===`status`?Vo(e)||`No current activity`:e.activity?.trim()||(e.status===`working`?re(ut(e)):`No current activity`)}function cs(e,t){let n=e.items.findLast(e=>e.kind===`turn`&&e.outcome===`open`&&!e.superseded),r=n?.steps.findLast(e=>e.kind!==`runError`);if(n===void 0||r?.kind!==`tools`)return;let i=r.calls.findLast(r=>On(r,{turn:n,trailing:!0,status:t,toolStatus:e.toolStatus})===`running`);return i===void 0?void 0:{call:i,turn:n}}function ls({store:e,controller:t,row:n}){kt(n.events===`off`?null:t,n.id);let r=M(e,e=>e.sessions[n.id]?.frames),i=Nt(e,n.id),a=(0,P.useMemo)(()=>r===void 0?void 0:cs(mt(r,i),n.status),[r,i,n.status]);return a===void 0?null:(0,F.jsx)(`span`,{className:`ox-now-w`,"aria-hidden":`true`,children:(0,F.jsx)(Tt,{call:a.call,state:`running`,className:`ox-now`})})}function us({row:e,grouping:t,selected:n,onPick:r,live:i}){let a=e.attention===`dnd`||e.attention===`focus`?e.attention:void 0,o=e.status===`waiting`&&t===`status`,s=ae();return(0,F.jsxs)(`div`,{className:e.status===`working`?`ox-arow ox-arow-w`:`ox-arow`,children:[(0,F.jsxs)(`button`,{type:`button`,className:e.status===`offline`?`v3-arow v3-arow-off`:`v3-arow`,"data-agent":e.id,"aria-current":n?`true`:void 0,onClick:()=>r?.(e.id),children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:36,badge:s(e.id)}),(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`span`,{className:`v3-aname`,children:[(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:os(e)})]}),(0,F.jsx)(`span`,{className:`v3-aact`,style:o?{color:`var(--gold-ink)`}:void 0,children:ss(e,t)}),i&&(0,F.jsx)(ls,{store:i.store,controller:i.controller,row:e})]}),a?(0,F.jsx)(ot,{attention:a}):(0,F.jsx)(`span`,{}),t===`host`?(0,F.jsx)(c,{row:e}):e.host!==void 0&&e.status!==`working`?(0,F.jsxs)(`span`,{className:`v3-meta ox-host`,children:[(0,F.jsx)(N,{icon:Ea,size:16,className:`ui-ic`}),e.host]}):(0,F.jsx)(`span`,{})]}),e.status===`working`&&(0,F.jsxs)(`a`,{className:`ox-act`,href:jt({view:`agent`,id:e.id,tab:`work`}),children:[`View work`,(0,F.jsx)(N,{icon:Yt,size:16})]})]})}function ds({rows:e}){return(0,F.jsxs)(`div`,{className:`v3-epsec`,children:[(0,F.jsxs)(`div`,{className:`v3-ghead`,style:{paddingTop:12},children:[(0,F.jsx)(N,{icon:Ta,size:16,className:`ui-ic`}),(0,F.jsx)(`span`,{style:{color:`var(--dim)`},children:`Endpoints`}),(0,F.jsx)(`span`,{className:`v3-count`,children:e.length})]}),e.map(e=>(0,F.jsxs)(`div`,{className:`v3-eprow`,children:[(0,F.jsx)(`span`,{className:e.status===`offline`?`ui-av ui-av-ep ui-av-off`:`ui-av ui-av-ep`,children:(0,F.jsx)(N,{icon:Da,size:16,className:`ui-ic ui-ic16`})}),(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:[e.role,e.host,e.status===`offline`?re(e.status):void 0].filter(Boolean).join(` · `)})]},e.id))]})}function fs({beat:e,clock:t}){let[,n]=(0,P.useReducer)(e=>e+1,0);return(0,P.useEffect)(()=>{let e=setInterval(n,ts);return()=>clearInterval(e)},[]),(0,F.jsxs)(`div`,{className:`v3-eprow`,style:{paddingLeft:66,fontSize:12.5},children:[`Oldest heartbeat among live agents: `,(0,F.jsx)(`span`,{className:`ui-num`,children:ft(t()-e)}),` ago`]})}function ps({store:e,controller:t=null,group:n,focusWaiting:r=!1,selected:i=null,onPick:a,clock:o=Date.now}){let s=M(e,e=>e.roster),c=M(e,e=>e.space),l=M(e,e=>e.stale),[u,d]=(0,P.useState)(n??`status`),f=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>d(n??ns()??`status`),[n]);let{agents:p,endpoints:m}=(0,P.useMemo)(()=>{let e=e=>e.card.kind===`agent`;return{agents:Rt(s.filter(e),{includeOffline:!0}),endpoints:Rt(s.filter(t=>!e(t)),{includeOffline:!0})}},[s]),h=u===`status`?is(p):as(p),g=p.length===0,_=h.some(e=>e.key===`waiting`)&&u===`status`,v=(0,P.useRef)(!1);(0,P.useLayoutEffect)(()=>{if(!r){v.current=!1;return}if(g||v.current)return;v.current=!0;let e=_?f.current:null;e?.focus({preventScroll:!0}),e?.scrollIntoView?.({block:`start`})},[r,g]);let y=e=>{d(e),rs(e)},b=p.filter(e=>e.status!==`offline`).length,x=l.some(e=>e.name===`roster`),S=new Set(x?[]:h.flatMap(e=>e.rows).filter(e=>e.status===`working`).slice(0,12).map(e=>e.id)),ee=hn(p);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Agents`}),!g&&(0,F.jsx)(`span`,{className:`ui-topic`,children:x?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-num`,children:b}),` last seen`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-num`,children:b}),` live, `,(0,F.jsx)(`span`,{className:`ui-num`,children:p.length-b}),` offline`,c===null?``:` on ${c}`]})}),(0,F.jsx)(`span`,{className:`ui-sp`}),!g&&(0,F.jsxs)(yo,{type:`single`,size:`sm`,"aria-label":`Group by`,value:u,onValueChange:e=>(e===`status`||e===`host`)&&y(e),children:[(0,F.jsx)(bo,{value:`status`,children:`Status`}),(0,F.jsx)(bo,{value:`host`,children:`Host`})]})]}),(0,F.jsx)(`div`,{className:`ui-scroll`,children:(0,F.jsxs)(`div`,{className:x?`ui-col s-lastseen`:`ui-col`,style:{maxWidth:900},children:[g&&(0,F.jsx)(So,{space:c}),!g&&(0,F.jsxs)(`div`,{className:u===`status`?`v3-by-status`:`v3-by-host`,children:[h.flatMap(n=>{let o=u===`status`?n.key:void 0,s=o!==void 0&&Object.hasOwn(zn,o);return[(0,F.jsxs)(`div`,{className:s?`v3-ghead v3-s-${o}`:`v3-ghead`,role:`heading`,"aria-level":2,ref:o===`waiting`?f:void 0,tabIndex:o===`waiting`?-1:void 0,"data-focused":o===`waiting`&&r?`true`:void 0,children:[s&&(0,F.jsx)(N,{icon:zn[o],size:16,className:qe(n.key,`ui-ic`)}),u===`host`&&(0,F.jsx)(N,{icon:Ea,size:16,className:`ui-ic`}),(0,F.jsx)(`span`,{style:{color:o===`offline`?`var(--dim)`:`var(--ink)`},children:n.label}),(0,F.jsx)(`span`,{className:`v3-count`,children:n.rows.length})]},`head:${n.key}`),...n.rows.map(n=>(0,F.jsx)(us,{row:n,grouping:u,selected:i===n.id,onPick:a,live:S.has(n.id)?{store:e,controller:t}:void 0},`row:${n.id}`))]}),u===`status`&&!x&&ee!==void 0&&Number.isFinite(ee)&&(0,F.jsx)(fs,{beat:ee,clock:o})]},u),m.length>0&&(0,F.jsx)(ds,{rows:m})]})})]})}var ms=[];function hs(e,t){let n=0,r=e.steps.length;for(;r>0&&n<t;){let t=e.steps[--r];t.kind!==`prompt`&&t.kind!==`reasoning`&&n++}return{...e,steps:e.steps.slice(r)}}function gs({turn:e,current:t,row:n}){let r=cn(t),{title:i,failed:a}=Fn(e,n.status,r);return(0,F.jsxs)(`div`,{className:`ui-lt-head ox-now-head`,children:[(0,F.jsx)(`h5`,{children:t?`Now`:`Last turn`}),(0,F.jsxs)(`span`,{className:`ox-now-t`,children:[i,a!==void 0&&(0,F.jsxs)(F.Fragment,{children:[`, `,(0,F.jsxs)(`span`,{className:`ox-fail`,children:[(0,F.jsx)(N,{icon:an,size:16}),a]})]})]})]})}function _s({store:e,id:t}){let n=M(e,e=>e.roster),r=M(e,e=>e.operatorId),i=M(e,e=>e.sessions[t]?.frames)??ms,a=Nt(e,t),o=n.find(e=>e.card.id===t),s=(0,P.useMemo)(()=>o?Rt([o],{includeOffline:!0})[0]:void 0,[o]),c=(0,P.useMemo)(()=>Qt(o),[o]),l=(0,P.useMemo)(()=>{let e=xt(n);return t=>wn(t,e,r)},[n,r]),u=(0,P.useMemo)(()=>mt(i,a),[i,a]);if(!s)return null;if(s.events===`off`)return(0,F.jsx)(_n,{children:`${s.name} publishes no work events.`});let d=u.items.filter(e=>e.kind===`turn`),f=d.findLast(e=>e.outcome===`open`&&!e.superseded),p=f!==void 0&&(s.status===`working`||s.status===`waiting`),m=p?f:d.at(-1);return m?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(gs,{turn:m,current:p,row:s}),(0,F.jsx)(Lt,{work:{items:[hs(m,3)],toolStatus:u.toolStatus},row:s,compact:!0,condition:c,nameOf:l})]}):null}function vs({store:e,controller:t=null,id:n,route:r}){let i=M(e,e=>e.roster),a=M(e,e=>e.operatorId),o=i.find(e=>e.card.id===n),s=(0,P.useMemo)(()=>o?Rt([o],{includeOffline:!0})[0].events:void 0,[o]);kt(o&&s!==`off`?t:null,n);let l=ae();if(!o)return(0,F.jsx)(`p`,{className:`ui-nr`,children:`Not on the roster`});let u=Rt([o],{includeOffline:!0})[0],d=[u.role,u.harness&&ve(u.harness)].filter(Boolean).join(` · `),f=typeof u.statusSince==`number`&&Number.isFinite(u.statusSince)?`Reported ${Re(new Date(u.statusSince))}`:void 0;return(0,F.jsxs)(`div`,{className:`ox-peek`,children:[(0,F.jsxs)(`div`,{className:`ox-peek-who`,children:[(0,F.jsx)(he,{vendor:u.harness,status:u.status,size:44,badge:l(u.id)}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:u.name}),d&&(0,F.jsx)(`div`,{className:`ui-sub`,children:d})]})]}),(0,F.jsxs)(`div`,{className:`ui-sline`,children:[(0,F.jsx)(c,{row:u}),(0,F.jsx)(`span`,{style:{color:`var(--ink)`},children:u.activity||`No current activity`}),f&&(0,F.jsx)(`small`,{children:f}),In(u,Date.now())&&(0,F.jsx)(`small`,{className:`ui-facts`,children:In(u,Date.now())})]}),(r?.view!==`agent`||r.id!==n)&&(0,F.jsx)(_s,{store:e,id:n}),(0,F.jsxs)(`div`,{className:`ui-actions`,children:[(0,F.jsx)(Et,{asChild:!0,size:`sm`,children:(0,F.jsxs)(`a`,{href:jt({view:`agent`,id:u.id,tab:`work`}),children:[(0,F.jsx)(N,{icon:Yt,"data-icon":`inline-start`}),`Open ${u.name}'s page`]})}),(0,F.jsx)(Et,{asChild:!0,variant:`outline`,size:`sm`,children:(0,F.jsxs)(`a`,{href:jt(Ht(u.id,a)),onClick:()=>zt({kind:`dm`,to:u.id}),children:[(0,F.jsx)(N,{icon:xn,"data-icon":`inline-start`}),`Message`]})})]})]})}var ys={live:{word:`live`,cls:`ui-mdot-live`,title:`From broker membership, served by the delivery daemon`},stale:{word:`stale`,cls:`ui-mdot-stale`,title:`The daemon's last report is older than 45 seconds, or has no time on it`},"traffic-only":{word:`traffic-only`,cls:`ui-mdot-traffic`,title:`No delivery daemon on an open mesh, so members come from who has posted`},unreadable:{word:`unreadable`,cls:`ui-mdot-unread`}};function bs({state:e,reason:t}){let n=ys[e],r=e===`unreadable`?t?`the read failed: ${t}`:`the read failed`:n.title;return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:e===`unreadable`?`destructive`:`outline`,children:[(0,F.jsx)(`i`,{className:`ui-mdot ${n.cls}`}),`Membership: `,n.word,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${r}`})]})}),(0,F.jsx)(E,{children:r})]})}function xs({...e}){return(0,F.jsx)(Dr,{"data-slot":`alert-dialog`,...e})}function Ss({...e}){return(0,F.jsx)(Or,{"data-slot":`alert-dialog-trigger`,...e})}function Cs({...e}){return(0,F.jsx)(kr,{"data-slot":`alert-dialog-portal`,...e})}function ws({className:e,...t}){return(0,F.jsx)(Ar,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ts({className:e,size:t=`default`,...n}){return(0,F.jsxs)(Cs,{children:[(0,F.jsx)(ws,{}),(0,F.jsx)(Nr,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Es({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ds({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Os({className:e,...t}){return(0,F.jsx)(Pr,{"data-slot":`alert-dialog-title`,className:A(`text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function ks({className:e,...t}){return(0,F.jsx)(Fr,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function As({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,F.jsx)(Et,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(Ir,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function js({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,F.jsx)(Et,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(Rr,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ms({channel:e,space:t,controller:n,children:r}){let[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=(0,P.useRef)(null),p=(0,P.useId)(),h=o===e,g=e=>{a(e),e&&(s(``),l(null),d(!1))},_=async()=>{if(h&&n!==null&&!u){d(!0),l(null);try{await n.deleteChannel(e),a(!1)}catch(e){l(e instanceof Error?e.message:String(e)),d(!1)}}};return(0,F.jsxs)(xs,{open:i,onOpenChange:g,children:[(0,F.jsx)(Ss,{asChild:!0,children:r}),(0,F.jsxs)(Ts,{onOpenAutoFocus:e=>{e.preventDefault(),f.current?.focus()},children:[(0,F.jsxs)(Es,{children:[(0,F.jsx)(Os,{children:`Delete #${e}?`}),(0,F.jsx)(ks,{children:`This deletes every message in #${e} for everyone${t?` on ${t}`:``}. You can't undo it. If anyone posts to #${e} again, it comes back empty.`})]}),(0,F.jsxs)(Mt,{children:[(0,F.jsx)(ct,{htmlFor:p,children:(0,F.jsxs)(`span`,{children:[`Type `,(0,F.jsx)(`b`,{children:e}),` to confirm`]})}),(0,F.jsx)(me,{ref:f,id:p,value:o,autoComplete:`off`,spellCheck:!1,onChange:e=>s(e.target.value)})]}),c!==null&&(0,F.jsx)(m,{variant:`destructive`,children:(0,F.jsx)(we,{children:c})}),(0,F.jsxs)(Ds,{children:[(0,F.jsx)(js,{children:`Keep channel`}),(0,F.jsxs)(As,{variant:`destructive`,disabled:!h||u||n===null,onClick:e=>{e.preventDefault(),_()},children:[(0,F.jsx)(N,{icon:wa,"data-icon":`inline-start`}),`Delete #${e}`]})]})]})]})}var Ns=[];function Ps(e){if(e?.deliveryClass===void 0)return;let t=[e.deliveryClass];return e.replay===!0&&t.push(e.replayWindow===void 0?`replay`:`replay ${e.replayWindow}`),t.join(`, `)}function Fs({store:e,controller:t,channel:r,now:i,onPick:a}){let o=M(e,e=>e.space),s=M(e,e=>e.roster),l=M(e,e=>e.channels),u=M(e,e=>e.membership),d=M(e,e=>e.open),f=d?.channel===r?d.messages:Ns,p=(0,P.useMemo)(()=>xt(s),[s]),m=(0,P.useMemo)(()=>Rt(s,{includeOffline:!0}),[s]),h=(0,P.useMemo)(()=>{let e=new Map(m.map((e,t)=>[e.id,t])),t=t=>e.get(t)??m.length;return $e(r,u,l.map(e=>e.channel),f).sort((e,n)=>t(e.id)-t(n.id))},[r,u,l,f,m]),g=ae(),_=(0,P.useMemo)(()=>new Map(m.map(e=>[e.id,e])),[m]),v=l.find(e=>e.channel===r),y=Ps(v),b=h.length;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`v3-mhead`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{style:{color:`var(--ink)`,fontWeight:600},children:`#${r}`}),` · `,(0,F.jsx)(`span`,{className:`ui-num`,children:b}),b===1?` member`:` members`]}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(bs,{state:n(u,i),reason:u.unreadable})]}),h.map(e=>{let t=_.get(e.id);return(0,F.jsxs)(`button`,{type:`button`,className:`v3-mrow`,"data-member":e.id,"data-source":e.source,onClick:()=>a(e.id),children:[(0,F.jsx)(he,{vendor:t?.harness,status:t?.status??`offline`,size:28,dot:t!==void 0,badge:t?g(e.id):void 0}),(0,F.jsxs)(`span`,{className:`v3-mname`,children:[t?.name??wn(e.id,p),t?.role&&(0,F.jsx)(`span`,{children:t.role})]}),t&&(0,F.jsx)(c,{row:t})]},e.id)}),(0,F.jsx)(`h5`,{style:{marginTop:14},children:`Channel`}),(0,F.jsxs)(`dl`,{className:`ui-kv`,style:{borderTop:0,paddingTop:0},children:[v?.description&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Topic`}),(0,F.jsx)(`dd`,{children:v.description})]}),y&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Delivery`}),(0,F.jsx)(`dd`,{children:y})]}),v&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Messages`}),(0,F.jsx)(`dd`,{className:`ui-num`,children:v.messages})]})]}),(0,F.jsx)(Ms,{channel:r,space:o,controller:t,children:(0,F.jsxs)(Et,{type:`button`,variant:`destructive`,className:`mt-1`,children:[(0,F.jsx)(N,{icon:wa,"data-icon":`inline-start`}),`Delete channel`]})})]})}var Is={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Ls(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Is.hasOwnProperty(t)?{space:Is[t],local:e}:e}function Rs(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function zs(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bs(e){var t=Ls(e);return(t.local?zs:Rs)(t)}function Vs(){}function Hs(e){return e==null?Vs:function(){return this.querySelector(e)}}function Us(e){typeof e!=`function`&&(e=Hs(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new Al(r,this._parents)}function Ws(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Gs(){return[]}function Ks(e){return e==null?Gs:function(){return this.querySelectorAll(e)}}function qs(e){return function(){return Ws(e.apply(this,arguments))}}function Js(e){e=typeof e==`function`?qs(e):Ks(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new Al(r,i)}function Ys(e){return function(){return this.matches(e)}}function Xs(e){return function(t){return t.matches(e)}}var Zs=Array.prototype.find;function Qs(e){return function(){return Zs.call(this.children,e)}}function $s(){return this.firstElementChild}function ec(e){return this.select(e==null?$s:Qs(typeof e==`function`?e:Xs(e)))}var tc=Array.prototype.filter;function nc(){return Array.from(this.children)}function rc(e){return function(){return tc.call(this.children,e)}}function ic(e){return this.selectAll(e==null?nc:rc(typeof e==`function`?e:Xs(e)))}function ac(e){typeof e!=`function`&&(e=Ys(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Al(r,this._parents)}function oc(e){return Array(e.length)}function sc(){return new Al(this._enter||this._groups.map(oc),this._parents)}function cc(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}cc.prototype={constructor:cc,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function lc(e){return function(){return e}}function uc(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new cc(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function dc(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new cc(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function fc(e){return e.__data__}function pc(e,t){if(!arguments.length)return Array.from(this,fc);var n=t?dc:uc,r=this._parents,i=this._groups;typeof e!=`function`&&(e=lc(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=mc(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new Al(o,r),o._enter=s,o._exit=c,o}function mc(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function hc(){return new Al(this._exit||this._groups.map(oc),this._parents)}function gc(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function _c(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new Al(s,this._parents)}function vc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function yc(e){e||=bc;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new Al(i,this._parents).order()}function bc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sc(){return Array.from(this)}function Cc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function wc(){let e=0;for(let t of this)++e;return e}function Tc(){return!this.node()}function Ec(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Dc(e){return function(){this.removeAttribute(e)}}function Oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kc(e,t){return function(){this.setAttribute(e,t)}}function Ac(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function jc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Mc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Nc(e,t){var n=Ls(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Oc:Dc:typeof t==`function`?n.local?Mc:jc:n.local?Ac:kc)(n,t))}function Pc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Fc(e){return function(){this.style.removeProperty(e)}}function Ic(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Lc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Rc(e,t,n){return arguments.length>1?this.each((t==null?Fc:typeof t==`function`?Lc:Ic)(e,t,n??``)):zc(this.node(),e)}function zc(e,t){return e.style.getPropertyValue(t)||Pc(e).getComputedStyle(e,null).getPropertyValue(t)}function Bc(e){return function(){delete this[e]}}function Vc(e,t){return function(){this[e]=t}}function Hc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Uc(e,t){return arguments.length>1?this.each((t==null?Bc:typeof t==`function`?Hc:Vc)(e,t)):this.node()[e]}function Wc(e){return e.trim().split(/^|\s+/)}function Gc(e){return e.classList||new Kc(e)}function Kc(e){this._node=e,this._names=Wc(e.getAttribute(`class`)||``)}Kc.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function qc(e,t){for(var n=Gc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Jc(e,t){for(var n=Gc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Yc(e){return function(){qc(this,e)}}function Xc(e){return function(){Jc(this,e)}}function Zc(e,t){return function(){(t.apply(this,arguments)?qc:Jc)(this,e)}}function Qc(e,t){var n=Wc(e+``);if(arguments.length<2){for(var r=Gc(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Zc:t?Yc:Xc)(n,t))}function $c(){this.textContent=``}function el(e){return function(){this.textContent=e}}function tl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function nl(e){return arguments.length?this.each(e==null?$c:(typeof e==`function`?tl:el)(e)):this.node().textContent}function rl(){this.innerHTML=``}function il(e){return function(){this.innerHTML=e}}function al(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function ol(e){return arguments.length?this.each(e==null?rl:(typeof e==`function`?al:il)(e)):this.node().innerHTML}function sl(){this.nextSibling&&this.parentNode.appendChild(this)}function cl(){return this.each(sl)}function ll(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ul(){return this.each(ll)}function dl(e){var t=typeof e==`function`?e:Bs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function fl(){return null}function pl(e,t){var n=typeof e==`function`?e:Bs(e),r=t==null?fl:typeof t==`function`?t:Hs(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ml(){var e=this.parentNode;e&&e.removeChild(this)}function hl(){return this.each(ml)}function gl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _l(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vl(e){return this.select(e?_l:gl)}function yl(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function bl(e){return function(t){e.call(this,t,this.__data__)}}function V(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function xl(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Sl(e,t,n){return function(){var r=this.__on,i,a=bl(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Cl(e,t,n){var r=V(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?Sl:xl,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function wl(e,t,n){var r=Pc(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Tl(e,t){return function(){return wl(this,e,t)}}function El(e,t){return function(){return wl(this,e,t.apply(this,arguments))}}function Dl(e,t){return this.each((typeof t==`function`?El:Tl)(e,t))}function*Ol(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var kl=[null];function Al(e,t){this._groups=e,this._parents=t}function jl(){return new Al([[document.documentElement]],kl)}function Ml(){return this}Al.prototype=jl.prototype={constructor:Al,select:Us,selectAll:Js,selectChild:ec,selectChildren:ic,filter:ac,data:pc,enter:sc,exit:hc,join:gc,merge:_c,selection:Ml,order:vc,sort:yc,call:xc,nodes:Sc,node:Cc,size:wc,empty:Tc,each:Ec,attr:Nc,style:Rc,property:Uc,classed:Qc,text:nl,html:ol,raise:cl,lower:ul,append:dl,insert:pl,remove:hl,clone:vl,datum:yl,on:Cl,dispatch:Dl,[Symbol.iterator]:Ol};function Nl(e){return typeof e==`string`?new Al([[document.querySelector(e)]],[document.documentElement]):new Al([[e]],kl)}function Pl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fl(e,t){if(e=Pl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Il={value:()=>{}};function Ll(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Rl(n)}function Rl(e){this._=e}function zl(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Rl.prototype=Ll.prototype={constructor:Rl,on:function(e,t){var n=this._,r=zl(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Bl(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Vl(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Vl(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Rl(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Bl(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Vl(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Il,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hl={capture:!0,passive:!1};function Ul(e){e.preventDefault(),e.stopImmediatePropagation()}function Wl(e){var t=e.document.documentElement,n=Nl(e).on(`dragstart.drag`,Ul,Hl);`onselectstart`in t?n.on(`selectstart.drag`,Ul,Hl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Gl(e,t){var n=e.document.documentElement,r=Nl(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Ul,Hl),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Kl(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ql(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Jl(){}var Yl=.7,Xl=1/Yl,Zl=`\\s*([+-]?\\d+)\\s*`,Ql=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,$l=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,eu=/^#([0-9a-f]{3,8})$/,tu=RegExp(`^rgb\\(${Zl},${Zl},${Zl}\\)$`),nu=RegExp(`^rgb\\(${$l},${$l},${$l}\\)$`),ru=RegExp(`^rgba\\(${Zl},${Zl},${Zl},${Ql}\\)$`),iu=RegExp(`^rgba\\(${$l},${$l},${$l},${Ql}\\)$`),au=RegExp(`^hsl\\(${Ql},${$l},${$l}\\)$`),ou=RegExp(`^hsla\\(${Ql},${$l},${$l},${Ql}\\)$`),su={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Kl(Jl,du,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:H,formatHex:H,formatHex8:cu,formatHsl:lu,formatRgb:uu,toString:uu});function H(){return this.rgb().formatHex()}function cu(){return this.rgb().formatHex8()}function lu(){return Cu(this).formatHsl()}function uu(){return this.rgb().formatRgb()}function du(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=eu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fu(t):n===3?new gu(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tu.exec(e))?new gu(t[1],t[2],t[3],1):(t=nu.exec(e))?new gu(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ru.exec(e))?pu(t[1],t[2],t[3],t[4]):(t=iu.exec(e))?pu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=au.exec(e))?U(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?U(t[1],t[2]/100,t[3]/100,t[4]):su.hasOwnProperty(e)?fu(su[e]):e===`transparent`?new gu(NaN,NaN,NaN,0):null}function fu(e){return new gu(e>>16&255,e>>8&255,e&255,1)}function pu(e,t,n,r){return r<=0&&(e=t=n=NaN),new gu(e,t,n,r)}function mu(e){return e instanceof Jl||(e=du(e)),e?(e=e.rgb(),new gu(e.r,e.g,e.b,e.opacity)):new gu}function hu(e,t,n,r){return arguments.length===1?mu(e):new gu(e,t,n,r??1)}function gu(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Kl(gu,hu,ql(Jl,{brighter(e){return e=e==null?Xl:Xl**+e,new gu(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yl:Yl**+e,new gu(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gu(xu(this.r),xu(this.g),xu(this.b),bu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_u,formatHex:_u,formatHex8:vu,formatRgb:yu,toString:yu}));function _u(){return`#${Su(this.r)}${Su(this.g)}${Su(this.b)}`}function vu(){return`#${Su(this.r)}${Su(this.g)}${Su(this.b)}${Su((isNaN(this.opacity)?1:this.opacity)*255)}`}function yu(){let e=bu(this.opacity);return`${e===1?`rgb(`:`rgba(`}${xu(this.r)}, ${xu(this.g)}, ${xu(this.b)}${e===1?`)`:`, ${e})`}`}function bu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function xu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Su(e){return e=xu(e),(e<16?`0`:``)+e.toString(16)}function U(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tu(e,t,n,r)}function Cu(e){if(e instanceof Tu)return new Tu(e.h,e.s,e.l,e.opacity);if(e instanceof Jl||(e=du(e)),!e)return new Tu;if(e instanceof Tu)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Tu(o,s,c,e.opacity)}function wu(e,t,n,r){return arguments.length===1?Cu(e):new Tu(e,t,n,r??1)}function Tu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Kl(Tu,wu,ql(Jl,{brighter(e){return e=e==null?Xl:Xl**+e,new Tu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yl:Yl**+e,new Tu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new gu(Ou(e>=240?e-240:e+120,i,r),Ou(e,i,r),Ou(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Tu(Eu(this.h),Du(this.s),Du(this.l),bu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=bu(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Eu(this.h)}, ${Du(this.s)*100}%, ${Du(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Eu(e){return e=(e||0)%360,e<0?e+360:e}function Du(e){return Math.max(0,Math.min(1,e||0))}function Ou(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ku=e=>()=>e;function Au(e,t){return function(n){return e+n*t}}function ju(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Mu(e){return(e=+e)==1?Nu:function(t,n){return n-t?ju(t,n,e):ku(isNaN(t)?n:t)}}function Nu(e,t){var n=t-e;return n?Au(e,n):ku(isNaN(e)?t:e)}var Pu=(function e(t){var n=Mu(t);function r(e,t){var r=n((e=hu(e)).r,(t=hu(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Nu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Fu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Iu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lu=new RegExp(Iu.source,`g`);function Ru(e){return function(){return e}}function zu(e){return function(t){return e(t)+``}}function Bu(e,t){var n=Iu.lastIndex=Lu.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Iu.exec(e))&&(i=Lu.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Fu(r,i)})),n=Lu.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?zu(c[0].x):Ru(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var Vu=180/Math.PI,Hu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Uu(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Vu,skewX:Math.atan(c)*Vu,scaleX:o,scaleY:s}}var Wu;function Gu(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Hu:Uu(t.a,t.b,t.c,t.d,t.e,t.f)}function Ku(e){return e==null||(Wu||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Wu.setAttribute(`transform`,e),!(e=Wu.transform.baseVal.consolidate()))?Hu:(e=e.matrix,Uu(e.a,e.b,e.c,e.d,e.e,e.f))}function qu(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Fu(e,i)},{i:c-2,x:Fu(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Fu(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Fu(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Fu(e,n)},{i:s-2,x:Fu(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Ju=qu(Gu,`px, `,`px)`,`deg)`),Yu=qu(Ku,`, `,`)`,`)`),Xu=1e-12;function Zu(e){return((e=Math.exp(e))+1/e)/2}function Qu(e){return((e=Math.exp(e))-1/e)/2}function $u(e){return((e=Math.exp(2*e))-1)/(e+1)}var ed=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Xu)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Zu(y),c=s/(n*g)*(i*$u(t*r+y)-Qu(y));return[a+c*d,o+c*f,s*i/Zu(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),td=0,W=0,G=0,K=1e3,q,J,nd=0,rd=0,id=0,ad=typeof performance==`object`&&performance.now?performance:Date,od=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Y(){return rd||=(od(sd),ad.now()+id)}function sd(){rd=0}function cd(){this._call=this._time=this._next=null}cd.prototype=ld.prototype={constructor:cd,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Y():+n)+(t==null?0:+t),!this._next&&J!==this&&(J?J._next=this:q=this,J=this),this._call=e,this._time=n,md()},stop:function(){this._call&&(this._call=null,this._time=1/0,md())}};function ld(e,t,n){var r=new cd;return r.restart(e,t,n),r}function ud(){Y(),++td;for(var e=q,t;e;)(t=rd-e._time)>=0&&e._call.call(void 0,t),e=e._next;--td}function dd(){rd=(nd=ad.now())+id,td=W=0;try{ud()}finally{td=0,pd(),rd=0}}function fd(){var e=ad.now(),t=e-nd;t>K&&(id-=t,nd=e)}function pd(){for(var e,t=q,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:q=n);J=e,md(r)}function md(e){td||(W&&=clearTimeout(W),e-rd>24?(e<1/0&&(W=setTimeout(dd,e-ad.now()-id)),G&&=clearInterval(G)):(G||=(nd=ad.now(),setInterval(fd,K)),td=1,od(dd)))}function hd(e,t,n){var r=new cd;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var gd=Ll(`start`,`end`,`cancel`,`interrupt`),_d=[];function vd(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;xd(e,n,{name:t,index:r,group:i,on:gd,tween:_d,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function yd(e,t){var n=bd(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function X(e,t){var n=bd(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function bd(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function xd(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ld(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return hd(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(hd(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Sd(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function Cd(e){return this.each(function(){Sd(this,e)})}function wd(e,t){var n,r;return function(){var i=X(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Td(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=X(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Ed(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=bd(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?wd:Td)(n,e,t))}function Dd(e,t,n){var r=e._id;return e.each(function(){var e=X(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return bd(e,r).value[t]}}function Od(e,t){var n;return(typeof t==`number`?Fu:t instanceof du?Pu:(n=du(t))?(t=n,Pu):Bu)(e,t)}function kd(e){return function(){this.removeAttribute(e)}}function Ad(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jd(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Md(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Nd(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Pd(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fd(e,t){var n=Ls(e),r=n===`transform`?Yu:Od;return this.attrTween(e,typeof t==`function`?(n.local?Pd:Nd)(n,r,Dd(this,`attr.`+e,t)):t==null?(n.local?Ad:kd)(n):(n.local?Md:jd)(n,r,t))}function Id(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ld(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Rd(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ld(e,i)),n}return i._value=t,i}function zd(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Id(e,i)),n}return i._value=t,i}function Bd(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Ls(e);return this.tween(n,(r.local?Rd:zd)(r,t))}function Vd(e,t){return function(){yd(this,e).delay=+t.apply(this,arguments)}}function Hd(e,t){return t=+t,function(){yd(this,e).delay=t}}function Ud(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Vd:Hd)(t,e)):bd(this.node(),t).delay}function Wd(e,t){return function(){X(this,e).duration=+t.apply(this,arguments)}}function Gd(e,t){return t=+t,function(){X(this,e).duration=t}}function Kd(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Wd:Gd)(t,e)):bd(this.node(),t).duration}function qd(e,t){if(typeof t!=`function`)throw Error();return function(){X(this,e).ease=t}}function Jd(e){var t=this._id;return arguments.length?this.each(qd(t,e)):bd(this.node(),t).ease}function Yd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();X(this,e).ease=n}}function Xd(e){if(typeof e!=`function`)throw Error();return this.each(Yd(this._id,e))}function Zd(e){typeof e!=`function`&&(e=Ys(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Ef(r,this._parents,this._name,this._id)}function Qd(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Ef(o,this._parents,this._name,this._id)}function $d(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ef(e,t,n){var r,i,a=$d(t)?yd:X;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function tf(e,t){var n=this._id;return arguments.length<2?bd(this.node(),n).on.on(e):this.each(ef(n,e,t))}function nf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function rf(){return this.on(`end.remove`,nf(this._id))}function af(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Hs(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,vd(l[f],t,n,f,l,bd(u,n)));return new Ef(a,this._parents,t,n)}function of(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ks(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=bd(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&vd(p,t,n,h,f,m);a.push(f),o.push(u)}return new Ef(a,o,t,n)}var sf=jl.prototype.constructor;function cf(){return new sf(this._groups,this._parents)}function lf(e,t){var n,r,i;return function(){var a=zc(this,e),o=(this.style.removeProperty(e),zc(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function uf(e){return function(){this.style.removeProperty(e)}}function df(e,t,n){var r,i=n+``,a;return function(){var o=zc(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ff(e,t,n){var r,i,a;return function(){var o=zc(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),zc(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function pf(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=X(this,e),l=c.on,u=c.value[a]==null?s||=uf(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Z(e,t,n){var r=(e+=``)==`transform`?Ju:Od;return t==null?this.styleTween(e,lf(e,r)).on(`end.style.`+e,uf(e)):typeof t==`function`?this.styleTween(e,ff(e,r,Dd(this,`style.`+e,t))).each(pf(this._id,e)):this.styleTween(e,df(e,r,t),n).on(`end.style.`+e,null)}function mf(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function hf(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&mf(e,a,n)),r}return a._value=t,a}function gf(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,hf(e,t,n??``))}function _f(e){return function(){this.textContent=e}}function vf(e){return function(){var t=e(this);this.textContent=t??``}}function yf(e){return this.tween(`text`,typeof e==`function`?vf(Dd(this,`text`,e)):_f(e==null?``:e+``))}function bf(e){return function(t){this.textContent=e.call(this,t)}}function xf(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&bf(r)),t}return r._value=e,r}function Sf(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,xf(e))}function Cf(){for(var e=this._name,t=this._id,n=Df(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=bd(c,t);vd(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ef(r,this._parents,e,n)}function wf(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=X(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Tf=0;function Ef(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Df(){return++Tf}var Of=jl.prototype;Ef.prototype={constructor:Ef,select:af,selectAll:of,selectChild:Of.selectChild,selectChildren:Of.selectChildren,filter:Zd,merge:Qd,selection:cf,transition:Cf,call:Of.call,nodes:Of.nodes,node:Of.node,size:Of.size,empty:Of.empty,each:Of.each,on:tf,attr:Fd,attrTween:Bd,style:Z,styleTween:gf,text:yf,textTween:Sf,remove:rf,tween:Ed,delay:Ud,duration:Kd,ease:Jd,easeVarying:Xd,end:wf,[Symbol.iterator]:Of[Symbol.iterator]};function kf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Af={time:null,delay:0,duration:250,ease:kf};function jf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Mf(e){var t,n;e instanceof Ef?(t=e._id,e=e._name):(t=Df(),(n=Af).time=Y(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&vd(c,e,t,l,o,n||jf(c,t));return new Ef(r,this._parents,e,t)}jl.prototype.interrupt=Cd,jl.prototype.transition=Mf;var Nf=e=>()=>e;function Pf(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ff(e,t,n){this.k=e,this.x=t,this.y=n}Ff.prototype={constructor:Ff,scale:function(e){return e===1?this:new Ff(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ff(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var If=new Ff(1,0,0);Lf.prototype=Ff.prototype;function Lf(e){for(;!e.__zoom;)if(!(e=e.parentNode))return If;return e.__zoom}function Rf(e){e.stopImmediatePropagation()}function zf(e){e.preventDefault(),e.stopImmediatePropagation()}function Bf(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Vf(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Q(){return this.__zoom||If}function Hf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uf(){return navigator.maxTouchPoints||`ontouchstart`in this}function Wf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Gf(){var e=Bf,t=Vf,n=Wf,r=Hf,i=Uf,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ed,l=Ll(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Q).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,ne).filter(i).on(`touchstart.zoom`,w).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,re).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Q),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(If.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Ff(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Ff(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Ff(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Nl(this.that).datum();l.call(e,this.that,new Pf(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Fl(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Sd(this),s.start();zf(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Nl(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Fl(t,i),l=t.clientX,u=t.clientY;Wl(t.view),Rf(t),a.mouse=[c,this.__zoom.invert(c)],Sd(this),a.start();function d(e){if(zf(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Fl(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gl(e.view,a.moved),zf(e),a.event(e).end()}}function ne(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Fl(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);zf(r),s>0?Nl(this).transition().duration(s).call(x,d,c,r):Nl(this).call(_.transform,d,c,r)}}function w(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Rf(t),s=0;s<i;++s)c=r[s],l=Fl(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Sd(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(zf(e),s=0;s<a;++s)c=i[s],l=Fl(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function re(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Rf(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Fl(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Nl(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Nf(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Nf(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Nf(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Nf([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}function Kf(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i<a;++i)o=n[i],s+=o.x,c+=o.y;for(s=(s/a-e)*r,c=(c/a-t)*r,i=0;i<a;++i)o=n[i],o.x-=s,o.y-=c}return i.initialize=function(e){n=e},i.x=function(t){return arguments.length?(e=+t,i):e},i.y=function(e){return arguments.length?(t=+e,i):t},i.strength=function(e){return arguments.length?(r=+e,i):r},i}function qf(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return Jf(this.cover(t,n),t,n,e)}function Jf(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Yf(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)Jf(this,o[n],s[n],e[n]);return this}function Xf(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Zf(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qf(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function $f(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function ep(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new $f(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new $f(p[3],g,_,c,l),new $f(p[2],o,_,g,l),new $f(p[1],g,s,c,_),new $f(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function $(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tp(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function np(){return this._root}function rp(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function ip(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new $f(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new $f(i,l,u,s,c)),(i=r[2])&&t.push(new $f(i,a,u,l,c)),(i=r[1])&&t.push(new $f(i,l,o,s,u)),(i=r[0])&&t.push(new $f(i,a,o,l,u))}return this}function ap(e){var t=[],n=[],r;for(this._root&&t.push(new $f(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new $f(a,o,s,u,d)),(a=i[1])&&t.push(new $f(a,u,s,c,d)),(a=i[2])&&t.push(new $f(a,o,d,u,l)),(a=i[3])&&t.push(new $f(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function op(e){return e[0]}function sp(e){return arguments.length?(this._x=e,this):this._x}function cp(e){return e[1]}function lp(e){return arguments.length?(this._y=e,this):this._y}function up(e,t,n){var r=new dp(t??op,n??cp,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dp(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function fp(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var pp=up.prototype=dp.prototype;pp.copy=function(){var e=new dp(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=fp(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=fp(r));return e},pp.add=qf,pp.addAll=Yf,pp.cover=Xf,pp.data=Zf,pp.extent=Qf,pp.find=ep,pp.remove=$,pp.removeAll=tp,pp.root=np,pp.size=rp,pp.visit=ip,pp.visitAfter=ap,pp.x=sp,pp.y=lp;function mp(e){return function(){return e}}function hp(e){return(e()-.5)*1e-6}function gp(e){return e.x+e.vx}function _p(e){return e.y+e.vy}function vp(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=mp(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=up(t,gp,_p).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=hp(r),_+=h*h),g===0&&(g=hp(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),c(),o):e},o}function yp(e){return e.index}function bp(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function xp(e){var t=yp,n=d,r,i=mp(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||hp(l),m=f.y+f.vy-d.y-d.vy||hp(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=bp(u,d.source)),typeof d.target!=`object`&&(d.target=bp(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:mp(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:mp(+e),h(),f):i},f}var Sp=1664525,Cp=1013904223,wp=4294967296;function Tp(){let e=1;return()=>(e=(Sp*e+Cp)%wp)/wp}function Ep(e){return e.x}function Dp(e){return e.y}var Op=10,kp=Math.PI*(3-Math.sqrt(5));function Ap(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=ld(d),l=Ll(`tick`,`end`),u=Tp();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=Op*Math.sqrt(.5+t),a=t*kp;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function jp(){var e,t,n,r,i=mp(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=up(e,Ep,Dp).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=hp(n),m+=d*d),f===0&&(f=hp(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=hp(n),m+=d*d),f===0&&(f=hp(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:mp(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function Mp(e){var t=mp(.1),n,r,i;typeof e!=`function`&&(e=mp(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:mp(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),o(),a):e},a}function Np(e){var t=mp(.1),n,r,i;typeof e!=`function`&&(e=mp(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:mp(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),o(),a):e},a}var Pp=e=>14+e.length*7,Fp=e=>e.kind===`channel`?Pp(e.label)/2+6:30;function Ip(e){let t=e.nodes.map(e=>e.id).sort(),n=e.links.map(e=>`${e.source}\u0000${e.target}\u0000${e.kind}`).sort();return`${t.join(``)}\u0002${n.join(``)}`}var Lp=300,Rp=.5,zp=20,Bp=class{sim;links;bodies=new Map;key;size=``;width=0;height=0;constructor(e,t){this.links=xp([]).id(e=>e.id).strength(.4),this.sim=Ap().force(`link`,this.links).force(`charge`,jp()).force(`center`,Kf()).force(`collide`,vp().radius(e=>e.r)).force(`x`,Mp()).force(`y`,Np()).force(`bounds`,()=>{for(let e of this.bodies.values())e.x!==void 0&&(e.x=Math.min(Math.max(e.x,e.r),this.width-e.r)),e.y!==void 0&&(e.y=Math.min(Math.max(e.y,e.r),this.height-e.r-zp))}).stop(),this.resize(e,t)}resize(e,t){let n=`${e}x${t}`;if(n===this.size)return!1;this.size=n,this.width=e,this.height=t;let r=Math.min(e,t)/420;return this.links.distance(90*r),this.sim.force(`charge`,jp().strength(-280*r*r)).force(`center`,Kf(e/2,t/2)).force(`x`,Mp(e/2).strength(.04)).force(`y`,Np(t/2).strength(.04)),!0}sync(e){let t=Ip(e);if(t===this.key)return!1;let n=new Map;for(let t of e.nodes)n.set(t.id,this.bodies.get(t.id)??{id:t.id,r:Fp(t)});return this.bodies=n,this.sim.nodes([...n.values()]),this.links.links(e.links.map(e=>({source:e.source,target:e.target}))),this.key=t,!0}warm(){this.sim.alpha(1).tick(Lp)}reheat(){this.sim.alpha(Math.max(this.sim.alpha(),Rp))}tick(){this.sim.tick()}get settled(){return this.sim.alpha()<this.sim.alphaMin()}at(e){let t=this.bodies.get(e);return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)?{x:t.x,y:t.y}:void 0}},Vp={request:e=>globalThis.requestAnimationFrame(e),cancel:e=>globalThis.cancelAnimationFrame(e)};function Hp(e,t,n){return[`ui-tl`,`ui-tl-${e}`,n?`ui-tl-off`:``,t?`ui-tl-hot`:``].filter(Boolean).join(` `)}function Up({status:e,x:t,y:n}){return(0,F.jsxs)(`g`,{className:`ui-tst ui-tst-${e}`,"aria-hidden":`true`,children:[e===`working`&&(0,F.jsx)(`circle`,{cx:t,cy:n,r:5}),e===`waiting`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:t,cy:n,r:5,className:`ui-tst-bg`}),(0,F.jsx)(`path`,{d:`M${t} ${n-4.2} A4.2 4.2 0 0 0 ${t} ${n+4.2} Z`}),(0,F.jsx)(`circle`,{cx:t,cy:n,r:4.2,className:`ui-tst-ring`})]}),(e===`idle`||e===`offline`)&&(0,F.jsx)(`circle`,{cx:t,cy:n,r:4.4})]})}function Wp({r:e}){let t=2*Math.PI*e;return(0,F.jsxs)(`g`,{className:`ui-orbit-g`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{r:e,className:`ui-orbit-ring`}),(0,F.jsx)(`circle`,{r:e,className:`ui-orbit`,strokeDasharray:`${t/5} ${t*4/5}`})]})}function Gp({node:e,x:t,y:n,size:r}){let i=e.status??`idle`,a=(0,P.useContext)(Se),o=ae()(e.id),s=r*.23,c=-r/2+s-3,l=r/2-s+2,u=o&&(0,F.jsxs)(`g`,{className:`ui-tidb`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{cx:c,cy:l,r:s,style:{fill:`var(--id-${i===`offline`?`off`:o.slot})`}}),(0,F.jsx)(`text`,{x:c,y:l+s*.42,textAnchor:`middle`,fontSize:[...o.letter].length>1?s*.95:s*1.2,children:o.letter})]});return(0,F.jsxs)(`g`,{className:i===`offline`?`ui-ta ui-ta-off`:`ui-ta`,"data-node":e.id,"data-pick":a?``:void 0,transform:`translate(${t} ${n})`,onClick:a?()=>a(e.id):void 0,children:[i===`working`&&(0,F.jsx)(Wp,{r:r/2+7}),(0,F.jsxs)(`g`,{className:`ui-ta-art`,children:[(0,F.jsx)(`svg`,{x:-r/2,y:-r/2,width:r,height:r,viewBox:`-2 -4 112 112`,overflow:`visible`,dangerouslySetInnerHTML:{__html:Ne(e.vendor,i)}}),(0,F.jsx)(`text`,{y:r/2+13,textAnchor:`middle`,className:`ui-ta-name`,children:e.label}),e.wide&&(0,F.jsxs)(`g`,{className:`ui-wide`,transform:`translate(0 ${r/2+26})`,children:[(0,F.jsx)(`rect`,{x:-70.4/2,y:-8,width:70.4,height:16,rx:6}),(0,F.jsx)(`text`,{y:3.5,textAnchor:`middle`,children:`all channels`})]})]}),u,(0,F.jsx)(Up,{status:i,x:r/2-2,y:r/2-1})]})}function Kp({node:e,x:t,y:n,hot:r}){let i=Pp(e.label);return(0,F.jsxs)(`g`,{className:r?`ui-tn ui-tn-hot`:`ui-tn`,"data-node":e.id,transform:`translate(${t} ${n})`,children:[(0,F.jsx)(`rect`,{x:-i/2,y:-12,width:i,height:24,rx:8}),(0,F.jsxs)(`text`,{y:4,textAnchor:`middle`,children:[`#`,e.label]})]})}function qp({model:e,width:t=400,height:n=420}){let r=(0,P.useRef)(null);r.current===null&&(r.current=new Bp(t,n),r.current.sync(e),r.current.warm());let i=r.current,[,a]=(0,P.useReducer)(e=>e+1,0),o=(0,P.useRef)(0),s=()=>{if(o.current!==0||i.settled)return;let e=()=>{o.current=0,i.tick(),a(),i.settled||(o.current=Vp.request(e))};o.current=Vp.request(e)};(0,P.useEffect)(()=>{i.resize(t,n)&&i.reheat(),i.sync(e)&&i.reheat(),s()}),(0,P.useEffect)(()=>()=>{Vp.cancel(o.current),o.current=0},[]);let c=(0,P.useRef)(null),[l,u]=(0,P.useState)(If);(0,P.useEffect)(()=>{let e=c.current;return Nl(e).call(Gf().scaleExtent([.4,4]).on(`zoom`,e=>u(e.transform))),()=>void Nl(e).on(`.zoom`,null)},[]);let d=e=>i.at(e)??{x:t/2,y:n/2},f=new Map(e.nodes.map(e=>[e.id,e])),p=new Set(e.links.filter(e=>e.hot).map(e=>e.target)),m=Math.min(40,t/10);return(0,F.jsx)(`svg`,{ref:c,className:`ui-topo-svg`,viewBox:`0 0 ${t} ${n}`,role:`img`,"aria-label":`Mesh topology`,children:(0,F.jsxs)(`g`,{transform:`translate(${l.x} ${l.y}) scale(${l.k})`,children:[e.links.map(e=>{let t=d(e.source),n=d(e.target);return(0,F.jsx)(`line`,{"data-link":`${e.source}>${e.target}`,className:Hp(e.kind,e.hot,f.get(e.source)?.status===`offline`),x1:t.x,y1:t.y,x2:n.x,y2:n.y},`${e.source}\u0000${e.target}`)}),e.nodes.filter(e=>e.kind===`channel`).map(e=>(0,F.jsx)(Kp,{node:e,...d(e.id),hot:p.has(e.id)},e.id)),e.nodes.filter(e=>e.kind===`agent`).map(e=>(0,F.jsx)(Gp,{node:e,...d(e.id),size:m},e.id))]})})}var Jp=e=>`#${e}`;function Yp(e){let{roster:t,channels:n,membership:r,recent:i,hideOffline:a,hideEmpty:o,now:s}=e,c=xt(t),l=new Map;for(let e of t){if(e.card.kind===`endpoint`||!e.card.id)continue;let t=e.card.meta?.connector;l.set(e.card.id,{id:e.card.id,kind:`agent`,label:e.card.name,...typeof t==`string`?{vendor:t}:{},status:e.status})}let u=new Set(n.map(e=>e.channel)),d=i.filter(e=>e.mode===`chat`&&e.channel).map(e=>({channel:e.channel,sender:e.senderId??e.msg.from.id,ts:e.ts}));for(let e of d)u.add(e.channel);let f=(r.unreadable===void 0?r.snapshot?.members??[]:[]).filter(e=>e.id);for(let e of f)for(let t of Ae(e.live??[],e.durable??[],[]).channels.keys())u.add(t);let p=new Set,m=new Map,h=(e,t)=>`${e}\u0000${t}`,g=[...u],_=n.filter(e=>e.deliveryClass===`durable`).map(e=>e.channel);for(let e of f){l.has(e.id)||l.set(e.id,{id:e.id,kind:`agent`,label:wn(e.id,c),status:`offline`});let t=Ae(e.live??[],e.durable??[],g,_);t.wide&&p.add(e.id);for(let[n,r]of t.channels)m.set(h(e.id,n),{source:e.id,target:Jp(n),kind:r===`live`?`member`:`durable`,hot:!1})}for(let e of d){if(!e.sender)continue;l.has(e.sender)||l.set(e.sender,{id:e.sender,kind:`agent`,label:wn(e.sender,c),status:`idle`});let t=h(e.sender,e.channel);m.has(t)||m.set(t,{source:e.sender,target:Jp(e.channel),kind:`traffic`,hot:!1})}for(let[e,t]of l)p.has(e)&&(t.wide=!0);for(let e of d)if(!(!e.sender||s-e.ts>=2e3))for(let t of m.values())t.target===Jp(e.channel)&&(t.hot=!0);let v=e=>l.get(e)?.status===`offline`,y=e=>a&&(e.kind===`durable`||v(e.source)),b=new Set;for(let e of m.values())e.kind!==`traffic`&&!y(e)&&b.add(e.target);let x=it(r),S=e=>o&&x&&!b.has(Jp(e)),ee=[...l.values()].filter(e=>!(a&&e.status===`offline`));for(let e of u)S(e)||ee.push({id:Jp(e),kind:`channel`,label:e});let te=new Set(ee.map(e=>e.id));return{nodes:ee,links:[...m.values()].filter(e=>te.has(e.source)&&te.has(e.target)&&!(e.kind!==`traffic`&&y(e)))}}var Xp=[{cls:`ui-lg-member`,label:`Member`},{cls:`ui-lg-durable`,label:`Durable member`},{cls:`ui-lg-offline`,label:`Offline agent`},{cls:`ui-lg-traffic`,label:`Posted here`},{cls:`ui-lg-hot`,label:`Active now`},{cls:`ui-lg-working`,label:`Working`}];function Zp(e,t,n){let r=M(e,e=>e.roster),i=M(e,e=>e.channels),a=M(e,e=>e.membership),o=M(e,e=>e.activity),[s,c]=(0,P.useState)(n),l=(0,P.useMemo)(()=>o.map(e=>({mode:e.mode,...`channel`in e&&e.channel!==void 0?{channel:e.channel}:{},...`senderId`in e&&e.senderId!==void 0?{senderId:e.senderId}:{},msg:e.msg,ts:e.arrivedAt??-1/0})),[o]),u=t(),d=Yp({roster:r,channels:i,membership:a,recent:l,hideOffline:s,hideEmpty:!0,now:u}),f=d.links.some(e=>e.hot),[,p]=(0,P.useReducer)(e=>e+1,0);return(0,P.useEffect)(()=>{let e=setInterval(p,f?500:5e3);return()=>clearInterval(e)},[f]),{model:d,membership:a,now:u,hideOffline:s,setHideOffline:c}}function Qp({store:e,clock:t=Date.now,initialHideOffline:r=!0}){let{model:i,membership:a,now:o,hideOffline:s,setHideOffline:c}=Zp(e,t,r);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Topology`}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(bs,{state:n(a,o),reason:a.unreadable}),(0,F.jsx)(Be,{variant:`outline`,size:`sm`,pressed:s,onPressedChange:c,children:`Hide offline`})]}),(0,F.jsx)(`div`,{className:`ui-scroll`,children:(0,F.jsxs)(`div`,{className:`ui-col ui-col-wide`,children:[(0,F.jsx)(`div`,{className:`ui-topo`,children:(0,F.jsx)(qp,{model:i,width:960,height:600})}),(0,F.jsxs)(`div`,{className:`ui-legend`,children:[Xp.map(e=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:e.cls}),e.label]},e.cls)),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{className:`ui-wide-key`,children:`all channels`}),`Reads every channel`]})]})]})})]})}var $p={width:360,height:420};function em({store:e,clock:t}){let{model:r,membership:i,now:a,hideOffline:o,setHideOffline:s}=Zp(e,t,!0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,marginBottom:10},children:[(0,F.jsx)(bs,{state:n(i,a),reason:i.unreadable}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(Be,{variant:`outline`,size:`sm`,pressed:o,onPressedChange:s,children:`Hide offline`})]}),(0,F.jsx)(`div`,{className:`ui-topo`,children:(0,F.jsx)(qp,{model:r,width:$p.width,height:$p.height})})]})}var tm=`cotal.panel.open`;function nm(){try{let e=globalThis.localStorage?.getItem(tm);return e===`1`||e!==`0`&&void 0}catch{return}}function rm(e){try{globalThis.localStorage?.setItem(tm,e?`1`:`0`)}catch{}}var im=e=>e.view===`agent`?`agent`:e.view===`channel`?`members`:`topology`;function am(e,t=!1){let n=jt(e),[r,i]=(0,P.useState)(!0),[a,o]=(0,P.useState)(!1),s=(0,P.useRef)(t);s.current=t,(0,P.useLayoutEffect)(()=>{let e=nm();e!==void 0&&i(e)},[]);let[c,l]=(0,P.useState)(()=>({key:n,tab:im(e),agent:e.view===`agent`?e.id:null})),u=c;c.key!==n&&(u={key:n,tab:im(e),agent:e.view===`channel`?c.agent:null},e.view===`agent`&&(u={...u,agent:e.id}),l(u),o(!1));let d=(0,P.useMemo)(()=>{let e=e=>{if(s.current)return o(e);i(e),rm(e)};return{setTab:e=>l(t=>({...t,tab:e})),selectAgent:t=>{l(e=>({...e,tab:`agent`,agent:t})),e(!0)},showMembers:()=>{l(e=>({...e,tab:`members`})),e(!0)},close:()=>e(!1),remember:e}},[]),f=t?a:r;return{open:f,tab:u.tab,agent:u.agent,setTab:d.setTab,selectAgent:d.selectAgent,showMembers:d.showMembers,close:d.close,toggle:()=>d.remember(!f)}}var om=(e,t)=>e.open&&(t||e.agent!==null);function sm({store:e,controller:t,channel:n,route:r,panel:i,clock:a}){let o=[{id:`members`,label:`Members`,off:n===null},{id:`agent`,label:`Agent`,off:i.agent===null},{id:`topology`,label:`Topology`,off:!1}];return(0,F.jsxs)(gt,{value:i.tab,onValueChange:e=>(e===`members`||e===`agent`||e===`topology`)&&i.setTab(e),className:`min-h-0 flex-1 gap-0`,children:[(0,F.jsxs)(`div`,{className:`ui-tabs`,children:[(0,F.jsx)(Cn,{"aria-label":`Details`,children:o.map(e=>(0,F.jsx)(yt,{value:e.id,disabled:e.off,children:e.label},e.id))}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Et,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close panel`,onClick:i.close,children:(0,F.jsx)(N,{icon:vn})})}),(0,F.jsx)(E,{children:`Close panel`})]})]}),(0,F.jsx)(Jt,{value:`members`,className:`ui-pane-body`,children:n!==null&&(0,F.jsx)(Fs,{store:e,controller:t,channel:n,now:a(),onPick:i.selectAgent})}),(0,F.jsx)(Jt,{value:`agent`,className:`ui-pane-body`,children:i.agent!==null&&(0,F.jsx)(vs,{store:e,controller:t,id:i.agent,route:r})}),(0,F.jsx)(Jt,{value:`topology`,className:`ui-pane-body`,children:(0,F.jsx)(em,{store:e,clock:a})})]})}var cm;function lm(){return Ue(()=>import(`./AgentPage-BO-a5SVf.js`).then(e=>cm=e),__vite__mapDeps([0,1,2]))}var um=(0,P.lazy)(()=>{let e=cm;return e?{then:t=>t({default:e.AgentPage})}:lm().then(e=>({default:e.AgentPage}))});function dm({store:e}){let t=_r(M(e,e=>e.orderNotes));return(0,F.jsx)(`div`,{children:t&&(0,F.jsx)(`p`,{id:`order-notice`,role:t.fault?`alert`:`status`,children:t.text})})}function fm(e,t,n,r,i,a,o){switch(t.view){case`channel`:return(0,F.jsx)(Qo,{store:e,channel:t.channel,onMembers:r.showMembers,onViewAgent:r.selectAgent,panelOpen:i,onTogglePanel:r.toggle});case`activity`:return(0,F.jsx)(Do,{store:e});case`dm`:return(0,F.jsx)($o,{store:e,peer:t.peer,with:t.with});case`topology`:return(0,F.jsx)(Qp,{store:e,clock:n});case`agents`:return(0,F.jsx)(ps,{store:e,controller:o.controller,group:t.group===`host`?`host`:void 0,selected:r.agent,onPick:a,clock:n});case`needs`:return(0,F.jsx)(ps,{store:e,controller:o.controller,group:`status`,focusWaiting:!0,selected:r.agent,onPick:a,clock:n});case`agent`:return(0,F.jsx)(P.Suspense,{fallback:(0,F.jsx)(co,{}),children:(0,F.jsx)(um,{store:e,controller:o.controller,id:t.id,tab:t.tab,at:t.at,back:o.back,phone:o.phone,panelOpen:o.panelOpen,onTogglePanel:o.toggle},t.id)})}}function pm({store:e,controller:t,route:n,paneOpen:r,msgPerSecond:i,clock:a=Date.now,phone:o=!1}){let s=M(e,e=>e.space),c=M(e,e=>e.channels),l=M(e,e=>e.roster),u=M(e,e=>e.dms),d=M(e,e=>e.loading),f=mm(n,c,u,l,M(e,e=>e.operatorId)),p=(0,P.useMemo)(()=>Rt(l,{includeOffline:!0}),[l]),m=(0,P.useMemo)(()=>on(p).length,[p]),h=(0,P.useMemo)(()=>l.filter(e=>e.card.kind===`agent`&&e.status===`working`).length,[l]),g=M(e,e=>e.stale.some(e=>e.name===`roster`)),_=(0,P.useMemo)(()=>S(p),[p]),v=am(n,o),y=om(v,r),b={...v,agent:y&&v.tab===`agent`?v.agent:null},x=gm(n),ee=(0,P.useContext)(mn),te=(0,P.useMemo)(()=>o?e=>ee({view:`agent`,id:e,tab:`work`}):v.selectAgent,[o,ee,v.selectAgent]),C={controller:t,phone:o,back:x,panelOpen:y,toggle:v.toggle},ne=d.roster||d.channels?(0,F.jsx)(co,{}):fm(e,n,a,b,y,te,C),w=(0,F.jsx)(sm,{store:e,controller:t,channel:n.view===`channel`?n.channel:null,route:n,panel:v,clock:a});return(0,F.jsx)(Sn.Provider,{value:t,children:(0,F.jsx)(Se.Provider,{value:te,children:(0,F.jsx)(k.Provider,{value:_,children:(0,F.jsx)(Ke,{children:(0,F.jsxs)(Xa,{route:n,controller:t,paneOpen:y,panel:w,places:f,phone:o,waiting:m,working:h,stale:g,onPanelClose:v.close,sidebar:(0,F.jsx)(_o,{store:e,route:n,msgPerSecond:i}),children:[(0,F.jsx)(`title`,{children:vr(s)}),(0,F.jsx)(dm,{store:e}),(0,F.jsx)(`section`,{className:`ui-view`,"data-view":n.view,children:ne})]})})})})})}function mm(e,t,n,r,i){let[a,o]=(0,P.useState)({channel:null,dm:null}),s=a;e.view===`channel`&&a.channel!==e.channel&&(s={...a,channel:e.channel}),e.view===`dm`&&(a.dm?.peer!==e.peer||a.dm?.with!==e.with)&&(s={...s,dm:{peer:e.peer,with:e.with}}),s!==a&&o(s);let c=(0,P.useMemo)(()=>_t(n,r),[n,r]),l=s.channel!==null&&t.some(e=>e.channel===s.channel)?s.channel:t[0]?.channel??null,u=s.dm===null?null:s.dm.with??i,d=c[0]?.conversations[0];return{channel:l,dm:s.dm!==null&&u!==null&&c.some(e=>e.id===s.dm?.peer)?{peer:s.dm.peer,with:u}:c[0]&&d?{peer:c[0].id,with:d.with}:null}}function hm(e){switch(e.view){case`channel`:return`#${e.channel}`;case`activity`:return`Activity`;case`dm`:return`Direct messages`;case`topology`:return`Topology`;case`needs`:return`Needs you`;case`agents`:case`agent`:return`Agents`}}function gm(e){let[t,n]=(0,P.useState)(null);e.view!==`agent`&&(t===null||jt(t)!==jt(e))&&n(e);let r=e.view===`agent`?t:e;return r===null?{label:`Agents`,route:{view:`agents`,group:`status`}}:{label:hm(r),route:r}}var _m=5e3,vm=6e4,ym={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},bm=e=>e.stale.some(e=>e.kind===`refused`&&e.name!==`roster`);function xm(e){let{store:t}=e,n=e.timer??ym;t.set({loading:{roster:!0,channels:!0}});let r=en(t,e.api),i=()=>{r.refresh().catch(e=>console.error(`dashboard refresh failed:`,e))},a={open(){t.set({connection:`connected`}),i()},error:()=>t.set(e=>e.connection===`closed`?{}:{connection:e.connection===`connecting`?`connecting`:`reconnecting`}),closed:()=>t.set({connection:`closed`}),roster:r.onRoster,presenceView:r.onPresenceView,membership:r.onMembership,membershipFailed:r.onMembershipFailed,message(t){e.onArrival?.(),r.onMessage(t)},hello:r.onHello,agentFrame:r.onAgentFrame},{error:o,closed:s}=a;a.error=()=>{r.onFeedLost(),o()},a.closed=()=>{r.onFeedLost(),s()};let c=null,l=_m,u=t.subscribe(()=>{bm(t.get())?c===null&&(c=n.set(()=>{c=null,l=Math.min(l*2,vm),i()},l)):(c!==null&&n.clear(c),c=null,l=_m)}),d=e.openFeed(a);return i(),{controller:r,stop(){u(),c!==null&&n.clear(c),c=null,d()}}}function Sm(e){let t=e,n=new Set;return{get:()=>t,set(e){let r=typeof e==`function`?e(t):e;t={...t,...r};for(let e of n)e()},subscribe(e){return n.add(e),()=>n.delete(e)}}}var Cm=Sm({space:null,connection:`connecting`,roster:[],presenceView:null,channels:[],unread:{},activity:[],dms:[],dmsCut:!1,open:null,stale:[],orderNotes:[],membership:{},loading:{roster:!1,channels:!1},post:null,operatorId:null,drafts:{},sessions:{}}),wm=1e4,Tm=(e,t)=>xm({store:e,api:qn(),openFeed:Zn,onArrival:t});function Em({host:e=window,start:t=Tm,clock:n=Date.now}){let[r,i]=(0,P.useState)(null),[a]=(0,P.useState)(()=>lr(wm,n()));(0,P.useLayoutEffect)(()=>{let e=t(Cm,()=>a.hit(n()));return i(e.controller),e.stop},[t,a,n]);let[o,s]=(0,P.useState)(()=>Dt(e));(0,P.useEffect)(()=>Ft(e,s),[e]),(0,P.useEffect)(()=>$t(e,o),[e,o]);let c=(0,P.useCallback)(t=>un(e,t),[e]),l=pn();return(0,F.jsx)(za,{defaultTheme:`system`,storageKey:`cotal.theme`,children:(0,F.jsx)(mn.Provider,{value:c,children:(0,F.jsx)(pm,{store:Cm,controller:r,route:o,paneOpen:o.view===`channel`||o.view===`agent`,msgPerSecond:()=>a.perSecond(n()),phone:l})})})}var Dm=document.getElementById(`root`);if(!Dm)throw Error(`index.html has no #root element`);(0,Kn.createRoot)(Dm).render((0,F.jsx)(P.StrictMode,{children:(0,F.jsx)(Em,{})}));
|
|
14
|
+
`).map(e=>(0,F.jsx)(`span`,{children:e},e))})]})}var uo=1e3,fo=e=>e.startsWith(`run.`),po={connecting:{text:`Connecting`,title:`Connecting to cotal web`},reconnecting:{text:`Reconnecting`,title:`Reconnecting to cotal web`},closed:{text:`Disconnected`,title:`The live feed closed and will not retry. Reload the page, or open the link cotal web printed when it started.`}},mo=e=>`${e.length} member${e.length===1?``:`s`} working: ${e.map(e=>e.name).join(`, `)}`;function ho({to:e,here:t,tip:n,badge:r,link:i,children:a}){let{isMobile:o}=u();return(0,F.jsxs)(_e,{children:[(0,F.jsx)(ce,{asChild:!0,isActive:t,className:r===void 0?void 0:`pr-8`,tooltip:n===void 0||o?void 0:{children:n,hidden:!1},children:(0,F.jsx)(`a`,{ref:i,href:jt(e),"aria-current":t?`page`:void 0,children:a})}),r!==void 0&&(0,F.jsx)(C,{"aria-hidden":`true`,children:r})]})}function go({connection:e}){let{text:t,title:n}=e===`connected`?{text:`Connected`,title:`Connected to cotal web`}:po[e];return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:e===`closed`?`destructive`:`outline`,children:[(0,F.jsx)(`i`,{className:e===`connected`?`ui-mdot ui-mdot-live`:`ui-mdot ui-mdot-down`}),t,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${n}`})]})}),(0,F.jsx)(E,{children:n})]})}function _o({store:e,route:t,msgPerSecond:n}){let r=M(e,e=>e.space),i=M(e,e=>e.channels),a=M(e,e=>e.unread),s=M(e,e=>e.roster),c=M(e,e=>e.dms),l=M(e,e=>e.membership),d=M(e,e=>e.connection),f=M(e,e=>e.loading),p=M(e,e=>e.post),m=M(e,e=>e.operatorId),[,h]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>h(e=>e+1),uo);return()=>clearInterval(e)},[]);let{isMobile:g,setOpenMobile:v}=u(),y=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{g&&y.current?.focus()},[g]);let b=jt(t),x=(0,P.useRef)(b);(0,P.useEffect)(()=>{x.current!==b&&(x.current=b,v(!1))},[b,v]);let S=(0,P.useMemo)(()=>Rt(s,{includeOffline:!0}),[s]),ee=(0,P.useMemo)(()=>xt(s),[s]),te=(0,P.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),C=ae(),w=(0,P.useMemo)(()=>{let e=i.map(e=>e.channel);return new Map(i.map(t=>[t.channel,$e(t.channel,l,e,[]).map(e=>te.get(e.id)).filter(e=>e?.status===`working`)]))},[i,l,te]),T=on(S).length,re=`${T} agent${T===1?``:`s`} waiting`,ie=yr(n()),oe=o(p,m!==null&&s.some(e=>e.card.id===m)),se=(0,P.useMemo)(()=>yn(c),[c]),[le,ue]=(0,P.useState)(!1),de=t.view===`dm`&&t.with!==void 0?Xt(t.peer,t.with):null,pe=(0,P.useMemo)(()=>le?se:se.filter((e,t)=>t<10||e.key===de),[se,le,de]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(xe,{children:(0,F.jsx)(`span`,{className:`ui-space px-2 py-1.5`,children:r})}),(0,F.jsx)(lo,{store:e}),f.roster||f.channels?(0,F.jsx)(so,{}):(0,F.jsxs)(_,{role:`navigation`,"aria-label":`Places`,children:[(0,F.jsx)(qt,{children:(0,F.jsxs)(ke,{children:[(0,F.jsxs)(ho,{to:{view:`needs`},here:t.view===`needs`,tip:T>0?re:void 0,badge:T>0?T:void 0,link:y,children:[(0,F.jsx)(Ia,{name:`inbox`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`Needs you`}),T>0&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${re}`})]}),(0,F.jsxs)(ho,{to:{view:`activity`},here:t.view===`activity`,badge:ie,children:[(0,F.jsx)(Ia,{name:`activity`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`Activity`}),(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${ie}`})]})]})}),(0,F.jsxs)(qt,{children:[(0,F.jsx)(Ut,{children:`Channels`}),i.length===0&&(0,F.jsx)(We,{className:`p-4`,children:(0,F.jsx)(fe,{children:(0,F.jsx)(ne,{children:`No channels yet. One appears with its first message.`})})}),(0,F.jsx)(ke,{children:i.map(e=>{let n=a[e.channel]??0,r=fo(e.channel)?`Events from run ${e.channel.slice(4)}`:void 0,i=w.get(e.channel)??[];return(0,F.jsxs)(ho,{to:{view:`channel`,channel:e.channel},here:t.view===`channel`&&t.channel===e.channel,tip:r,badge:n>0?n:void 0,children:[r?(0,F.jsx)(N,{icon:Ta}):(0,F.jsx)(Ia,{name:`hash`}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:e.channel}),i.length>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(`span`,{className:`ox-sbw`,children:[(0,F.jsx)(N,{icon:tn,className:`ox-spin`}),(0,F.jsx)(`span`,{"aria-hidden":`true`,children:i.length}),(0,F.jsx)(`span`,{className:`ui-sr`,children:mo(i)})]})}),(0,F.jsx)(E,{children:mo(i)})]}),n>0&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${n}`}),r&&(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${r}`})]},e.channel)})})]}),(0,F.jsxs)(qt,{children:[(0,F.jsx)(Ut,{children:`Direct messages`}),(0,F.jsxs)(ke,{children:[pe.map(({key:e,parts:t,opener:n,verified:r})=>{let i=t[0]===n?t[1]:t[0];return(0,F.jsxs)(ho,{to:{view:`dm`,peer:n,with:i},here:e===de,children:[(0,F.jsx)(`span`,{className:`ui-stack`,"aria-hidden":`true`,children:[n,i].map(e=>(0,F.jsx)(he,{vendor:te.get(e)?.harness,status:te.get(e)?.status??`offline`,size:18,dot:te.has(e),badge:te.has(e)?C(e):void 0},e))}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,children:`${wn(n,ee,m)}, ${wn(i,ee,m)}`}),!r&&(0,F.jsx)(Bt,{})]},e)}),se.length>10&&(0,F.jsx)(_e,{children:(0,F.jsx)(ce,{type:`button`,"aria-expanded":le,onClick:()=>ue(e=>!e),children:(0,F.jsx)(`span`,{children:le?`Show fewer`:`Show all ${se.length}`})})})]})]})]}),(0,F.jsx)(De,{children:(0,F.jsxs)(Qa,{size:`xs`,children:[(0,F.jsx)(eo,{children:(0,F.jsx)(kn,{size:`sm`,children:(0,F.jsx)(Rn,{children:`OP`})})}),(0,F.jsxs)(to,{children:[(0,F.jsx)(no,{children:`operator`}),oe&&(0,F.jsxs)(ro,{children:[(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(`span`,{tabIndex:0,"aria-describedby":`operator-line-why`,children:oe.text})}),(0,F.jsx)(E,{children:oe.title})]}),(0,F.jsx)(`span`,{id:`operator-line-why`,className:`ui-sr`,children:oe.title})]})]}),(0,F.jsx)(io,{children:(0,F.jsx)(go,{connection:d})})]})})]})}var vo=P.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function yo({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,F.jsx)(fa,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:A(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[spacing=0]:data-[variant=outline]:rounded-2xl data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,F.jsx)(vo.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function bo({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=P.useContext(vo);return(0,F.jsx)(xa,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:A(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-2xl group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-2xl group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-2xl group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-2xl data-[state=on]:bg-muted group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,v({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function xo(e,t){if(e){for(let{msg:n,senderId:r}of t)if(n.replyTo===e)return r===void 0?{id:n.from.id,verified:!1}:{id:r,verified:!0}}}function So({space:e}){return(0,F.jsxs)(We,{children:[(0,F.jsxs)(fe,{children:[(0,F.jsx)(dn,{"data-wave":`claude`,dangerouslySetInnerHTML:{__html:`<svg viewBox="0 0 150 150" width="150" height="150" overflow="visible" aria-hidden="true">${Mn(`claude`)}</svg>`}}),(0,F.jsx)(le,{children:e===null?`No agents here yet.`:`No agents on ${e} yet.`}),(0,F.jsx)(ne,{children:`Start one from your terminal. It shows up here when it joins.`})]}),(0,F.jsxs)(Xe,{children:[(0,F.jsx)(dt,{command:`cotal spawn`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(dt,{command:`cotal personas`}),` lists the others.`]})]})]})}var Co=e=>e.some(e=>e.card.kind===`agent`),wo=[{label:`All`,value:`all`},{label:`Channels`,value:`chat`},{label:`Direct`,value:`unicast`},{label:`Roles`,value:`anycast`}];function To(e,t){return e.mode===`chat`?typeof e.channel==`string`?`#${e.channel}`:null:e.mode===`anycast`?typeof e.msg.toService==`string`?`to role ${e.msg.toService}`:null:typeof e.msg.to==`string`?`to ${wn(e.msg.to,t)}`:null}function Eo({banner:e}){return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(m,{role:`status`,children:[(0,F.jsx)(N,{icon:Ca}),(0,F.jsx)(Wt,{children:e.label}),(e.count||e.body)&&(0,F.jsxs)(we,{children:[e.count&&(0,F.jsx)(`div`,{children:e.count}),e.body&&(0,F.jsx)(`div`,{children:e.body})]}),(0,F.jsx)(`div`,{className:`ui-sr`,children:e.title})]})}),(0,F.jsx)(E,{children:e.title})]})}function Do({store:e}){let t=M(e,e=>e.activity),n=M(e,e=>e.roster),r=M(e,e=>e.space),a=M(e,e=>e.operatorId),o=gr(M(e,e=>e.stale)),[s,c]=(0,P.useState)(`all`),l=(0,P.useMemo)(()=>xt(n),[n]),u=(0,P.useMemo)(()=>Rt(n,{includeOffline:!0}),[n]),d=(0,P.useMemo)(()=>new Map(u.map(e=>[e.id,e])),[u]),f=(0,P.useMemo)(()=>{let e=t.map(e=>({msg:e.msg,senderId:e.senderId}));return t.map((t,n)=>({e:t,claim:t.mode===`anycast`?xo(t.msg.id,e.slice(n+1)):void 0})).reverse()},[t]),p=s===`all`?f:f.filter(({e})=>e.mode===s);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Activity`}),!o&&(0,F.jsx)(lo,{store:e,inHeader:!0}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(yo,{type:`single`,size:`sm`,"aria-label":`Show`,value:s,onValueChange:e=>{let t=wo.find(t=>t.value===e);t&&c(t.value)},children:wo.map(e=>(0,F.jsx)(bo,{value:e.value,children:e.label},e.value))})]}),(0,F.jsxs)(`div`,{className:`ui-scroll`,children:[!Co(n)&&(0,F.jsx)(So,{space:r}),(0,F.jsxs)(`div`,{className:`ui-col flex flex-col gap-8`,children:[o&&(0,F.jsx)(Eo,{banner:o}),p.map(({e,claim:t})=>{let n=e.senderId;return(0,F.jsx)(i,{msg:e.msg,senderId:n,mode:e.mode,idx:l,peers:d,own:n!==void 0&&n===a,mention:`operator`,claim:t,place:To(e,l)},`${e.msg.id}\u0001${n??``}`)})]})]})]})}function Oo({className:e,size:t=`default`,...n}){return(0,F.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:A(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-[min(var(--radius-4xl),24px)] bg-card py-(--card-spacing) text-sm text-card-foreground shadow-sm ring-1 ring-foreground/5 [--card-spacing:--spacing(5)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] dark:ring-foreground/10 *:[img:first-child]:rounded-t-[min(var(--radius-4xl),24px)] *:[img:last-child]:rounded-b-[min(var(--radius-4xl),24px)]`,e),...n})}function ko({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-header`,className:A(`group/card-header @container/card-header grid auto-rows-min items-start gap-1.5 rounded-t-[min(var(--radius-4xl),24px)] px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function Ao({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-title`,className:A(`text-base font-medium`,e),...t})}function jo({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-description`,className:A(`text-sm text-muted-foreground`,e),...t})}function Mo({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-action`,className:A(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}function No({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`card-footer`,className:A(`flex items-center rounded-b-[min(var(--radius-4xl),24px)] px-(--card-spacing) [.border-t]:pt-(--card-spacing)`,e),...t})}var Po=`cotal.needs.dismissed`,Fo=`Dismiss until the status changes`,Io=e=>`${e.id} ${e.statusSince??``}`,Lo=new Set;function Ro(){let e=[];try{let t=JSON.parse(globalThis.localStorage?.getItem(Po)??`[]`);Array.isArray(t)&&(e=t.filter(e=>typeof e==`string`))}catch{}return[...new Set([...e,...Lo])]}function zo(e){try{globalThis.localStorage?.setItem(Po,JSON.stringify(e.slice(-100)))}catch{}}function Bo(){let[e,t]=(0,P.useState)([]);return(0,P.useLayoutEffect)(()=>t(Ro()),[]),[new Set(e),n=>{Lo.add(n);let r=[...e.filter(e=>e!==n),n];t(r),zo(r)}]}function Vo(e){let t=typeof e.statusSince==`number`&&Number.isFinite(e.statusSince)?`Reported ${Re(new Date(e.statusSince))}`:void 0,n=[e.activity?.trim().replace(/\.$/,``),t].filter(e=>!!e);return n.length?`${n.join(`. `)}.`:``}function Ho(e,t=Date.now()){return e.condition?In({condition:e.condition},t):``}function Uo({row:e,onViewAgent:t,onDismiss:n,post:r=null,selfId:i=null}){let a=ae(),o=Ho(e);return(0,F.jsxs)(Oo,{size:`sm`,children:[(0,F.jsxs)(ko,{children:[(0,F.jsxs)(Ao,{className:`flex items-center gap-2`,children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:22,badge:a(e.id)}),`${e.name} is waiting`]}),(0,F.jsx)(jo,{className:`line-clamp-2`,children:Vo(e)}),o&&(0,F.jsx)(jo,{children:o}),(0,F.jsx)(Mo,{children:(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Et,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Fo,onClick:n,children:(0,F.jsx)(N,{icon:vn})})}),(0,F.jsx)(E,{children:Fo})]})})]}),(0,F.jsxs)(No,{className:`flex-wrap gap-2`,children:[(0,F.jsx)(Et,{type:`button`,variant:`outline`,disabled:!t,onClick:()=>t?.(e.id),children:`View agent`}),r?.mode===`off`?(0,F.jsxs)(Et,{type:`button`,variant:`outline`,onClick:()=>sn(be({kind:`dm`,to:e.id})),children:[(0,F.jsx)(N,{icon:lt,"data-icon":`inline-start`}),`Copy command`]}):(0,F.jsx)(Et,{asChild:!0,children:(0,F.jsx)(`a`,{href:jt(Ht(e.id,i)),onClick:()=>zt({kind:`dm`,to:e.id}),children:`Message ${e.name}`})})]})]})}function Wo({rows:e}){let t=ae(),n=u().isMobile;if(e.length===0)return null;let r=e.length-3;return(0,F.jsxs)(`div`,{className:`ox-typing`,role:`status`,"aria-live":`polite`,children:[e.slice(0,3).map(e=>(0,F.jsxs)(Nn,{className:`ox-wline`,children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:18,dot:!1,badge:t(e.id)}),(0,F.jsxs)(Ie,{className:`ox-wline-c`,children:[(0,F.jsx)(`b`,{children:e.name}),` is ${ut(e)}`,e.activity&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{className:`ox-shimmer`,children:e.activity})]})]}),(0,F.jsx)(`a`,{className:`ox-act`,href:jt({view:`agent`,id:e.id,tab:`work`}),children:n?`View`:(0,F.jsxs)(F.Fragment,{children:[`View work`,(0,F.jsx)(N,{icon:Yt,size:16})]})})]},e.id)),r>0&&(0,F.jsx)(`div`,{className:`ox-wmore`,children:`and ${r} more`})]})}var z=4,B=[],Go=e=>typeof e.toService==`string`?`anycast`:typeof e.to==`string`?`unicast`:`chat`,Ko={s:[`second`,`seconds`],m:[`minute`,`minutes`],h:[`hour`,`hours`],d:[`day`,`days`]};function qo(e){let t=[];if(e?.deliveryClass===`durable`&&t.push({text:`durable`,title:`Kept for members who are offline`}),e?.replay===!0){let n=e.replayWindow;if(n===void 0)t.push({text:`replay`,title:`New members see every message the channel keeps`});else{let e=/^(\d+)(s|m|h|d)$/.exec(n.trim()),r=e?Number(e[1])===1?Ko[e[2]][0]:`${e[1]} ${Ko[e[2]][1]}`:n;t.push({text:`replay ${n}`,title:`New members see the last ${r}`})}}return t}function Jo(e,t){let n=e=>{let t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()},r=n(t),i=n(e);if(i===r)return`Today`;if(i===n(r-432e5))return`Yesterday`;let a=new Date(e),o=a.getFullYear()===new Date(t).getFullYear();return a.toLocaleDateString(`en-GB`,o?{day:`numeric`,month:`long`}:{day:`numeric`,month:`long`,year:`numeric`})}var Yo=({msg:e,senderId:t})=>`${e.id}\u0001${t??``}`;function Xo({messages:e,idx:t,peers:n,self:r}){let a=Date.now(),o=[],s=[],c=()=>{if(s.length===0)return;let a=s;s=[],o.push((0,F.jsx)(Tn,{messageId:Yo(e[a[0]]),children:(0,F.jsx)(It,{children:a.map((o,s)=>{let{msg:c,senderId:l}=e[o],u=Go(c);return(0,F.jsx)(i,{msg:c,senderId:l,mode:u,idx:t,peers:n,run:a.length===1?`alone`:s===0?`first`:s===a.length-1?`last`:`middle`,own:l!==void 0&&l===r,mention:`operator`,claim:u===`anycast`?xo(c.id,e.slice(o+1)):void 0},Yo(e[o]))})})},Yo(e[a[0]])))},l;return e.forEach(({msg:t,senderId:n},r)=>{let i=Number.isFinite(t.ts)?Jo(t.ts,a):void 0,u=i!==void 0&&i!==l;(u||n===void 0||e[r-1]?.senderId!==n)&&c(),u&&o.push((0,F.jsx)(Tn,{children:(0,F.jsx)(Nn,{variant:`separator`,children:(0,F.jsx)(Ie,{children:i})})},`day\u0001${Yo(e[r])}`)),i!==void 0&&(l=i),s.push(r)}),c(),(0,F.jsx)(F.Fragment,{children:o})}function Zo(){return(0,F.jsx)(vt,{behavior:En()?`auto`:`smooth`})}function Qo({store:e,channel:t,onMembers:n,onViewAgent:r,panelOpen:i=!1,onTogglePanel:a}){let o=M(e,e=>e.open),s=M(e,e=>e.channels),c=M(e,e=>e.roster),l=M(e,e=>e.membership),d=M(e,e=>e.post),f=M(e,e=>e.operatorId),p=o?.channel===t?o.messages:B,m=(0,P.useMemo)(()=>({kind:`msg`,channel:t}),[t]),h=(0,P.useMemo)(()=>new Set(p.map(e=>e.msg.id)),[p]),g=(0,P.useMemo)(()=>xt(c),[c]),_=(0,P.useMemo)(()=>Rt(c,{includeOffline:!0}),[c]),v=(0,P.useMemo)(()=>new Map(_.map(e=>[e.id,e])),[_]),y=ae(),b=s.find(e=>e.channel===t),x=(0,P.useMemo)(()=>$e(t,l,s.map(e=>e.channel),p),[t,l,s,p]),S=x.map(e=>v.get(e.id)).filter(e=>e?.status===`working`),[ee,te]=Bo(),C=on(_).find(e=>!ee.has(Io(e))),ne=x.length,w=u().isMobile,T=w?`Open agent panel`:`Toggle panel`,re=`${ne} member${ne===1?``:`s`}`,ie=`Working now: ${S.map(e=>e.name).join(`, `)}`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`# ${t}`}),b?.description&&(0,F.jsx)(`span`,{className:`ui-topic`,children:b.description}),(0,F.jsx)(`span`,{className:`ui-sp`}),!w&&qo(b).map(e=>(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:`outline`,children:[e.text,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${e.title}`})]})}),(0,F.jsx)(E,{children:e.title})]},e.text)),S.length>0&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(`span`,{className:`ox-hchip`,children:[(0,F.jsx)(N,{icon:tn,size:16,className:`ui-ic ox-spin`}),w?S.length:`${S.length} working`,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${ie}`})]})}),(0,F.jsx)(E,{children:ie})]}),(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(`span`,{className:`inline-flex`,tabIndex:n?void 0:0,children:(0,F.jsxs)(Et,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":re,disabled:!n,onClick:n,children:[(0,F.jsx)(`span`,{className:`ui-stack`,"aria-hidden":`true`,children:x.slice(0,z).map(e=>{let t=v.get(e.id);return(0,F.jsx)(he,{vendor:t?.harness,status:t?.status??`offline`,badge:t?y(e.id):void 0,size:22},e.id)})}),ne]})})}),(0,F.jsx)(E,{children:re})]}),a&&(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Be,{"aria-label":T,pressed:i,onPressedChange:a,children:(0,F.jsx)(N,{icon:Ct})})}),(0,F.jsx)(E,{children:T})]})]}),(0,F.jsx)(St,{autoScroll:!0,children:(0,F.jsxs)(bn,{className:`flex-1`,children:[(0,F.jsx)(Ot,{children:(0,F.jsxs)(Zt,{className:`ui-col`,children:[(0,F.jsx)(Xo,{messages:p,idx:g,peers:v,self:f}),(0,F.jsx)(gn,{store:e,target:m,shown:h}),S.length>0&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Wo,{rows:S})})]})}),(0,F.jsx)(Zo,{})]})},t),(C||d)&&(0,F.jsx)(`div`,{className:`ui-dock`,children:(0,F.jsxs)(`div`,{className:`ui-dock-in`,children:[C&&(0,F.jsx)(Uo,{row:C,onViewAgent:r,onDismiss:()=>te(Io(C)),post:d,selfId:f}),(0,F.jsx)(rn,{store:e,target:m,where:`#${t}`,to:w?`to #${t}`:`to #${t} · ${ne} member${ne===1?``:`s`}`})]})})]})}function $o({store:e,peer:t,with:n}){let r=M(e,e=>e.dms),i=M(e,e=>e.roster),a=M(e,e=>e.post),o=M(e,e=>e.operatorId),s=(0,P.useMemo)(()=>xt(i),[i]),c=(0,P.useMemo)(()=>Rt(i,{includeOffline:!0}),[i]),l=(0,P.useMemo)(()=>new Map(c.map(e=>[e.id,e])),[c]),u=M(e,e=>e.dmsCut),d=n??o??void 0,f=(0,P.useMemo)(()=>{if(d===void 0)return;let e=Xt(t,d);return yn(r).find(t=>t.key===e)},[r,t,d]),p=l.get(t),m=ae(),h=wn(t,s,o),g=[p?.role,p?.harness&&ve(p.harness)].filter(Boolean).join(` · `),_=(0,P.useMemo)(()=>Kt({view:`dm`,peer:t,with:n},o),[t,n,o]),v=(0,P.useMemo)(()=>new Set(r.map(e=>e.msg.id)),[r]),y=M(e,e=>_?e.drafts[Ee(_)]?.outgoing.length??0:0),b=_?.kind===`dm`?wn(_.to,s,o):``,x=[...new Set([t,d])].map(e=>e===void 0?void 0:l.get(e)).filter(e=>e?.status===`working`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(he,{vendor:p?.harness,status:p?.status??`offline`,size:22,badge:p?m(t):void 0}),(0,F.jsx)(`h1`,{children:h}),g&&(0,F.jsx)(`span`,{className:`ui-topic`,children:g}),f&&d!==void 0&&(0,F.jsx)(`span`,{className:`ui-topic`,children:`with ${wn(d,s,o)}`}),f&&!f.verified&&(0,F.jsx)(Bt,{})]}),(0,F.jsx)(St,{autoScroll:!0,children:(0,F.jsxs)(bn,{className:`flex-1`,children:[(0,F.jsx)(Ot,{children:(0,F.jsx)(Zt,{className:`ui-col`,children:f||y>0?(0,F.jsxs)(F.Fragment,{children:[f&&u&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Nn,{children:(0,F.jsx)(Ie,{children:`Earlier messages aren't loaded`})})}),f&&(0,F.jsx)(Xo,{messages:f.messages,idx:s,peers:l,self:o}),_&&(0,F.jsx)(gn,{store:e,target:_,shown:v}),x.length>0&&(0,F.jsx)(Tn,{children:(0,F.jsx)(Wo,{rows:x})})]}):(0,F.jsx)(Tn,{children:(0,F.jsx)(We,{children:(0,F.jsx)(fe,{children:(0,F.jsx)(le,{children:`No direct messages with ${h} yet.`})})})})})}),(0,F.jsx)(Zo,{})]})},`${t}\u0001${d??``}`),a&&(_||n!==void 0)&&(0,F.jsx)(`div`,{className:`ui-dock`,children:(0,F.jsx)(`div`,{className:`ui-dock-in`,children:_?(0,F.jsx)(rn,{store:e,target:_,where:b,to:`to ${b}`}):(0,F.jsx)(wt,{peer:t,name:h,selfId:o})})})]})}var es=`cotal.agents.group`,ts=1e3;function ns(){try{let e=globalThis.localStorage?.getItem(es);return e===`status`||e===`host`?e:void 0}catch{return}}function rs(e){try{globalThis.localStorage?.setItem(es,e)}catch{}}function is(e){let t=[...new Set(e.map(e=>e.status).filter(e=>!nn.includes(e)))].sort();return[...nn,...t].map(t=>({key:t,label:re(t),rows:e.filter(e=>e.status===t)})).filter(e=>e.rows.length>0)}function as(e){let t=[...new Set(e.map(e=>e.host).filter(e=>e!==void 0))].sort((e,t)=>e.localeCompare(t)).map(t=>({key:`host:${t}`,label:t,rows:e.filter(e=>e.host===t)})),n=e.filter(e=>e.host===void 0);return n.length>0?[...t,{key:`host:`,label:`No host reported`,rows:n}]:t}var os=e=>[e.role,e.harness===void 0?void 0:ve(e.harness)].filter(Boolean).join(` · `);function ss(e,t){return e.status===`offline`?`Last heartbeat ${Re(new Date(e.ts))}`:e.status===`waiting`&&t===`status`?Vo(e)||`No current activity`:e.activity?.trim()||(e.status===`working`?re(ut(e)):`No current activity`)}function cs(e,t){let n=e.items.findLast(e=>e.kind===`turn`&&e.outcome===`open`&&!e.superseded),r=n?.steps.findLast(e=>e.kind!==`runError`);if(n===void 0||r?.kind!==`tools`)return;let i=r.calls.findLast(r=>On(r,{turn:n,trailing:!0,status:t,toolStatus:e.toolStatus})===`running`);return i===void 0?void 0:{call:i,turn:n}}function ls({store:e,controller:t,row:n}){kt(n.events===`off`?null:t,n.id);let r=M(e,e=>e.sessions[n.id]?.frames),i=Nt(e,n.id),a=(0,P.useMemo)(()=>r===void 0?void 0:cs(mt(r,i),n.status),[r,i,n.status]);return a===void 0?null:(0,F.jsx)(`span`,{className:`ox-now-w`,"aria-hidden":`true`,children:(0,F.jsx)(Tt,{call:a.call,state:`running`,className:`ox-now`})})}function us({row:e,grouping:t,selected:n,onPick:r,live:i}){let a=e.attention===`dnd`||e.attention===`focus`?e.attention:void 0,o=e.status===`waiting`&&t===`status`,s=ae();return(0,F.jsxs)(`div`,{className:e.status===`working`?`ox-arow ox-arow-w`:`ox-arow`,children:[(0,F.jsxs)(`button`,{type:`button`,className:e.status===`offline`?`v3-arow v3-arow-off`:`v3-arow`,"data-agent":e.id,"aria-current":n?`true`:void 0,onClick:()=>r?.(e.id),children:[(0,F.jsx)(he,{vendor:e.harness,status:e.status,size:36,badge:s(e.id)}),(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`span`,{className:`v3-aname`,children:[(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:os(e)})]}),(0,F.jsx)(`span`,{className:`v3-aact`,style:o?{color:`var(--gold-ink)`}:void 0,children:ss(e,t)}),i&&(0,F.jsx)(ls,{store:i.store,controller:i.controller,row:e})]}),a?(0,F.jsx)(ot,{attention:a}):(0,F.jsx)(`span`,{}),t===`host`?(0,F.jsx)(c,{row:e}):e.host!==void 0&&e.status!==`working`?(0,F.jsxs)(`span`,{className:`v3-meta ox-host`,children:[(0,F.jsx)(N,{icon:Ea,size:16,className:`ui-ic`}),e.host]}):(0,F.jsx)(`span`,{})]}),e.status===`working`&&(0,F.jsxs)(`a`,{className:`ox-act`,href:jt({view:`agent`,id:e.id,tab:`work`}),children:[`View work`,(0,F.jsx)(N,{icon:Yt,size:16})]})]})}function ds({rows:e}){return(0,F.jsxs)(`div`,{className:`v3-epsec`,children:[(0,F.jsxs)(`div`,{className:`v3-ghead`,style:{paddingTop:12},children:[(0,F.jsx)(N,{icon:Ta,size:16,className:`ui-ic`}),(0,F.jsx)(`span`,{style:{color:`var(--dim)`},children:`Endpoints`}),(0,F.jsx)(`span`,{className:`v3-count`,children:e.length})]}),e.map(e=>(0,F.jsxs)(`div`,{className:`v3-eprow`,children:[(0,F.jsx)(`span`,{className:e.status===`offline`?`ui-av ui-av-ep ui-av-off`:`ui-av ui-av-ep`,children:(0,F.jsx)(N,{icon:Da,size:16,className:`ui-ic ui-ic16`})}),(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:[e.role,e.host,e.status===`offline`?re(e.status):void 0].filter(Boolean).join(` · `)})]},e.id))]})}function fs({beat:e,clock:t}){let[,n]=(0,P.useReducer)(e=>e+1,0);return(0,P.useEffect)(()=>{let e=setInterval(n,ts);return()=>clearInterval(e)},[]),(0,F.jsxs)(`div`,{className:`v3-eprow`,style:{paddingLeft:66,fontSize:12.5},children:[`Oldest heartbeat among live agents: `,(0,F.jsx)(`span`,{className:`ui-num`,children:ft(t()-e)}),` ago`]})}function ps({store:e,controller:t=null,group:n,focusWaiting:r=!1,selected:i=null,onPick:a,clock:o=Date.now}){let s=M(e,e=>e.roster),c=M(e,e=>e.space),l=M(e,e=>e.stale),[u,d]=(0,P.useState)(n??`status`),f=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>d(n??ns()??`status`),[n]);let{agents:p,endpoints:m}=(0,P.useMemo)(()=>{let e=e=>e.card.kind===`agent`;return{agents:Rt(s.filter(e),{includeOffline:!0}),endpoints:Rt(s.filter(t=>!e(t)),{includeOffline:!0})}},[s]),h=u===`status`?is(p):as(p),g=p.length===0,_=h.some(e=>e.key===`waiting`)&&u===`status`,v=(0,P.useRef)(!1);(0,P.useLayoutEffect)(()=>{if(!r){v.current=!1;return}if(g||v.current)return;v.current=!0;let e=_?f.current:null;e?.focus({preventScroll:!0}),e?.scrollIntoView?.({block:`start`})},[r,g]);let y=e=>{d(e),rs(e)},b=p.filter(e=>e.status!==`offline`).length,x=l.some(e=>e.name===`roster`),S=new Set(x?[]:h.flatMap(e=>e.rows).filter(e=>e.status===`working`).slice(0,12).map(e=>e.id)),ee=hn(p);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Agents`}),!g&&(0,F.jsx)(`span`,{className:`ui-topic`,children:x?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-num`,children:b}),` last seen`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`ui-num`,children:b}),` live, `,(0,F.jsx)(`span`,{className:`ui-num`,children:p.length-b}),` offline`,c===null?``:` on ${c}`]})}),(0,F.jsx)(`span`,{className:`ui-sp`}),!g&&(0,F.jsxs)(yo,{type:`single`,size:`sm`,"aria-label":`Group by`,value:u,onValueChange:e=>(e===`status`||e===`host`)&&y(e),children:[(0,F.jsx)(bo,{value:`status`,children:`Status`}),(0,F.jsx)(bo,{value:`host`,children:`Host`})]})]}),(0,F.jsx)(`div`,{className:`ui-scroll`,children:(0,F.jsxs)(`div`,{className:x?`ui-col s-lastseen`:`ui-col`,style:{maxWidth:900},children:[g&&(0,F.jsx)(So,{space:c}),!g&&(0,F.jsxs)(`div`,{className:u===`status`?`v3-by-status`:`v3-by-host`,children:[h.flatMap(n=>{let o=u===`status`?n.key:void 0,s=o!==void 0&&Object.hasOwn(zn,o);return[(0,F.jsxs)(`div`,{className:s?`v3-ghead v3-s-${o}`:`v3-ghead`,role:`heading`,"aria-level":2,ref:o===`waiting`?f:void 0,tabIndex:o===`waiting`?-1:void 0,"data-focused":o===`waiting`&&r?`true`:void 0,children:[s&&(0,F.jsx)(N,{icon:zn[o],size:16,className:qe(n.key,`ui-ic`)}),u===`host`&&(0,F.jsx)(N,{icon:Ea,size:16,className:`ui-ic`}),(0,F.jsx)(`span`,{style:{color:o===`offline`?`var(--dim)`:`var(--ink)`},children:n.label}),(0,F.jsx)(`span`,{className:`v3-count`,children:n.rows.length})]},`head:${n.key}`),...n.rows.map(n=>(0,F.jsx)(us,{row:n,grouping:u,selected:i===n.id,onPick:a,live:S.has(n.id)?{store:e,controller:t}:void 0},`row:${n.id}`))]}),u===`status`&&!x&&ee!==void 0&&Number.isFinite(ee)&&(0,F.jsx)(fs,{beat:ee,clock:o})]},u),m.length>0&&(0,F.jsx)(ds,{rows:m})]})})]})}var ms=[];function hs(e,t){let n=0,r=e.steps.length;for(;r>0&&n<t;){let t=e.steps[--r];t.kind!==`prompt`&&t.kind!==`reasoning`&&n++}return{...e,steps:e.steps.slice(r)}}function gs({turn:e,current:t,row:n}){let r=cn(t),{title:i,failed:a}=Fn(e,n.status,r);return(0,F.jsxs)(`div`,{className:`ui-lt-head ox-now-head`,children:[(0,F.jsx)(`h5`,{children:t?`Now`:`Last turn`}),(0,F.jsxs)(`span`,{className:`ox-now-t`,children:[i,a!==void 0&&(0,F.jsxs)(F.Fragment,{children:[`, `,(0,F.jsxs)(`span`,{className:`ox-fail`,children:[(0,F.jsx)(N,{icon:an,size:16}),a]})]})]})]})}function _s({store:e,id:t}){let n=M(e,e=>e.roster),r=M(e,e=>e.operatorId),i=M(e,e=>e.sessions[t]?.frames)??ms,a=Nt(e,t),o=n.find(e=>e.card.id===t),s=(0,P.useMemo)(()=>o?Rt([o],{includeOffline:!0})[0]:void 0,[o]),c=(0,P.useMemo)(()=>Qt(o),[o]),l=(0,P.useMemo)(()=>{let e=xt(n);return t=>wn(t,e,r)},[n,r]),u=(0,P.useMemo)(()=>mt(i,a),[i,a]);if(!s)return null;if(s.events===`off`)return(0,F.jsx)(_n,{children:`${s.name} publishes no work events.`});let d=u.items.filter(e=>e.kind===`turn`),f=d.findLast(e=>e.outcome===`open`&&!e.superseded),p=f!==void 0&&(s.status===`working`||s.status===`waiting`),m=p?f:d.at(-1);return m?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(gs,{turn:m,current:p,row:s}),(0,F.jsx)(Lt,{work:{items:[hs(m,3)],toolStatus:u.toolStatus},row:s,compact:!0,condition:c,nameOf:l})]}):null}function vs({store:e,controller:t=null,id:n,route:r}){let i=M(e,e=>e.roster),a=M(e,e=>e.operatorId),o=i.find(e=>e.card.id===n),s=(0,P.useMemo)(()=>o?Rt([o],{includeOffline:!0})[0].events:void 0,[o]);kt(o&&s!==`off`?t:null,n);let l=ae();if(!o)return(0,F.jsx)(`p`,{className:`ui-nr`,children:`Not on the roster`});let u=Rt([o],{includeOffline:!0})[0],d=[u.role,u.harness&&ve(u.harness)].filter(Boolean).join(` · `),f=typeof u.statusSince==`number`&&Number.isFinite(u.statusSince)?`Reported ${Re(new Date(u.statusSince))}`:void 0;return(0,F.jsxs)(`div`,{className:`ox-peek`,children:[(0,F.jsxs)(`div`,{className:`ox-peek-who`,children:[(0,F.jsx)(he,{vendor:u.harness,status:u.status,size:44,badge:l(u.id)}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:u.name}),d&&(0,F.jsx)(`div`,{className:`ui-sub`,children:d})]})]}),(0,F.jsxs)(`div`,{className:`ui-sline`,children:[(0,F.jsx)(c,{row:u}),(0,F.jsx)(`span`,{style:{color:`var(--ink)`},children:u.activity||`No current activity`}),f&&(0,F.jsx)(`small`,{children:f}),In(u,Date.now())&&(0,F.jsx)(`small`,{className:`ui-facts`,children:In(u,Date.now())})]}),(r?.view!==`agent`||r.id!==n)&&(0,F.jsx)(_s,{store:e,id:n}),(0,F.jsxs)(`div`,{className:`ui-actions`,children:[(0,F.jsx)(Et,{asChild:!0,size:`sm`,children:(0,F.jsxs)(`a`,{href:jt({view:`agent`,id:u.id,tab:`work`}),children:[(0,F.jsx)(N,{icon:Yt,"data-icon":`inline-start`}),`Open ${u.name}'s page`]})}),(0,F.jsx)(Et,{asChild:!0,variant:`outline`,size:`sm`,children:(0,F.jsxs)(`a`,{href:jt(Ht(u.id,a)),onClick:()=>zt({kind:`dm`,to:u.id}),children:[(0,F.jsx)(N,{icon:xn,"data-icon":`inline-start`}),`Message`]})})]})]})}var ys={live:{word:`live`,cls:`ui-mdot-live`,title:`From broker membership, served by the delivery daemon`},stale:{word:`stale`,cls:`ui-mdot-stale`,title:`The daemon's last report is older than 45 seconds, or has no time on it`},"traffic-only":{word:`traffic-only`,cls:`ui-mdot-traffic`,title:`No delivery daemon on an open mesh, so members come from who has posted`},unreadable:{word:`unreadable`,cls:`ui-mdot-unread`}};function bs({state:e,reason:t}){let n=ys[e],r=e===`unreadable`?t?`the read failed: ${t}`:`the read failed`:n.title;return(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsxs)(ht,{variant:e===`unreadable`?`destructive`:`outline`,children:[(0,F.jsx)(`i`,{className:`ui-mdot ${n.cls}`}),`Membership: `,n.word,(0,F.jsx)(`span`,{className:`ui-sr`,children:` ${r}`})]})}),(0,F.jsx)(E,{children:r})]})}function xs({...e}){return(0,F.jsx)(Dr,{"data-slot":`alert-dialog`,...e})}function Ss({...e}){return(0,F.jsx)(Or,{"data-slot":`alert-dialog-trigger`,...e})}function Cs({...e}){return(0,F.jsx)(kr,{"data-slot":`alert-dialog-portal`,...e})}function ws({className:e,...t}){return(0,F.jsx)(Ar,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ts({className:e,size:t=`default`,...n}){return(0,F.jsxs)(Cs,{children:[(0,F.jsx)(ws,{}),(0,F.jsx)(Nr,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Es({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ds({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Os({className:e,...t}){return(0,F.jsx)(Pr,{"data-slot":`alert-dialog-title`,className:A(`text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function ks({className:e,...t}){return(0,F.jsx)(Fr,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function As({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,F.jsx)(Et,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(Ir,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function js({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,F.jsx)(Et,{variant:t,size:n,asChild:!0,children:(0,F.jsx)(Rr,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ms({channel:e,space:t,controller:n,children:r}){let[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=(0,P.useRef)(null),p=(0,P.useId)(),h=o===e,g=e=>{a(e),e&&(s(``),l(null),d(!1))},_=async()=>{if(h&&n!==null&&!u){d(!0),l(null);try{await n.deleteChannel(e),a(!1)}catch(e){l(e instanceof Error?e.message:String(e)),d(!1)}}};return(0,F.jsxs)(xs,{open:i,onOpenChange:g,children:[(0,F.jsx)(Ss,{asChild:!0,children:r}),(0,F.jsxs)(Ts,{onOpenAutoFocus:e=>{e.preventDefault(),f.current?.focus()},children:[(0,F.jsxs)(Es,{children:[(0,F.jsx)(Os,{children:`Delete #${e}?`}),(0,F.jsx)(ks,{children:`This deletes every message in #${e} for everyone${t?` on ${t}`:``}. You can't undo it. If anyone posts to #${e} again, it comes back empty.`})]}),(0,F.jsxs)(Mt,{children:[(0,F.jsx)(ct,{htmlFor:p,children:(0,F.jsxs)(`span`,{children:[`Type `,(0,F.jsx)(`b`,{children:e}),` to confirm`]})}),(0,F.jsx)(me,{ref:f,id:p,value:o,autoComplete:`off`,spellCheck:!1,onChange:e=>s(e.target.value)})]}),c!==null&&(0,F.jsx)(m,{variant:`destructive`,children:(0,F.jsx)(we,{children:c})}),(0,F.jsxs)(Ds,{children:[(0,F.jsx)(js,{children:`Keep channel`}),(0,F.jsxs)(As,{variant:`destructive`,disabled:!h||u||n===null,onClick:e=>{e.preventDefault(),_()},children:[(0,F.jsx)(N,{icon:wa,"data-icon":`inline-start`}),`Delete #${e}`]})]})]})]})}var Ns=[];function Ps(e){if(e?.deliveryClass===void 0)return;let t=[e.deliveryClass];return e.replay===!0&&t.push(e.replayWindow===void 0?`replay`:`replay ${e.replayWindow}`),t.join(`, `)}function Fs({store:e,controller:t,channel:r,now:i,onPick:a}){let o=M(e,e=>e.space),s=M(e,e=>e.roster),l=M(e,e=>e.channels),u=M(e,e=>e.membership),d=M(e,e=>e.open),f=d?.channel===r?d.messages:Ns,p=(0,P.useMemo)(()=>xt(s),[s]),m=(0,P.useMemo)(()=>Rt(s,{includeOffline:!0}),[s]),h=(0,P.useMemo)(()=>{let e=new Map(m.map((e,t)=>[e.id,t])),t=t=>e.get(t)??m.length;return $e(r,u,l.map(e=>e.channel),f).sort((e,n)=>t(e.id)-t(n.id))},[r,u,l,f,m]),g=ae(),_=(0,P.useMemo)(()=>new Map(m.map(e=>[e.id,e])),[m]),v=l.find(e=>e.channel===r),y=Ps(v),b=h.length;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`v3-mhead`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{style:{color:`var(--ink)`,fontWeight:600},children:`#${r}`}),` · `,(0,F.jsx)(`span`,{className:`ui-num`,children:b}),b===1?` member`:` members`]}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(bs,{state:n(u,i),reason:u.unreadable})]}),h.map(e=>{let t=_.get(e.id);return(0,F.jsxs)(`button`,{type:`button`,className:`v3-mrow`,"data-member":e.id,"data-source":e.source,onClick:()=>a(e.id),children:[(0,F.jsx)(he,{vendor:t?.harness,status:t?.status??`offline`,size:28,dot:t!==void 0,badge:t?g(e.id):void 0}),(0,F.jsxs)(`span`,{className:`v3-mname`,children:[t?.name??wn(e.id,p),t?.role&&(0,F.jsx)(`span`,{children:t.role})]}),t&&(0,F.jsx)(c,{row:t})]},e.id)}),(0,F.jsx)(`h5`,{style:{marginTop:14},children:`Channel`}),(0,F.jsxs)(`dl`,{className:`ui-kv`,style:{borderTop:0,paddingTop:0},children:[v?.description&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Topic`}),(0,F.jsx)(`dd`,{children:v.description})]}),y&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Delivery`}),(0,F.jsx)(`dd`,{children:y})]}),v&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`dt`,{children:`Messages`}),(0,F.jsx)(`dd`,{className:`ui-num`,children:v.messages})]})]}),(0,F.jsx)(Ms,{channel:r,space:o,controller:t,children:(0,F.jsxs)(Et,{type:`button`,variant:`destructive`,className:`mt-1`,children:[(0,F.jsx)(N,{icon:wa,"data-icon":`inline-start`}),`Delete channel`]})})]})}var Is={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Ls(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Is.hasOwnProperty(t)?{space:Is[t],local:e}:e}function Rs(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function zs(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bs(e){var t=Ls(e);return(t.local?zs:Rs)(t)}function Vs(){}function Hs(e){return e==null?Vs:function(){return this.querySelector(e)}}function Us(e){typeof e!=`function`&&(e=Hs(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new Al(r,this._parents)}function Ws(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Gs(){return[]}function Ks(e){return e==null?Gs:function(){return this.querySelectorAll(e)}}function qs(e){return function(){return Ws(e.apply(this,arguments))}}function Js(e){e=typeof e==`function`?qs(e):Ks(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new Al(r,i)}function Ys(e){return function(){return this.matches(e)}}function Xs(e){return function(t){return t.matches(e)}}var Zs=Array.prototype.find;function Qs(e){return function(){return Zs.call(this.children,e)}}function $s(){return this.firstElementChild}function ec(e){return this.select(e==null?$s:Qs(typeof e==`function`?e:Xs(e)))}var tc=Array.prototype.filter;function nc(){return Array.from(this.children)}function rc(e){return function(){return tc.call(this.children,e)}}function ic(e){return this.selectAll(e==null?nc:rc(typeof e==`function`?e:Xs(e)))}function ac(e){typeof e!=`function`&&(e=Ys(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Al(r,this._parents)}function oc(e){return Array(e.length)}function sc(){return new Al(this._enter||this._groups.map(oc),this._parents)}function cc(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}cc.prototype={constructor:cc,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function lc(e){return function(){return e}}function uc(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new cc(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function dc(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new cc(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function fc(e){return e.__data__}function pc(e,t){if(!arguments.length)return Array.from(this,fc);var n=t?dc:uc,r=this._parents,i=this._groups;typeof e!=`function`&&(e=lc(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=mc(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new Al(o,r),o._enter=s,o._exit=c,o}function mc(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function hc(){return new Al(this._exit||this._groups.map(oc),this._parents)}function gc(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function _c(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new Al(s,this._parents)}function vc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function yc(e){e||=bc;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new Al(i,this._parents).order()}function bc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sc(){return Array.from(this)}function Cc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function wc(){let e=0;for(let t of this)++e;return e}function Tc(){return!this.node()}function Ec(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Dc(e){return function(){this.removeAttribute(e)}}function Oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kc(e,t){return function(){this.setAttribute(e,t)}}function Ac(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function jc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Mc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Nc(e,t){var n=Ls(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Oc:Dc:typeof t==`function`?n.local?Mc:jc:n.local?Ac:kc)(n,t))}function Pc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Fc(e){return function(){this.style.removeProperty(e)}}function Ic(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Lc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Rc(e,t,n){return arguments.length>1?this.each((t==null?Fc:typeof t==`function`?Lc:Ic)(e,t,n??``)):zc(this.node(),e)}function zc(e,t){return e.style.getPropertyValue(t)||Pc(e).getComputedStyle(e,null).getPropertyValue(t)}function Bc(e){return function(){delete this[e]}}function Vc(e,t){return function(){this[e]=t}}function Hc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Uc(e,t){return arguments.length>1?this.each((t==null?Bc:typeof t==`function`?Hc:Vc)(e,t)):this.node()[e]}function Wc(e){return e.trim().split(/^|\s+/)}function Gc(e){return e.classList||new Kc(e)}function Kc(e){this._node=e,this._names=Wc(e.getAttribute(`class`)||``)}Kc.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function qc(e,t){for(var n=Gc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Jc(e,t){for(var n=Gc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Yc(e){return function(){qc(this,e)}}function Xc(e){return function(){Jc(this,e)}}function Zc(e,t){return function(){(t.apply(this,arguments)?qc:Jc)(this,e)}}function Qc(e,t){var n=Wc(e+``);if(arguments.length<2){for(var r=Gc(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Zc:t?Yc:Xc)(n,t))}function $c(){this.textContent=``}function el(e){return function(){this.textContent=e}}function tl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function nl(e){return arguments.length?this.each(e==null?$c:(typeof e==`function`?tl:el)(e)):this.node().textContent}function rl(){this.innerHTML=``}function il(e){return function(){this.innerHTML=e}}function al(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function ol(e){return arguments.length?this.each(e==null?rl:(typeof e==`function`?al:il)(e)):this.node().innerHTML}function sl(){this.nextSibling&&this.parentNode.appendChild(this)}function cl(){return this.each(sl)}function ll(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ul(){return this.each(ll)}function dl(e){var t=typeof e==`function`?e:Bs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function fl(){return null}function pl(e,t){var n=typeof e==`function`?e:Bs(e),r=t==null?fl:typeof t==`function`?t:Hs(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ml(){var e=this.parentNode;e&&e.removeChild(this)}function hl(){return this.each(ml)}function gl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _l(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vl(e){return this.select(e?_l:gl)}function yl(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function bl(e){return function(t){e.call(this,t,this.__data__)}}function V(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function xl(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Sl(e,t,n){return function(){var r=this.__on,i,a=bl(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Cl(e,t,n){var r=V(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?Sl:xl,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function wl(e,t,n){var r=Pc(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Tl(e,t){return function(){return wl(this,e,t)}}function El(e,t){return function(){return wl(this,e,t.apply(this,arguments))}}function Dl(e,t){return this.each((typeof t==`function`?El:Tl)(e,t))}function*Ol(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var kl=[null];function Al(e,t){this._groups=e,this._parents=t}function jl(){return new Al([[document.documentElement]],kl)}function Ml(){return this}Al.prototype=jl.prototype={constructor:Al,select:Us,selectAll:Js,selectChild:ec,selectChildren:ic,filter:ac,data:pc,enter:sc,exit:hc,join:gc,merge:_c,selection:Ml,order:vc,sort:yc,call:xc,nodes:Sc,node:Cc,size:wc,empty:Tc,each:Ec,attr:Nc,style:Rc,property:Uc,classed:Qc,text:nl,html:ol,raise:cl,lower:ul,append:dl,insert:pl,remove:hl,clone:vl,datum:yl,on:Cl,dispatch:Dl,[Symbol.iterator]:Ol};function Nl(e){return typeof e==`string`?new Al([[document.querySelector(e)]],[document.documentElement]):new Al([[e]],kl)}function Pl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fl(e,t){if(e=Pl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Il={value:()=>{}};function Ll(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Rl(n)}function Rl(e){this._=e}function zl(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Rl.prototype=Ll.prototype={constructor:Rl,on:function(e,t){var n=this._,r=zl(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Bl(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Vl(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Vl(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Rl(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Bl(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Vl(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Il,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hl={capture:!0,passive:!1};function Ul(e){e.preventDefault(),e.stopImmediatePropagation()}function Wl(e){var t=e.document.documentElement,n=Nl(e).on(`dragstart.drag`,Ul,Hl);`onselectstart`in t?n.on(`selectstart.drag`,Ul,Hl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Gl(e,t){var n=e.document.documentElement,r=Nl(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Ul,Hl),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Kl(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ql(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Jl(){}var Yl=.7,Xl=1/Yl,Zl=`\\s*([+-]?\\d+)\\s*`,Ql=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,$l=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,eu=/^#([0-9a-f]{3,8})$/,tu=RegExp(`^rgb\\(${Zl},${Zl},${Zl}\\)$`),nu=RegExp(`^rgb\\(${$l},${$l},${$l}\\)$`),ru=RegExp(`^rgba\\(${Zl},${Zl},${Zl},${Ql}\\)$`),iu=RegExp(`^rgba\\(${$l},${$l},${$l},${Ql}\\)$`),au=RegExp(`^hsl\\(${Ql},${$l},${$l}\\)$`),ou=RegExp(`^hsla\\(${Ql},${$l},${$l},${Ql}\\)$`),su={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Kl(Jl,du,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:H,formatHex:H,formatHex8:cu,formatHsl:lu,formatRgb:uu,toString:uu});function H(){return this.rgb().formatHex()}function cu(){return this.rgb().formatHex8()}function lu(){return Cu(this).formatHsl()}function uu(){return this.rgb().formatRgb()}function du(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=eu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fu(t):n===3?new gu(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tu.exec(e))?new gu(t[1],t[2],t[3],1):(t=nu.exec(e))?new gu(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ru.exec(e))?pu(t[1],t[2],t[3],t[4]):(t=iu.exec(e))?pu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=au.exec(e))?U(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?U(t[1],t[2]/100,t[3]/100,t[4]):su.hasOwnProperty(e)?fu(su[e]):e===`transparent`?new gu(NaN,NaN,NaN,0):null}function fu(e){return new gu(e>>16&255,e>>8&255,e&255,1)}function pu(e,t,n,r){return r<=0&&(e=t=n=NaN),new gu(e,t,n,r)}function mu(e){return e instanceof Jl||(e=du(e)),e?(e=e.rgb(),new gu(e.r,e.g,e.b,e.opacity)):new gu}function hu(e,t,n,r){return arguments.length===1?mu(e):new gu(e,t,n,r??1)}function gu(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Kl(gu,hu,ql(Jl,{brighter(e){return e=e==null?Xl:Xl**+e,new gu(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yl:Yl**+e,new gu(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gu(xu(this.r),xu(this.g),xu(this.b),bu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_u,formatHex:_u,formatHex8:vu,formatRgb:yu,toString:yu}));function _u(){return`#${Su(this.r)}${Su(this.g)}${Su(this.b)}`}function vu(){return`#${Su(this.r)}${Su(this.g)}${Su(this.b)}${Su((isNaN(this.opacity)?1:this.opacity)*255)}`}function yu(){let e=bu(this.opacity);return`${e===1?`rgb(`:`rgba(`}${xu(this.r)}, ${xu(this.g)}, ${xu(this.b)}${e===1?`)`:`, ${e})`}`}function bu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function xu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Su(e){return e=xu(e),(e<16?`0`:``)+e.toString(16)}function U(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tu(e,t,n,r)}function Cu(e){if(e instanceof Tu)return new Tu(e.h,e.s,e.l,e.opacity);if(e instanceof Jl||(e=du(e)),!e)return new Tu;if(e instanceof Tu)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Tu(o,s,c,e.opacity)}function wu(e,t,n,r){return arguments.length===1?Cu(e):new Tu(e,t,n,r??1)}function Tu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Kl(Tu,wu,ql(Jl,{brighter(e){return e=e==null?Xl:Xl**+e,new Tu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yl:Yl**+e,new Tu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new gu(Ou(e>=240?e-240:e+120,i,r),Ou(e,i,r),Ou(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Tu(Eu(this.h),Du(this.s),Du(this.l),bu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=bu(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Eu(this.h)}, ${Du(this.s)*100}%, ${Du(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Eu(e){return e=(e||0)%360,e<0?e+360:e}function Du(e){return Math.max(0,Math.min(1,e||0))}function Ou(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ku=e=>()=>e;function Au(e,t){return function(n){return e+n*t}}function ju(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Mu(e){return(e=+e)==1?Nu:function(t,n){return n-t?ju(t,n,e):ku(isNaN(t)?n:t)}}function Nu(e,t){var n=t-e;return n?Au(e,n):ku(isNaN(e)?t:e)}var Pu=(function e(t){var n=Mu(t);function r(e,t){var r=n((e=hu(e)).r,(t=hu(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Nu(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Fu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Iu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lu=new RegExp(Iu.source,`g`);function Ru(e){return function(){return e}}function zu(e){return function(t){return e(t)+``}}function Bu(e,t){var n=Iu.lastIndex=Lu.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Iu.exec(e))&&(i=Lu.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Fu(r,i)})),n=Lu.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?zu(c[0].x):Ru(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var Vu=180/Math.PI,Hu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Uu(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Vu,skewX:Math.atan(c)*Vu,scaleX:o,scaleY:s}}var Wu;function Gu(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Hu:Uu(t.a,t.b,t.c,t.d,t.e,t.f)}function Ku(e){return e==null||(Wu||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Wu.setAttribute(`transform`,e),!(e=Wu.transform.baseVal.consolidate()))?Hu:(e=e.matrix,Uu(e.a,e.b,e.c,e.d,e.e,e.f))}function qu(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Fu(e,i)},{i:c-2,x:Fu(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Fu(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Fu(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Fu(e,n)},{i:s-2,x:Fu(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Ju=qu(Gu,`px, `,`px)`,`deg)`),Yu=qu(Ku,`, `,`)`,`)`),Xu=1e-12;function Zu(e){return((e=Math.exp(e))+1/e)/2}function Qu(e){return((e=Math.exp(e))-1/e)/2}function $u(e){return((e=Math.exp(2*e))-1)/(e+1)}var ed=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Xu)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Zu(y),c=s/(n*g)*(i*$u(t*r+y)-Qu(y));return[a+c*d,o+c*f,s*i/Zu(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),td=0,W=0,G=0,K=1e3,q,J,nd=0,rd=0,id=0,ad=typeof performance==`object`&&performance.now?performance:Date,od=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Y(){return rd||=(od(sd),ad.now()+id)}function sd(){rd=0}function cd(){this._call=this._time=this._next=null}cd.prototype=ld.prototype={constructor:cd,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Y():+n)+(t==null?0:+t),!this._next&&J!==this&&(J?J._next=this:q=this,J=this),this._call=e,this._time=n,md()},stop:function(){this._call&&(this._call=null,this._time=1/0,md())}};function ld(e,t,n){var r=new cd;return r.restart(e,t,n),r}function ud(){Y(),++td;for(var e=q,t;e;)(t=rd-e._time)>=0&&e._call.call(void 0,t),e=e._next;--td}function dd(){rd=(nd=ad.now())+id,td=W=0;try{ud()}finally{td=0,pd(),rd=0}}function fd(){var e=ad.now(),t=e-nd;t>K&&(id-=t,nd=e)}function pd(){for(var e,t=q,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:q=n);J=e,md(r)}function md(e){td||(W&&=clearTimeout(W),e-rd>24?(e<1/0&&(W=setTimeout(dd,e-ad.now()-id)),G&&=clearInterval(G)):(G||=(nd=ad.now(),setInterval(fd,K)),td=1,od(dd)))}function hd(e,t,n){var r=new cd;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var gd=Ll(`start`,`end`,`cancel`,`interrupt`),_d=[];function vd(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;xd(e,n,{name:t,index:r,group:i,on:gd,tween:_d,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function yd(e,t){var n=bd(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function X(e,t){var n=bd(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function bd(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function xd(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=ld(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return hd(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(hd(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Sd(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function Cd(e){return this.each(function(){Sd(this,e)})}function wd(e,t){var n,r;return function(){var i=X(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Td(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=X(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Ed(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=bd(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?wd:Td)(n,e,t))}function Dd(e,t,n){var r=e._id;return e.each(function(){var e=X(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return bd(e,r).value[t]}}function Od(e,t){var n;return(typeof t==`number`?Fu:t instanceof du?Pu:(n=du(t))?(t=n,Pu):Bu)(e,t)}function kd(e){return function(){this.removeAttribute(e)}}function Ad(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jd(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Md(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Nd(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Pd(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fd(e,t){var n=Ls(e),r=n===`transform`?Yu:Od;return this.attrTween(e,typeof t==`function`?(n.local?Pd:Nd)(n,r,Dd(this,`attr.`+e,t)):t==null?(n.local?Ad:kd)(n):(n.local?Md:jd)(n,r,t))}function Id(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ld(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Rd(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ld(e,i)),n}return i._value=t,i}function zd(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Id(e,i)),n}return i._value=t,i}function Bd(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Ls(e);return this.tween(n,(r.local?Rd:zd)(r,t))}function Vd(e,t){return function(){yd(this,e).delay=+t.apply(this,arguments)}}function Hd(e,t){return t=+t,function(){yd(this,e).delay=t}}function Ud(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Vd:Hd)(t,e)):bd(this.node(),t).delay}function Wd(e,t){return function(){X(this,e).duration=+t.apply(this,arguments)}}function Gd(e,t){return t=+t,function(){X(this,e).duration=t}}function Kd(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Wd:Gd)(t,e)):bd(this.node(),t).duration}function qd(e,t){if(typeof t!=`function`)throw Error();return function(){X(this,e).ease=t}}function Jd(e){var t=this._id;return arguments.length?this.each(qd(t,e)):bd(this.node(),t).ease}function Yd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();X(this,e).ease=n}}function Xd(e){if(typeof e!=`function`)throw Error();return this.each(Yd(this._id,e))}function Zd(e){typeof e!=`function`&&(e=Ys(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Ef(r,this._parents,this._name,this._id)}function Qd(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Ef(o,this._parents,this._name,this._id)}function $d(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ef(e,t,n){var r,i,a=$d(t)?yd:X;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function tf(e,t){var n=this._id;return arguments.length<2?bd(this.node(),n).on.on(e):this.each(ef(n,e,t))}function nf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function rf(){return this.on(`end.remove`,nf(this._id))}function af(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Hs(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,vd(l[f],t,n,f,l,bd(u,n)));return new Ef(a,this._parents,t,n)}function of(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ks(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=bd(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&vd(p,t,n,h,f,m);a.push(f),o.push(u)}return new Ef(a,o,t,n)}var sf=jl.prototype.constructor;function cf(){return new sf(this._groups,this._parents)}function lf(e,t){var n,r,i;return function(){var a=zc(this,e),o=(this.style.removeProperty(e),zc(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function uf(e){return function(){this.style.removeProperty(e)}}function df(e,t,n){var r,i=n+``,a;return function(){var o=zc(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function ff(e,t,n){var r,i,a;return function(){var o=zc(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),zc(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function pf(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=X(this,e),l=c.on,u=c.value[a]==null?s||=uf(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Z(e,t,n){var r=(e+=``)==`transform`?Ju:Od;return t==null?this.styleTween(e,lf(e,r)).on(`end.style.`+e,uf(e)):typeof t==`function`?this.styleTween(e,ff(e,r,Dd(this,`style.`+e,t))).each(pf(this._id,e)):this.styleTween(e,df(e,r,t),n).on(`end.style.`+e,null)}function mf(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function hf(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&mf(e,a,n)),r}return a._value=t,a}function gf(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,hf(e,t,n??``))}function _f(e){return function(){this.textContent=e}}function vf(e){return function(){var t=e(this);this.textContent=t??``}}function yf(e){return this.tween(`text`,typeof e==`function`?vf(Dd(this,`text`,e)):_f(e==null?``:e+``))}function bf(e){return function(t){this.textContent=e.call(this,t)}}function xf(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&bf(r)),t}return r._value=e,r}function Sf(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,xf(e))}function Cf(){for(var e=this._name,t=this._id,n=Df(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=bd(c,t);vd(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ef(r,this._parents,e,n)}function wf(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=X(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Tf=0;function Ef(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Df(){return++Tf}var Of=jl.prototype;Ef.prototype={constructor:Ef,select:af,selectAll:of,selectChild:Of.selectChild,selectChildren:Of.selectChildren,filter:Zd,merge:Qd,selection:cf,transition:Cf,call:Of.call,nodes:Of.nodes,node:Of.node,size:Of.size,empty:Of.empty,each:Of.each,on:tf,attr:Fd,attrTween:Bd,style:Z,styleTween:gf,text:yf,textTween:Sf,remove:rf,tween:Ed,delay:Ud,duration:Kd,ease:Jd,easeVarying:Xd,end:wf,[Symbol.iterator]:Of[Symbol.iterator]};function kf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Af={time:null,delay:0,duration:250,ease:kf};function jf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Mf(e){var t,n;e instanceof Ef?(t=e._id,e=e._name):(t=Df(),(n=Af).time=Y(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&vd(c,e,t,l,o,n||jf(c,t));return new Ef(r,this._parents,e,t)}jl.prototype.interrupt=Cd,jl.prototype.transition=Mf;var Nf=e=>()=>e;function Pf(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ff(e,t,n){this.k=e,this.x=t,this.y=n}Ff.prototype={constructor:Ff,scale:function(e){return e===1?this:new Ff(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ff(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var If=new Ff(1,0,0);Lf.prototype=Ff.prototype;function Lf(e){for(;!e.__zoom;)if(!(e=e.parentNode))return If;return e.__zoom}function Rf(e){e.stopImmediatePropagation()}function zf(e){e.preventDefault(),e.stopImmediatePropagation()}function Bf(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Vf(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Q(){return this.__zoom||If}function Hf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uf(){return navigator.maxTouchPoints||`ontouchstart`in this}function Wf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Gf(){var e=Bf,t=Vf,n=Wf,r=Hf,i=Uf,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ed,l=Ll(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Q).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,ne).filter(i).on(`touchstart.zoom`,w).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,re).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Q),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(If.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Ff(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Ff(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Ff(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Nl(this.that).datum();l.call(e,this.that,new Pf(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Fl(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Sd(this),s.start();zf(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Nl(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Fl(t,i),l=t.clientX,u=t.clientY;Wl(t.view),Rf(t),a.mouse=[c,this.__zoom.invert(c)],Sd(this),a.start();function d(e){if(zf(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Fl(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gl(e.view,a.moved),zf(e),a.event(e).end()}}function ne(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Fl(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);zf(r),s>0?Nl(this).transition().duration(s).call(x,d,c,r):Nl(this).call(_.transform,d,c,r)}}function w(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Rf(t),s=0;s<i;++s)c=r[s],l=Fl(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Sd(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(zf(e),s=0;s<a;++s)c=i[s],l=Fl(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function re(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Rf(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Fl(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Nl(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Nf(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Nf(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Nf(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Nf([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}function Kf(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i<a;++i)o=n[i],s+=o.x,c+=o.y;for(s=(s/a-e)*r,c=(c/a-t)*r,i=0;i<a;++i)o=n[i],o.x-=s,o.y-=c}return i.initialize=function(e){n=e},i.x=function(t){return arguments.length?(e=+t,i):e},i.y=function(e){return arguments.length?(t=+e,i):t},i.strength=function(e){return arguments.length?(r=+e,i):r},i}function qf(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return Jf(this.cover(t,n),t,n,e)}function Jf(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Yf(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)Jf(this,o[n],s[n],e[n]);return this}function Xf(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Zf(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qf(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function $f(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function ep(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new $f(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new $f(p[3],g,_,c,l),new $f(p[2],o,_,g,l),new $f(p[1],g,s,c,_),new $f(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function $(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tp(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function np(){return this._root}function rp(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function ip(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new $f(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new $f(i,l,u,s,c)),(i=r[2])&&t.push(new $f(i,a,u,l,c)),(i=r[1])&&t.push(new $f(i,l,o,s,u)),(i=r[0])&&t.push(new $f(i,a,o,l,u))}return this}function ap(e){var t=[],n=[],r;for(this._root&&t.push(new $f(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new $f(a,o,s,u,d)),(a=i[1])&&t.push(new $f(a,u,s,c,d)),(a=i[2])&&t.push(new $f(a,o,d,u,l)),(a=i[3])&&t.push(new $f(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function op(e){return e[0]}function sp(e){return arguments.length?(this._x=e,this):this._x}function cp(e){return e[1]}function lp(e){return arguments.length?(this._y=e,this):this._y}function up(e,t,n){var r=new dp(t??op,n??cp,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dp(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function fp(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var pp=up.prototype=dp.prototype;pp.copy=function(){var e=new dp(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=fp(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=fp(r));return e},pp.add=qf,pp.addAll=Yf,pp.cover=Xf,pp.data=Zf,pp.extent=Qf,pp.find=ep,pp.remove=$,pp.removeAll=tp,pp.root=np,pp.size=rp,pp.visit=ip,pp.visitAfter=ap,pp.x=sp,pp.y=lp;function mp(e){return function(){return e}}function hp(e){return(e()-.5)*1e-6}function gp(e){return e.x+e.vx}function _p(e){return e.y+e.vy}function vp(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=mp(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=up(t,gp,_p).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=hp(r),_+=h*h),g===0&&(g=hp(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),c(),o):e},o}function yp(e){return e.index}function bp(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function xp(e){var t=yp,n=d,r,i=mp(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||hp(l),m=f.y+f.vy-d.y-d.vy||hp(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=bp(u,d.source)),typeof d.target!=`object`&&(d.target=bp(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:mp(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:mp(+e),h(),f):i},f}var Sp=1664525,Cp=1013904223,wp=4294967296;function Tp(){let e=1;return()=>(e=(Sp*e+Cp)%wp)/wp}function Ep(e){return e.x}function Dp(e){return e.y}var Op=10,kp=Math.PI*(3-Math.sqrt(5));function Ap(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=ld(d),l=Ll(`tick`,`end`),u=Tp();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=Op*Math.sqrt(.5+t),a=t*kp;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function jp(){var e,t,n,r,i=mp(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=up(e,Ep,Dp).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=hp(n),m+=d*d),f===0&&(f=hp(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=hp(n),m+=d*d),f===0&&(f=hp(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:mp(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function Mp(e){var t=mp(.1),n,r,i;typeof e!=`function`&&(e=mp(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:mp(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),o(),a):e},a}function Np(e){var t=mp(.1),n,r,i;typeof e!=`function`&&(e=mp(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:mp(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:mp(+t),o(),a):e},a}var Pp=e=>14+e.length*7,Fp=e=>e.kind===`channel`?Pp(e.label)/2+6:30;function Ip(e){let t=e.nodes.map(e=>e.id).sort(),n=e.links.map(e=>`${e.source}\u0000${e.target}\u0000${e.kind}`).sort();return`${t.join(``)}\u0002${n.join(``)}`}var Lp=300,Rp=.5,zp=20,Bp=class{sim;links;bodies=new Map;key;size=``;width=0;height=0;constructor(e,t){this.links=xp([]).id(e=>e.id).strength(.4),this.sim=Ap().force(`link`,this.links).force(`charge`,jp()).force(`center`,Kf()).force(`collide`,vp().radius(e=>e.r)).force(`x`,Mp()).force(`y`,Np()).force(`bounds`,()=>{for(let e of this.bodies.values())e.x!==void 0&&(e.x=Math.min(Math.max(e.x,e.r),this.width-e.r)),e.y!==void 0&&(e.y=Math.min(Math.max(e.y,e.r),this.height-e.r-zp))}).stop(),this.resize(e,t)}resize(e,t){let n=`${e}x${t}`;if(n===this.size)return!1;this.size=n,this.width=e,this.height=t;let r=Math.min(e,t)/420;return this.links.distance(90*r),this.sim.force(`charge`,jp().strength(-280*r*r)).force(`center`,Kf(e/2,t/2)).force(`x`,Mp(e/2).strength(.04)).force(`y`,Np(t/2).strength(.04)),!0}sync(e){let t=Ip(e);if(t===this.key)return!1;let n=new Map;for(let t of e.nodes)n.set(t.id,this.bodies.get(t.id)??{id:t.id,r:Fp(t)});return this.bodies=n,this.sim.nodes([...n.values()]),this.links.links(e.links.map(e=>({source:e.source,target:e.target}))),this.key=t,!0}warm(){this.sim.alpha(1).tick(Lp)}reheat(){this.sim.alpha(Math.max(this.sim.alpha(),Rp))}tick(){this.sim.tick()}get settled(){return this.sim.alpha()<this.sim.alphaMin()}at(e){let t=this.bodies.get(e);return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)?{x:t.x,y:t.y}:void 0}},Vp={request:e=>globalThis.requestAnimationFrame(e),cancel:e=>globalThis.cancelAnimationFrame(e)};function Hp(e,t,n){return[`ui-tl`,`ui-tl-${e}`,n?`ui-tl-off`:``,t?`ui-tl-hot`:``].filter(Boolean).join(` `)}function Up({status:e,x:t,y:n}){return(0,F.jsxs)(`g`,{className:`ui-tst ui-tst-${e}`,"aria-hidden":`true`,children:[e===`working`&&(0,F.jsx)(`circle`,{cx:t,cy:n,r:5}),e===`waiting`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`circle`,{cx:t,cy:n,r:5,className:`ui-tst-bg`}),(0,F.jsx)(`path`,{d:`M${t} ${n-4.2} A4.2 4.2 0 0 0 ${t} ${n+4.2} Z`}),(0,F.jsx)(`circle`,{cx:t,cy:n,r:4.2,className:`ui-tst-ring`})]}),(e===`idle`||e===`offline`)&&(0,F.jsx)(`circle`,{cx:t,cy:n,r:4.4})]})}function Wp({r:e}){let t=2*Math.PI*e;return(0,F.jsxs)(`g`,{className:`ui-orbit-g`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{r:e,className:`ui-orbit-ring`}),(0,F.jsx)(`circle`,{r:e,className:`ui-orbit`,strokeDasharray:`${t/5} ${t*4/5}`})]})}function Gp({node:e,x:t,y:n,size:r}){let i=e.status??`idle`,a=(0,P.useContext)(Se),o=ae()(e.id),s=r*.23,c=-r/2+s-3,l=r/2-s+2,u=o&&(0,F.jsxs)(`g`,{className:`ui-tidb`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{cx:c,cy:l,r:s,style:{fill:`var(--id-${i===`offline`?`off`:o.slot})`}}),(0,F.jsx)(`text`,{x:c,y:l+s*.42,textAnchor:`middle`,fontSize:[...o.letter].length>1?s*.95:s*1.2,children:o.letter})]});return(0,F.jsxs)(`g`,{className:i===`offline`?`ui-ta ui-ta-off`:`ui-ta`,"data-node":e.id,"data-pick":a?``:void 0,transform:`translate(${t} ${n})`,onClick:a?()=>a(e.id):void 0,children:[i===`working`&&(0,F.jsx)(Wp,{r:r/2+7}),(0,F.jsxs)(`g`,{className:`ui-ta-art`,children:[(0,F.jsx)(`svg`,{x:-r/2,y:-r/2,width:r,height:r,viewBox:`-2 -4 112 112`,overflow:`visible`,dangerouslySetInnerHTML:{__html:Ne(e.vendor,i)}}),(0,F.jsx)(`text`,{y:r/2+13,textAnchor:`middle`,className:`ui-ta-name`,children:e.label}),e.wide&&(0,F.jsxs)(`g`,{className:`ui-wide`,transform:`translate(0 ${r/2+26})`,children:[(0,F.jsx)(`rect`,{x:-70.4/2,y:-8,width:70.4,height:16,rx:6}),(0,F.jsx)(`text`,{y:3.5,textAnchor:`middle`,children:`all channels`})]})]}),u,(0,F.jsx)(Up,{status:i,x:r/2-2,y:r/2-1})]})}function Kp({node:e,x:t,y:n,hot:r}){let i=Pp(e.label);return(0,F.jsxs)(`g`,{className:r?`ui-tn ui-tn-hot`:`ui-tn`,"data-node":e.id,transform:`translate(${t} ${n})`,children:[(0,F.jsx)(`rect`,{x:-i/2,y:-12,width:i,height:24,rx:8}),(0,F.jsxs)(`text`,{y:4,textAnchor:`middle`,children:[`#`,e.label]})]})}function qp({model:e,width:t=400,height:n=420}){let r=(0,P.useRef)(null);r.current===null&&(r.current=new Bp(t,n),r.current.sync(e),r.current.warm());let i=r.current,[,a]=(0,P.useReducer)(e=>e+1,0),o=(0,P.useRef)(0),s=()=>{if(o.current!==0||i.settled)return;let e=()=>{o.current=0,i.tick(),a(),i.settled||(o.current=Vp.request(e))};o.current=Vp.request(e)};(0,P.useEffect)(()=>{i.resize(t,n)&&i.reheat(),i.sync(e)&&i.reheat(),s()}),(0,P.useEffect)(()=>()=>{Vp.cancel(o.current),o.current=0},[]);let c=(0,P.useRef)(null),[l,u]=(0,P.useState)(If);(0,P.useEffect)(()=>{let e=c.current;return Nl(e).call(Gf().scaleExtent([.4,4]).on(`zoom`,e=>u(e.transform))),()=>void Nl(e).on(`.zoom`,null)},[]);let d=e=>i.at(e)??{x:t/2,y:n/2},f=new Map(e.nodes.map(e=>[e.id,e])),p=new Set(e.links.filter(e=>e.hot).map(e=>e.target)),m=Math.min(40,t/10);return(0,F.jsx)(`svg`,{ref:c,className:`ui-topo-svg`,viewBox:`0 0 ${t} ${n}`,role:`img`,"aria-label":`Mesh topology`,children:(0,F.jsxs)(`g`,{transform:`translate(${l.x} ${l.y}) scale(${l.k})`,children:[e.links.map(e=>{let t=d(e.source),n=d(e.target);return(0,F.jsx)(`line`,{"data-link":`${e.source}>${e.target}`,className:Hp(e.kind,e.hot,f.get(e.source)?.status===`offline`),x1:t.x,y1:t.y,x2:n.x,y2:n.y},`${e.source}\u0000${e.target}`)}),e.nodes.filter(e=>e.kind===`channel`).map(e=>(0,F.jsx)(Kp,{node:e,...d(e.id),hot:p.has(e.id)},e.id)),e.nodes.filter(e=>e.kind===`agent`).map(e=>(0,F.jsx)(Gp,{node:e,...d(e.id),size:m},e.id))]})})}var Jp=e=>`#${e}`;function Yp(e){let{roster:t,channels:n,membership:r,recent:i,hideOffline:a,hideEmpty:o,now:s}=e,c=xt(t),l=new Map;for(let e of t){if(e.card.kind===`endpoint`||!e.card.id)continue;let t=e.card.meta?.connector;l.set(e.card.id,{id:e.card.id,kind:`agent`,label:e.card.name,...typeof t==`string`?{vendor:t}:{},status:e.status})}let u=new Set(n.map(e=>e.channel)),d=i.filter(e=>e.mode===`chat`&&e.channel).map(e=>({channel:e.channel,sender:e.senderId??e.msg.from.id,ts:e.ts}));for(let e of d)u.add(e.channel);let f=(r.unreadable===void 0?r.snapshot?.members??[]:[]).filter(e=>e.id);for(let e of f)for(let t of Ae(e.live??[],e.durable??[],[]).channels.keys())u.add(t);let p=new Set,m=new Map,h=(e,t)=>`${e}\u0000${t}`,g=[...u],_=n.filter(e=>e.deliveryClass===`durable`).map(e=>e.channel);for(let e of f){l.has(e.id)||l.set(e.id,{id:e.id,kind:`agent`,label:wn(e.id,c),status:`offline`});let t=Ae(e.live??[],e.durable??[],g,_);t.wide&&p.add(e.id);for(let[n,r]of t.channels)m.set(h(e.id,n),{source:e.id,target:Jp(n),kind:r===`live`?`member`:`durable`,hot:!1})}for(let e of d){if(!e.sender)continue;l.has(e.sender)||l.set(e.sender,{id:e.sender,kind:`agent`,label:wn(e.sender,c),status:`idle`});let t=h(e.sender,e.channel);m.has(t)||m.set(t,{source:e.sender,target:Jp(e.channel),kind:`traffic`,hot:!1})}for(let[e,t]of l)p.has(e)&&(t.wide=!0);for(let e of d)if(!(!e.sender||s-e.ts>=2e3))for(let t of m.values())t.target===Jp(e.channel)&&(t.hot=!0);let v=e=>l.get(e)?.status===`offline`,y=e=>a&&(e.kind===`durable`||v(e.source)),b=new Set;for(let e of m.values())e.kind!==`traffic`&&!y(e)&&b.add(e.target);let x=it(r),S=e=>o&&x&&!b.has(Jp(e)),ee=[...l.values()].filter(e=>!(a&&e.status===`offline`));for(let e of u)S(e)||ee.push({id:Jp(e),kind:`channel`,label:e});let te=new Set(ee.map(e=>e.id));return{nodes:ee,links:[...m.values()].filter(e=>te.has(e.source)&&te.has(e.target)&&!(e.kind!==`traffic`&&y(e)))}}var Xp=[{cls:`ui-lg-member`,label:`Member`},{cls:`ui-lg-durable`,label:`Durable member`},{cls:`ui-lg-offline`,label:`Offline agent`},{cls:`ui-lg-traffic`,label:`Posted here`},{cls:`ui-lg-hot`,label:`Active now`},{cls:`ui-lg-working`,label:`Working`}];function Zp(e,t,n){let r=M(e,e=>e.roster),i=M(e,e=>e.channels),a=M(e,e=>e.membership),o=M(e,e=>e.activity),[s,c]=(0,P.useState)(n),l=(0,P.useMemo)(()=>o.map(e=>({mode:e.mode,...`channel`in e&&e.channel!==void 0?{channel:e.channel}:{},...`senderId`in e&&e.senderId!==void 0?{senderId:e.senderId}:{},msg:e.msg,ts:e.arrivedAt??-1/0})),[o]),u=t(),d=Yp({roster:r,channels:i,membership:a,recent:l,hideOffline:s,hideEmpty:!0,now:u}),f=d.links.some(e=>e.hot),[,p]=(0,P.useReducer)(e=>e+1,0);return(0,P.useEffect)(()=>{let e=setInterval(p,f?500:5e3);return()=>clearInterval(e)},[f]),{model:d,membership:a,now:u,hideOffline:s,setHideOffline:c}}function Qp({store:e,clock:t=Date.now,initialHideOffline:r=!0}){let{model:i,membership:a,now:o,hideOffline:s,setHideOffline:c}=Zp(e,t,r);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{className:`ui-bar`,children:[(0,F.jsx)(An,{}),(0,F.jsx)(`h1`,{children:`Topology`}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(bs,{state:n(a,o),reason:a.unreadable}),(0,F.jsx)(Be,{variant:`outline`,size:`sm`,pressed:s,onPressedChange:c,children:`Hide offline`})]}),(0,F.jsx)(`div`,{className:`ui-scroll`,children:(0,F.jsxs)(`div`,{className:`ui-col ui-col-wide`,children:[(0,F.jsx)(`div`,{className:`ui-topo`,children:(0,F.jsx)(qp,{model:i,width:960,height:600})}),(0,F.jsxs)(`div`,{className:`ui-legend`,children:[Xp.map(e=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:e.cls}),e.label]},e.cls)),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{className:`ui-wide-key`,children:`all channels`}),`Reads every channel`]})]})]})})]})}var $p={width:360,height:420};function em({store:e,clock:t}){let{model:r,membership:i,now:a,hideOffline:o,setHideOffline:s}=Zp(e,t,!0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,marginBottom:10},children:[(0,F.jsx)(bs,{state:n(i,a),reason:i.unreadable}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsx)(Be,{variant:`outline`,size:`sm`,pressed:o,onPressedChange:s,children:`Hide offline`})]}),(0,F.jsx)(`div`,{className:`ui-topo`,children:(0,F.jsx)(qp,{model:r,width:$p.width,height:$p.height})})]})}var tm=`cotal.panel.open`;function nm(){try{let e=globalThis.localStorage?.getItem(tm);return e===`1`||e!==`0`&&void 0}catch{return}}function rm(e){try{globalThis.localStorage?.setItem(tm,e?`1`:`0`)}catch{}}var im=e=>e.view===`agent`?`agent`:e.view===`channel`?`members`:`topology`;function am(e,t=!1){let n=jt(e),[r,i]=(0,P.useState)(!0),[a,o]=(0,P.useState)(!1),s=(0,P.useRef)(t);s.current=t,(0,P.useLayoutEffect)(()=>{let e=nm();e!==void 0&&i(e)},[]);let[c,l]=(0,P.useState)(()=>({key:n,tab:im(e),agent:e.view===`agent`?e.id:null})),u=c;c.key!==n&&(u={key:n,tab:im(e),agent:e.view===`channel`?c.agent:null},e.view===`agent`&&(u={...u,agent:e.id}),l(u),o(!1));let d=(0,P.useMemo)(()=>{let e=e=>{if(s.current)return o(e);i(e),rm(e)};return{setTab:e=>l(t=>({...t,tab:e})),selectAgent:t=>{l(e=>({...e,tab:`agent`,agent:t})),e(!0)},showMembers:()=>{l(e=>({...e,tab:`members`})),e(!0)},close:()=>e(!1),remember:e}},[]),f=t?a:r;return{open:f,tab:u.tab,agent:u.agent,setTab:d.setTab,selectAgent:d.selectAgent,showMembers:d.showMembers,close:d.close,toggle:()=>d.remember(!f)}}var om=(e,t)=>e.open&&(t||e.agent!==null);function sm({store:e,controller:t,channel:n,route:r,panel:i,clock:a}){let o=[{id:`members`,label:`Members`,off:n===null},{id:`agent`,label:`Agent`,off:i.agent===null},{id:`topology`,label:`Topology`,off:!1}];return(0,F.jsxs)(gt,{value:i.tab,onValueChange:e=>(e===`members`||e===`agent`||e===`topology`)&&i.setTab(e),className:`min-h-0 flex-1 gap-0`,children:[(0,F.jsxs)(`div`,{className:`ui-tabs`,children:[(0,F.jsx)(Cn,{"aria-label":`Details`,children:o.map(e=>(0,F.jsx)(yt,{value:e.id,disabled:e.off,children:e.label},e.id))}),(0,F.jsx)(`span`,{className:`ui-sp`}),(0,F.jsxs)(Ye,{children:[(0,F.jsx)(Qe,{asChild:!0,children:(0,F.jsx)(Et,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close panel`,onClick:i.close,children:(0,F.jsx)(N,{icon:vn})})}),(0,F.jsx)(E,{children:`Close panel`})]})]}),(0,F.jsx)(Jt,{value:`members`,className:`ui-pane-body`,children:n!==null&&(0,F.jsx)(Fs,{store:e,controller:t,channel:n,now:a(),onPick:i.selectAgent})}),(0,F.jsx)(Jt,{value:`agent`,className:`ui-pane-body`,children:i.agent!==null&&(0,F.jsx)(vs,{store:e,controller:t,id:i.agent,route:r})}),(0,F.jsx)(Jt,{value:`topology`,className:`ui-pane-body`,children:(0,F.jsx)(em,{store:e,clock:a})})]})}var cm;function lm(){return Ue(()=>import(`./AgentPage-OQYeLRkK.js`).then(e=>cm=e),__vite__mapDeps([0,1,2]))}var um=(0,P.lazy)(()=>{let e=cm;return e?{then:t=>t({default:e.AgentPage})}:lm().then(e=>({default:e.AgentPage}))});function dm({store:e}){let t=_r(M(e,e=>e.orderNotes));return(0,F.jsx)(`div`,{children:t&&(0,F.jsx)(`p`,{id:`order-notice`,role:t.fault?`alert`:`status`,children:t.text})})}function fm(e,t,n,r,i,a,o){switch(t.view){case`channel`:return(0,F.jsx)(Qo,{store:e,channel:t.channel,onMembers:r.showMembers,onViewAgent:r.selectAgent,panelOpen:i,onTogglePanel:r.toggle});case`activity`:return(0,F.jsx)(Do,{store:e});case`dm`:return(0,F.jsx)($o,{store:e,peer:t.peer,with:t.with});case`topology`:return(0,F.jsx)(Qp,{store:e,clock:n});case`agents`:return(0,F.jsx)(ps,{store:e,controller:o.controller,group:t.group===`host`?`host`:void 0,selected:r.agent,onPick:a,clock:n});case`needs`:return(0,F.jsx)(ps,{store:e,controller:o.controller,group:`status`,focusWaiting:!0,selected:r.agent,onPick:a,clock:n});case`agent`:return(0,F.jsx)(P.Suspense,{fallback:(0,F.jsx)(co,{}),children:(0,F.jsx)(um,{store:e,controller:o.controller,id:t.id,tab:t.tab,at:t.at,back:o.back,phone:o.phone,panelOpen:o.panelOpen,onTogglePanel:o.toggle},t.id)})}}function pm({store:e,controller:t,route:n,paneOpen:r,msgPerSecond:i,clock:a=Date.now,phone:o=!1}){let s=M(e,e=>e.space),c=M(e,e=>e.channels),l=M(e,e=>e.roster),u=M(e,e=>e.dms),d=M(e,e=>e.loading),f=mm(n,c,u,l,M(e,e=>e.operatorId)),p=(0,P.useMemo)(()=>Rt(l,{includeOffline:!0}),[l]),m=(0,P.useMemo)(()=>on(p).length,[p]),h=(0,P.useMemo)(()=>l.filter(e=>e.card.kind===`agent`&&e.status===`working`).length,[l]),g=M(e,e=>e.stale.some(e=>e.name===`roster`)),_=(0,P.useMemo)(()=>S(p),[p]),v=am(n,o),y=om(v,r),b={...v,agent:y&&v.tab===`agent`?v.agent:null},x=gm(n),ee=(0,P.useContext)(mn),te=(0,P.useMemo)(()=>o?e=>ee({view:`agent`,id:e,tab:`work`}):v.selectAgent,[o,ee,v.selectAgent]),C={controller:t,phone:o,back:x,panelOpen:y,toggle:v.toggle},ne=d.roster||d.channels?(0,F.jsx)(co,{}):fm(e,n,a,b,y,te,C),w=(0,F.jsx)(sm,{store:e,controller:t,channel:n.view===`channel`?n.channel:null,route:n,panel:v,clock:a});return(0,F.jsx)(Sn.Provider,{value:t,children:(0,F.jsx)(Se.Provider,{value:te,children:(0,F.jsx)(k.Provider,{value:_,children:(0,F.jsx)(Ke,{children:(0,F.jsxs)(Xa,{route:n,controller:t,paneOpen:y,panel:w,places:f,phone:o,waiting:m,working:h,stale:g,onPanelClose:v.close,sidebar:(0,F.jsx)(_o,{store:e,route:n,msgPerSecond:i}),children:[(0,F.jsx)(`title`,{children:vr(s)}),(0,F.jsx)(dm,{store:e}),(0,F.jsx)(`section`,{className:`ui-view`,"data-view":n.view,children:ne})]})})})})})}function mm(e,t,n,r,i){let[a,o]=(0,P.useState)({channel:null,dm:null}),s=a;e.view===`channel`&&a.channel!==e.channel&&(s={...a,channel:e.channel}),e.view===`dm`&&(a.dm?.peer!==e.peer||a.dm?.with!==e.with)&&(s={...s,dm:{peer:e.peer,with:e.with}}),s!==a&&o(s);let c=(0,P.useMemo)(()=>_t(n,r),[n,r]),l=s.channel!==null&&t.some(e=>e.channel===s.channel)?s.channel:t[0]?.channel??null,u=s.dm===null?null:s.dm.with??i,d=c[0]?.conversations[0];return{channel:l,dm:s.dm!==null&&u!==null&&c.some(e=>e.id===s.dm?.peer)?{peer:s.dm.peer,with:u}:c[0]&&d?{peer:c[0].id,with:d.with}:null}}function hm(e){switch(e.view){case`channel`:return`#${e.channel}`;case`activity`:return`Activity`;case`dm`:return`Direct messages`;case`topology`:return`Topology`;case`needs`:return`Needs you`;case`agents`:case`agent`:return`Agents`}}function gm(e){let[t,n]=(0,P.useState)(null);e.view!==`agent`&&(t===null||jt(t)!==jt(e))&&n(e);let r=e.view===`agent`?t:e;return r===null?{label:`Agents`,route:{view:`agents`,group:`status`}}:{label:hm(r),route:r}}var _m=5e3,vm=6e4,ym={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e)},bm=e=>e.stale.some(e=>e.kind===`refused`&&e.name!==`roster`);function xm(e){let{store:t}=e,n=e.timer??ym;t.set({loading:{roster:!0,channels:!0}});let r=en(t,e.api),i=()=>{r.refresh().catch(e=>console.error(`dashboard refresh failed:`,e))},a={open(){t.set({connection:`connected`}),i()},error:()=>t.set(e=>e.connection===`closed`?{}:{connection:e.connection===`connecting`?`connecting`:`reconnecting`}),closed:()=>t.set({connection:`closed`}),roster:r.onRoster,presenceView:r.onPresenceView,membership:r.onMembership,membershipFailed:r.onMembershipFailed,message(t){e.onArrival?.(),r.onMessage(t)},hello:r.onHello,agentFrame:r.onAgentFrame},{error:o,closed:s}=a;a.error=()=>{r.onFeedLost(),o()},a.closed=()=>{r.onFeedLost(),s()};let c=null,l=_m,u=t.subscribe(()=>{bm(t.get())?c===null&&(c=n.set(()=>{c=null,l=Math.min(l*2,vm),i()},l)):(c!==null&&n.clear(c),c=null,l=_m)}),d=e.openFeed(a);return i(),{controller:r,stop(){u(),c!==null&&n.clear(c),c=null,d()}}}function Sm(e){let t=e,n=new Set;return{get:()=>t,set(e){let r=typeof e==`function`?e(t):e;t={...t,...r};for(let e of n)e()},subscribe(e){return n.add(e),()=>n.delete(e)}}}var Cm=Sm({space:null,connection:`connecting`,roster:[],presenceView:null,channels:[],unread:{},activity:[],dms:[],dmsCut:!1,open:null,stale:[],orderNotes:[],membership:{},loading:{roster:!1,channels:!1},post:null,operatorId:null,drafts:{},sessions:{}}),wm=1e4,Tm=(e,t)=>xm({store:e,api:qn(),openFeed:Zn,onArrival:t});function Em({host:e=window,start:t=Tm,clock:n=Date.now}){let[r,i]=(0,P.useState)(null),[a]=(0,P.useState)(()=>lr(wm,n()));(0,P.useLayoutEffect)(()=>{let e=t(Cm,()=>a.hit(n()));return i(e.controller),e.stop},[t,a,n]);let[o,s]=(0,P.useState)(()=>Dt(e));(0,P.useEffect)(()=>Ft(e,s),[e]),(0,P.useEffect)(()=>$t(e,o),[e,o]);let c=(0,P.useCallback)(t=>un(e,t),[e]),l=pn();return(0,F.jsx)(za,{defaultTheme:`system`,storageKey:`cotal.theme`,children:(0,F.jsx)(mn.Provider,{value:c,children:(0,F.jsx)(pm,{store:Cm,controller:r,route:o,paneOpen:o.view===`channel`||o.view===`agent`,msgPerSecond:()=>a.perSecond(n()),phone:l})})})}var Dm=document.getElementById(`root`);if(!Dm)throw Error(`index.html has no #root element`);(0,Kn.createRoot)(Dm).render((0,F.jsx)(P.StrictMode,{children:(0,F.jsx)(Em,{})}));
|