ccdeck 3.23.0 → 3.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BrowserWatchModal-DD6srgsk.js → BrowserWatchModal-plr3Bmmv.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-zExZpRWU.js → UsageHistoryModal-DEZjEWrd.js} +1 -1
- package/dist/web/assets/{index-Dsca2TwS.js → index-DuAcNsxl.js} +46 -46
- package/dist/web/assets/index-cRw55wBV.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +2 -2
- package/src/server/deck-prefs.mjs +14 -10
- package/src/server/index.mjs +42 -2
- package/src/server/lan-engine.mjs +42 -0
- package/src/server/lan-reach.mjs +136 -4
- package/src/server/lan-socket.mjs +18 -0
- package/dist/web/assets/index-Bf-qcZ6x.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var zu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bf={exports:{}},
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var zu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bf={exports:{}},zl={},zf={exports:{}},ot={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ak;function YM(){if(ak)return
|
|
9
|
+
*/var ak;function YM(){if(ak)return ot;ak=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function y(O){return O===null||typeof O!="object"?null:(O=m&&O[m]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(O,F,oe){this.props=O,this.context=F,this.refs=_,this.updater=oe||w}S.prototype.isReactComponent={},S.prototype.setState=function(O,F){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,F,"setState")},S.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function b(){}b.prototype=S.prototype;function j(O,F,oe){this.props=O,this.context=F,this.refs=_,this.updater=oe||w}var E=j.prototype=new b;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function L(O,F,oe){var z,Z={},U=null,re=null;if(F!=null)for(z in F.ref!==void 0&&(re=F.ref),F.key!==void 0&&(U=""+F.key),F)T.call(F,z)&&!I.hasOwnProperty(z)&&(Z[z]=F[z]);var de=arguments.length-2;if(de===1)Z.children=oe;else if(1<de){for(var pe=Array(de),ge=0;ge<de;ge++)pe[ge]=arguments[ge+2];Z.children=pe}if(O&&O.defaultProps)for(z in de=O.defaultProps,de)Z[z]===void 0&&(Z[z]=de[z]);return{$$typeof:e,type:O,key:U,ref:re,props:Z,_owner:R.current}}function H(O,F){return{$$typeof:e,type:O.type,key:F,ref:O.ref,props:O.props,_owner:O._owner}}function $(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function V(O){var F={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(oe){return F[oe]})}var Q=/\/+/g;function J(O,F){return typeof O=="object"&&O!==null&&O.key!=null?V(""+O.key):F.toString(36)}function M(O,F,oe,z,Z){var U=typeof O;(U==="undefined"||U==="boolean")&&(O=null);var re=!1;if(O===null)re=!0;else switch(U){case"string":case"number":re=!0;break;case"object":switch(O.$$typeof){case e:case t:re=!0}}if(re)return re=O,Z=Z(re),O=z===""?"."+J(re,0):z,C(Z)?(oe="",O!=null&&(oe=O.replace(Q,"$&/")+"/"),M(Z,F,oe,"",function(ge){return ge})):Z!=null&&($(Z)&&(Z=H(Z,oe+(!Z.key||re&&re.key===Z.key?"":(""+Z.key).replace(Q,"$&/")+"/")+O)),F.push(Z)),1;if(re=0,z=z===""?".":z+":",C(O))for(var de=0;de<O.length;de++){U=O[de];var pe=z+J(U,de);re+=M(U,F,oe,pe,Z)}else if(pe=y(O),typeof pe=="function")for(O=pe.call(O),de=0;!(U=O.next()).done;)U=U.value,pe=z+J(U,de++),re+=M(U,F,oe,pe,Z);else if(U==="object")throw F=String(O),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return re}function X(O,F,oe){if(O==null)return O;var z=[],Z=0;return M(O,z,"","",function(U){return F.call(oe,U,Z++)}),z}function G(O){if(O._status===-1){var F=O._result;F=F(),F.then(function(oe){(O._status===0||O._status===-1)&&(O._status=1,O._result=oe)},function(oe){(O._status===0||O._status===-1)&&(O._status=2,O._result=oe)}),O._status===-1&&(O._status=0,O._result=F)}if(O._status===1)return O._result.default;throw O._result}var P={current:null},B={transition:null},W={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:B,ReactCurrentOwner:R};function Y(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:X,forEach:function(O,F,oe){X(O,function(){F.apply(this,arguments)},oe)},count:function(O){var F=0;return X(O,function(){F++}),F},toArray:function(O){return X(O,function(F){return F})||[]},only:function(O){if(!$(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},ot.Component=S,ot.Fragment=n,ot.Profiler=a,ot.PureComponent=j,ot.StrictMode=s,ot.Suspense=f,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,ot.act=Y,ot.cloneElement=function(O,F,oe){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var z=N({},O.props),Z=O.key,U=O.ref,re=O._owner;if(F!=null){if(F.ref!==void 0&&(U=F.ref,re=R.current),F.key!==void 0&&(Z=""+F.key),O.type&&O.type.defaultProps)var de=O.type.defaultProps;for(pe in F)T.call(F,pe)&&!I.hasOwnProperty(pe)&&(z[pe]=F[pe]===void 0&&de!==void 0?de[pe]:F[pe])}var pe=arguments.length-2;if(pe===1)z.children=oe;else if(1<pe){de=Array(pe);for(var ge=0;ge<pe;ge++)de[ge]=arguments[ge+2];z.children=de}return{$$typeof:e,type:O.type,key:Z,ref:U,props:z,_owner:re}},ot.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:i,_context:O},O.Consumer=O},ot.createElement=L,ot.createFactory=function(O){var F=L.bind(null,O);return F.type=O,F},ot.createRef=function(){return{current:null}},ot.forwardRef=function(O){return{$$typeof:u,render:O}},ot.isValidElement=$,ot.lazy=function(O){return{$$typeof:h,_payload:{_status:-1,_result:O},_init:G}},ot.memo=function(O,F){return{$$typeof:p,type:O,compare:F===void 0?null:F}},ot.startTransition=function(O){var F=B.transition;B.transition={};try{O()}finally{B.transition=F}},ot.unstable_act=Y,ot.useCallback=function(O,F){return P.current.useCallback(O,F)},ot.useContext=function(O){return P.current.useContext(O)},ot.useDebugValue=function(){},ot.useDeferredValue=function(O){return P.current.useDeferredValue(O)},ot.useEffect=function(O,F){return P.current.useEffect(O,F)},ot.useId=function(){return P.current.useId()},ot.useImperativeHandle=function(O,F,oe){return P.current.useImperativeHandle(O,F,oe)},ot.useInsertionEffect=function(O,F){return P.current.useInsertionEffect(O,F)},ot.useLayoutEffect=function(O,F){return P.current.useLayoutEffect(O,F)},ot.useMemo=function(O,F){return P.current.useMemo(O,F)},ot.useReducer=function(O,F,oe){return P.current.useReducer(O,F,oe)},ot.useRef=function(O){return P.current.useRef(O)},ot.useState=function(O){return P.current.useState(O)},ot.useSyncExternalStore=function(O,F,oe){return P.current.useSyncExternalStore(O,F,oe)},ot.useTransition=function(){return P.current.useTransition()},ot.version="18.3.1",ot}var ok;function bc(){return ok||(ok=1,zf.exports=YM()),zf.exports}/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ik;function KM(){if(ik)return
|
|
17
|
+
*/var ik;function KM(){if(ik)return zl;ik=1;var e=bc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return zl.Fragment=n,zl.jsx=c,zl.jsxs=c,zl}var lk;function XM(){return lk||(lk=1,Bf.exports=KM()),Bf.exports}var l=XM(),Uu={},Uf={exports:{}},On={},Wf={exports:{}},Hf={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var ck;function ZM(){return ck||(ck=1,(function(e){function t(
|
|
25
|
+
*/var ck;function ZM(){return ck||(ck=1,(function(e){function t(B,W){var Y=B.length;B.push(W);e:for(;0<Y;){var O=Y-1>>>1,F=B[O];if(0<a(F,W))B[O]=W,B[Y]=F,Y=O;else break e}}function n(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var W=B[0],Y=B.pop();if(Y!==W){B[0]=Y;e:for(var O=0,F=B.length,oe=F>>>1;O<oe;){var z=2*(O+1)-1,Z=B[z],U=z+1,re=B[U];if(0>a(Z,Y))U<F&&0>a(re,Z)?(B[O]=re,B[U]=Y,O=U):(B[O]=Z,B[z]=Y,O=z);else if(U<F&&0>a(re,Y))B[O]=re,B[U]=Y,O=U;else break e}}return W}function a(B,W){var Y=B.sortIndex-W.sortIndex;return Y!==0?Y:B.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,w=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(B){for(var W=n(p);W!==null;){if(W.callback===null)s(p);else if(W.startTime<=B)s(p),W.sortIndex=W.expirationTime,t(f,W);else break;W=n(p)}}function C(B){if(_=!1,E(B),!N)if(n(f)!==null)N=!0,G(T);else{var W=n(p);W!==null&&P(C,W.startTime-B)}}function T(B,W){N=!1,_&&(_=!1,b(L),L=-1),w=!0;var Y=y;try{for(E(W),m=n(f);m!==null&&(!(m.expirationTime>W)||B&&!V());){var O=m.callback;if(typeof O=="function"){m.callback=null,y=m.priorityLevel;var F=O(m.expirationTime<=W);W=e.unstable_now(),typeof F=="function"?m.callback=F:m===n(f)&&s(f),E(W)}else s(f);m=n(f)}if(m!==null)var oe=!0;else{var z=n(p);z!==null&&P(C,z.startTime-W),oe=!1}return oe}finally{m=null,y=Y,w=!1}}var R=!1,I=null,L=-1,H=5,$=-1;function V(){return!(e.unstable_now()-$<H)}function Q(){if(I!==null){var B=e.unstable_now();$=B;var W=!0;try{W=I(!0,B)}finally{W?J():(R=!1,I=null)}}else R=!1}var J;if(typeof j=="function")J=function(){j(Q)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,X=M.port2;M.port1.onmessage=Q,J=function(){X.postMessage(null)}}else J=function(){S(Q,0)};function G(B){I=B,R||(R=!0,J())}function P(B,W){L=S(function(){B(e.unstable_now())},W)}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(B){B.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,G(T))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var Y=y;y=W;try{return B()}finally{y=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,W){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Y=y;y=B;try{return W()}finally{y=Y}},e.unstable_scheduleCallback=function(B,W,Y){var O=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?O+Y:O):Y=O,B){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=Y+F,B={id:h++,callback:W,priorityLevel:B,startTime:Y,expirationTime:F,sortIndex:-1},Y>O?(B.sortIndex=Y,t(p,B),n(f)===null&&B===n(p)&&(_?(b(L),L=-1):_=!0,P(C,Y-O))):(B.sortIndex=F,t(f,B),N||w||(N=!0,G(T))),B},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(B){var W=y;return function(){var Y=y;y=W;try{return B.apply(this,arguments)}finally{y=Y}}}})(Hf)),Hf}var uk;function QM(){return uk||(uk=1,Wf.exports=ZM()),Wf.exports}/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var dk;function JM(){if(dk)return
|
|
34
|
-
|
|
35
|
-
`),
|
|
36
|
-
`),A=v.length-1,
|
|
37
|
-
`+v[A].replace(" at new "," at ");return r.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",r.displayName)),ne}while(1<=A&&0<=X);break}}}finally{he=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?V(r):""}function J(r){switch(r.tag){case 5:return V(r.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return r=Y(r.type,!1),r;case 11:return r=Y(r.type.render,!1),r;case 1:return r=Y(r.type,!0),r;default:return""}}function z(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case R:return"Portal";case W:return"Profiler";case F:return"StrictMode";case Q:return"Suspense";case M:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case B:return(r.displayName||"Context")+".Consumer";case O:return(r._context.displayName||"Context")+".Provider";case Z:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case K:return o=r.displayName||null,o!==null?o:z(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return z(r(o))}catch{}}return null}function re(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return z(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function me(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ge(r){var o=me(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,b=d.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,b.call(this,A)}}),Object.defineProperty(r,o,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Me(r){r._valueTracker||(r._valueTracker=ge(r))}function qe(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return r&&(g=me(r)?r.checked?"true":"false":r.value),r=g,r!==d?(o.setValue(r),!0):!1}function Ve(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ue(r,o){var d=o.checked;return U({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function Se(r,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=le(o.value!=null?o.value:d),r._wrapperState={initialChecked:g,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Qe(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function Ne(r,o){Qe(r,o);var d=le(o.value),g=o.type;if(d!=null)g==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?ue(r,o.type,d):o.hasOwnProperty("defaultValue")&&ue(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function _e(r,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var g=o.type;if(!(g!=="submit"&&g!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,d||o===r.value||(r.value=o),r.defaultValue=o}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function ue(r,o,d){(o!=="number"||Ve(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var je=Array.isArray;function Ce(r,o,d,g){if(r=r.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<r.length;d++)v=o.hasOwnProperty("$"+r[d].value),r[d].selected!==v&&(r[d].selected=v),v&&g&&(r[d].defaultSelected=!0)}else{for(d=""+le(d),o=null,v=0;v<r.length;v++){if(r[v].value===d){r[v].selected=!0,g&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function Fe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return U({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function We(r,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(je(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}r._wrapperState={initialValue:le(d)}}function He(r,o){var d=le(o.value),g=le(o.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),o.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),g!=null&&(r.defaultValue=""+g)}function ot(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function wt(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ut(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?wt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ee,ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,g,v){MSApp.execUnsafeLocalFunction(function(){return r(o,d,g,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ee=ee||document.createElement("div"),ee.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ee.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Be(r,o){if(o){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=o;return}}r.textContent=o}var et={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ht=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(r){ht.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),et[o]=et[r]})});function Je(r,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||et.hasOwnProperty(r)&&et[r]?(""+o).trim():o+"px"}function tt(r,o){r=r.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=Je(d,o[d],g);d==="float"&&(d="cssFloat"),g?r.setProperty(d,v):r[d]=v}}var it=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bt(r,o){if(o){if(it[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function nt(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pt=null;function fe(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var lt=null,vt=null,Gt=null;function Dt(r){if(r=Sl(r)){if(typeof lt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=ru(o),lt(r.stateNode,r.type,o))}}function Gn(r){vt?Gt?Gt.push(r):Gt=[r]:vt=r}function It(){if(vt){var r=vt,o=Gt;if(Gt=vt=null,Dt(r),o)for(r=0;r<o.length;r++)Dt(o[r])}}function Vn(r,o){return r(o)}function Yn(){}var qt=!1;function Kn(r,o,d){if(qt)return r(o,d);qt=!0;try{return Vn(r,o,d)}finally{qt=!1,(vt!==null||Gt!==null)&&(Yn(),It())}}function te(r,o){var d=r.stateNode;if(d===null)return null;var g=ru(d);if(g===null)return null;d=g[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var Ae=!1;if(u)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){Ae=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{Ae=!1}function Re(r,o,d,g,v,b,A,X,ne){var de=Array.prototype.slice.call(arguments,3);try{o.apply(d,de)}catch(we){this.onError(we)}}var Le=!1,ct=null,Ct=!1,yt=null,Zr={onError:function(r){Le=!0,ct=r}};function kt(r,o,d,g,v,b,A,X,ne){Le=!1,ct=null,Re.apply(Zr,arguments)}function Jt(r,o,d,g,v,b,A,X,ne){if(kt.apply(this,arguments),Le){if(Le){var de=ct;Le=!1,ct=null}else throw Error(n(198));Ct||(Ct=!0,yt=de)}}function rn(r){var o=r,d=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(d=o.return),r=o.return;while(r)}return o.tag===3?d:null}function $r(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function ko(r){if(rn(r)!==r)throw Error(n(188))}function Ki(r){var o=r.alternate;if(!o){if(o=rn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var d=r,g=o;;){var v=d.return;if(v===null)break;var b=v.alternate;if(b===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===d)return ko(v),r;if(b===g)return ko(v),o;b=b.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=b;else{for(var A=!1,X=v.child;X;){if(X===d){A=!0,d=v,g=b;break}if(X===g){A=!0,g=v,d=b;break}X=X.sibling}if(!A){for(X=b.child;X;){if(X===d){A=!0,d=b,g=v;break}if(X===g){A=!0,g=b,d=v;break}X=X.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?r:o}function ua(r){return r=Ki(r),r!==null?da(r):null}function da(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=da(r);if(o!==null)return o;r=r.sibling}return null}var ha=t.unstable_scheduleCallback,_s=t.unstable_cancelCallback,fa=t.unstable_shouldYield,pa=t.unstable_requestPaint,St=t.unstable_now,Xi=t.unstable_getCurrentPriorityLevel,Ns=t.unstable_ImmediatePriority,_o=t.unstable_UserBlockingPriority,Or=t.unstable_NormalPriority,ma=t.unstable_LowPriority,No=t.unstable_IdlePriority,dr=null,vn=null;function Pr(r){if(vn&&typeof vn.onCommitFiberRoot=="function")try{vn.onCommitFiberRoot(dr,r,void 0,(r.current.flags&128)===128)}catch{}}var jn=Math.clz32?Math.clz32:Sh,Oc=Math.log,ga=Math.LN2;function Sh(r){return r>>>=0,r===0?32:31-(Oc(r)/ga|0)|0}var ya=64,wa=4194304;function va(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function xa(r,o){var d=r.pendingLanes;if(d===0)return 0;var g=0,v=r.suspendedLanes,b=r.pingedLanes,A=d&268435455;if(A!==0){var X=A&~v;X!==0?g=va(X):(b&=A,b!==0&&(g=va(b)))}else A=d&~v,A!==0?g=va(A):b!==0&&(g=va(b));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,b=o&-o,v>=b||v===16&&(b&4194240)!==0))return o;if((g&4)!==0&&(g|=d&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)d=31-jn(o),v=1<<d,g|=r[d],o&=~v;return g}function ba(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jh(r,o){for(var d=r.suspendedLanes,g=r.pingedLanes,v=r.expirationTimes,b=r.pendingLanes;0<b;){var A=31-jn(b),X=1<<A,ne=v[A];ne===-1?((X&d)===0||(X&g)!==0)&&(v[A]=ba(X,o)):ne<=o&&(r.expiredLanes|=X),b&=~X}}function So(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function En(){var r=ya;return ya<<=1,(ya&4194240)===0&&(ya=64),r}function Ss(r){for(var o=[],d=0;31>d;d++)o.push(r);return o}function ka(r,o,d){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-jn(o),r[o]=d}function Zi(r,o){var d=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var g=r.eventTimes;for(r=r.expirationTimes;0<d;){var v=31-jn(d),b=1<<v;o[v]=0,g[v]=-1,r[v]=-1,d&=~b}}function Ft(r,o){var d=r.entangledLanes|=o;for(r=r.entanglements;d;){var g=31-jn(d),v=1<<g;v&o|r[g]&o&&(r[g]|=o),d&=~v}}var mt=0;function hr(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var _a,jo,Pc,fr,Na,Qi=!1,Eo=[],pr=null,mr=null,xn=null,js=new Map,Es=new Map,Pn=[],Ji="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function el(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":xn=null;break;case"pointerover":case"pointerout":js.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Es.delete(o.pointerId)}}function Cs(r,o,d,g,v,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:b,targetContainers:[v]},o!==null&&(o=Sl(o),o!==null&&jo(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Lc(r,o,d,g,v){switch(o){case"focusin":return pr=Cs(pr,r,o,d,g,v),!0;case"dragenter":return mr=Cs(mr,r,o,d,g,v),!0;case"mouseover":return xn=Cs(xn,r,o,d,g,v),!0;case"pointerover":var b=v.pointerId;return js.set(b,Cs(js.get(b)||null,r,o,d,g,v)),!0;case"gotpointercapture":return b=v.pointerId,Es.set(b,Cs(Es.get(b)||null,r,o,d,g,v)),!0}return!1}function tl(r){var o=Wa(r.target);if(o!==null){var d=rn(o);if(d!==null){if(o=d.tag,o===13){if(o=$r(d),o!==null){r.blockedOn=o,Na(r.priority,function(){Pc(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Bt(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var d=Ro(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var g=new d.constructor(d.type,d);pt=g,d.target.dispatchEvent(g),pt=null}else return o=Sl(d),o!==null&&jo(o),r.blockedOn=d,!1;o.shift()}return!0}function Sa(r,o,d){Bt(r)&&d.delete(o)}function Co(){Qi=!1,pr!==null&&Bt(pr)&&(pr=null),mr!==null&&Bt(mr)&&(mr=null),xn!==null&&Bt(xn)&&(xn=null),js.forEach(Sa),Es.forEach(Sa)}function Qr(r,o){r.blockedOn===o&&(r.blockedOn=null,Qi||(Qi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Co)))}function ja(r){function o(v){return Qr(v,r)}if(0<Eo.length){Qr(Eo[0],r);for(var d=1;d<Eo.length;d++){var g=Eo[d];g.blockedOn===r&&(g.blockedOn=null)}}for(pr!==null&&Qr(pr,r),mr!==null&&Qr(mr,r),xn!==null&&Qr(xn,r),js.forEach(o),Es.forEach(o),d=0;d<Pn.length;d++)g=Pn[d],g.blockedOn===r&&(g.blockedOn=null);for(;0<Pn.length&&(d=Pn[0],d.blockedOn===null);)tl(d),d.blockedOn===null&&Pn.shift()}var Ln=C.ReactCurrentBatchConfig,Ea=!0;function Ts(r,o,d,g){var v=mt,b=Ln.transition;Ln.transition=null;try{mt=1,To(r,o,d,g)}finally{mt=v,Ln.transition=b}}function Eh(r,o,d,g){var v=mt,b=Ln.transition;Ln.transition=null;try{mt=4,To(r,o,d,g)}finally{mt=v,Ln.transition=b}}function To(r,o,d,g){if(Ea){var v=Ro(r,o,d,g);if(v===null)ae(r,o,g,Ao,d),el(r,g);else if(Lc(v,r,o,d,g))g.stopPropagation();else if(el(r,g),o&4&&-1<Ji.indexOf(r)){for(;v!==null;){var b=Sl(v);if(b!==null&&_a(b),b=Ro(r,o,d,g),b===null&&ae(r,o,g,Ao,d),b===v)break;v=b}v!==null&&g.stopPropagation()}else ae(r,o,g,null,d)}}var Ao=null;function Ro(r,o,d,g){if(Ao=null,r=fe(g),r=Wa(r),r!==null)if(o=rn(r),o===null)r=null;else if(d=o.tag,d===13){if(r=$r(o),r!==null)return r;r=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Ao=r,null}function Dc(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xi()){case Ns:return 1;case _o:return 4;case Or:case ma:return 16;case No:return 536870912;default:return 16}default:return 16}}var hn=null,Jr=null,Ca=null;function As(){if(Ca)return Ca;var r,o=Jr,d=o.length,g,v="value"in hn?hn.value:hn.textContent,b=v.length;for(r=0;r<d&&o[r]===v[r];r++);var A=d-r;for(g=1;g<=A&&o[d-g]===v[b-g];g++);return Ca=v.slice(r,1<g?1-g:void 0)}function Ta(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Rs(){return!0}function Xn(){return!1}function bn(r){function o(d,g,v,b,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=b,this.target=A,this.currentTarget=null;for(var X in r)r.hasOwnProperty(X)&&(d=r[X],this[X]=d?d(b):b[X]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Rs:Xn,this.isPropagationStopped=Xn,this}return U(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Rs)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Rs)},persist:function(){},isPersistent:Rs}),o}var Vt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Aa=bn(Vt),es=U({},Vt,{view:0,detail:0}),qc=bn(es),Ms,Ra,Is,$s=U({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Is&&(Is&&r.type==="mousemove"?(Ms=r.screenX-Is.screenX,Ra=r.screenY-Is.screenY):Ra=Ms=0,Is=r),Ms)},movementY:function(r){return"movementY"in r?r.movementY:Ra}}),nl=bn($s),Ch=U({},$s,{dataTransfer:0}),ts=bn(Ch),rl=U({},es,{relatedTarget:0}),Mo=bn(rl),sl=U({},Vt,{animationName:0,elapsedTime:0,pseudoElement:0}),Fc=bn(sl),al=U({},Vt,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),ns=bn(al),Bc=U({},Vt,{data:0}),zc=bn(Bc),Uc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wc={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Th={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sn(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Th[r])?!!o[r]:!1}function Io(){return sn}var $o=U({},es,{key:function(r){if(r.key){var o=Uc[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Ta(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Wc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(r){return r.type==="keypress"?Ta(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ta(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Os=bn($o),Ma=U({},$s,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oo=bn(Ma),ol=U({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Po=bn(ol),Ia=U({},Vt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hc=bn(Ia),Ah=U({},$s,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Rh=bn(Ah),Lo=[9,13,27,32],il=u&&"CompositionEvent"in window,$a=null;u&&"documentMode"in document&&($a=document.documentMode);var ll=u&&"TextEvent"in window&&!$a,gr=u&&(!il||$a&&8<$a&&11>=$a),Ps=" ",cl=!1;function Gc(r,o){switch(r){case"keyup":return Lo.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var rs=!1;function Mh(r,o){switch(r){case"compositionend":return Vc(o);case"keypress":return o.which!==32?null:(cl=!0,Ps);case"textInput":return r=o.data,r===Ps&&cl?null:r;default:return null}}function Ih(r,o){if(rs)return r==="compositionend"||!il&&Gc(r,o)?(r=As(),Ca=Jr=hn=null,rs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return gr&&o.locale!=="ko"?null:o.data;default:return null}}var fn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!fn[r.type]:o==="textarea"}function Kc(r,o,d,g){Gn(g),o=Ee(o,"onChange"),0<o.length&&(d=new Aa("onChange","change",null,d,g),r.push({event:d,listeners:o}))}var Oa=null,Lr=null;function Do(r){bl(r,0)}function qo(r){var o=ti(r);if(qe(o))return r}function yr(r,o){if(r==="change")return o}var ul=!1;if(u){var dl;if(u){var Fo="oninput"in document;if(!Fo){var hl=document.createElement("div");hl.setAttribute("oninput","return;"),Fo=typeof hl.oninput=="function"}dl=Fo}else dl=!1;ul=dl&&(!document.documentMode||9<document.documentMode)}function Xc(){Oa&&(Oa.detachEvent("onpropertychange",Pa),Lr=Oa=null)}function Pa(r){if(r.propertyName==="value"&&qo(Lr)){var o=[];Kc(o,Lr,r,fe(r)),Kn(Do,o)}}function $h(r,o,d){r==="focusin"?(Xc(),Oa=o,Lr=d,Oa.attachEvent("onpropertychange",Pa)):r==="focusout"&&Xc()}function fl(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return qo(Lr)}function Zc(r,o){if(r==="click")return qo(o)}function Qc(r,o){if(r==="input"||r==="change")return qo(o)}function Jc(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var kn=typeof Object.is=="function"?Object.is:Jc;function Dr(r,o){if(kn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var d=Object.keys(r),g=Object.keys(o);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(o,v)||!kn(r[v],o[v]))return!1}return!0}function Bo(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function pl(r,o){var d=Bo(r);r=0;for(var g;d;){if(d.nodeType===3){if(g=r+d.textContent.length,r<=o&&g>=o)return{node:d,offset:o-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Bo(d)}}function La(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?La(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function zo(){for(var r=window,o=Ve();o instanceof r.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)r=o.contentWindow;else break;o=Ve(r.document)}return o}function Ls(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function ml(r){var o=zo(),d=r.focusedElem,g=r.selectionRange;if(o!==d&&d&&d.ownerDocument&&La(d.ownerDocument.documentElement,d)){if(g!==null&&Ls(d)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(r,d.value.length);else if(r=(o=d.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=d.textContent.length,b=Math.min(g.start,v);g=g.end===void 0?b:Math.min(g.end,v),!r.extend&&b>g&&(v=g,g=b,b=v),v=pl(d,b);var A=pl(d,g);v&&A&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==A.node||r.focusOffset!==A.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),b>g?(r.addRange(o),r.extend(A.node,A.offset)):(o.setEnd(A.node,A.offset),r.addRange(o)))}}for(o=[],r=d;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)r=o[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Ds=u&&"documentMode"in document&&11>=document.documentMode,ss=null,Uo=null,$t=null,Wo=!1;function gl(r,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Wo||ss==null||ss!==Ve(g)||(g=ss,"selectionStart"in g&&Ls(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),$t&&Dr($t,g)||($t=g,g=Ee(Uo,"onSelect"),0<g.length&&(o=new Aa("onSelect","select",null,o,d),r.push({event:o,listeners:g}),o.target=ss)))}function Ho(r,o){var d={};return d[r.toLowerCase()]=o.toLowerCase(),d["Webkit"+r]="webkit"+o,d["Moz"+r]="moz"+o,d}var qs={animationend:Ho("Animation","AnimationEnd"),animationiteration:Ho("Animation","AnimationIteration"),animationstart:Ho("Animation","AnimationStart"),transitionend:Ho("Transition","TransitionEnd")},Go={},Da={};u&&(Da=document.createElement("div").style,"AnimationEvent"in window||(delete qs.animationend.animation,delete qs.animationiteration.animation,delete qs.animationstart.animation),"TransitionEvent"in window||delete qs.transitionend.transition);function Vo(r){if(Go[r])return Go[r];if(!qs[r])return r;var o=qs[r],d;for(d in o)if(o.hasOwnProperty(d)&&d in Da)return Go[r]=o[d];return r}var qr=Vo("animationend"),Yo=Vo("animationiteration"),qa=Vo("animationstart"),Ko=Vo("transitionend"),eu=new Map,yl="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function wr(r,o){eu.set(r,o),i(o,[r])}for(var wl=0;wl<yl.length;wl++){var vl=yl[wl],tu=vl.toLowerCase(),Fa=vl[0].toUpperCase()+vl.slice(1);wr(tu,"on"+Fa)}wr(qr,"onAnimationEnd"),wr(Yo,"onAnimationIteration"),wr(qa,"onAnimationStart"),wr("dblclick","onDoubleClick"),wr("focusin","onFocus"),wr("focusout","onBlur"),wr(Ko,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Oh=new Set("cancel close invalid load scroll toggle".split(" ").concat(as));function xl(r,o,d){var g=r.type||"unknown-event";r.currentTarget=d,Jt(g,o,void 0,r),r.currentTarget=null}function bl(r,o){o=(o&4)!==0;for(var d=0;d<r.length;d++){var g=r[d],v=g.event;g=g.listeners;e:{var b=void 0;if(o)for(var A=g.length-1;0<=A;A--){var X=g[A],ne=X.instance,de=X.currentTarget;if(X=X.listener,ne!==b&&v.isPropagationStopped())break e;xl(v,X,de),b=ne}else for(A=0;A<g.length;A++){if(X=g[A],ne=X.instance,de=X.currentTarget,X=X.listener,ne!==b&&v.isPropagationStopped())break e;xl(v,X,de),b=ne}}}if(Ct)throw r=yt,Ct=!1,yt=null,r}function xt(r,o){var d=o[Ph];d===void 0&&(d=o[Ph]=new Set);var g=r+"__bubble";d.has(g)||(q(o,r,2,!1),d.add(g))}function Xo(r,o,d){var g=0;o&&(g|=4),q(d,r,g,o)}var Ba="_reactListening"+Math.random().toString(36).slice(2);function D(r){if(!r[Ba]){r[Ba]=!0,s.forEach(function(d){d!=="selectionchange"&&(Oh.has(d)||Xo(d,!1,r),Xo(d,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Ba]||(o[Ba]=!0,Xo("selectionchange",!1,o))}}function q(r,o,d,g){switch(Dc(o)){case 1:var v=Ts;break;case 4:v=Eh;break;default:v=To}d=v.bind(null,o,d,r),v=void 0,!Ae||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),g?v!==void 0?r.addEventListener(o,d,{capture:!0,passive:v}):r.addEventListener(o,d,!0):v!==void 0?r.addEventListener(o,d,{passive:v}):r.addEventListener(o,d,!1)}function ae(r,o,d,g,v){var b=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var X=g.stateNode.containerInfo;if(X===v||X.nodeType===8&&X.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var ne=A.tag;if((ne===3||ne===4)&&(ne=A.stateNode.containerInfo,ne===v||ne.nodeType===8&&ne.parentNode===v))return;A=A.return}for(;X!==null;){if(A=Wa(X),A===null)return;if(ne=A.tag,ne===5||ne===6){g=b=A;continue e}X=X.parentNode}}g=g.return}Kn(function(){var de=b,we=fe(d),xe=[];e:{var ye=eu.get(r);if(ye!==void 0){var Te=Aa,$e=r;switch(r){case"keypress":if(Ta(d)===0)break e;case"keydown":case"keyup":Te=Os;break;case"focusin":$e="focus",Te=Mo;break;case"focusout":$e="blur",Te=Mo;break;case"beforeblur":case"afterblur":Te=Mo;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Te=nl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Te=ts;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Te=Po;break;case qr:case Yo:case qa:Te=Fc;break;case Ko:Te=Hc;break;case"scroll":Te=qc;break;case"wheel":Te=Rh;break;case"copy":case"cut":case"paste":Te=ns;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Te=Oo}var Pe=(o&4)!==0,zt=!Pe&&r==="scroll",ie=Pe?ye!==null?ye+"Capture":null:ye;Pe=[];for(var se=de,ce;se!==null;){ce=se;var be=ce.stateNode;if(ce.tag===5&&be!==null&&(ce=be,ie!==null&&(be=te(se,ie),be!=null&&Pe.push(oe(se,be,ce)))),zt)break;se=se.return}0<Pe.length&&(ye=new Te(ye,$e,null,d,we),xe.push({event:ye,listeners:Pe}))}}if((o&7)===0){e:{if(ye=r==="mouseover"||r==="pointerover",Te=r==="mouseout"||r==="pointerout",ye&&d!==pt&&($e=d.relatedTarget||d.fromElement)&&(Wa($e)||$e[is]))break e;if((Te||ye)&&(ye=we.window===we?we:(ye=we.ownerDocument)?ye.defaultView||ye.parentWindow:window,Te?($e=d.relatedTarget||d.toElement,Te=de,$e=$e?Wa($e):null,$e!==null&&(zt=rn($e),$e!==zt||$e.tag!==5&&$e.tag!==6)&&($e=null)):(Te=null,$e=de),Te!==$e)){if(Pe=nl,be="onMouseLeave",ie="onMouseEnter",se="mouse",(r==="pointerout"||r==="pointerover")&&(Pe=Oo,be="onPointerLeave",ie="onPointerEnter",se="pointer"),zt=Te==null?ye:ti(Te),ce=$e==null?ye:ti($e),ye=new Pe(be,se+"leave",Te,d,we),ye.target=zt,ye.relatedTarget=ce,be=null,Wa(we)===de&&(Pe=new Pe(ie,se+"enter",$e,d,we),Pe.target=ce,Pe.relatedTarget=zt,be=Pe),zt=be,Te&&$e)t:{for(Pe=Te,ie=$e,se=0,ce=Pe;ce;ce=ve(ce))se++;for(ce=0,be=ie;be;be=ve(be))ce++;for(;0<se-ce;)Pe=ve(Pe),se--;for(;0<ce-se;)ie=ve(ie),ce--;for(;se--;){if(Pe===ie||ie!==null&&Pe===ie.alternate)break t;Pe=ve(Pe),ie=ve(ie)}Pe=null}else Pe=null;Te!==null&&Ge(xe,ye,Te,Pe,!1),$e!==null&&zt!==null&&Ge(xe,zt,$e,Pe,!0)}}e:{if(ye=de?ti(de):window,Te=ye.nodeName&&ye.nodeName.toLowerCase(),Te==="select"||Te==="input"&&ye.type==="file")var De=yr;else if(Yc(ye))if(ul)De=Qc;else{De=fl;var Ye=$h}else(Te=ye.nodeName)&&Te.toLowerCase()==="input"&&(ye.type==="checkbox"||ye.type==="radio")&&(De=Zc);if(De&&(De=De(r,de))){Kc(xe,De,d,we);break e}Ye&&Ye(r,ye,de),r==="focusout"&&(Ye=ye._wrapperState)&&Ye.controlled&&ye.type==="number"&&ue(ye,"number",ye.value)}switch(Ye=de?ti(de):window,r){case"focusin":(Yc(Ye)||Ye.contentEditable==="true")&&(ss=Ye,Uo=de,$t=null);break;case"focusout":$t=Uo=ss=null;break;case"mousedown":Wo=!0;break;case"contextmenu":case"mouseup":case"dragend":Wo=!1,gl(xe,d,we);break;case"selectionchange":if(Ds)break;case"keydown":case"keyup":gl(xe,d,we)}var Ke;if(il)e:{switch(r){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else rs?Gc(r,d)&&(Xe="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Xe="onCompositionStart");Xe&&(gr&&d.locale!=="ko"&&(rs||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&rs&&(Ke=As()):(hn=we,Jr="value"in hn?hn.value:hn.textContent,rs=!0)),Ye=Ee(de,Xe),0<Ye.length&&(Xe=new zc(Xe,r,null,d,we),xe.push({event:Xe,listeners:Ye}),Ke?Xe.data=Ke:(Ke=Vc(d),Ke!==null&&(Xe.data=Ke)))),(Ke=ll?Mh(r,d):Ih(r,d))&&(de=Ee(de,"onBeforeInput"),0<de.length&&(we=new zc("onBeforeInput","beforeinput",null,d,we),xe.push({event:we,listeners:de}),we.data=Ke))}bl(xe,o)})}function oe(r,o,d){return{instance:r,listener:o,currentTarget:d}}function Ee(r,o){for(var d=o+"Capture",g=[];r!==null;){var v=r,b=v.stateNode;v.tag===5&&b!==null&&(v=b,b=te(r,d),b!=null&&g.unshift(oe(r,b,v)),b=te(r,o),b!=null&&g.push(oe(r,b,v))),r=r.return}return g}function ve(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Ge(r,o,d,g,v){for(var b=o._reactName,A=[];d!==null&&d!==g;){var X=d,ne=X.alternate,de=X.stateNode;if(ne!==null&&ne===g)break;X.tag===5&&de!==null&&(X=de,v?(ne=te(d,b),ne!=null&&A.unshift(oe(d,ne,X))):v||(ne=te(d,b),ne!=null&&A.push(oe(d,ne,X)))),d=d.return}A.length!==0&&r.push({event:o,listeners:A})}var rt=/\r\n?/g,_t=/\u0000|\uFFFD/g;function Ze(r){return(typeof r=="string"?r:""+r).replace(rt,`
|
|
38
|
-
`).replace(_t,"")}function an(r,o,d){if(o=Ze(o),Ze(r)!==o&&d)throw Error(n(425))}function os(){}var Zo=null,kl=null;function Qo(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var _l=typeof setTimeout=="function"?setTimeout:void 0,nu=typeof clearTimeout=="function"?clearTimeout:void 0,Jo=typeof Promise=="function"?Promise:void 0,za=typeof queueMicrotask=="function"?queueMicrotask:typeof Jo<"u"?function(r){return Jo.resolve(null).then(r).catch(Ua)}:_l;function Ua(r){setTimeout(function(){throw r})}function Ot(r,o){var d=o,g=0;do{var v=d.nextSibling;if(r.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){r.removeChild(v),ja(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);ja(o)}function vr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function j0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return r;o--}else d==="/$"&&o++}r=r.previousSibling}return null}var ei=Math.random().toString(36).slice(2),Fr="__reactFiber$"+ei,Nl="__reactProps$"+ei,is="__reactContainer$"+ei,Ph="__reactEvents$"+ei,dM="__reactListeners$"+ei,hM="__reactHandles$"+ei;function Wa(r){var o=r[Fr];if(o)return o;for(var d=r.parentNode;d;){if(o=d[is]||d[Fr]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(r=j0(r);r!==null;){if(d=r[Fr])return d;r=j0(r)}return o}r=d,d=r.parentNode}return null}function Sl(r){return r=r[Fr]||r[is],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ti(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function ru(r){return r[Nl]||null}var Lh=[],ni=-1;function Fs(r){return{current:r}}function Et(r){0>ni||(r.current=Lh[ni],Lh[ni]=null,ni--)}function jt(r,o){ni++,Lh[ni]=r.current,r.current=o}var Bs={},pn=Fs(Bs),Cn=Fs(!1),Ha=Bs;function ri(r,o){var d=r.type.contextTypes;if(!d)return Bs;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=o[b];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function Tn(r){return r=r.childContextTypes,r!=null}function su(){Et(Cn),Et(pn)}function E0(r,o,d){if(pn.current!==Bs)throw Error(n(168));jt(pn,o),jt(Cn,d)}function C0(r,o,d){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in o))throw Error(n(108,re(r)||"Unknown",v));return U({},d,g)}function au(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Bs,Ha=pn.current,jt(pn,r),jt(Cn,Cn.current),!0}function T0(r,o,d){var g=r.stateNode;if(!g)throw Error(n(169));d?(r=C0(r,o,Ha),g.__reactInternalMemoizedMergedChildContext=r,Et(Cn),Et(pn),jt(pn,r)):Et(Cn),jt(Cn,d)}var ls=null,ou=!1,Dh=!1;function A0(r){ls===null?ls=[r]:ls.push(r)}function fM(r){ou=!0,A0(r)}function zs(){if(!Dh&&ls!==null){Dh=!0;var r=0,o=mt;try{var d=ls;for(mt=1;r<d.length;r++){var g=d[r];do g=g(!0);while(g!==null)}ls=null,ou=!1}catch(v){throw ls!==null&&(ls=ls.slice(r+1)),ha(Ns,zs),v}finally{mt=o,Dh=!1}}return null}var si=[],ai=0,iu=null,lu=0,Zn=[],Qn=0,Ga=null,cs=1,us="";function Va(r,o){si[ai++]=lu,si[ai++]=iu,iu=r,lu=o}function R0(r,o,d){Zn[Qn++]=cs,Zn[Qn++]=us,Zn[Qn++]=Ga,Ga=r;var g=cs;r=us;var v=32-jn(g)-1;g&=~(1<<v),d+=1;var b=32-jn(o)+v;if(30<b){var A=v-v%5;b=(g&(1<<A)-1).toString(32),g>>=A,v-=A,cs=1<<32-jn(o)+v|d<<v|g,us=b+r}else cs=1<<b|d<<v|g,us=r}function qh(r){r.return!==null&&(Va(r,1),R0(r,1,0))}function Fh(r){for(;r===iu;)iu=si[--ai],si[ai]=null,lu=si[--ai],si[ai]=null;for(;r===Ga;)Ga=Zn[--Qn],Zn[Qn]=null,us=Zn[--Qn],Zn[Qn]=null,cs=Zn[--Qn],Zn[Qn]=null}var Dn=null,qn=null,Tt=!1,xr=null;function M0(r,o){var d=nr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=r,o=r.deletions,o===null?(r.deletions=[d],r.flags|=16):o.push(d)}function I0(r,o){switch(r.tag){case 5:var d=r.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,Dn=r,qn=vr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Dn=r,qn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Ga!==null?{id:cs,overflow:us}:null,r.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=nr(18,null,null,0),d.stateNode=o,d.return=r,r.child=d,Dn=r,qn=null,!0):!1;default:return!1}}function Bh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function zh(r){if(Tt){var o=qn;if(o){var d=o;if(!I0(r,o)){if(Bh(r))throw Error(n(418));o=vr(d.nextSibling);var g=Dn;o&&I0(r,o)?M0(g,d):(r.flags=r.flags&-4097|2,Tt=!1,Dn=r)}}else{if(Bh(r))throw Error(n(418));r.flags=r.flags&-4097|2,Tt=!1,Dn=r}}}function $0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Dn=r}function cu(r){if(r!==Dn)return!1;if(!Tt)return $0(r),Tt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Qo(r.type,r.memoizedProps)),o&&(o=qn)){if(Bh(r))throw O0(),Error(n(418));for(;o;)M0(r,o),o=vr(o.nextSibling)}if($0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(o===0){qn=vr(r.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}r=r.nextSibling}qn=null}}else qn=Dn?vr(r.stateNode.nextSibling):null;return!0}function O0(){for(var r=qn;r;)r=vr(r.nextSibling)}function oi(){qn=Dn=null,Tt=!1}function Uh(r){xr===null?xr=[r]:xr.push(r)}var pM=C.ReactCurrentBatchConfig;function jl(r,o,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,r));var v=g,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(A){var X=v.refs;A===null?delete X[b]:X[b]=A},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,r))}return r}function uu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function P0(r){var o=r._init;return o(r._payload)}function L0(r){function o(ie,se){if(r){var ce=ie.deletions;ce===null?(ie.deletions=[se],ie.flags|=16):ce.push(se)}}function d(ie,se){if(!r)return null;for(;se!==null;)o(ie,se),se=se.sibling;return null}function g(ie,se){for(ie=new Map;se!==null;)se.key!==null?ie.set(se.key,se):ie.set(se.index,se),se=se.sibling;return ie}function v(ie,se){return ie=Xs(ie,se),ie.index=0,ie.sibling=null,ie}function b(ie,se,ce){return ie.index=ce,r?(ce=ie.alternate,ce!==null?(ce=ce.index,ce<se?(ie.flags|=2,se):ce):(ie.flags|=2,se)):(ie.flags|=1048576,se)}function A(ie){return r&&ie.alternate===null&&(ie.flags|=2),ie}function X(ie,se,ce,be){return se===null||se.tag!==6?(se=Of(ce,ie.mode,be),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function ne(ie,se,ce,be){var De=ce.type;return De===I?we(ie,se,ce.props.children,be,ce.key):se!==null&&(se.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&P0(De)===se.type)?(be=v(se,ce.props),be.ref=jl(ie,se,ce),be.return=ie,be):(be=$u(ce.type,ce.key,ce.props,null,ie.mode,be),be.ref=jl(ie,se,ce),be.return=ie,be)}function de(ie,se,ce,be){return se===null||se.tag!==4||se.stateNode.containerInfo!==ce.containerInfo||se.stateNode.implementation!==ce.implementation?(se=Pf(ce,ie.mode,be),se.return=ie,se):(se=v(se,ce.children||[]),se.return=ie,se)}function we(ie,se,ce,be,De){return se===null||se.tag!==7?(se=to(ce,ie.mode,be,De),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function xe(ie,se,ce){if(typeof se=="string"&&se!==""||typeof se=="number")return se=Of(""+se,ie.mode,ce),se.return=ie,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case T:return ce=$u(se.type,se.key,se.props,null,ie.mode,ce),ce.ref=jl(ie,null,se),ce.return=ie,ce;case R:return se=Pf(se,ie.mode,ce),se.return=ie,se;case G:var be=se._init;return xe(ie,be(se._payload),ce)}if(je(se)||L(se))return se=to(se,ie.mode,ce,null),se.return=ie,se;uu(ie,se)}return null}function ye(ie,se,ce,be){var De=se!==null?se.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return De!==null?null:X(ie,se,""+ce,be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:return ce.key===De?ne(ie,se,ce,be):null;case R:return ce.key===De?de(ie,se,ce,be):null;case G:return De=ce._init,ye(ie,se,De(ce._payload),be)}if(je(ce)||L(ce))return De!==null?null:we(ie,se,ce,be,null);uu(ie,ce)}return null}function Te(ie,se,ce,be,De){if(typeof be=="string"&&be!==""||typeof be=="number")return ie=ie.get(ce)||null,X(se,ie,""+be,De);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case T:return ie=ie.get(be.key===null?ce:be.key)||null,ne(se,ie,be,De);case R:return ie=ie.get(be.key===null?ce:be.key)||null,de(se,ie,be,De);case G:var Ye=be._init;return Te(ie,se,ce,Ye(be._payload),De)}if(je(be)||L(be))return ie=ie.get(ce)||null,we(se,ie,be,De,null);uu(se,be)}return null}function $e(ie,se,ce,be){for(var De=null,Ye=null,Ke=se,Xe=se=0,nn=null;Ke!==null&&Xe<ce.length;Xe++){Ke.index>Xe?(nn=Ke,Ke=null):nn=Ke.sibling;var ft=ye(ie,Ke,ce[Xe],be);if(ft===null){Ke===null&&(Ke=nn);break}r&&Ke&&ft.alternate===null&&o(ie,Ke),se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft,Ke=nn}if(Xe===ce.length)return d(ie,Ke),Tt&&Va(ie,Xe),De;if(Ke===null){for(;Xe<ce.length;Xe++)Ke=xe(ie,ce[Xe],be),Ke!==null&&(se=b(Ke,se,Xe),Ye===null?De=Ke:Ye.sibling=Ke,Ye=Ke);return Tt&&Va(ie,Xe),De}for(Ke=g(ie,Ke);Xe<ce.length;Xe++)nn=Te(Ke,ie,Xe,ce[Xe],be),nn!==null&&(r&&nn.alternate!==null&&Ke.delete(nn.key===null?Xe:nn.key),se=b(nn,se,Xe),Ye===null?De=nn:Ye.sibling=nn,Ye=nn);return r&&Ke.forEach(function(Zs){return o(ie,Zs)}),Tt&&Va(ie,Xe),De}function Pe(ie,se,ce,be){var De=L(ce);if(typeof De!="function")throw Error(n(150));if(ce=De.call(ce),ce==null)throw Error(n(151));for(var Ye=De=null,Ke=se,Xe=se=0,nn=null,ft=ce.next();Ke!==null&&!ft.done;Xe++,ft=ce.next()){Ke.index>Xe?(nn=Ke,Ke=null):nn=Ke.sibling;var Zs=ye(ie,Ke,ft.value,be);if(Zs===null){Ke===null&&(Ke=nn);break}r&&Ke&&Zs.alternate===null&&o(ie,Ke),se=b(Zs,se,Xe),Ye===null?De=Zs:Ye.sibling=Zs,Ye=Zs,Ke=nn}if(ft.done)return d(ie,Ke),Tt&&Va(ie,Xe),De;if(Ke===null){for(;!ft.done;Xe++,ft=ce.next())ft=xe(ie,ft.value,be),ft!==null&&(se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft);return Tt&&Va(ie,Xe),De}for(Ke=g(ie,Ke);!ft.done;Xe++,ft=ce.next())ft=Te(Ke,ie,Xe,ft.value,be),ft!==null&&(r&&ft.alternate!==null&&Ke.delete(ft.key===null?Xe:ft.key),se=b(ft,se,Xe),Ye===null?De=ft:Ye.sibling=ft,Ye=ft);return r&&Ke.forEach(function(VM){return o(ie,VM)}),Tt&&Va(ie,Xe),De}function zt(ie,se,ce,be){if(typeof ce=="object"&&ce!==null&&ce.type===I&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:e:{for(var De=ce.key,Ye=se;Ye!==null;){if(Ye.key===De){if(De=ce.type,De===I){if(Ye.tag===7){d(ie,Ye.sibling),se=v(Ye,ce.props.children),se.return=ie,ie=se;break e}}else if(Ye.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&P0(De)===Ye.type){d(ie,Ye.sibling),se=v(Ye,ce.props),se.ref=jl(ie,Ye,ce),se.return=ie,ie=se;break e}d(ie,Ye);break}else o(ie,Ye);Ye=Ye.sibling}ce.type===I?(se=to(ce.props.children,ie.mode,be,ce.key),se.return=ie,ie=se):(be=$u(ce.type,ce.key,ce.props,null,ie.mode,be),be.ref=jl(ie,se,ce),be.return=ie,ie=be)}return A(ie);case R:e:{for(Ye=ce.key;se!==null;){if(se.key===Ye)if(se.tag===4&&se.stateNode.containerInfo===ce.containerInfo&&se.stateNode.implementation===ce.implementation){d(ie,se.sibling),se=v(se,ce.children||[]),se.return=ie,ie=se;break e}else{d(ie,se);break}else o(ie,se);se=se.sibling}se=Pf(ce,ie.mode,be),se.return=ie,ie=se}return A(ie);case G:return Ye=ce._init,zt(ie,se,Ye(ce._payload),be)}if(je(ce))return $e(ie,se,ce,be);if(L(ce))return Pe(ie,se,ce,be);uu(ie,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,se!==null&&se.tag===6?(d(ie,se.sibling),se=v(se,ce),se.return=ie,ie=se):(d(ie,se),se=Of(ce,ie.mode,be),se.return=ie,ie=se),A(ie)):d(ie,se)}return zt}var ii=L0(!0),D0=L0(!1),du=Fs(null),hu=null,li=null,Wh=null;function Hh(){Wh=li=hu=null}function Gh(r){var o=du.current;Et(du),r._currentValue=o}function Vh(r,o,d){for(;r!==null;){var g=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,g!==null&&(g.childLanes|=o)):g!==null&&(g.childLanes&o)!==o&&(g.childLanes|=o),r===d)break;r=r.return}}function ci(r,o){hu=r,Wh=li=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(An=!0),r.firstContext=null)}function Jn(r){var o=r._currentValue;if(Wh!==r)if(r={context:r,memoizedValue:o,next:null},li===null){if(hu===null)throw Error(n(308));li=r,hu.dependencies={lanes:0,firstContext:r}}else li=li.next=r;return o}var Ya=null;function Yh(r){Ya===null?Ya=[r]:Ya.push(r)}function q0(r,o,d,g){var v=o.interleaved;return v===null?(d.next=d,Yh(o)):(d.next=v.next,v.next=d),o.interleaved=d,ds(r,g)}function ds(r,o){r.lanes|=o;var d=r.alternate;for(d!==null&&(d.lanes|=o),d=r,r=r.return;r!==null;)r.childLanes|=o,d=r.alternate,d!==null&&(d.childLanes|=o),d=r,r=r.return;return d.tag===3?d.stateNode:null}var Us=!1;function Kh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function hs(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ws(r,o,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(dt&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,ds(r,d)}return v=g.interleaved,v===null?(o.next=o,Yh(g)):(o.next=v.next,v.next=o),g.interleaved=o,ds(r,d)}function fu(r,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Ft(r,d)}}function B0(r,o){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,b=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};b===null?v=b=A:b=b.next=A,d=d.next}while(d!==null);b===null?v=b=o:b=b.next=o}else v=b=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:g.shared,effects:g.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=o:r.next=o,d.lastBaseUpdate=o}function pu(r,o,d,g){var v=r.updateQueue;Us=!1;var b=v.firstBaseUpdate,A=v.lastBaseUpdate,X=v.shared.pending;if(X!==null){v.shared.pending=null;var ne=X,de=ne.next;ne.next=null,A===null?b=de:A.next=de,A=ne;var we=r.alternate;we!==null&&(we=we.updateQueue,X=we.lastBaseUpdate,X!==A&&(X===null?we.firstBaseUpdate=de:X.next=de,we.lastBaseUpdate=ne))}if(b!==null){var xe=v.baseState;A=0,we=de=ne=null,X=b;do{var ye=X.lane,Te=X.eventTime;if((g&ye)===ye){we!==null&&(we=we.next={eventTime:Te,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var $e=r,Pe=X;switch(ye=o,Te=d,Pe.tag){case 1:if($e=Pe.payload,typeof $e=="function"){xe=$e.call(Te,xe,ye);break e}xe=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=Pe.payload,ye=typeof $e=="function"?$e.call(Te,xe,ye):$e,ye==null)break e;xe=U({},xe,ye);break e;case 2:Us=!0}}X.callback!==null&&X.lane!==0&&(r.flags|=64,ye=v.effects,ye===null?v.effects=[X]:ye.push(X))}else Te={eventTime:Te,lane:ye,tag:X.tag,payload:X.payload,callback:X.callback,next:null},we===null?(de=we=Te,ne=xe):we=we.next=Te,A|=ye;if(X=X.next,X===null){if(X=v.shared.pending,X===null)break;ye=X,X=ye.next,ye.next=null,v.lastBaseUpdate=ye,v.shared.pending=null}}while(!0);if(we===null&&(ne=xe),v.baseState=ne,v.firstBaseUpdate=de,v.lastBaseUpdate=we,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else b===null&&(v.shared.lanes=0);Za|=A,r.lanes=A,r.memoizedState=xe}}function z0(r,o,d){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var El={},Br=Fs(El),Cl=Fs(El),Tl=Fs(El);function Ka(r){if(r===El)throw Error(n(174));return r}function Xh(r,o){switch(jt(Tl,o),jt(Cl,r),jt(Br,El),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ut(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ut(o,r)}Et(Br),jt(Br,o)}function ui(){Et(Br),Et(Cl),Et(Tl)}function U0(r){Ka(Tl.current);var o=Ka(Br.current),d=ut(o,r.type);o!==d&&(jt(Cl,r),jt(Br,d))}function Zh(r){Cl.current===r&&(Et(Br),Et(Cl))}var Rt=Fs(0);function mu(r){for(var o=r;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Qh=[];function Jh(){for(var r=0;r<Qh.length;r++)Qh[r]._workInProgressVersionPrimary=null;Qh.length=0}var gu=C.ReactCurrentDispatcher,ef=C.ReactCurrentBatchConfig,Xa=0,Mt=null,Yt=null,en=null,yu=!1,Al=!1,Rl=0,mM=0;function mn(){throw Error(n(321))}function tf(r,o){if(o===null)return!1;for(var d=0;d<o.length&&d<r.length;d++)if(!kn(r[d],o[d]))return!1;return!0}function nf(r,o,d,g,v,b){if(Xa=b,Mt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,gu.current=r===null||r.memoizedState===null?vM:xM,r=d(g,v),Al){b=0;do{if(Al=!1,Rl=0,25<=b)throw Error(n(301));b+=1,en=Yt=null,o.updateQueue=null,gu.current=bM,r=d(g,v)}while(Al)}if(gu.current=xu,o=Yt!==null&&Yt.next!==null,Xa=0,en=Yt=Mt=null,yu=!1,o)throw Error(n(300));return r}function rf(){var r=Rl!==0;return Rl=0,r}function zr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Mt.memoizedState=en=r:en=en.next=r,en}function er(){if(Yt===null){var r=Mt.alternate;r=r!==null?r.memoizedState:null}else r=Yt.next;var o=en===null?Mt.memoizedState:en.next;if(o!==null)en=o,Yt=r;else{if(r===null)throw Error(n(310));Yt=r,r={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},en===null?Mt.memoizedState=en=r:en=en.next=r}return en}function Ml(r,o){return typeof o=="function"?o(r):o}function sf(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=Yt,v=g.baseQueue,b=d.pending;if(b!==null){if(v!==null){var A=v.next;v.next=b.next,b.next=A}g.baseQueue=v=b,d.pending=null}if(v!==null){b=v.next,g=g.baseState;var X=A=null,ne=null,de=b;do{var we=de.lane;if((Xa&we)===we)ne!==null&&(ne=ne.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),g=de.hasEagerState?de.eagerState:r(g,de.action);else{var xe={lane:we,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};ne===null?(X=ne=xe,A=g):ne=ne.next=xe,Mt.lanes|=we,Za|=we}de=de.next}while(de!==null&&de!==b);ne===null?A=g:ne.next=X,kn(g,o.memoizedState)||(An=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=ne,d.lastRenderedState=g}if(r=d.interleaved,r!==null){v=r;do b=v.lane,Mt.lanes|=b,Za|=b,v=v.next;while(v!==r)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function af(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=d.dispatch,v=d.pending,b=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do b=r(b,A.action),A=A.next;while(A!==v);kn(b,o.memoizedState)||(An=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),d.lastRenderedState=b}return[b,g]}function W0(){}function H0(r,o){var d=Mt,g=er(),v=o(),b=!kn(g.memoizedState,v);if(b&&(g.memoizedState=v,An=!0),g=g.queue,of(Y0.bind(null,d,g,r),[r]),g.getSnapshot!==o||b||en!==null&&en.memoizedState.tag&1){if(d.flags|=2048,Il(9,V0.bind(null,d,g,v,o),void 0,null),tn===null)throw Error(n(349));(Xa&30)!==0||G0(d,o,v)}return v}function G0(r,o,d){r.flags|=16384,r={getSnapshot:o,value:d},o=Mt.updateQueue,o===null?(o={lastEffect:null,stores:null},Mt.updateQueue=o,o.stores=[r]):(d=o.stores,d===null?o.stores=[r]:d.push(r))}function V0(r,o,d,g){o.value=d,o.getSnapshot=g,K0(o)&&X0(r)}function Y0(r,o,d){return d(function(){K0(o)&&X0(r)})}function K0(r){var o=r.getSnapshot;r=r.value;try{var d=o();return!kn(r,d)}catch{return!0}}function X0(r){var o=ds(r,1);o!==null&&Nr(o,r,1,-1)}function Z0(r){var o=zr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:r},o.queue=r,r=r.dispatch=wM.bind(null,Mt,r),[o.memoizedState,r]}function Il(r,o,d,g){return r={tag:r,create:o,destroy:d,deps:g,next:null},o=Mt.updateQueue,o===null?(o={lastEffect:null,stores:null},Mt.updateQueue=o,o.lastEffect=r.next=r):(d=o.lastEffect,d===null?o.lastEffect=r.next=r:(g=d.next,d.next=r,r.next=g,o.lastEffect=r)),r}function Q0(){return er().memoizedState}function wu(r,o,d,g){var v=zr();Mt.flags|=r,v.memoizedState=Il(1|o,d,void 0,g===void 0?null:g)}function vu(r,o,d,g){var v=er();g=g===void 0?null:g;var b=void 0;if(Yt!==null){var A=Yt.memoizedState;if(b=A.destroy,g!==null&&tf(g,A.deps)){v.memoizedState=Il(o,d,b,g);return}}Mt.flags|=r,v.memoizedState=Il(1|o,d,b,g)}function J0(r,o){return wu(8390656,8,r,o)}function of(r,o){return vu(2048,8,r,o)}function eb(r,o){return vu(4,2,r,o)}function tb(r,o){return vu(4,4,r,o)}function nb(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function rb(r,o,d){return d=d!=null?d.concat([r]):null,vu(4,4,nb.bind(null,o,r),d)}function lf(){}function sb(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(d.memoizedState=[r,o],r)}function ab(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(r=r(),d.memoizedState=[r,o],r)}function ob(r,o,d){return(Xa&21)===0?(r.baseState&&(r.baseState=!1,An=!0),r.memoizedState=d):(kn(d,o)||(d=En(),Mt.lanes|=d,Za|=d,r.baseState=!0),o)}function gM(r,o){var d=mt;mt=d!==0&&4>d?d:4,r(!0);var g=ef.transition;ef.transition={};try{r(!1),o()}finally{mt=d,ef.transition=g}}function ib(){return er().memoizedState}function yM(r,o,d){var g=Ys(r);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},lb(r))cb(o,d);else if(d=q0(r,o,d,g),d!==null){var v=Nn();Nr(d,r,g,v),ub(d,o,g)}}function wM(r,o,d){var g=Ys(r),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(lb(r))cb(o,v);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var A=o.lastRenderedState,X=b(A,d);if(v.hasEagerState=!0,v.eagerState=X,kn(X,A)){var ne=o.interleaved;ne===null?(v.next=v,Yh(o)):(v.next=ne.next,ne.next=v),o.interleaved=v;return}}catch{}finally{}d=q0(r,o,v,g),d!==null&&(v=Nn(),Nr(d,r,g,v),ub(d,o,g))}}function lb(r){var o=r.alternate;return r===Mt||o!==null&&o===Mt}function cb(r,o){Al=yu=!0;var d=r.pending;d===null?o.next=o:(o.next=d.next,d.next=o),r.pending=o}function ub(r,o,d){if((d&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Ft(r,d)}}var xu={readContext:Jn,useCallback:mn,useContext:mn,useEffect:mn,useImperativeHandle:mn,useInsertionEffect:mn,useLayoutEffect:mn,useMemo:mn,useReducer:mn,useRef:mn,useState:mn,useDebugValue:mn,useDeferredValue:mn,useTransition:mn,useMutableSource:mn,useSyncExternalStore:mn,useId:mn,unstable_isNewReconciler:!1},vM={readContext:Jn,useCallback:function(r,o){return zr().memoizedState=[r,o===void 0?null:o],r},useContext:Jn,useEffect:J0,useImperativeHandle:function(r,o,d){return d=d!=null?d.concat([r]):null,wu(4194308,4,nb.bind(null,o,r),d)},useLayoutEffect:function(r,o){return wu(4194308,4,r,o)},useInsertionEffect:function(r,o){return wu(4,2,r,o)},useMemo:function(r,o){var d=zr();return o=o===void 0?null:o,r=r(),d.memoizedState=[r,o],r},useReducer:function(r,o,d){var g=zr();return o=d!==void 0?d(o):o,g.memoizedState=g.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},g.queue=r,r=r.dispatch=yM.bind(null,Mt,r),[g.memoizedState,r]},useRef:function(r){var o=zr();return r={current:r},o.memoizedState=r},useState:Z0,useDebugValue:lf,useDeferredValue:function(r){return zr().memoizedState=r},useTransition:function(){var r=Z0(!1),o=r[0];return r=gM.bind(null,r[1]),zr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,d){var g=Mt,v=zr();if(Tt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),tn===null)throw Error(n(349));(Xa&30)!==0||G0(g,o,d)}v.memoizedState=d;var b={value:d,getSnapshot:o};return v.queue=b,J0(Y0.bind(null,g,b,r),[r]),g.flags|=2048,Il(9,V0.bind(null,g,b,d,o),void 0,null),d},useId:function(){var r=zr(),o=tn.identifierPrefix;if(Tt){var d=us,g=cs;d=(g&~(1<<32-jn(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Rl++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=mM++,o=":"+o+"r"+d.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},xM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:sf,useRef:Q0,useState:function(){return sf(Ml)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return ob(o,Yt.memoizedState,r)},useTransition:function(){var r=sf(Ml)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1},bM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:af,useRef:Q0,useState:function(){return af(Ml)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return Yt===null?o.memoizedState=r:ob(o,Yt.memoizedState,r)},useTransition:function(){var r=af(Ml)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1};function br(r,o){if(r&&r.defaultProps){o=U({},o),r=r.defaultProps;for(var d in r)o[d]===void 0&&(o[d]=r[d]);return o}return o}function cf(r,o,d,g){o=r.memoizedState,d=d(g,o),d=d==null?o:U({},o,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var bu={isMounted:function(r){return(r=r._reactInternals)?rn(r)===r:!1},enqueueSetState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ys(r),b=hs(g,v);b.payload=o,d!=null&&(b.callback=d),o=Ws(r,b,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueReplaceState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ys(r),b=hs(g,v);b.tag=1,b.payload=o,d!=null&&(b.callback=d),o=Ws(r,b,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var d=Nn(),g=Ys(r),v=hs(d,g);v.tag=2,o!=null&&(v.callback=o),o=Ws(r,v,g),o!==null&&(Nr(o,r,g,d),fu(o,r,g))}};function db(r,o,d,g,v,b,A){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,b,A):o.prototype&&o.prototype.isPureReactComponent?!Dr(d,g)||!Dr(v,b):!0}function hb(r,o,d){var g=!1,v=Bs,b=o.contextType;return typeof b=="object"&&b!==null?b=Jn(b):(v=Tn(o)?Ha:pn.current,g=o.contextTypes,b=(g=g!=null)?ri(r,v):Bs),o=new o(d,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=bu,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=b),o}function fb(r,o,d,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,g),o.state!==r&&bu.enqueueReplaceState(o,o.state,null)}function uf(r,o,d,g){var v=r.stateNode;v.props=d,v.state=r.memoizedState,v.refs={},Kh(r);var b=o.contextType;typeof b=="object"&&b!==null?v.context=Jn(b):(b=Tn(o)?Ha:pn.current,v.context=ri(r,b)),v.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(cf(r,o,b,d),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&bu.enqueueReplaceState(v,v.state,null),pu(r,d,v,g),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function di(r,o){try{var d="",g=o;do d+=J(g),g=g.return;while(g);var v=d}catch(b){v=`
|
|
39
|
-
Error generating stack: `+
|
|
40
|
-
`+b.stack}return{value:r,source:o,stack:v,digest:null}}function df(r,o,d){return{value:r,source:null,stack:d??null,digest:o??null}}function hf(r,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var kM=typeof WeakMap=="function"?WeakMap:Map;function pb(r,o,d){d=hs(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){Cu||(Cu=!0,Ef=g),hf(r,o)},d}function mb(r,o,d){d=hs(-1,d),d.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var v=o.value;d.payload=function(){return g(v)},d.callback=function(){hf(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(d.callback=function(){hf(r,o),typeof g!="function"&&(Gs===null?Gs=new Set([this]):Gs.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function gb(r,o,d){var g=r.pingCache;if(g===null){g=r.pingCache=new kM;var v=new Set;g.set(o,v)}else v=g.get(o),v===void 0&&(v=new Set,g.set(o,v));v.has(d)||(v.add(d),r=PM.bind(null,r,o,d),o.then(r,r))}function yb(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function wb(r,o,d,g,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=hs(-1,1),o.tag=2,Ws(d,o,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var _M=C.ReactCurrentOwner,An=!1;function _n(r,o,d,g){o.child=r===null?D0(o,null,d,g):ii(o,r.child,d,g)}function vb(r,o,d,g,v){d=d.render;var b=o.ref;return ci(o,v),g=nf(r,o,d,g,b,v),d=rf(),r!==null&&!An?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,fs(r,o,v)):(Tt&&d&&qh(o),o.flags|=1,_n(r,o,g,v),o.child)}function xb(r,o,d,g,v){if(r===null){var b=d.type;return typeof b=="function"&&!$f(b)&&b.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=b,bb(r,o,b,g,v)):(r=$u(d.type,null,g,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&v)===0){var A=b.memoizedProps;if(d=d.compare,d=d!==null?d:Dr,d(A,g)&&r.ref===o.ref)return fs(r,o,v)}return o.flags|=1,r=Xs(b,g),r.ref=o.ref,r.return=o,o.child=r}function bb(r,o,d,g,v){if(r!==null){var b=r.memoizedProps;if(Dr(b,g)&&r.ref===o.ref)if(An=!1,o.pendingProps=g=b,(r.lanes&v)!==0)(r.flags&131072)!==0&&(An=!0);else return o.lanes=r.lanes,fs(r,o,v)}return ff(r,o,d,g,v)}function kb(r,o,d){var g=o.pendingProps,v=g.children,b=r!==null?r.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt(fi,Fn),Fn|=d;else{if((d&1073741824)===0)return r=b!==null?b.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,jt(fi,Fn),Fn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=b!==null?b.baseLanes:d,jt(fi,Fn),Fn|=g}else b!==null?(g=b.baseLanes|d,o.memoizedState=null):g=d,jt(fi,Fn),Fn|=g;return _n(r,o,v,d),o.child}function _b(r,o){var d=o.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function ff(r,o,d,g,v){var b=Tn(d)?Ha:pn.current;return b=ri(o,b),ci(o,v),d=nf(r,o,d,g,b,v),g=rf(),r!==null&&!An?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,fs(r,o,v)):(Tt&&g&&qh(o),o.flags|=1,_n(r,o,d,v),o.child)}function Nb(r,o,d,g,v){if(Tn(d)){var b=!0;au(o)}else b=!1;if(ci(o,v),o.stateNode===null)_u(r,o),hb(o,d,g),uf(o,d,g,v),g=!0;else if(r===null){var A=o.stateNode,X=o.memoizedProps;A.props=X;var ne=A.context,de=d.contextType;typeof de=="object"&&de!==null?de=Jn(de):(de=Tn(d)?Ha:pn.current,de=ri(o,de));var we=d.getDerivedStateFromProps,xe=typeof we=="function"||typeof A.getSnapshotBeforeUpdate=="function";xe||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==g||ne!==de)&&fb(o,A,g,de),Us=!1;var ye=o.memoizedState;A.state=ye,pu(o,g,A,v),ne=o.memoizedState,X!==g||ye!==ne||Cn.current||Us?(typeof we=="function"&&(cf(o,d,we,g),ne=o.memoizedState),(X=Us||db(o,d,X,g,ye,ne,de))?(xe||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(o.flags|=4194308)):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=ne),A.props=g,A.state=ne,A.context=de,g=X):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,F0(r,o),X=o.memoizedProps,de=o.type===o.elementType?X:br(o.type,X),A.props=de,xe=o.pendingProps,ye=A.context,ne=d.contextType,typeof ne=="object"&&ne!==null?ne=Jn(ne):(ne=Tn(d)?Ha:pn.current,ne=ri(o,ne));var Te=d.getDerivedStateFromProps;(we=typeof Te=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(X!==xe||ye!==ne)&&fb(o,A,g,ne),Us=!1,ye=o.memoizedState,A.state=ye,pu(o,g,A,v);var $e=o.memoizedState;X!==xe||ye!==$e||Cn.current||Us?(typeof Te=="function"&&(cf(o,d,Te,g),$e=o.memoizedState),(de=Us||db(o,d,de,g,ye,$e,ne)||!1)?(we||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,$e,ne),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,$e,ne)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=$e),A.props=g,A.state=$e,A.context=ne,g=de):(typeof A.componentDidUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),g=!1)}return pf(r,o,d,g,b,v)}function pf(r,o,d,g,v,b){_b(r,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&T0(o,d,!1),fs(r,o,b);g=o.stateNode,_M.current=o;var X=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&A?(o.child=ii(o,r.child,null,b),o.child=ii(o,null,X,b)):_n(r,o,X,b),o.memoizedState=g.state,v&&T0(o,d,!0),o.child}function Sb(r){var o=r.stateNode;o.pendingContext?E0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&E0(r,o.context,!1),Xh(r,o.containerInfo)}function jb(r,o,d,g,v){return oi(),Uh(v),o.flags|=256,_n(r,o,d,g),o.child}var mf={dehydrated:null,treeContext:null,retryLane:0};function gf(r){return{baseLanes:r,cachePool:null,transitions:null}}function Eb(r,o,d){var g=o.pendingProps,v=Rt.current,b=!1,A=(o.flags&128)!==0,X;if((X=A)||(X=r!==null&&r.memoizedState===null?!1:(v&2)!==0),X?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),jt(Rt,v&1),r===null)return zh(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(A=g.children,r=g.fallback,b?(g=o.mode,b=o.child,A={mode:"hidden",children:A},(g&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=A):b=Ou(A,g,0,null),r=to(r,g,d,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=gf(d),o.memoizedState=mf,r):yf(o,A));if(v=r.memoizedState,v!==null&&(X=v.dehydrated,X!==null))return NM(r,o,A,g,X,v,d);if(b){b=g.fallback,A=o.mode,v=r.child,X=v.sibling;var ne={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=ne,o.deletions=null):(g=Xs(v,ne),g.subtreeFlags=v.subtreeFlags&14680064),X!==null?b=Xs(X,b):(b=to(b,A,d,null),b.flags|=2),b.return=o,g.return=o,g.sibling=b,o.child=g,g=b,b=o.child,A=r.child.memoizedState,A=A===null?gf(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},b.memoizedState=A,b.childLanes=r.childLanes&~d,o.memoizedState=mf,g}return b=r.child,r=b.sibling,g=Xs(b,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=d),g.return=o,g.sibling=null,r!==null&&(d=o.deletions,d===null?(o.deletions=[r],o.flags|=16):d.push(r)),o.child=g,o.memoizedState=null,g}function yf(r,o){return o=Ou({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function ku(r,o,d,g){return g!==null&&Uh(g),ii(o,r.child,null,d),r=yf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function NM(r,o,d,g,v,b,A){if(d)return o.flags&256?(o.flags&=-257,g=df(Error(n(422))),ku(r,o,A,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=g.fallback,v=o.mode,g=Ou({mode:"visible",children:g.children},v,0,null),b=to(b,v,A,null),b.flags|=2,g.return=o,b.return=o,g.sibling=b,o.child=g,(o.mode&1)!==0&&ii(o,r.child,null,A),o.child.memoizedState=gf(A),o.memoizedState=mf,b);if((o.mode&1)===0)return ku(r,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var X=g.dgst;return g=X,b=Error(n(419)),g=df(b,g,void 0),ku(r,o,A,g)}if(X=(A&r.childLanes)!==0,An||X){if(g=tn,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==b.retryLane&&(b.retryLane=v,ds(r,v),Nr(g,r,v,-1))}return If(),g=df(Error(n(421))),ku(r,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=LM.bind(null,r),v._reactRetry=o,null):(r=b.treeContext,qn=vr(v.nextSibling),Dn=o,Tt=!0,xr=null,r!==null&&(Zn[Qn++]=cs,Zn[Qn++]=us,Zn[Qn++]=Ga,cs=r.id,us=r.overflow,Ga=o),o=yf(o,g.children),o.flags|=4096,o)}function Cb(r,o,d){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),Vh(r.return,o,d)}function wf(r,o,d,g,v){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=g,b.tail=d,b.tailMode=v)}function Tb(r,o,d){var g=o.pendingProps,v=g.revealOrder,b=g.tail;if(_n(r,o,g.children,d),g=Rt.current,(g&2)!==0)g=g&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Cb(r,d,o);else if(r.tag===19)Cb(r,d,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}if(jt(Rt,g),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)r=d.alternate,r!==null&&mu(r)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),wf(o,!1,v,d,b);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&mu(r)===null){o.child=v;break}r=v.sibling,v.sibling=d,d=v,v=r}wf(o,!0,d,null,b);break;case"together":wf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function _u(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function fs(r,o,d){if(r!==null&&(o.dependencies=r.dependencies),Za|=o.lanes,(d&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,d=Xs(r,r.pendingProps),o.child=d,d.return=o;r.sibling!==null;)r=r.sibling,d=d.sibling=Xs(r,r.pendingProps),d.return=o;d.sibling=null}return o.child}function SM(r,o,d){switch(o.tag){case 3:Sb(o),oi();break;case 5:U0(o);break;case 1:Tn(o.type)&&au(o);break;case 4:Xh(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;jt(du,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(jt(Rt,Rt.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?Eb(r,o,d):(jt(Rt,Rt.current&1),r=fs(r,o,d),r!==null?r.sibling:null);jt(Rt,Rt.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(r.flags&128)!==0){if(g)return Tb(r,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),jt(Rt,Rt.current),g)break;return null;case 22:case 23:return o.lanes=0,kb(r,o,d)}return fs(r,o,d)}var Ab,vf,Rb,Mb;Ab=function(r,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},vf=function(){},Rb=function(r,o,d,g){var v=r.memoizedProps;if(v!==g){r=o.stateNode,Ka(Br.current);var b=null;switch(d){case"input":v=Ue(r,v),g=Ue(r,g),b=[];break;case"select":v=U({},v,{value:void 0}),g=U({},g,{value:void 0}),b=[];break;case"textarea":v=Fe(r,v),g=Fe(r,g),b=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=os)}bt(d,g);var A;d=null;for(de in v)if(!g.hasOwnProperty(de)&&v.hasOwnProperty(de)&&v[de]!=null)if(de==="style"){var X=v[de];for(A in X)X.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?b||(b=[]):(b=b||[]).push(de,null));for(de in g){var ne=g[de];if(X=v!=null?v[de]:void 0,g.hasOwnProperty(de)&&ne!==X&&(ne!=null||X!=null))if(de==="style")if(X){for(A in X)!X.hasOwnProperty(A)||ne&&ne.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in ne)ne.hasOwnProperty(A)&&X[A]!==ne[A]&&(d||(d={}),d[A]=ne[A])}else d||(b||(b=[]),b.push(de,d)),d=ne;else de==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,X=X?X.__html:void 0,ne!=null&&X!==ne&&(b=b||[]).push(de,ne)):de==="children"?typeof ne!="string"&&typeof ne!="number"||(b=b||[]).push(de,""+ne):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(ne!=null&&de==="onScroll"&&xt("scroll",r),b||X===ne||(b=[])):(b=b||[]).push(de,ne))}d&&(b=b||[]).push("style",d);var de=b;(o.updateQueue=de)&&(o.flags|=4)}},Mb=function(r,o,d,g){d!==g&&(o.flags|=4)};function $l(r,o){if(!Tt)switch(r.tailMode){case"hidden":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function gn(r){var o=r.alternate!==null&&r.alternate.child===r.child,d=0,g=0;if(o)for(var v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=g,r.childLanes=d,o}function jM(r,o,d){var g=o.pendingProps;switch(Fh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(o),null;case 1:return Tn(o.type)&&su(),gn(o),null;case 3:return g=o.stateNode,ui(),Et(Cn),Et(pn),Jh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(cu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,xr!==null&&(Af(xr),xr=null))),vf(r,o),gn(o),null;case 5:Zh(o);var v=Ka(Tl.current);if(d=o.type,r!==null&&o.stateNode!=null)Rb(r,o,d,g,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return gn(o),null}if(r=Ka(Br.current),cu(o)){g=o.stateNode,d=o.type;var b=o.memoizedProps;switch(g[Fr]=o,g[Nl]=b,r=(o.mode&1)!==0,d){case"dialog":xt("cancel",g),xt("close",g);break;case"iframe":case"object":case"embed":xt("load",g);break;case"video":case"audio":for(v=0;v<as.length;v++)xt(as[v],g);break;case"source":xt("error",g);break;case"img":case"image":case"link":xt("error",g),xt("load",g);break;case"details":xt("toggle",g);break;case"input":Se(g,b),xt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!b.multiple},xt("invalid",g);break;case"textarea":We(g,b),xt("invalid",g)}bt(d,b),v=null;for(var A in b)if(b.hasOwnProperty(A)){var X=b[A];A==="children"?typeof X=="string"?g.textContent!==X&&(b.suppressHydrationWarning!==!0&&an(g.textContent,X,r),v=["children",X]):typeof X=="number"&&g.textContent!==""+X&&(b.suppressHydrationWarning!==!0&&an(g.textContent,X,r),v=["children",""+X]):a.hasOwnProperty(A)&&X!=null&&A==="onScroll"&&xt("scroll",g)}switch(d){case"input":Me(g),_e(g,b,!0);break;case"textarea":Me(g),ot(g);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(g.onclick=os)}g=v,o.updateQueue=g,g!==null&&(o.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=wt(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=A.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=A.createElement(d,{is:g.is}):(r=A.createElement(d),d==="select"&&(A=r,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):r=A.createElementNS(r,d),r[Fr]=o,r[Nl]=g,Ab(r,o,!1,!1),o.stateNode=r;e:{switch(A=nt(d,g),d){case"dialog":xt("cancel",r),xt("close",r),v=g;break;case"iframe":case"object":case"embed":xt("load",r),v=g;break;case"video":case"audio":for(v=0;v<as.length;v++)xt(as[v],r);v=g;break;case"source":xt("error",r),v=g;break;case"img":case"image":case"link":xt("error",r),xt("load",r),v=g;break;case"details":xt("toggle",r),v=g;break;case"input":Se(r,g),v=Ue(r,g),xt("invalid",r);break;case"option":v=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},v=U({},g,{value:void 0}),xt("invalid",r);break;case"textarea":We(r,g),v=Fe(r,g),xt("invalid",r);break;default:v=g}bt(d,v),X=v;for(b in X)if(X.hasOwnProperty(b)){var ne=X[b];b==="style"?tt(r,ne):b==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&ke(r,ne)):b==="children"?typeof ne=="string"?(d!=="textarea"||ne!=="")&&Be(r,ne):typeof ne=="number"&&Be(r,""+ne):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?ne!=null&&b==="onScroll"&&xt("scroll",r):ne!=null&&E(r,b,ne,A))}switch(d){case"input":Me(r),_e(r,g,!1);break;case"textarea":Me(r),ot(r);break;case"option":g.value!=null&&r.setAttribute("value",""+le(g.value));break;case"select":r.multiple=!!g.multiple,b=g.value,b!=null?Ce(r,!!g.multiple,b,!1):g.defaultValue!=null&&Ce(r,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=os)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return gn(o),null;case 6:if(r&&o.stateNode!=null)Mb(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=Ka(Tl.current),Ka(Br.current),cu(o)){if(g=o.stateNode,d=o.memoizedProps,g[Fr]=o,(b=g.nodeValue!==d)&&(r=Dn,r!==null))switch(r.tag){case 3:an(g.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&an(g.nodeValue,d,(r.mode&1)!==0)}b&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[Fr]=o,o.stateNode=g}return gn(o),null;case 13:if(Et(Rt),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Tt&&qn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)O0(),oi(),o.flags|=98560,b=!1;else if(b=cu(o),g!==null&&g.dehydrated!==null){if(r===null){if(!b)throw Error(n(318));if(b=o.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[Fr]=o}else oi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;gn(o),b=!1}else xr!==null&&(Af(xr),xr=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Rt.current&1)!==0?Kt===0&&(Kt=3):If())),o.updateQueue!==null&&(o.flags|=4),gn(o),null);case 4:return ui(),vf(r,o),r===null&&D(o.stateNode.containerInfo),gn(o),null;case 10:return Gh(o.type._context),gn(o),null;case 17:return Tn(o.type)&&su(),gn(o),null;case 19:if(Et(Rt),b=o.memoizedState,b===null)return gn(o),null;if(g=(o.flags&128)!==0,A=b.rendering,A===null)if(g)$l(b,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(A=mu(r),A!==null){for(o.flags|=128,$l(b,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)b=d,r=g,b.flags&=14680066,A=b.alternate,A===null?(b.childLanes=0,b.lanes=r,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=A.childLanes,b.lanes=A.lanes,b.child=A.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=A.memoizedProps,b.memoizedState=A.memoizedState,b.updateQueue=A.updateQueue,b.type=A.type,r=A.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return jt(Rt,Rt.current&1|2),o.child}r=r.sibling}b.tail!==null&&St()>pi&&(o.flags|=128,g=!0,$l(b,!1),o.lanes=4194304)}else{if(!g)if(r=mu(A),r!==null){if(o.flags|=128,g=!0,d=r.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),$l(b,!0),b.tail===null&&b.tailMode==="hidden"&&!A.alternate&&!Tt)return gn(o),null}else 2*St()-b.renderingStartTime>pi&&d!==1073741824&&(o.flags|=128,g=!0,$l(b,!1),o.lanes=4194304);b.isBackwards?(A.sibling=o.child,o.child=A):(d=b.last,d!==null?d.sibling=A:o.child=A,b.last=A)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=St(),o.sibling=null,d=Rt.current,jt(Rt,g?d&1|2:d&1),o):(gn(o),null);case 22:case 23:return Mf(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(Fn&1073741824)!==0&&(gn(o),o.subtreeFlags&6&&(o.flags|=8192)):gn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function EM(r,o){switch(Fh(o),o.tag){case 1:return Tn(o.type)&&su(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return ui(),Et(Cn),Et(pn),Jh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Zh(o),null;case 13:if(Et(Rt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));oi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Et(Rt),null;case 4:return ui(),null;case 10:return Gh(o.type._context),null;case 22:case 23:return Mf(),null;case 24:return null;default:return null}}var Nu=!1,yn=!1,CM=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function hi(r,o){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Pt(r,o,g)}else d.current=null}function xf(r,o,d){try{d()}catch(g){Pt(r,o,g)}}var Ib=!1;function TM(r,o){if(Zo=Ea,r=zo(),Ls(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,b=g.focusNode;g=g.focusOffset;try{d.nodeType,b.nodeType}catch{d=null;break e}var A=0,X=-1,ne=-1,de=0,we=0,xe=r,ye=null;t:for(;;){for(var Te;xe!==d||v!==0&&xe.nodeType!==3||(X=A+v),xe!==b||g!==0&&xe.nodeType!==3||(ne=A+g),xe.nodeType===3&&(A+=xe.nodeValue.length),(Te=xe.firstChild)!==null;)ye=xe,xe=Te;for(;;){if(xe===r)break t;if(ye===d&&++de===v&&(X=A),ye===b&&++we===g&&(ne=A),(Te=xe.nextSibling)!==null)break;xe=ye,ye=xe.parentNode}xe=Te}d=X===-1||ne===-1?null:{start:X,end:ne}}else d=null}d=d||{start:0,end:0}}else d=null;for(kl={focusedElem:r,selectionRange:d},Ea=!1,Ie=o;Ie!==null;)if(o=Ie,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ie=r;else for(;Ie!==null;){o=Ie;try{var $e=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if($e!==null){var Pe=$e.memoizedProps,zt=$e.memoizedState,ie=o.stateNode,se=ie.getSnapshotBeforeUpdate(o.elementType===o.type?Pe:br(o.type,Pe),zt);ie.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ce=o.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(be){Pt(o,o.return,be)}if(r=o.sibling,r!==null){r.return=o.return,Ie=r;break}Ie=o.return}return $e=Ib,Ib=!1,$e}function Ol(r,o,d){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&r)===r){var b=v.destroy;v.destroy=void 0,b!==void 0&&xf(o,d,b)}v=v.next}while(v!==g)}}function Su(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&r)===r){var g=d.create;d.destroy=g()}d=d.next}while(d!==o)}}function bf(r){var o=r.ref;if(o!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof o=="function"?o(r):o.current=r}}function $b(r){var o=r.alternate;o!==null&&(r.alternate=null,$b(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Fr],delete o[Nl],delete o[Ph],delete o[dM],delete o[hM])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Ob(r){return r.tag===5||r.tag===3||r.tag===4}function Pb(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ob(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(r,o):d.insertBefore(r,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(r,d)):(o=d,o.appendChild(r)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=os));else if(g!==4&&(r=r.child,r!==null))for(kf(r,o,d),r=r.sibling;r!==null;)kf(r,o,d),r=r.sibling}function _f(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.insertBefore(r,o):d.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(_f(r,o,d),r=r.sibling;r!==null;)_f(r,o,d),r=r.sibling}var on=null,kr=!1;function Hs(r,o,d){for(d=d.child;d!==null;)Lb(r,o,d),d=d.sibling}function Lb(r,o,d){if(vn&&typeof vn.onCommitFiberUnmount=="function")try{vn.onCommitFiberUnmount(dr,d)}catch{}switch(d.tag){case 5:yn||hi(d,o);case 6:var g=on,v=kr;on=null,Hs(r,o,d),on=g,kr=v,on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):on.removeChild(d.stateNode));break;case 18:on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?Ot(r.parentNode,d):r.nodeType===1&&Ot(r,d),ja(r)):Ot(on,d.stateNode));break;case 4:g=on,v=kr,on=d.stateNode.containerInfo,kr=!0,Hs(r,o,d),on=g,kr=v;break;case 0:case 11:case 14:case 15:if(!yn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var b=v,A=b.destroy;b=b.tag,A!==void 0&&((b&2)!==0||(b&4)!==0)&&xf(d,o,A),v=v.next}while(v!==g)}Hs(r,o,d);break;case 1:if(!yn&&(hi(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(X){Pt(d,o,X)}Hs(r,o,d);break;case 21:Hs(r,o,d);break;case 22:d.mode&1?(yn=(g=yn)||d.memoizedState!==null,Hs(r,o,d),yn=g):Hs(r,o,d);break;default:Hs(r,o,d)}}function Db(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new CM),o.forEach(function(g){var v=DM.bind(null,r,g);d.has(g)||(d.add(g),g.then(v,v))})}}function _r(r,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var b=r,A=o,X=A;e:for(;X!==null;){switch(X.tag){case 5:on=X.stateNode,kr=!1;break e;case 3:on=X.stateNode.containerInfo,kr=!0;break e;case 4:on=X.stateNode.containerInfo,kr=!0;break e}X=X.return}if(on===null)throw Error(n(160));Lb(b,A,v),on=null,kr=!1;var ne=v.alternate;ne!==null&&(ne.return=null),v.return=null}catch(de){Pt(v,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)qb(o,r),o=o.sibling}function qb(r,o){var d=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(_r(o,r),Ur(r),g&4){try{Ol(3,r,r.return),Su(3,r)}catch(Pe){Pt(r,r.return,Pe)}try{Ol(5,r,r.return)}catch(Pe){Pt(r,r.return,Pe)}}break;case 1:_r(o,r),Ur(r),g&512&&d!==null&&hi(d,d.return);break;case 5:if(_r(o,r),Ur(r),g&512&&d!==null&&hi(d,d.return),r.flags&32){var v=r.stateNode;try{Be(v,"")}catch(Pe){Pt(r,r.return,Pe)}}if(g&4&&(v=r.stateNode,v!=null)){var b=r.memoizedProps,A=d!==null?d.memoizedProps:b,X=r.type,ne=r.updateQueue;if(r.updateQueue=null,ne!==null)try{X==="input"&&b.type==="radio"&&b.name!=null&&Qe(v,b),nt(X,A);var de=nt(X,b);for(A=0;A<ne.length;A+=2){var we=ne[A],xe=ne[A+1];we==="style"?tt(v,xe):we==="dangerouslySetInnerHTML"?ke(v,xe):we==="children"?Be(v,xe):E(v,we,xe,de)}switch(X){case"input":Ne(v,b);break;case"textarea":He(v,b);break;case"select":var ye=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!b.multiple;var Te=b.value;Te!=null?Ce(v,!!b.multiple,Te,!1):ye!==!!b.multiple&&(b.defaultValue!=null?Ce(v,!!b.multiple,b.defaultValue,!0):Ce(v,!!b.multiple,b.multiple?[]:"",!1))}v[Nl]=b}catch(Pe){Pt(r,r.return,Pe)}}break;case 6:if(_r(o,r),Ur(r),g&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,b=r.memoizedProps;try{v.nodeValue=b}catch(Pe){Pt(r,r.return,Pe)}}break;case 3:if(_r(o,r),Ur(r),g&4&&d!==null&&d.memoizedState.isDehydrated)try{ja(o.containerInfo)}catch(Pe){Pt(r,r.return,Pe)}break;case 4:_r(o,r),Ur(r);break;case 13:_r(o,r),Ur(r),v=r.child,v.flags&8192&&(b=v.memoizedState!==null,v.stateNode.isHidden=b,!b||v.alternate!==null&&v.alternate.memoizedState!==null||(jf=St())),g&4&&Db(r);break;case 22:if(we=d!==null&&d.memoizedState!==null,r.mode&1?(yn=(de=yn)||we,_r(o,r),yn=de):_r(o,r),Ur(r),g&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!we&&(r.mode&1)!==0)for(Ie=r,we=r.child;we!==null;){for(xe=Ie=we;Ie!==null;){switch(ye=Ie,Te=ye.child,ye.tag){case 0:case 11:case 14:case 15:Ol(4,ye,ye.return);break;case 1:hi(ye,ye.return);var $e=ye.stateNode;if(typeof $e.componentWillUnmount=="function"){g=ye,d=ye.return;try{o=g,$e.props=o.memoizedProps,$e.state=o.memoizedState,$e.componentWillUnmount()}catch(Pe){Pt(g,d,Pe)}}break;case 5:hi(ye,ye.return);break;case 22:if(ye.memoizedState!==null){zb(xe);continue}}Te!==null?(Te.return=ye,Ie=Te):zb(xe)}we=we.sibling}e:for(we=null,xe=r;;){if(xe.tag===5){if(we===null){we=xe;try{v=xe.stateNode,de?(b=v.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(X=xe.stateNode,ne=xe.memoizedProps.style,A=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,X.style.display=Je("display",A))}catch(Pe){Pt(r,r.return,Pe)}}}else if(xe.tag===6){if(we===null)try{xe.stateNode.nodeValue=de?"":xe.memoizedProps}catch(Pe){Pt(r,r.return,Pe)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===r)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===r)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===r)break e;we===xe&&(we=null),xe=xe.return}we===xe&&(we=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:_r(o,r),Ur(r),g&4&&Db(r);break;case 21:break;default:_r(o,r),Ur(r)}}function Ur(r){var o=r.flags;if(o&2){try{e:{for(var d=r.return;d!==null;){if(Ob(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Be(v,""),g.flags&=-33);var b=Pb(r);_f(r,b,v);break;case 3:case 4:var A=g.stateNode.containerInfo,X=Pb(r);kf(r,X,A);break;default:throw Error(n(161))}}catch(ne){Pt(r,r.return,ne)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function AM(r,o,d){Ie=r,Fb(r)}function Fb(r,o,d){for(var g=(r.mode&1)!==0;Ie!==null;){var v=Ie,b=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Nu;if(!A){var X=v.alternate,ne=X!==null&&X.memoizedState!==null||yn;X=Nu;var de=yn;if(Nu=A,(yn=ne)&&!de)for(Ie=v;Ie!==null;)A=Ie,ne=A.child,A.tag===22&&A.memoizedState!==null?Ub(v):ne!==null?(ne.return=A,Ie=ne):Ub(v);for(;b!==null;)Ie=b,Fb(b),b=b.sibling;Ie=v,Nu=X,yn=de}Bb(r)}else(v.subtreeFlags&8772)!==0&&b!==null?(b.return=v,Ie=b):Bb(r)}}function Bb(r){for(;Ie!==null;){var o=Ie;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:yn||Su(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!yn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:br(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&z0(o,b,g);break;case 3:var A=o.updateQueue;if(A!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}z0(o,A,d)}break;case 5:var X=o.stateNode;if(d===null&&o.flags&4){d=X;var ne=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&d.focus();break;case"img":ne.src&&(d.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var de=o.alternate;if(de!==null){var we=de.memoizedState;if(we!==null){var xe=we.dehydrated;xe!==null&&ja(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}yn||o.flags&512&&bf(o)}catch(ye){Pt(o,o.return,ye)}}if(o===r){Ie=null;break}if(d=o.sibling,d!==null){d.return=o.return,Ie=d;break}Ie=o.return}}function zb(r){for(;Ie!==null;){var o=Ie;if(o===r){Ie=null;break}var d=o.sibling;if(d!==null){d.return=o.return,Ie=d;break}Ie=o.return}}function Ub(r){for(;Ie!==null;){var o=Ie;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Su(4,o)}catch(ne){Pt(o,d,ne)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(ne){Pt(o,v,ne)}}var b=o.return;try{bf(o)}catch(ne){Pt(o,b,ne)}break;case 5:var A=o.return;try{bf(o)}catch(ne){Pt(o,A,ne)}}}catch(ne){Pt(o,o.return,ne)}if(o===r){Ie=null;break}var X=o.sibling;if(X!==null){X.return=o.return,Ie=X;break}Ie=o.return}}var RM=Math.ceil,ju=C.ReactCurrentDispatcher,Nf=C.ReactCurrentOwner,tr=C.ReactCurrentBatchConfig,dt=0,tn=null,Ut=null,ln=0,Fn=0,fi=Fs(0),Kt=0,Pl=null,Za=0,Eu=0,Sf=0,Ll=null,Rn=null,jf=0,pi=1/0,ps=null,Cu=!1,Ef=null,Gs=null,Tu=!1,Vs=null,Au=0,Dl=0,Cf=null,Ru=-1,Mu=0;function Nn(){return(dt&6)!==0?St():Ru!==-1?Ru:Ru=St()}function Ys(r){return(r.mode&1)===0?1:(dt&2)!==0&&ln!==0?ln&-ln:pM.transition!==null?(Mu===0&&(Mu=En()),Mu):(r=mt,r!==0||(r=window.event,r=r===void 0?16:Dc(r.type)),r)}function Nr(r,o,d,g){if(50<Dl)throw Dl=0,Cf=null,Error(n(185));ka(r,d,g),((dt&2)===0||r!==tn)&&(r===tn&&((dt&2)===0&&(Eu|=d),Kt===4&&Ks(r,ln)),Mn(r,g),d===1&&dt===0&&(o.mode&1)===0&&(pi=St()+500,ou&&zs()))}function Mn(r,o){var d=r.callbackNode;jh(r,o);var g=xa(r,r===tn?ln:0);if(g===0)d!==null&&_s(d),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(d!=null&&_s(d),o===1)r.tag===0?fM(Hb.bind(null,r)):A0(Hb.bind(null,r)),za(function(){(dt&6)===0&&zs()}),d=null;else{switch(hr(g)){case 1:d=Ns;break;case 4:d=_o;break;case 16:d=Or;break;case 536870912:d=No;break;default:d=Or}d=Jb(d,Wb.bind(null,r))}r.callbackPriority=o,r.callbackNode=d}}function Wb(r,o){if(Ru=-1,Mu=0,(dt&6)!==0)throw Error(n(327));var d=r.callbackNode;if(mi()&&r.callbackNode!==d)return null;var g=xa(r,r===tn?ln:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=Iu(r,g);else{o=g;var v=dt;dt|=2;var b=Vb();(tn!==r||ln!==o)&&(ps=null,pi=St()+500,Ja(r,o));do try{$M();break}catch(X){Gb(r,X)}while(!0);Hh(),ju.current=b,dt=v,Ut!==null?o=0:(tn=null,ln=0,o=Kt)}if(o!==0){if(o===2&&(v=So(r),v!==0&&(g=v,o=Tf(r,v))),o===1)throw d=Pl,Ja(r,0),Ks(r,g),Mn(r,St()),d;if(o===6)Ks(r,g);else{if(v=r.current.alternate,(g&30)===0&&!MM(v)&&(o=Iu(r,g),o===2&&(b=So(r),b!==0&&(g=b,o=Tf(r,b))),o===1))throw d=Pl,Ja(r,0),Ks(r,g),Mn(r,St()),d;switch(r.finishedWork=v,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:eo(r,Rn,ps);break;case 3:if(Ks(r,g),(g&130023424)===g&&(o=jf+500-St(),10<o)){if(xa(r,0)!==0)break;if(v=r.suspendedLanes,(v&g)!==g){Nn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=_l(eo.bind(null,r,Rn,ps),o);break}eo(r,Rn,ps);break;case 4:if(Ks(r,g),(g&4194240)===g)break;for(o=r.eventTimes,v=-1;0<g;){var A=31-jn(g);b=1<<A,A=o[A],A>v&&(v=A),g&=~b}if(g=v,g=St()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*RM(g/1960))-g,10<g){r.timeoutHandle=_l(eo.bind(null,r,Rn,ps),g);break}eo(r,Rn,ps);break;case 5:eo(r,Rn,ps);break;default:throw Error(n(329))}}}return Mn(r,St()),r.callbackNode===d?Wb.bind(null,r):null}function Tf(r,o){var d=Ll;return r.current.memoizedState.isDehydrated&&(Ja(r,o).flags|=256),r=Iu(r,o),r!==2&&(o=Rn,Rn=d,o!==null&&Af(o)),r}function Af(r){Rn===null?Rn=r:Rn.push.apply(Rn,r)}function MM(r){for(var o=r;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],b=v.getSnapshot;v=v.value;try{if(!kn(b(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ks(r,o){for(o&=~Sf,o&=~Eu,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var d=31-jn(o),g=1<<d;r[d]=-1,o&=~g}}function Hb(r){if((dt&6)!==0)throw Error(n(327));mi();var o=xa(r,0);if((o&1)===0)return Mn(r,St()),null;var d=Iu(r,o);if(r.tag!==0&&d===2){var g=So(r);g!==0&&(o=g,d=Tf(r,g))}if(d===1)throw d=Pl,Ja(r,0),Ks(r,o),Mn(r,St()),d;if(d===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,eo(r,Rn,ps),Mn(r,St()),null}function Rf(r,o){var d=dt;dt|=1;try{return r(o)}finally{dt=d,dt===0&&(pi=St()+500,ou&&zs())}}function Qa(r){Vs!==null&&Vs.tag===0&&(dt&6)===0&&mi();var o=dt;dt|=1;var d=tr.transition,g=mt;try{if(tr.transition=null,mt=1,r)return r()}finally{mt=g,tr.transition=d,dt=o,(dt&6)===0&&zs()}}function Mf(){Fn=fi.current,Et(fi)}function Ja(r,o){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,nu(d)),Ut!==null)for(d=Ut.return;d!==null;){var g=d;switch(Fh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&su();break;case 3:ui(),Et(Cn),Et(pn),Jh();break;case 5:Zh(g);break;case 4:ui();break;case 13:Et(Rt);break;case 19:Et(Rt);break;case 10:Gh(g.type._context);break;case 22:case 23:Mf()}d=d.return}if(tn=r,Ut=r=Xs(r.current,null),ln=Fn=o,Kt=0,Pl=null,Sf=Eu=Za=0,Rn=Ll=null,Ya!==null){for(o=0;o<Ya.length;o++)if(d=Ya[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,b=d.pending;if(b!==null){var A=b.next;b.next=v,g.next=A}d.pending=g}Ya=null}return r}function Gb(r,o){do{var d=Ut;try{if(Hh(),gu.current=xu,yu){for(var g=Mt.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}yu=!1}if(Xa=0,en=Yt=Mt=null,Al=!1,Rl=0,Nf.current=null,d===null||d.return===null){Kt=1,Pl=o,Ut=null;break}e:{var b=r,A=d.return,X=d,ne=o;if(o=ln,X.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var de=ne,we=X,xe=we.tag;if((we.mode&1)===0&&(xe===0||xe===11||xe===15)){var ye=we.alternate;ye?(we.updateQueue=ye.updateQueue,we.memoizedState=ye.memoizedState,we.lanes=ye.lanes):(we.updateQueue=null,we.memoizedState=null)}var Te=yb(A);if(Te!==null){Te.flags&=-257,wb(Te,A,X,b,o),Te.mode&1&&gb(b,de,o),o=Te,ne=de;var $e=o.updateQueue;if($e===null){var Pe=new Set;Pe.add(ne),o.updateQueue=Pe}else $e.add(ne);break e}else{if((o&1)===0){gb(b,de,o),If();break e}ne=Error(n(426))}}else if(Tt&&X.mode&1){var zt=yb(A);if(zt!==null){(zt.flags&65536)===0&&(zt.flags|=256),wb(zt,A,X,b,o),Uh(di(ne,X));break e}}b=ne=di(ne,X),Kt!==4&&(Kt=2),Ll===null?Ll=[b]:Ll.push(b),b=A;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var ie=pb(b,ne,o);B0(b,ie);break e;case 1:X=ne;var se=b.type,ce=b.stateNode;if((b.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(Gs===null||!Gs.has(ce)))){b.flags|=65536,o&=-o,b.lanes|=o;var be=mb(b,X,o);B0(b,be);break e}}b=b.return}while(b!==null)}Kb(d)}catch(De){o=De,Ut===d&&d!==null&&(Ut=d=d.return);continue}break}while(!0)}function Vb(){var r=ju.current;return ju.current=xu,r===null?xu:r}function If(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),tn===null||(Za&268435455)===0&&(Eu&268435455)===0||Ks(tn,ln)}function Iu(r,o){var d=dt;dt|=2;var g=Vb();(tn!==r||ln!==o)&&(ps=null,Ja(r,o));do try{IM();break}catch(v){Gb(r,v)}while(!0);if(Hh(),dt=d,ju.current=g,Ut!==null)throw Error(n(261));return tn=null,ln=0,Kt}function IM(){for(;Ut!==null;)Yb(Ut)}function $M(){for(;Ut!==null&&!fa();)Yb(Ut)}function Yb(r){var o=Qb(r.alternate,r,Fn);r.memoizedProps=r.pendingProps,o===null?Kb(r):Ut=o,Nf.current=null}function Kb(r){var o=r;do{var d=o.alternate;if(r=o.return,(o.flags&32768)===0){if(d=jM(d,o,Fn),d!==null){Ut=d;return}}else{if(d=EM(d,o),d!==null){d.flags&=32767,Ut=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Kt=6,Ut=null;return}}if(o=o.sibling,o!==null){Ut=o;return}Ut=o=r}while(o!==null);Kt===0&&(Kt=5)}function eo(r,o,d){var g=mt,v=tr.transition;try{tr.transition=null,mt=1,OM(r,o,d,g)}finally{tr.transition=v,mt=g}return null}function OM(r,o,d,g){do mi();while(Vs!==null);if((dt&6)!==0)throw Error(n(327));d=r.finishedWork;var v=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=d.lanes|d.childLanes;if(Zi(r,b),r===tn&&(Ut=tn=null,ln=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Tu||(Tu=!0,Jb(Or,function(){return mi(),null})),b=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||b){b=tr.transition,tr.transition=null;var A=mt;mt=1;var X=dt;dt|=4,Nf.current=null,TM(r,d),qb(d,r),ml(kl),Ea=!!Zo,kl=Zo=null,r.current=d,AM(d),pa(),dt=X,mt=A,tr.transition=b}else r.current=d;if(Tu&&(Tu=!1,Vs=r,Au=v),b=r.pendingLanes,b===0&&(Gs=null),Pr(d.stateNode),Mn(r,St()),o!==null)for(g=r.onRecoverableError,d=0;d<o.length;d++)v=o[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(Cu)throw Cu=!1,r=Ef,Ef=null,r;return(Au&1)!==0&&r.tag!==0&&mi(),b=r.pendingLanes,(b&1)!==0?r===Cf?Dl++:(Dl=0,Cf=r):Dl=0,zs(),null}function mi(){if(Vs!==null){var r=hr(Au),o=tr.transition,d=mt;try{if(tr.transition=null,mt=16>r?16:r,Vs===null)var g=!1;else{if(r=Vs,Vs=null,Au=0,(dt&6)!==0)throw Error(n(331));var v=dt;for(dt|=4,Ie=r.current;Ie!==null;){var b=Ie,A=b.child;if((Ie.flags&16)!==0){var X=b.deletions;if(X!==null){for(var ne=0;ne<X.length;ne++){var de=X[ne];for(Ie=de;Ie!==null;){var we=Ie;switch(we.tag){case 0:case 11:case 15:Ol(8,we,b)}var xe=we.child;if(xe!==null)xe.return=we,Ie=xe;else for(;Ie!==null;){we=Ie;var ye=we.sibling,Te=we.return;if($b(we),we===de){Ie=null;break}if(ye!==null){ye.return=Te,Ie=ye;break}Ie=Te}}}var $e=b.alternate;if($e!==null){var Pe=$e.child;if(Pe!==null){$e.child=null;do{var zt=Pe.sibling;Pe.sibling=null,Pe=zt}while(Pe!==null)}}Ie=b}}if((b.subtreeFlags&2064)!==0&&A!==null)A.return=b,Ie=A;else e:for(;Ie!==null;){if(b=Ie,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:Ol(9,b,b.return)}var ie=b.sibling;if(ie!==null){ie.return=b.return,Ie=ie;break e}Ie=b.return}}var se=r.current;for(Ie=se;Ie!==null;){A=Ie;var ce=A.child;if((A.subtreeFlags&2064)!==0&&ce!==null)ce.return=A,Ie=ce;else e:for(A=se;Ie!==null;){if(X=Ie,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Su(9,X)}}catch(De){Pt(X,X.return,De)}if(X===A){Ie=null;break e}var be=X.sibling;if(be!==null){be.return=X.return,Ie=be;break e}Ie=X.return}}if(dt=v,zs(),vn&&typeof vn.onPostCommitFiberRoot=="function")try{vn.onPostCommitFiberRoot(dr,r)}catch{}g=!0}return g}finally{mt=d,tr.transition=o}}return!1}function Xb(r,o,d){o=di(d,o),o=pb(r,o,1),r=Ws(r,o,1),o=Nn(),r!==null&&(ka(r,1,o),Mn(r,o))}function Pt(r,o,d){if(r.tag===3)Xb(r,r,d);else for(;o!==null;){if(o.tag===3){Xb(o,r,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Gs===null||!Gs.has(g))){r=di(d,r),r=mb(o,r,1),o=Ws(o,r,1),r=Nn(),o!==null&&(ka(o,1,r),Mn(o,r));break}}o=o.return}}function PM(r,o,d){var g=r.pingCache;g!==null&&g.delete(o),o=Nn(),r.pingedLanes|=r.suspendedLanes&d,tn===r&&(ln&d)===d&&(Kt===4||Kt===3&&(ln&130023424)===ln&&500>St()-jf?Ja(r,0):Sf|=d),Mn(r,o)}function Zb(r,o){o===0&&((r.mode&1)===0?o=1:(o=wa,wa<<=1,(wa&130023424)===0&&(wa=4194304)));var d=Nn();r=ds(r,o),r!==null&&(ka(r,o,d),Mn(r,d))}function LM(r){var o=r.memoizedState,d=0;o!==null&&(d=o.retryLane),Zb(r,d)}function DM(r,o){var d=0;switch(r.tag){case 13:var g=r.stateNode,v=r.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),Zb(r,d)}var Qb;Qb=function(r,o,d){if(r!==null)if(r.memoizedProps!==o.pendingProps||Cn.current)An=!0;else{if((r.lanes&d)===0&&(o.flags&128)===0)return An=!1,SM(r,o,d);An=(r.flags&131072)!==0}else An=!1,Tt&&(o.flags&1048576)!==0&&R0(o,lu,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;_u(r,o),r=o.pendingProps;var v=ri(o,pn.current);ci(o,d),v=nf(null,o,g,r,v,d);var b=rf();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Tn(g)?(b=!0,au(o)):b=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Kh(o),v.updater=bu,o.stateNode=v,v._reactInternals=o,uf(o,g,r,d),o=pf(null,o,g,!0,b,d)):(o.tag=0,Tt&&b&&qh(o),_n(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch(_u(r,o),r=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=FM(g),r=br(g,r),v){case 0:o=ff(null,o,g,r,d);break e;case 1:o=Nb(null,o,g,r,d);break e;case 11:o=vb(null,o,g,r,d);break e;case 14:o=xb(null,o,g,br(g.type,r),d);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),ff(r,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),Nb(r,o,g,v,d);case 3:e:{if(Sb(o),r===null)throw Error(n(387));g=o.pendingProps,b=o.memoizedState,v=b.element,F0(r,o),pu(o,g,null,d);var A=o.memoizedState;if(g=A.element,b.isDehydrated)if(b={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){v=di(Error(n(423)),o),o=jb(r,o,g,d,v);break e}else if(g!==v){v=di(Error(n(424)),o),o=jb(r,o,g,d,v);break e}else for(qn=vr(o.stateNode.containerInfo.firstChild),Dn=o,Tt=!0,xr=null,d=D0(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(oi(),g===v){o=fs(r,o,d);break e}_n(r,o,g,d)}o=o.child}return o;case 5:return U0(o),r===null&&zh(o),g=o.type,v=o.pendingProps,b=r!==null?r.memoizedProps:null,A=v.children,Qo(g,v)?A=null:b!==null&&Qo(g,b)&&(o.flags|=32),_b(r,o),_n(r,o,A,d),o.child;case 6:return r===null&&zh(o),null;case 13:return Eb(r,o,d);case 4:return Xh(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=ii(o,null,g,d):_n(r,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),vb(r,o,g,v,d);case 7:return _n(r,o,o.pendingProps,d),o.child;case 8:return _n(r,o,o.pendingProps.children,d),o.child;case 12:return _n(r,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,b=o.memoizedProps,A=v.value,jt(du,g._currentValue),g._currentValue=A,b!==null)if(kn(b.value,A)){if(b.children===v.children&&!Cn.current){o=fs(r,o,d);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var X=b.dependencies;if(X!==null){A=b.child;for(var ne=X.firstContext;ne!==null;){if(ne.context===g){if(b.tag===1){ne=hs(-1,d&-d),ne.tag=2;var de=b.updateQueue;if(de!==null){de=de.shared;var we=de.pending;we===null?ne.next=ne:(ne.next=we.next,we.next=ne),de.pending=ne}}b.lanes|=d,ne=b.alternate,ne!==null&&(ne.lanes|=d),Vh(b.return,d,o),X.lanes|=d;break}ne=ne.next}}else if(b.tag===10)A=b.type===o.type?null:b.child;else if(b.tag===18){if(A=b.return,A===null)throw Error(n(341));A.lanes|=d,X=A.alternate,X!==null&&(X.lanes|=d),Vh(A,d,o),A=b.sibling}else A=b.child;if(A!==null)A.return=b;else for(A=b;A!==null;){if(A===o){A=null;break}if(b=A.sibling,b!==null){b.return=A.return,A=b;break}A=A.return}b=A}_n(r,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,ci(o,d),v=Jn(v),g=g(v),o.flags|=1,_n(r,o,g,d),o.child;case 14:return g=o.type,v=br(g,o.pendingProps),v=br(g.type,v),xb(r,o,g,v,d);case 15:return bb(r,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),_u(r,o),o.tag=1,Tn(g)?(r=!0,au(o)):r=!1,ci(o,d),hb(o,g,v),uf(o,g,v,d),pf(null,o,g,!0,r,d);case 19:return Tb(r,o,d);case 22:return kb(r,o,d)}throw Error(n(156,o.tag))};function Jb(r,o){return ha(r,o)}function qM(r,o,d,g){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(r,o,d,g){return new qM(r,o,d,g)}function $f(r){return r=r.prototype,!(!r||!r.isReactComponent)}function FM(r){if(typeof r=="function")return $f(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Z)return 11;if(r===K)return 14}return 2}function Xs(r,o){var d=r.alternate;return d===null?(d=nr(r.tag,o,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=o,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,o=r.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function $u(r,o,d,g,v,b){var A=2;if(g=r,typeof r=="function")$f(r)&&(A=1);else if(typeof r=="string")A=5;else e:switch(r){case I:return to(d.children,v,b,o);case F:A=8,v|=8;break;case W:return r=nr(12,d,o,v|2),r.elementType=W,r.lanes=b,r;case Q:return r=nr(13,d,o,v),r.elementType=Q,r.lanes=b,r;case M:return r=nr(19,d,o,v),r.elementType=M,r.lanes=b,r;case P:return Ou(d,v,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:A=10;break e;case B:A=9;break e;case Z:A=11;break e;case K:A=14;break e;case G:A=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=nr(A,d,o,v),o.elementType=r,o.type=g,o.lanes=b,o}function to(r,o,d,g){return r=nr(7,r,g,o),r.lanes=d,r}function Ou(r,o,d,g){return r=nr(22,r,g,o),r.elementType=P,r.lanes=d,r.stateNode={isHidden:!1},r}function Of(r,o,d){return r=nr(6,r,null,o),r.lanes=d,r}function Pf(r,o,d){return o=nr(4,r.children!==null?r.children:[],r.key,o),o.lanes=d,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function BM(r,o,d,g,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ss(0),this.expirationTimes=Ss(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ss(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Lf(r,o,d,g,v,b,A,X,ne){return r=new BM(r,o,d,X,ne),o===1?(o=1,b===!0&&(o|=8)):o=0,b=nr(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kh(b),r}function zM(r,o,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:r,containerInfo:o,implementation:d}}function ek(r){if(!r)return Bs;r=r._reactInternals;e:{if(rn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Tn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var d=r.type;if(Tn(d))return C0(r,d,o)}return o}function tk(r,o,d,g,v,b,A,X,ne){return r=Lf(d,g,!0,r,v,b,A,X,ne),r.context=ek(null),d=r.current,g=Nn(),v=Ys(d),b=hs(g,v),b.callback=o??null,Ws(d,b,v),r.current.lanes=v,ka(r,v,g),Mn(r,g),r}function Pu(r,o,d,g){var v=o.current,b=Nn(),A=Ys(v);return d=ek(d),o.context===null?o.context=d:o.pendingContext=d,o=hs(b,A),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ws(v,o,A),r!==null&&(Nr(r,v,A,b),fu(r,v,A)),A}function Lu(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function nk(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<o?d:o}}function Df(r,o){nk(r,o),(r=r.alternate)&&nk(r,o)}function UM(){return null}var rk=typeof reportError=="function"?reportError:function(r){console.error(r)};function qf(r){this._internalRoot=r}Du.prototype.render=qf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Pu(r,o,null,null)},Du.prototype.unmount=qf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Qa(function(){Pu(null,r,null,null)}),o[is]=null}};function Du(r){this._internalRoot=r}Du.prototype.unstable_scheduleHydration=function(r){if(r){var o=fr();r={blockedOn:null,target:r,priority:o};for(var d=0;d<Pn.length&&o!==0&&o<Pn[d].priority;d++);Pn.splice(d,0,r),d===0&&tl(r)}};function Ff(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function qu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function sk(){}function WM(r,o,d,g,v){if(v){if(typeof g=="function"){var b=g;g=function(){var de=Lu(A);b.call(de)}}var A=tk(o,g,r,0,null,!1,!1,"",sk);return r._reactRootContainer=A,r[is]=A.current,D(r.nodeType===8?r.parentNode:r),Qa(),A}for(;v=r.lastChild;)r.removeChild(v);if(typeof g=="function"){var X=g;g=function(){var de=Lu(ne);X.call(de)}}var ne=Lf(r,0,!1,null,null,!1,!1,"",sk);return r._reactRootContainer=ne,r[is]=ne.current,D(r.nodeType===8?r.parentNode:r),Qa(function(){Pu(o,ne,d,g)}),ne}function Fu(r,o,d,g,v){var b=d._reactRootContainer;if(b){var A=b;if(typeof v=="function"){var X=v;v=function(){var ne=Lu(A);X.call(ne)}}Pu(o,A,r,v)}else A=WM(d,o,r,v,g);return Lu(A)}_a=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var d=va(o.pendingLanes);d!==0&&(Ft(o,d|1),Mn(o,St()),(dt&6)===0&&(pi=St()+500,zs()))}break;case 13:Qa(function(){var g=ds(r,1);if(g!==null){var v=Nn();Nr(g,r,1,v)}}),Df(r,1)}},jo=function(r){if(r.tag===13){var o=ds(r,134217728);if(o!==null){var d=Nn();Nr(o,r,134217728,d)}Df(r,134217728)}},Pc=function(r){if(r.tag===13){var o=Ys(r),d=ds(r,o);if(d!==null){var g=Nn();Nr(d,r,o,g)}Df(r,o)}},fr=function(){return mt},Na=function(r,o){var d=mt;try{return mt=r,o()}finally{mt=d}},lt=function(r,o,d){switch(o){case"input":if(Ne(r,d),o=d.name,d.type==="radio"&&o!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var g=d[o];if(g!==r&&g.form===r.form){var v=ru(g);if(!v)throw Error(n(90));qe(g),Ne(g,v)}}}break;case"textarea":He(r,d);break;case"select":o=d.value,o!=null&&Ce(r,!!d.multiple,o,!1)}},Vn=Rf,Yn=Qa;var HM={usingClientEntryPoint:!1,Events:[Sl,ti,ru,Gn,It,Rf]},ql={findFiberByHostInstance:Wa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GM={bundleType:ql.bundleType,version:ql.version,rendererPackageName:ql.rendererPackageName,rendererConfig:ql.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=ua(r),r===null?null:r.stateNode},findFiberByHostInstance:ql.findFiberByHostInstance||UM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bu.isDisabled&&Bu.supportsFiber)try{dr=Bu.inject(GM),vn=Bu}catch{}}return In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HM,In.createPortal=function(r,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ff(o))throw Error(n(200));return zM(r,o,null,d)},In.createRoot=function(r,o){if(!Ff(r))throw Error(n(299));var d=!1,g="",v=rk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Lf(r,1,!1,null,null,d,!1,g,v),r[is]=o.current,D(r.nodeType===8?r.parentNode:r),new qf(o)},In.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=ua(o),r=r===null?null:r.stateNode,r},In.flushSync=function(r){return Qa(r)},In.hydrate=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!0,d)},In.hydrateRoot=function(r,o,d){if(!Ff(r))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,b="",A=rk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=tk(o,null,r,1,d??null,v,!1,b,A),r[is]=o.current,D(r),g)for(r=0;r<g.length;r++)d=g[r],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Du(o)},In.render=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!1,d)},In.unmountComponentAtNode=function(r){if(!qu(r))throw Error(n(40));return r._reactRootContainer?(Qa(function(){Fu(null,null,r,!1,function(){r._reactRootContainer=null,r[is]=null})}),!0):!1},In.unstable_batchedUpdates=Rf,In.unstable_renderSubtreeIntoContainer=function(r,o,d,g){if(!qu(d))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Fu(r,o,d,!1,g)},In.version="18.3.1-next-f1338f8080-20240426",In}var hk;function wT(){if(hk)return Uf.exports;hk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Uf.exports=JM(),Uf.exports}var fk;function eI(){if(fk)return Uu;fk=1;var e=wT();return Uu.createRoot=e.createRoot,Uu.hydrateRoot=e.hydrateRoot,Uu}var tI=eI();const nI="modulepreload",rI=function(e){return"/"+e},pk={},vT=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=rI(p),p in pk)return;pk[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":nI,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,N)=>{y.addEventListener("load",w),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};var x=bc();const pe=xx(x);function un(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=un(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Vf={},Yf={exports:{}},Kf={};/**
|
|
33
|
+
*/var dk;function JM(){if(dk)return On;dk=1;var e=bc(),t=QM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function i(r,o){c(r,o),c(r+"Capture",o)}function c(r,o){for(a[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},m={};function y(r){return f.call(m,r)?!0:f.call(h,r)?!1:p.test(r)?m[r]=!0:(h[r]=!0,!1)}function w(r,o,d,g){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,d,g){if(o===null||typeof o>"u"||w(r,o,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function _(r,o,d,g,v,k,A){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=r,this.type=o,this.sanitizeURL=k,this.removeEmptyString=A}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new _(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new _(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new _(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new _(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){S[r]=new _(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new _(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new _(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new _(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new _(r,5,!1,r.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function j(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(b,j);S[o]=new _(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(b,j);S[o]=new _(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(b,j);S[o]=new _(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new _(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new _(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,o,d,g){var v=S.hasOwnProperty(o)?S[o]:null;(v!==null?v.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,d,v,g)&&(d=null),g||v===null?y(o)&&(d===null?r.removeAttribute(o):r.setAttribute(o,""+d)):v.mustUseProperty?r[v.propertyName]=d===null?v.type===3?!1:"":d:(o=v.attributeName,g=v.attributeNamespace,d===null?r.removeAttribute(o):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?r.setAttributeNS(g,o,d):r.setAttribute(o,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),V=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),B=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Y=Object.assign,O;function F(r){if(O===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);O=o&&o[1]||""}return`
|
|
34
|
+
`+O+r}var oe=!1;function z(r,o){if(!r||oe)return"";oe=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(he){var g=he}Reflect.construct(r,[],o)}else{try{o.call()}catch(he){g=he}r.call(o.prototype)}else{try{throw Error()}catch(he){g=he}r()}}catch(he){if(he&&g&&typeof he.stack=="string"){for(var v=he.stack.split(`
|
|
35
|
+
`),k=g.stack.split(`
|
|
36
|
+
`),A=v.length-1,K=k.length-1;1<=A&&0<=K&&v[A]!==k[K];)K--;for(;1<=A&&0<=K;A--,K--)if(v[A]!==k[K]){if(A!==1||K!==1)do if(A--,K--,0>K||v[A]!==k[K]){var ne=`
|
|
37
|
+
`+v[A].replace(" at new "," at ");return r.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",r.displayName)),ne}while(1<=A&&0<=K);break}}}finally{oe=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?F(r):""}function Z(r){switch(r.tag){case 5:return F(r.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return r=z(r.type,!1),r;case 11:return r=z(r.type.render,!1),r;case 1:return r=z(r.type,!0),r;default:return""}}function U(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case R:return"Portal";case H:return"Profiler";case L:return"StrictMode";case J:return"Suspense";case M:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case V:return(r.displayName||"Context")+".Consumer";case $:return(r._context.displayName||"Context")+".Provider";case Q:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return o=r.displayName||null,o!==null?o:U(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return U(r(o))}catch{}}return null}function re(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(o);case 8:return o===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function de(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ge(r){var o=pe(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,k=d.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,k.call(this,A)}}),Object.defineProperty(r,o,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Te(r){r._valueTracker||(r._valueTracker=ge(r))}function Ue(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var d=o.getValue(),g="";return r&&(g=pe(r)?r.checked?"true":"false":r.value),r=g,r!==d?(o.setValue(r),!0):!1}function He(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Pe(r,o){var d=o.checked;return Y({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function Se(r,o){var d=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;d=de(o.value!=null?o.value:d),r._wrapperState={initialChecked:g,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function nt(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function je(r,o){nt(r,o);var d=de(o.value),g=o.type;if(d!=null)g==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ke(r,o.type,d):o.hasOwnProperty("defaultValue")&&Ke(r,o.type,de(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function be(r,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var g=o.type;if(!(g!=="submit"&&g!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,d||o===r.value||(r.value=o),r.defaultValue=o}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function Ke(r,o,d){(o!=="number"||He(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var ct=Array.isArray;function Ye(r,o,d,g){if(r=r.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<r.length;d++)v=o.hasOwnProperty("$"+r[d].value),r[d].selected!==v&&(r[d].selected=v),v&&g&&(r[d].defaultSelected=!0)}else{for(d=""+de(d),o=null,v=0;v<r.length;v++){if(r[v].value===d){r[v].selected=!0,g&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function ce(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return Y({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function ke(r,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(ct(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}r._wrapperState={initialValue:de(d)}}function Ee(r,o){var d=de(o.value),g=de(o.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),o.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),g!=null&&(r.defaultValue=""+g)}function Ze(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Xe(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ut(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Xe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ee,Ne=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,g,v){MSApp.execUnsafeLocalFunction(function(){return r(o,d,g,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ee=ee||document.createElement("div"),ee.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ee.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Be(r,o){if(o){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=o;return}}r.textContent=o}var et={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pt=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(r){pt.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),et[o]=et[r]})});function tt(r,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||et.hasOwnProperty(r)&&et[r]?(""+o).trim():o+"px"}function rt(r,o){r=r.style;for(var d in o)if(o.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=tt(d,o[d],g);d==="float"&&(d="cssFloat"),g?r.setProperty(d,v):r[d]=v}}var lt=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bt(r,o){if(o){if(lt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function st(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mt=null;function ze(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Dt=null,me=null,gt=null;function kt(r){if(r=El(r)){if(typeof Dt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=ru(o),Dt(r.stateNode,r.type,o))}}function jn(r){me?gt?gt.push(r):gt=[r]:me=r}function En(){if(me){var r=me,o=gt;if(gt=me=null,kt(r),o)for(r=0;r<o.length;r++)kt(o[r])}}function Yn(r,o){return r(o)}function qt(){}var Ft=!1;function Kn(r,o,d){if(Ft)return r(o,d);Ft=!0;try{return Yn(r,o,d)}finally{Ft=!1,(me!==null||gt!==null)&&(qt(),En())}}function te(r,o){var d=r.stateNode;if(d===null)return null;var g=ru(d);if(g===null)return null;d=g[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var Ae=!1;if(u)try{var Ie={};Object.defineProperty(Ie,"passive",{get:function(){Ae=!0}}),window.addEventListener("test",Ie,Ie),window.removeEventListener("test",Ie,Ie)}catch{Ae=!1}function Me(r,o,d,g,v,k,A,K,ne){var he=Array.prototype.slice.call(arguments,3);try{o.apply(d,he)}catch(we){this.onError(we)}}var De=!1,dt=null,Tt=!1,vt=null,Qr={onError:function(r){De=!0,dt=r}};function _t(r,o,d,g,v,k,A,K,ne){De=!1,dt=null,Me.apply(Qr,arguments)}function Jt(r,o,d,g,v,k,A,K,ne){if(_t.apply(this,arguments),De){if(De){var he=dt;De=!1,dt=null}else throw Error(n(198));Tt||(Tt=!0,vt=he)}}function rn(r){var o=r,d=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(d=o.return),r=o.return;while(r)}return o.tag===3?d:null}function Pr(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function No(r){if(rn(r)!==r)throw Error(n(188))}function Zi(r){var o=r.alternate;if(!o){if(o=rn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var d=r,g=o;;){var v=d.return;if(v===null)break;var k=v.alternate;if(k===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===d)return No(v),r;if(k===g)return No(v),o;k=k.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=k;else{for(var A=!1,K=v.child;K;){if(K===d){A=!0,d=v,g=k;break}if(K===g){A=!0,g=v,d=k;break}K=K.sibling}if(!A){for(K=k.child;K;){if(K===d){A=!0,d=k,g=v;break}if(K===g){A=!0,g=k,d=v;break}K=K.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?r:o}function ha(r){return r=Zi(r),r!==null?fa(r):null}function fa(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=fa(r);if(o!==null)return o;r=r.sibling}return null}var pa=t.unstable_scheduleCallback,Ns=t.unstable_cancelCallback,ma=t.unstable_shouldYield,ga=t.unstable_requestPaint,jt=t.unstable_now,Qi=t.unstable_getCurrentPriorityLevel,Ss=t.unstable_ImmediatePriority,So=t.unstable_UserBlockingPriority,Lr=t.unstable_NormalPriority,ya=t.unstable_LowPriority,jo=t.unstable_IdlePriority,dr=null,vn=null;function Dr(r){if(vn&&typeof vn.onCommitFiberRoot=="function")try{vn.onCommitFiberRoot(dr,r,void 0,(r.current.flags&128)===128)}catch{}}var Cn=Math.clz32?Math.clz32:Sh,Oc=Math.log,wa=Math.LN2;function Sh(r){return r>>>=0,r===0?32:31-(Oc(r)/wa|0)|0}var va=64,xa=4194304;function ba(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ka(r,o){var d=r.pendingLanes;if(d===0)return 0;var g=0,v=r.suspendedLanes,k=r.pingedLanes,A=d&268435455;if(A!==0){var K=A&~v;K!==0?g=ba(K):(k&=A,k!==0&&(g=ba(k)))}else A=d&~v,A!==0?g=ba(A):k!==0&&(g=ba(k));if(g===0)return 0;if(o!==0&&o!==g&&(o&v)===0&&(v=g&-g,k=o&-o,v>=k||v===16&&(k&4194240)!==0))return o;if((g&4)!==0&&(g|=d&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)d=31-Cn(o),v=1<<d,g|=r[d],o&=~v;return g}function _a(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jh(r,o){for(var d=r.suspendedLanes,g=r.pingedLanes,v=r.expirationTimes,k=r.pendingLanes;0<k;){var A=31-Cn(k),K=1<<A,ne=v[A];ne===-1?((K&d)===0||(K&g)!==0)&&(v[A]=_a(K,o)):ne<=o&&(r.expiredLanes|=K),k&=~K}}function Eo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Tn(){var r=va;return va<<=1,(va&4194240)===0&&(va=64),r}function js(r){for(var o=[],d=0;31>d;d++)o.push(r);return o}function Na(r,o,d){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-Cn(o),r[o]=d}function Ji(r,o){var d=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var g=r.eventTimes;for(r=r.expirationTimes;0<d;){var v=31-Cn(d),k=1<<v;o[v]=0,g[v]=-1,r[v]=-1,d&=~k}}function Bt(r,o){var d=r.entangledLanes|=o;for(r=r.entanglements;d;){var g=31-Cn(d),v=1<<g;v&o|r[g]&o&&(r[g]|=o),d&=~v}}var yt=0;function hr(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Sa,Co,Pc,fr,ja,el=!1,To=[],pr=null,mr=null,xn=null,Es=new Map,Cs=new Map,Dn=[],tl="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function nl(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":xn=null;break;case"pointerover":case"pointerout":Es.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cs.delete(o.pointerId)}}function Ts(r,o,d,g,v,k){return r===null||r.nativeEvent!==k?(r={blockedOn:o,domEventName:d,eventSystemFlags:g,nativeEvent:k,targetContainers:[v]},o!==null&&(o=El(o),o!==null&&Co(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Lc(r,o,d,g,v){switch(o){case"focusin":return pr=Ts(pr,r,o,d,g,v),!0;case"dragenter":return mr=Ts(mr,r,o,d,g,v),!0;case"mouseover":return xn=Ts(xn,r,o,d,g,v),!0;case"pointerover":var k=v.pointerId;return Es.set(k,Ts(Es.get(k)||null,r,o,d,g,v)),!0;case"gotpointercapture":return k=v.pointerId,Cs.set(k,Ts(Cs.get(k)||null,r,o,d,g,v)),!0}return!1}function rl(r){var o=Ga(r.target);if(o!==null){var d=rn(o);if(d!==null){if(o=d.tag,o===13){if(o=Pr(d),o!==null){r.blockedOn=o,ja(r.priority,function(){Pc(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function zt(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var d=Io(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var g=new d.constructor(d.type,d);mt=g,d.target.dispatchEvent(g),mt=null}else return o=El(d),o!==null&&Co(o),r.blockedOn=d,!1;o.shift()}return!0}function Ea(r,o,d){zt(r)&&d.delete(o)}function Ao(){el=!1,pr!==null&&zt(pr)&&(pr=null),mr!==null&&zt(mr)&&(mr=null),xn!==null&&zt(xn)&&(xn=null),Es.forEach(Ea),Cs.forEach(Ea)}function Jr(r,o){r.blockedOn===o&&(r.blockedOn=null,el||(el=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ao)))}function Ca(r){function o(v){return Jr(v,r)}if(0<To.length){Jr(To[0],r);for(var d=1;d<To.length;d++){var g=To[d];g.blockedOn===r&&(g.blockedOn=null)}}for(pr!==null&&Jr(pr,r),mr!==null&&Jr(mr,r),xn!==null&&Jr(xn,r),Es.forEach(o),Cs.forEach(o),d=0;d<Dn.length;d++)g=Dn[d],g.blockedOn===r&&(g.blockedOn=null);for(;0<Dn.length&&(d=Dn[0],d.blockedOn===null);)rl(d),d.blockedOn===null&&Dn.shift()}var qn=C.ReactCurrentBatchConfig,Ta=!0;function As(r,o,d,g){var v=yt,k=qn.transition;qn.transition=null;try{yt=1,Ro(r,o,d,g)}finally{yt=v,qn.transition=k}}function Eh(r,o,d,g){var v=yt,k=qn.transition;qn.transition=null;try{yt=4,Ro(r,o,d,g)}finally{yt=v,qn.transition=k}}function Ro(r,o,d,g){if(Ta){var v=Io(r,o,d,g);if(v===null)ae(r,o,g,Mo,d),nl(r,g);else if(Lc(v,r,o,d,g))g.stopPropagation();else if(nl(r,g),o&4&&-1<tl.indexOf(r)){for(;v!==null;){var k=El(v);if(k!==null&&Sa(k),k=Io(r,o,d,g),k===null&&ae(r,o,g,Mo,d),k===v)break;v=k}v!==null&&g.stopPropagation()}else ae(r,o,g,null,d)}}var Mo=null;function Io(r,o,d,g){if(Mo=null,r=ze(g),r=Ga(r),r!==null)if(o=rn(r),o===null)r=null;else if(d=o.tag,d===13){if(r=Pr(o),r!==null)return r;r=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Mo=r,null}function Dc(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qi()){case Ss:return 1;case So:return 4;case Lr:case ya:return 16;case jo:return 536870912;default:return 16}default:return 16}}var hn=null,es=null,Aa=null;function Rs(){if(Aa)return Aa;var r,o=es,d=o.length,g,v="value"in hn?hn.value:hn.textContent,k=v.length;for(r=0;r<d&&o[r]===v[r];r++);var A=d-r;for(g=1;g<=A&&o[d-g]===v[k-g];g++);return Aa=v.slice(r,1<g?1-g:void 0)}function Ra(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Ms(){return!0}function Xn(){return!1}function bn(r){function o(d,g,v,k,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=k,this.target=A,this.currentTarget=null;for(var K in r)r.hasOwnProperty(K)&&(d=r[K],this[K]=d?d(k):k[K]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Ms:Xn,this.isPropagationStopped=Xn,this}return Y(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Ms)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Ms)},persist:function(){},isPersistent:Ms}),o}var Vt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ma=bn(Vt),ts=Y({},Vt,{view:0,detail:0}),qc=bn(ts),Is,Ia,$s,Os=Y({},ts,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oo,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==$s&&($s&&r.type==="mousemove"?(Is=r.screenX-$s.screenX,Ia=r.screenY-$s.screenY):Ia=Is=0,$s=r),Is)},movementY:function(r){return"movementY"in r?r.movementY:Ia}}),sl=bn(Os),Ch=Y({},Os,{dataTransfer:0}),ns=bn(Ch),al=Y({},ts,{relatedTarget:0}),$o=bn(al),ol=Y({},Vt,{animationName:0,elapsedTime:0,pseudoElement:0}),Fc=bn(ol),il=Y({},Vt,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),rs=bn(il),Bc=Y({},Vt,{data:0}),zc=bn(Bc),Uc={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wc={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Th={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sn(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Th[r])?!!o[r]:!1}function Oo(){return sn}var Po=Y({},ts,{key:function(r){if(r.key){var o=Uc[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Ra(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Wc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oo,charCode:function(r){return r.type==="keypress"?Ra(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ra(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ps=bn(Po),$a=Y({},Os,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lo=bn($a),ll=Y({},ts,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oo}),Do=bn(ll),Oa=Y({},Vt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hc=bn(Oa),Ah=Y({},Os,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Rh=bn(Ah),qo=[9,13,27,32],cl=u&&"CompositionEvent"in window,Pa=null;u&&"documentMode"in document&&(Pa=document.documentMode);var ul=u&&"TextEvent"in window&&!Pa,gr=u&&(!cl||Pa&&8<Pa&&11>=Pa),Ls=" ",dl=!1;function Gc(r,o){switch(r){case"keyup":return qo.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ss=!1;function Mh(r,o){switch(r){case"compositionend":return Vc(o);case"keypress":return o.which!==32?null:(dl=!0,Ls);case"textInput":return r=o.data,r===Ls&&dl?null:r;default:return null}}function Ih(r,o){if(ss)return r==="compositionend"||!cl&&Gc(r,o)?(r=Rs(),Aa=es=hn=null,ss=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return gr&&o.locale!=="ko"?null:o.data;default:return null}}var fn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yc(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!fn[r.type]:o==="textarea"}function Kc(r,o,d,g){jn(g),o=Ce(o,"onChange"),0<o.length&&(d=new Ma("onChange","change",null,d,g),r.push({event:d,listeners:o}))}var La=null,qr=null;function Fo(r){_l(r,0)}function Bo(r){var o=ri(r);if(Ue(o))return r}function yr(r,o){if(r==="change")return o}var hl=!1;if(u){var fl;if(u){var zo="oninput"in document;if(!zo){var pl=document.createElement("div");pl.setAttribute("oninput","return;"),zo=typeof pl.oninput=="function"}fl=zo}else fl=!1;hl=fl&&(!document.documentMode||9<document.documentMode)}function Xc(){La&&(La.detachEvent("onpropertychange",Da),qr=La=null)}function Da(r){if(r.propertyName==="value"&&Bo(qr)){var o=[];Kc(o,qr,r,ze(r)),Kn(Fo,o)}}function $h(r,o,d){r==="focusin"?(Xc(),La=o,qr=d,La.attachEvent("onpropertychange",Da)):r==="focusout"&&Xc()}function ml(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Bo(qr)}function Zc(r,o){if(r==="click")return Bo(o)}function Qc(r,o){if(r==="input"||r==="change")return Bo(o)}function Jc(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var kn=typeof Object.is=="function"?Object.is:Jc;function Fr(r,o){if(kn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var d=Object.keys(r),g=Object.keys(o);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(o,v)||!kn(r[v],o[v]))return!1}return!0}function Uo(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function gl(r,o){var d=Uo(r);r=0;for(var g;d;){if(d.nodeType===3){if(g=r+d.textContent.length,r<=o&&g>=o)return{node:d,offset:o-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Uo(d)}}function qa(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?qa(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Wo(){for(var r=window,o=He();o instanceof r.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)r=o.contentWindow;else break;o=He(r.document)}return o}function Ds(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function yl(r){var o=Wo(),d=r.focusedElem,g=r.selectionRange;if(o!==d&&d&&d.ownerDocument&&qa(d.ownerDocument.documentElement,d)){if(g!==null&&Ds(d)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(r,d.value.length);else if(r=(o=d.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=d.textContent.length,k=Math.min(g.start,v);g=g.end===void 0?k:Math.min(g.end,v),!r.extend&&k>g&&(v=g,g=k,k=v),v=gl(d,k);var A=gl(d,g);v&&A&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==A.node||r.focusOffset!==A.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),k>g?(r.addRange(o),r.extend(A.node,A.offset)):(o.setEnd(A.node,A.offset),r.addRange(o)))}}for(o=[],r=d;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)r=o[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var qs=u&&"documentMode"in document&&11>=document.documentMode,as=null,Ho=null,$t=null,Go=!1;function wl(r,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Go||as==null||as!==He(g)||(g=as,"selectionStart"in g&&Ds(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),$t&&Fr($t,g)||($t=g,g=Ce(Ho,"onSelect"),0<g.length&&(o=new Ma("onSelect","select",null,o,d),r.push({event:o,listeners:g}),o.target=as)))}function Vo(r,o){var d={};return d[r.toLowerCase()]=o.toLowerCase(),d["Webkit"+r]="webkit"+o,d["Moz"+r]="moz"+o,d}var Fs={animationend:Vo("Animation","AnimationEnd"),animationiteration:Vo("Animation","AnimationIteration"),animationstart:Vo("Animation","AnimationStart"),transitionend:Vo("Transition","TransitionEnd")},Yo={},Fa={};u&&(Fa=document.createElement("div").style,"AnimationEvent"in window||(delete Fs.animationend.animation,delete Fs.animationiteration.animation,delete Fs.animationstart.animation),"TransitionEvent"in window||delete Fs.transitionend.transition);function Ko(r){if(Yo[r])return Yo[r];if(!Fs[r])return r;var o=Fs[r],d;for(d in o)if(o.hasOwnProperty(d)&&d in Fa)return Yo[r]=o[d];return r}var Br=Ko("animationend"),Xo=Ko("animationiteration"),Ba=Ko("animationstart"),Zo=Ko("transitionend"),eu=new Map,vl="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function wr(r,o){eu.set(r,o),i(o,[r])}for(var xl=0;xl<vl.length;xl++){var bl=vl[xl],tu=bl.toLowerCase(),za=bl[0].toUpperCase()+bl.slice(1);wr(tu,"on"+za)}wr(Br,"onAnimationEnd"),wr(Xo,"onAnimationIteration"),wr(Ba,"onAnimationStart"),wr("dblclick","onDoubleClick"),wr("focusin","onFocus"),wr("focusout","onBlur"),wr(Zo,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var os="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Oh=new Set("cancel close invalid load scroll toggle".split(" ").concat(os));function kl(r,o,d){var g=r.type||"unknown-event";r.currentTarget=d,Jt(g,o,void 0,r),r.currentTarget=null}function _l(r,o){o=(o&4)!==0;for(var d=0;d<r.length;d++){var g=r[d],v=g.event;g=g.listeners;e:{var k=void 0;if(o)for(var A=g.length-1;0<=A;A--){var K=g[A],ne=K.instance,he=K.currentTarget;if(K=K.listener,ne!==k&&v.isPropagationStopped())break e;kl(v,K,he),k=ne}else for(A=0;A<g.length;A++){if(K=g[A],ne=K.instance,he=K.currentTarget,K=K.listener,ne!==k&&v.isPropagationStopped())break e;kl(v,K,he),k=ne}}}if(Tt)throw r=vt,Tt=!1,vt=null,r}function xt(r,o){var d=o[Ph];d===void 0&&(d=o[Ph]=new Set);var g=r+"__bubble";d.has(g)||(q(o,r,2,!1),d.add(g))}function Qo(r,o,d){var g=0;o&&(g|=4),q(d,r,g,o)}var Ua="_reactListening"+Math.random().toString(36).slice(2);function D(r){if(!r[Ua]){r[Ua]=!0,s.forEach(function(d){d!=="selectionchange"&&(Oh.has(d)||Qo(d,!1,r),Qo(d,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Ua]||(o[Ua]=!0,Qo("selectionchange",!1,o))}}function q(r,o,d,g){switch(Dc(o)){case 1:var v=As;break;case 4:v=Eh;break;default:v=Ro}d=v.bind(null,o,d,r),v=void 0,!Ae||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),g?v!==void 0?r.addEventListener(o,d,{capture:!0,passive:v}):r.addEventListener(o,d,!0):v!==void 0?r.addEventListener(o,d,{passive:v}):r.addEventListener(o,d,!1)}function ae(r,o,d,g,v){var k=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var K=g.stateNode.containerInfo;if(K===v||K.nodeType===8&&K.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var ne=A.tag;if((ne===3||ne===4)&&(ne=A.stateNode.containerInfo,ne===v||ne.nodeType===8&&ne.parentNode===v))return;A=A.return}for(;K!==null;){if(A=Ga(K),A===null)return;if(ne=A.tag,ne===5||ne===6){g=k=A;continue e}K=K.parentNode}}g=g.return}Kn(function(){var he=k,we=ze(d),xe=[];e:{var ye=eu.get(r);if(ye!==void 0){var Re=Ma,Oe=r;switch(r){case"keypress":if(Ra(d)===0)break e;case"keydown":case"keyup":Re=Ps;break;case"focusin":Oe="focus",Re=$o;break;case"focusout":Oe="blur",Re=$o;break;case"beforeblur":case"afterblur":Re=$o;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Re=sl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Re=ns;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Re=Do;break;case Br:case Xo:case Ba:Re=Fc;break;case Zo:Re=Hc;break;case"scroll":Re=qc;break;case"wheel":Re=Rh;break;case"copy":case"cut":case"paste":Re=rs;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Re=Lo}var Le=(o&4)!==0,Ut=!Le&&r==="scroll",le=Le?ye!==null?ye+"Capture":null:ye;Le=[];for(var se=he,ue;se!==null;){ue=se;var _e=ue.stateNode;if(ue.tag===5&&_e!==null&&(ue=_e,le!==null&&(_e=te(se,le),_e!=null&&Le.push(ie(se,_e,ue)))),Ut)break;se=se.return}0<Le.length&&(ye=new Re(ye,Oe,null,d,we),xe.push({event:ye,listeners:Le}))}}if((o&7)===0){e:{if(ye=r==="mouseover"||r==="pointerover",Re=r==="mouseout"||r==="pointerout",ye&&d!==mt&&(Oe=d.relatedTarget||d.fromElement)&&(Ga(Oe)||Oe[ls]))break e;if((Re||ye)&&(ye=we.window===we?we:(ye=we.ownerDocument)?ye.defaultView||ye.parentWindow:window,Re?(Oe=d.relatedTarget||d.toElement,Re=he,Oe=Oe?Ga(Oe):null,Oe!==null&&(Ut=rn(Oe),Oe!==Ut||Oe.tag!==5&&Oe.tag!==6)&&(Oe=null)):(Re=null,Oe=he),Re!==Oe)){if(Le=sl,_e="onMouseLeave",le="onMouseEnter",se="mouse",(r==="pointerout"||r==="pointerover")&&(Le=Lo,_e="onPointerLeave",le="onPointerEnter",se="pointer"),Ut=Re==null?ye:ri(Re),ue=Oe==null?ye:ri(Oe),ye=new Le(_e,se+"leave",Re,d,we),ye.target=Ut,ye.relatedTarget=ue,_e=null,Ga(we)===he&&(Le=new Le(le,se+"enter",Oe,d,we),Le.target=ue,Le.relatedTarget=Ut,_e=Le),Ut=_e,Re&&Oe)t:{for(Le=Re,le=Oe,se=0,ue=Le;ue;ue=ve(ue))se++;for(ue=0,_e=le;_e;_e=ve(_e))ue++;for(;0<se-ue;)Le=ve(Le),se--;for(;0<ue-se;)le=ve(le),ue--;for(;se--;){if(Le===le||le!==null&&Le===le.alternate)break t;Le=ve(Le),le=ve(le)}Le=null}else Le=null;Re!==null&&We(xe,ye,Re,Le,!1),Oe!==null&&Ut!==null&&We(xe,Ut,Oe,Le,!0)}}e:{if(ye=he?ri(he):window,Re=ye.nodeName&&ye.nodeName.toLowerCase(),Re==="select"||Re==="input"&&ye.type==="file")var qe=yr;else if(Yc(ye))if(hl)qe=Qc;else{qe=ml;var Ge=$h}else(Re=ye.nodeName)&&Re.toLowerCase()==="input"&&(ye.type==="checkbox"||ye.type==="radio")&&(qe=Zc);if(qe&&(qe=qe(r,he))){Kc(xe,qe,d,we);break e}Ge&&Ge(r,ye,he),r==="focusout"&&(Ge=ye._wrapperState)&&Ge.controlled&&ye.type==="number"&&Ke(ye,"number",ye.value)}switch(Ge=he?ri(he):window,r){case"focusin":(Yc(Ge)||Ge.contentEditable==="true")&&(as=Ge,Ho=he,$t=null);break;case"focusout":$t=Ho=as=null;break;case"mousedown":Go=!0;break;case"contextmenu":case"mouseup":case"dragend":Go=!1,wl(xe,d,we);break;case"selectionchange":if(qs)break;case"keydown":case"keyup":wl(xe,d,we)}var Ve;if(cl)e:{switch(r){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else ss?Gc(r,d)&&(Qe="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Qe="onCompositionStart");Qe&&(gr&&d.locale!=="ko"&&(ss||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&ss&&(Ve=Rs()):(hn=we,es="value"in hn?hn.value:hn.textContent,ss=!0)),Ge=Ce(he,Qe),0<Ge.length&&(Qe=new zc(Qe,r,null,d,we),xe.push({event:Qe,listeners:Ge}),Ve?Qe.data=Ve:(Ve=Vc(d),Ve!==null&&(Qe.data=Ve)))),(Ve=ul?Mh(r,d):Ih(r,d))&&(he=Ce(he,"onBeforeInput"),0<he.length&&(we=new zc("onBeforeInput","beforeinput",null,d,we),xe.push({event:we,listeners:he}),we.data=Ve))}_l(xe,o)})}function ie(r,o,d){return{instance:r,listener:o,currentTarget:d}}function Ce(r,o){for(var d=o+"Capture",g=[];r!==null;){var v=r,k=v.stateNode;v.tag===5&&k!==null&&(v=k,k=te(r,d),k!=null&&g.unshift(ie(r,k,v)),k=te(r,o),k!=null&&g.push(ie(r,k,v))),r=r.return}return g}function ve(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function We(r,o,d,g,v){for(var k=o._reactName,A=[];d!==null&&d!==g;){var K=d,ne=K.alternate,he=K.stateNode;if(ne!==null&&ne===g)break;K.tag===5&&he!==null&&(K=he,v?(ne=te(d,k),ne!=null&&A.unshift(ie(d,ne,K))):v||(ne=te(d,k),ne!=null&&A.push(ie(d,ne,K)))),d=d.return}A.length!==0&&r.push({event:o,listeners:A})}var at=/\r\n?/g,Nt=/\u0000|\uFFFD/g;function Je(r){return(typeof r=="string"?r:""+r).replace(at,`
|
|
38
|
+
`).replace(Nt,"")}function an(r,o,d){if(o=Je(o),Je(r)!==o&&d)throw Error(n(425))}function is(){}var Jo=null,Nl=null;function ei(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Sl=typeof setTimeout=="function"?setTimeout:void 0,nu=typeof clearTimeout=="function"?clearTimeout:void 0,ti=typeof Promise=="function"?Promise:void 0,Wa=typeof queueMicrotask=="function"?queueMicrotask:typeof ti<"u"?function(r){return ti.resolve(null).then(r).catch(Ha)}:Sl;function Ha(r){setTimeout(function(){throw r})}function Ot(r,o){var d=o,g=0;do{var v=d.nextSibling;if(r.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){r.removeChild(v),Ca(o);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);Ca(o)}function vr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function j0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return r;o--}else d==="/$"&&o++}r=r.previousSibling}return null}var ni=Math.random().toString(36).slice(2),zr="__reactFiber$"+ni,jl="__reactProps$"+ni,ls="__reactContainer$"+ni,Ph="__reactEvents$"+ni,dM="__reactListeners$"+ni,hM="__reactHandles$"+ni;function Ga(r){var o=r[zr];if(o)return o;for(var d=r.parentNode;d;){if(o=d[ls]||d[zr]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(r=j0(r);r!==null;){if(d=r[zr])return d;r=j0(r)}return o}r=d,d=r.parentNode}return null}function El(r){return r=r[zr]||r[ls],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ri(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function ru(r){return r[jl]||null}var Lh=[],si=-1;function Bs(r){return{current:r}}function Ct(r){0>si||(r.current=Lh[si],Lh[si]=null,si--)}function Et(r,o){si++,Lh[si]=r.current,r.current=o}var zs={},pn=Bs(zs),An=Bs(!1),Va=zs;function ai(r,o){var d=r.type.contextTypes;if(!d)return zs;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var v={},k;for(k in d)v[k]=o[k];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function Rn(r){return r=r.childContextTypes,r!=null}function su(){Ct(An),Ct(pn)}function E0(r,o,d){if(pn.current!==zs)throw Error(n(168));Et(pn,o),Et(An,d)}function C0(r,o,d){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in o))throw Error(n(108,re(r)||"Unknown",v));return Y({},d,g)}function au(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||zs,Va=pn.current,Et(pn,r),Et(An,An.current),!0}function T0(r,o,d){var g=r.stateNode;if(!g)throw Error(n(169));d?(r=C0(r,o,Va),g.__reactInternalMemoizedMergedChildContext=r,Ct(An),Ct(pn),Et(pn,r)):Ct(An),Et(An,d)}var cs=null,ou=!1,Dh=!1;function A0(r){cs===null?cs=[r]:cs.push(r)}function fM(r){ou=!0,A0(r)}function Us(){if(!Dh&&cs!==null){Dh=!0;var r=0,o=yt;try{var d=cs;for(yt=1;r<d.length;r++){var g=d[r];do g=g(!0);while(g!==null)}cs=null,ou=!1}catch(v){throw cs!==null&&(cs=cs.slice(r+1)),pa(Ss,Us),v}finally{yt=o,Dh=!1}}return null}var oi=[],ii=0,iu=null,lu=0,Zn=[],Qn=0,Ya=null,us=1,ds="";function Ka(r,o){oi[ii++]=lu,oi[ii++]=iu,iu=r,lu=o}function R0(r,o,d){Zn[Qn++]=us,Zn[Qn++]=ds,Zn[Qn++]=Ya,Ya=r;var g=us;r=ds;var v=32-Cn(g)-1;g&=~(1<<v),d+=1;var k=32-Cn(o)+v;if(30<k){var A=v-v%5;k=(g&(1<<A)-1).toString(32),g>>=A,v-=A,us=1<<32-Cn(o)+v|d<<v|g,ds=k+r}else us=1<<k|d<<v|g,ds=r}function qh(r){r.return!==null&&(Ka(r,1),R0(r,1,0))}function Fh(r){for(;r===iu;)iu=oi[--ii],oi[ii]=null,lu=oi[--ii],oi[ii]=null;for(;r===Ya;)Ya=Zn[--Qn],Zn[Qn]=null,ds=Zn[--Qn],Zn[Qn]=null,us=Zn[--Qn],Zn[Qn]=null}var Fn=null,Bn=null,At=!1,xr=null;function M0(r,o){var d=nr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=r,o=r.deletions,o===null?(r.deletions=[d],r.flags|=16):o.push(d)}function I0(r,o){switch(r.tag){case 5:var d=r.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,Fn=r,Bn=vr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Fn=r,Bn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Ya!==null?{id:us,overflow:ds}:null,r.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=nr(18,null,null,0),d.stateNode=o,d.return=r,r.child=d,Fn=r,Bn=null,!0):!1;default:return!1}}function Bh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function zh(r){if(At){var o=Bn;if(o){var d=o;if(!I0(r,o)){if(Bh(r))throw Error(n(418));o=vr(d.nextSibling);var g=Fn;o&&I0(r,o)?M0(g,d):(r.flags=r.flags&-4097|2,At=!1,Fn=r)}}else{if(Bh(r))throw Error(n(418));r.flags=r.flags&-4097|2,At=!1,Fn=r}}}function $0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Fn=r}function cu(r){if(r!==Fn)return!1;if(!At)return $0(r),At=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!ei(r.type,r.memoizedProps)),o&&(o=Bn)){if(Bh(r))throw O0(),Error(n(418));for(;o;)M0(r,o),o=vr(o.nextSibling)}if($0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(o===0){Bn=vr(r.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}r=r.nextSibling}Bn=null}}else Bn=Fn?vr(r.stateNode.nextSibling):null;return!0}function O0(){for(var r=Bn;r;)r=vr(r.nextSibling)}function li(){Bn=Fn=null,At=!1}function Uh(r){xr===null?xr=[r]:xr.push(r)}var pM=C.ReactCurrentBatchConfig;function Cl(r,o,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,r));var v=g,k=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===k?o.ref:(o=function(A){var K=v.refs;A===null?delete K[k]:K[k]=A},o._stringRef=k,o)}if(typeof r!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,r))}return r}function uu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function P0(r){var o=r._init;return o(r._payload)}function L0(r){function o(le,se){if(r){var ue=le.deletions;ue===null?(le.deletions=[se],le.flags|=16):ue.push(se)}}function d(le,se){if(!r)return null;for(;se!==null;)o(le,se),se=se.sibling;return null}function g(le,se){for(le=new Map;se!==null;)se.key!==null?le.set(se.key,se):le.set(se.index,se),se=se.sibling;return le}function v(le,se){return le=Zs(le,se),le.index=0,le.sibling=null,le}function k(le,se,ue){return le.index=ue,r?(ue=le.alternate,ue!==null?(ue=ue.index,ue<se?(le.flags|=2,se):ue):(le.flags|=2,se)):(le.flags|=1048576,se)}function A(le){return r&&le.alternate===null&&(le.flags|=2),le}function K(le,se,ue,_e){return se===null||se.tag!==6?(se=Of(ue,le.mode,_e),se.return=le,se):(se=v(se,ue),se.return=le,se)}function ne(le,se,ue,_e){var qe=ue.type;return qe===I?we(le,se,ue.props.children,_e,ue.key):se!==null&&(se.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&P0(qe)===se.type)?(_e=v(se,ue.props),_e.ref=Cl(le,se,ue),_e.return=le,_e):(_e=$u(ue.type,ue.key,ue.props,null,le.mode,_e),_e.ref=Cl(le,se,ue),_e.return=le,_e)}function he(le,se,ue,_e){return se===null||se.tag!==4||se.stateNode.containerInfo!==ue.containerInfo||se.stateNode.implementation!==ue.implementation?(se=Pf(ue,le.mode,_e),se.return=le,se):(se=v(se,ue.children||[]),se.return=le,se)}function we(le,se,ue,_e,qe){return se===null||se.tag!==7?(se=ro(ue,le.mode,_e,qe),se.return=le,se):(se=v(se,ue),se.return=le,se)}function xe(le,se,ue){if(typeof se=="string"&&se!==""||typeof se=="number")return se=Of(""+se,le.mode,ue),se.return=le,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case T:return ue=$u(se.type,se.key,se.props,null,le.mode,ue),ue.ref=Cl(le,null,se),ue.return=le,ue;case R:return se=Pf(se,le.mode,ue),se.return=le,se;case G:var _e=se._init;return xe(le,_e(se._payload),ue)}if(ct(se)||W(se))return se=ro(se,le.mode,ue,null),se.return=le,se;uu(le,se)}return null}function ye(le,se,ue,_e){var qe=se!==null?se.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return qe!==null?null:K(le,se,""+ue,_e);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:return ue.key===qe?ne(le,se,ue,_e):null;case R:return ue.key===qe?he(le,se,ue,_e):null;case G:return qe=ue._init,ye(le,se,qe(ue._payload),_e)}if(ct(ue)||W(ue))return qe!==null?null:we(le,se,ue,_e,null);uu(le,ue)}return null}function Re(le,se,ue,_e,qe){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return le=le.get(ue)||null,K(se,le,""+_e,qe);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case T:return le=le.get(_e.key===null?ue:_e.key)||null,ne(se,le,_e,qe);case R:return le=le.get(_e.key===null?ue:_e.key)||null,he(se,le,_e,qe);case G:var Ge=_e._init;return Re(le,se,ue,Ge(_e._payload),qe)}if(ct(_e)||W(_e))return le=le.get(ue)||null,we(se,le,_e,qe,null);uu(se,_e)}return null}function Oe(le,se,ue,_e){for(var qe=null,Ge=null,Ve=se,Qe=se=0,nn=null;Ve!==null&&Qe<ue.length;Qe++){Ve.index>Qe?(nn=Ve,Ve=null):nn=Ve.sibling;var ft=ye(le,Ve,ue[Qe],_e);if(ft===null){Ve===null&&(Ve=nn);break}r&&Ve&&ft.alternate===null&&o(le,Ve),se=k(ft,se,Qe),Ge===null?qe=ft:Ge.sibling=ft,Ge=ft,Ve=nn}if(Qe===ue.length)return d(le,Ve),At&&Ka(le,Qe),qe;if(Ve===null){for(;Qe<ue.length;Qe++)Ve=xe(le,ue[Qe],_e),Ve!==null&&(se=k(Ve,se,Qe),Ge===null?qe=Ve:Ge.sibling=Ve,Ge=Ve);return At&&Ka(le,Qe),qe}for(Ve=g(le,Ve);Qe<ue.length;Qe++)nn=Re(Ve,le,Qe,ue[Qe],_e),nn!==null&&(r&&nn.alternate!==null&&Ve.delete(nn.key===null?Qe:nn.key),se=k(nn,se,Qe),Ge===null?qe=nn:Ge.sibling=nn,Ge=nn);return r&&Ve.forEach(function(Qs){return o(le,Qs)}),At&&Ka(le,Qe),qe}function Le(le,se,ue,_e){var qe=W(ue);if(typeof qe!="function")throw Error(n(150));if(ue=qe.call(ue),ue==null)throw Error(n(151));for(var Ge=qe=null,Ve=se,Qe=se=0,nn=null,ft=ue.next();Ve!==null&&!ft.done;Qe++,ft=ue.next()){Ve.index>Qe?(nn=Ve,Ve=null):nn=Ve.sibling;var Qs=ye(le,Ve,ft.value,_e);if(Qs===null){Ve===null&&(Ve=nn);break}r&&Ve&&Qs.alternate===null&&o(le,Ve),se=k(Qs,se,Qe),Ge===null?qe=Qs:Ge.sibling=Qs,Ge=Qs,Ve=nn}if(ft.done)return d(le,Ve),At&&Ka(le,Qe),qe;if(Ve===null){for(;!ft.done;Qe++,ft=ue.next())ft=xe(le,ft.value,_e),ft!==null&&(se=k(ft,se,Qe),Ge===null?qe=ft:Ge.sibling=ft,Ge=ft);return At&&Ka(le,Qe),qe}for(Ve=g(le,Ve);!ft.done;Qe++,ft=ue.next())ft=Re(Ve,le,Qe,ft.value,_e),ft!==null&&(r&&ft.alternate!==null&&Ve.delete(ft.key===null?Qe:ft.key),se=k(ft,se,Qe),Ge===null?qe=ft:Ge.sibling=ft,Ge=ft);return r&&Ve.forEach(function(VM){return o(le,VM)}),At&&Ka(le,Qe),qe}function Ut(le,se,ue,_e){if(typeof ue=="object"&&ue!==null&&ue.type===I&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:e:{for(var qe=ue.key,Ge=se;Ge!==null;){if(Ge.key===qe){if(qe=ue.type,qe===I){if(Ge.tag===7){d(le,Ge.sibling),se=v(Ge,ue.props.children),se.return=le,le=se;break e}}else if(Ge.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&P0(qe)===Ge.type){d(le,Ge.sibling),se=v(Ge,ue.props),se.ref=Cl(le,Ge,ue),se.return=le,le=se;break e}d(le,Ge);break}else o(le,Ge);Ge=Ge.sibling}ue.type===I?(se=ro(ue.props.children,le.mode,_e,ue.key),se.return=le,le=se):(_e=$u(ue.type,ue.key,ue.props,null,le.mode,_e),_e.ref=Cl(le,se,ue),_e.return=le,le=_e)}return A(le);case R:e:{for(Ge=ue.key;se!==null;){if(se.key===Ge)if(se.tag===4&&se.stateNode.containerInfo===ue.containerInfo&&se.stateNode.implementation===ue.implementation){d(le,se.sibling),se=v(se,ue.children||[]),se.return=le,le=se;break e}else{d(le,se);break}else o(le,se);se=se.sibling}se=Pf(ue,le.mode,_e),se.return=le,le=se}return A(le);case G:return Ge=ue._init,Ut(le,se,Ge(ue._payload),_e)}if(ct(ue))return Oe(le,se,ue,_e);if(W(ue))return Le(le,se,ue,_e);uu(le,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,se!==null&&se.tag===6?(d(le,se.sibling),se=v(se,ue),se.return=le,le=se):(d(le,se),se=Of(ue,le.mode,_e),se.return=le,le=se),A(le)):d(le,se)}return Ut}var ci=L0(!0),D0=L0(!1),du=Bs(null),hu=null,ui=null,Wh=null;function Hh(){Wh=ui=hu=null}function Gh(r){var o=du.current;Ct(du),r._currentValue=o}function Vh(r,o,d){for(;r!==null;){var g=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,g!==null&&(g.childLanes|=o)):g!==null&&(g.childLanes&o)!==o&&(g.childLanes|=o),r===d)break;r=r.return}}function di(r,o){hu=r,Wh=ui=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(Mn=!0),r.firstContext=null)}function Jn(r){var o=r._currentValue;if(Wh!==r)if(r={context:r,memoizedValue:o,next:null},ui===null){if(hu===null)throw Error(n(308));ui=r,hu.dependencies={lanes:0,firstContext:r}}else ui=ui.next=r;return o}var Xa=null;function Yh(r){Xa===null?Xa=[r]:Xa.push(r)}function q0(r,o,d,g){var v=o.interleaved;return v===null?(d.next=d,Yh(o)):(d.next=v.next,v.next=d),o.interleaved=d,hs(r,g)}function hs(r,o){r.lanes|=o;var d=r.alternate;for(d!==null&&(d.lanes|=o),d=r,r=r.return;r!==null;)r.childLanes|=o,d=r.alternate,d!==null&&(d.childLanes|=o),d=r,r=r.return;return d.tag===3?d.stateNode:null}var Ws=!1;function Kh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function fs(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Hs(r,o,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(ht&2)!==0){var v=g.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),g.pending=o,hs(r,d)}return v=g.interleaved,v===null?(o.next=o,Yh(g)):(o.next=v.next,v.next=o),g.interleaved=o,hs(r,d)}function fu(r,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Bt(r,d)}}function B0(r,o){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,k=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};k===null?v=k=A:k=k.next=A,d=d.next}while(d!==null);k===null?v=k=o:k=k.next=o}else v=k=o;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:g.shared,effects:g.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=o:r.next=o,d.lastBaseUpdate=o}function pu(r,o,d,g){var v=r.updateQueue;Ws=!1;var k=v.firstBaseUpdate,A=v.lastBaseUpdate,K=v.shared.pending;if(K!==null){v.shared.pending=null;var ne=K,he=ne.next;ne.next=null,A===null?k=he:A.next=he,A=ne;var we=r.alternate;we!==null&&(we=we.updateQueue,K=we.lastBaseUpdate,K!==A&&(K===null?we.firstBaseUpdate=he:K.next=he,we.lastBaseUpdate=ne))}if(k!==null){var xe=v.baseState;A=0,we=he=ne=null,K=k;do{var ye=K.lane,Re=K.eventTime;if((g&ye)===ye){we!==null&&(we=we.next={eventTime:Re,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var Oe=r,Le=K;switch(ye=o,Re=d,Le.tag){case 1:if(Oe=Le.payload,typeof Oe=="function"){xe=Oe.call(Re,xe,ye);break e}xe=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Le.payload,ye=typeof Oe=="function"?Oe.call(Re,xe,ye):Oe,ye==null)break e;xe=Y({},xe,ye);break e;case 2:Ws=!0}}K.callback!==null&&K.lane!==0&&(r.flags|=64,ye=v.effects,ye===null?v.effects=[K]:ye.push(K))}else Re={eventTime:Re,lane:ye,tag:K.tag,payload:K.payload,callback:K.callback,next:null},we===null?(he=we=Re,ne=xe):we=we.next=Re,A|=ye;if(K=K.next,K===null){if(K=v.shared.pending,K===null)break;ye=K,K=ye.next,ye.next=null,v.lastBaseUpdate=ye,v.shared.pending=null}}while(!0);if(we===null&&(ne=xe),v.baseState=ne,v.firstBaseUpdate=he,v.lastBaseUpdate=we,o=v.shared.interleaved,o!==null){v=o;do A|=v.lane,v=v.next;while(v!==o)}else k===null&&(v.shared.lanes=0);Ja|=A,r.lanes=A,r.memoizedState=xe}}function z0(r,o,d){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var Tl={},Ur=Bs(Tl),Al=Bs(Tl),Rl=Bs(Tl);function Za(r){if(r===Tl)throw Error(n(174));return r}function Xh(r,o){switch(Et(Rl,o),Et(Al,r),Et(Ur,Tl),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ut(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ut(o,r)}Ct(Ur),Et(Ur,o)}function hi(){Ct(Ur),Ct(Al),Ct(Rl)}function U0(r){Za(Rl.current);var o=Za(Ur.current),d=ut(o,r.type);o!==d&&(Et(Al,r),Et(Ur,d))}function Zh(r){Al.current===r&&(Ct(Ur),Ct(Al))}var Mt=Bs(0);function mu(r){for(var o=r;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Qh=[];function Jh(){for(var r=0;r<Qh.length;r++)Qh[r]._workInProgressVersionPrimary=null;Qh.length=0}var gu=C.ReactCurrentDispatcher,ef=C.ReactCurrentBatchConfig,Qa=0,It=null,Yt=null,en=null,yu=!1,Ml=!1,Il=0,mM=0;function mn(){throw Error(n(321))}function tf(r,o){if(o===null)return!1;for(var d=0;d<o.length&&d<r.length;d++)if(!kn(r[d],o[d]))return!1;return!0}function nf(r,o,d,g,v,k){if(Qa=k,It=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,gu.current=r===null||r.memoizedState===null?vM:xM,r=d(g,v),Ml){k=0;do{if(Ml=!1,Il=0,25<=k)throw Error(n(301));k+=1,en=Yt=null,o.updateQueue=null,gu.current=bM,r=d(g,v)}while(Ml)}if(gu.current=xu,o=Yt!==null&&Yt.next!==null,Qa=0,en=Yt=It=null,yu=!1,o)throw Error(n(300));return r}function rf(){var r=Il!==0;return Il=0,r}function Wr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?It.memoizedState=en=r:en=en.next=r,en}function er(){if(Yt===null){var r=It.alternate;r=r!==null?r.memoizedState:null}else r=Yt.next;var o=en===null?It.memoizedState:en.next;if(o!==null)en=o,Yt=r;else{if(r===null)throw Error(n(310));Yt=r,r={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},en===null?It.memoizedState=en=r:en=en.next=r}return en}function $l(r,o){return typeof o=="function"?o(r):o}function sf(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=Yt,v=g.baseQueue,k=d.pending;if(k!==null){if(v!==null){var A=v.next;v.next=k.next,k.next=A}g.baseQueue=v=k,d.pending=null}if(v!==null){k=v.next,g=g.baseState;var K=A=null,ne=null,he=k;do{var we=he.lane;if((Qa&we)===we)ne!==null&&(ne=ne.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),g=he.hasEagerState?he.eagerState:r(g,he.action);else{var xe={lane:we,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};ne===null?(K=ne=xe,A=g):ne=ne.next=xe,It.lanes|=we,Ja|=we}he=he.next}while(he!==null&&he!==k);ne===null?A=g:ne.next=K,kn(g,o.memoizedState)||(Mn=!0),o.memoizedState=g,o.baseState=A,o.baseQueue=ne,d.lastRenderedState=g}if(r=d.interleaved,r!==null){v=r;do k=v.lane,It.lanes|=k,Ja|=k,v=v.next;while(v!==r)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function af(r){var o=er(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=d.dispatch,v=d.pending,k=o.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do k=r(k,A.action),A=A.next;while(A!==v);kn(k,o.memoizedState)||(Mn=!0),o.memoizedState=k,o.baseQueue===null&&(o.baseState=k),d.lastRenderedState=k}return[k,g]}function W0(){}function H0(r,o){var d=It,g=er(),v=o(),k=!kn(g.memoizedState,v);if(k&&(g.memoizedState=v,Mn=!0),g=g.queue,of(Y0.bind(null,d,g,r),[r]),g.getSnapshot!==o||k||en!==null&&en.memoizedState.tag&1){if(d.flags|=2048,Ol(9,V0.bind(null,d,g,v,o),void 0,null),tn===null)throw Error(n(349));(Qa&30)!==0||G0(d,o,v)}return v}function G0(r,o,d){r.flags|=16384,r={getSnapshot:o,value:d},o=It.updateQueue,o===null?(o={lastEffect:null,stores:null},It.updateQueue=o,o.stores=[r]):(d=o.stores,d===null?o.stores=[r]:d.push(r))}function V0(r,o,d,g){o.value=d,o.getSnapshot=g,K0(o)&&X0(r)}function Y0(r,o,d){return d(function(){K0(o)&&X0(r)})}function K0(r){var o=r.getSnapshot;r=r.value;try{var d=o();return!kn(r,d)}catch{return!0}}function X0(r){var o=hs(r,1);o!==null&&Nr(o,r,1,-1)}function Z0(r){var o=Wr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:r},o.queue=r,r=r.dispatch=wM.bind(null,It,r),[o.memoizedState,r]}function Ol(r,o,d,g){return r={tag:r,create:o,destroy:d,deps:g,next:null},o=It.updateQueue,o===null?(o={lastEffect:null,stores:null},It.updateQueue=o,o.lastEffect=r.next=r):(d=o.lastEffect,d===null?o.lastEffect=r.next=r:(g=d.next,d.next=r,r.next=g,o.lastEffect=r)),r}function Q0(){return er().memoizedState}function wu(r,o,d,g){var v=Wr();It.flags|=r,v.memoizedState=Ol(1|o,d,void 0,g===void 0?null:g)}function vu(r,o,d,g){var v=er();g=g===void 0?null:g;var k=void 0;if(Yt!==null){var A=Yt.memoizedState;if(k=A.destroy,g!==null&&tf(g,A.deps)){v.memoizedState=Ol(o,d,k,g);return}}It.flags|=r,v.memoizedState=Ol(1|o,d,k,g)}function J0(r,o){return wu(8390656,8,r,o)}function of(r,o){return vu(2048,8,r,o)}function eb(r,o){return vu(4,2,r,o)}function tb(r,o){return vu(4,4,r,o)}function nb(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function rb(r,o,d){return d=d!=null?d.concat([r]):null,vu(4,4,nb.bind(null,o,r),d)}function lf(){}function sb(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(d.memoizedState=[r,o],r)}function ab(r,o){var d=er();o=o===void 0?null:o;var g=d.memoizedState;return g!==null&&o!==null&&tf(o,g[1])?g[0]:(r=r(),d.memoizedState=[r,o],r)}function ob(r,o,d){return(Qa&21)===0?(r.baseState&&(r.baseState=!1,Mn=!0),r.memoizedState=d):(kn(d,o)||(d=Tn(),It.lanes|=d,Ja|=d,r.baseState=!0),o)}function gM(r,o){var d=yt;yt=d!==0&&4>d?d:4,r(!0);var g=ef.transition;ef.transition={};try{r(!1),o()}finally{yt=d,ef.transition=g}}function ib(){return er().memoizedState}function yM(r,o,d){var g=Ks(r);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},lb(r))cb(o,d);else if(d=q0(r,o,d,g),d!==null){var v=Nn();Nr(d,r,g,v),ub(d,o,g)}}function wM(r,o,d){var g=Ks(r),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(lb(r))cb(o,v);else{var k=r.alternate;if(r.lanes===0&&(k===null||k.lanes===0)&&(k=o.lastRenderedReducer,k!==null))try{var A=o.lastRenderedState,K=k(A,d);if(v.hasEagerState=!0,v.eagerState=K,kn(K,A)){var ne=o.interleaved;ne===null?(v.next=v,Yh(o)):(v.next=ne.next,ne.next=v),o.interleaved=v;return}}catch{}finally{}d=q0(r,o,v,g),d!==null&&(v=Nn(),Nr(d,r,g,v),ub(d,o,g))}}function lb(r){var o=r.alternate;return r===It||o!==null&&o===It}function cb(r,o){Ml=yu=!0;var d=r.pending;d===null?o.next=o:(o.next=d.next,d.next=o),r.pending=o}function ub(r,o,d){if((d&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Bt(r,d)}}var xu={readContext:Jn,useCallback:mn,useContext:mn,useEffect:mn,useImperativeHandle:mn,useInsertionEffect:mn,useLayoutEffect:mn,useMemo:mn,useReducer:mn,useRef:mn,useState:mn,useDebugValue:mn,useDeferredValue:mn,useTransition:mn,useMutableSource:mn,useSyncExternalStore:mn,useId:mn,unstable_isNewReconciler:!1},vM={readContext:Jn,useCallback:function(r,o){return Wr().memoizedState=[r,o===void 0?null:o],r},useContext:Jn,useEffect:J0,useImperativeHandle:function(r,o,d){return d=d!=null?d.concat([r]):null,wu(4194308,4,nb.bind(null,o,r),d)},useLayoutEffect:function(r,o){return wu(4194308,4,r,o)},useInsertionEffect:function(r,o){return wu(4,2,r,o)},useMemo:function(r,o){var d=Wr();return o=o===void 0?null:o,r=r(),d.memoizedState=[r,o],r},useReducer:function(r,o,d){var g=Wr();return o=d!==void 0?d(o):o,g.memoizedState=g.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},g.queue=r,r=r.dispatch=yM.bind(null,It,r),[g.memoizedState,r]},useRef:function(r){var o=Wr();return r={current:r},o.memoizedState=r},useState:Z0,useDebugValue:lf,useDeferredValue:function(r){return Wr().memoizedState=r},useTransition:function(){var r=Z0(!1),o=r[0];return r=gM.bind(null,r[1]),Wr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,d){var g=It,v=Wr();if(At){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),tn===null)throw Error(n(349));(Qa&30)!==0||G0(g,o,d)}v.memoizedState=d;var k={value:d,getSnapshot:o};return v.queue=k,J0(Y0.bind(null,g,k,r),[r]),g.flags|=2048,Ol(9,V0.bind(null,g,k,d,o),void 0,null),d},useId:function(){var r=Wr(),o=tn.identifierPrefix;if(At){var d=ds,g=us;d=(g&~(1<<32-Cn(g)-1)).toString(32)+d,o=":"+o+"R"+d,d=Il++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=mM++,o=":"+o+"r"+d.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},xM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:sf,useRef:Q0,useState:function(){return sf($l)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return ob(o,Yt.memoizedState,r)},useTransition:function(){var r=sf($l)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1},bM={readContext:Jn,useCallback:sb,useContext:Jn,useEffect:of,useImperativeHandle:rb,useInsertionEffect:eb,useLayoutEffect:tb,useMemo:ab,useReducer:af,useRef:Q0,useState:function(){return af($l)},useDebugValue:lf,useDeferredValue:function(r){var o=er();return Yt===null?o.memoizedState=r:ob(o,Yt.memoizedState,r)},useTransition:function(){var r=af($l)[0],o=er().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ib,unstable_isNewReconciler:!1};function br(r,o){if(r&&r.defaultProps){o=Y({},o),r=r.defaultProps;for(var d in r)o[d]===void 0&&(o[d]=r[d]);return o}return o}function cf(r,o,d,g){o=r.memoizedState,d=d(g,o),d=d==null?o:Y({},o,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var bu={isMounted:function(r){return(r=r._reactInternals)?rn(r)===r:!1},enqueueSetState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ks(r),k=fs(g,v);k.payload=o,d!=null&&(k.callback=d),o=Hs(r,k,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueReplaceState:function(r,o,d){r=r._reactInternals;var g=Nn(),v=Ks(r),k=fs(g,v);k.tag=1,k.payload=o,d!=null&&(k.callback=d),o=Hs(r,k,v),o!==null&&(Nr(o,r,v,g),fu(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var d=Nn(),g=Ks(r),v=fs(d,g);v.tag=2,o!=null&&(v.callback=o),o=Hs(r,v,g),o!==null&&(Nr(o,r,g,d),fu(o,r,g))}};function db(r,o,d,g,v,k,A){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,k,A):o.prototype&&o.prototype.isPureReactComponent?!Fr(d,g)||!Fr(v,k):!0}function hb(r,o,d){var g=!1,v=zs,k=o.contextType;return typeof k=="object"&&k!==null?k=Jn(k):(v=Rn(o)?Va:pn.current,g=o.contextTypes,k=(g=g!=null)?ai(r,v):zs),o=new o(d,k),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=bu,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=k),o}function fb(r,o,d,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,g),o.state!==r&&bu.enqueueReplaceState(o,o.state,null)}function uf(r,o,d,g){var v=r.stateNode;v.props=d,v.state=r.memoizedState,v.refs={},Kh(r);var k=o.contextType;typeof k=="object"&&k!==null?v.context=Jn(k):(k=Rn(o)?Va:pn.current,v.context=ai(r,k)),v.state=r.memoizedState,k=o.getDerivedStateFromProps,typeof k=="function"&&(cf(r,o,k,d),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&bu.enqueueReplaceState(v,v.state,null),pu(r,d,v,g),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function fi(r,o){try{var d="",g=o;do d+=Z(g),g=g.return;while(g);var v=d}catch(k){v=`
|
|
39
|
+
Error generating stack: `+k.message+`
|
|
40
|
+
`+k.stack}return{value:r,source:o,stack:v,digest:null}}function df(r,o,d){return{value:r,source:null,stack:d??null,digest:o??null}}function hf(r,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var kM=typeof WeakMap=="function"?WeakMap:Map;function pb(r,o,d){d=fs(-1,d),d.tag=3,d.payload={element:null};var g=o.value;return d.callback=function(){Cu||(Cu=!0,Ef=g),hf(r,o)},d}function mb(r,o,d){d=fs(-1,d),d.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var v=o.value;d.payload=function(){return g(v)},d.callback=function(){hf(r,o)}}var k=r.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(d.callback=function(){hf(r,o),typeof g!="function"&&(Vs===null?Vs=new Set([this]):Vs.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})}),d}function gb(r,o,d){var g=r.pingCache;if(g===null){g=r.pingCache=new kM;var v=new Set;g.set(o,v)}else v=g.get(o),v===void 0&&(v=new Set,g.set(o,v));v.has(d)||(v.add(d),r=PM.bind(null,r,o,d),o.then(r,r))}function yb(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function wb(r,o,d,g,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=fs(-1,1),o.tag=2,Hs(d,o,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var _M=C.ReactCurrentOwner,Mn=!1;function _n(r,o,d,g){o.child=r===null?D0(o,null,d,g):ci(o,r.child,d,g)}function vb(r,o,d,g,v){d=d.render;var k=o.ref;return di(o,v),g=nf(r,o,d,g,k,v),d=rf(),r!==null&&!Mn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,ps(r,o,v)):(At&&d&&qh(o),o.flags|=1,_n(r,o,g,v),o.child)}function xb(r,o,d,g,v){if(r===null){var k=d.type;return typeof k=="function"&&!$f(k)&&k.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=k,bb(r,o,k,g,v)):(r=$u(d.type,null,g,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(k=r.child,(r.lanes&v)===0){var A=k.memoizedProps;if(d=d.compare,d=d!==null?d:Fr,d(A,g)&&r.ref===o.ref)return ps(r,o,v)}return o.flags|=1,r=Zs(k,g),r.ref=o.ref,r.return=o,o.child=r}function bb(r,o,d,g,v){if(r!==null){var k=r.memoizedProps;if(Fr(k,g)&&r.ref===o.ref)if(Mn=!1,o.pendingProps=g=k,(r.lanes&v)!==0)(r.flags&131072)!==0&&(Mn=!0);else return o.lanes=r.lanes,ps(r,o,v)}return ff(r,o,d,g,v)}function kb(r,o,d){var g=o.pendingProps,v=g.children,k=r!==null?r.memoizedState:null;if(g.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Et(mi,zn),zn|=d;else{if((d&1073741824)===0)return r=k!==null?k.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,Et(mi,zn),zn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=k!==null?k.baseLanes:d,Et(mi,zn),zn|=g}else k!==null?(g=k.baseLanes|d,o.memoizedState=null):g=d,Et(mi,zn),zn|=g;return _n(r,o,v,d),o.child}function _b(r,o){var d=o.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function ff(r,o,d,g,v){var k=Rn(d)?Va:pn.current;return k=ai(o,k),di(o,v),d=nf(r,o,d,g,k,v),g=rf(),r!==null&&!Mn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,ps(r,o,v)):(At&&g&&qh(o),o.flags|=1,_n(r,o,d,v),o.child)}function Nb(r,o,d,g,v){if(Rn(d)){var k=!0;au(o)}else k=!1;if(di(o,v),o.stateNode===null)_u(r,o),hb(o,d,g),uf(o,d,g,v),g=!0;else if(r===null){var A=o.stateNode,K=o.memoizedProps;A.props=K;var ne=A.context,he=d.contextType;typeof he=="object"&&he!==null?he=Jn(he):(he=Rn(d)?Va:pn.current,he=ai(o,he));var we=d.getDerivedStateFromProps,xe=typeof we=="function"||typeof A.getSnapshotBeforeUpdate=="function";xe||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(K!==g||ne!==he)&&fb(o,A,g,he),Ws=!1;var ye=o.memoizedState;A.state=ye,pu(o,g,A,v),ne=o.memoizedState,K!==g||ye!==ne||An.current||Ws?(typeof we=="function"&&(cf(o,d,we,g),ne=o.memoizedState),(K=Ws||db(o,d,K,g,ye,ne,he))?(xe||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(o.flags|=4194308)):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=ne),A.props=g,A.state=ne,A.context=he,g=K):(typeof A.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{A=o.stateNode,F0(r,o),K=o.memoizedProps,he=o.type===o.elementType?K:br(o.type,K),A.props=he,xe=o.pendingProps,ye=A.context,ne=d.contextType,typeof ne=="object"&&ne!==null?ne=Jn(ne):(ne=Rn(d)?Va:pn.current,ne=ai(o,ne));var Re=d.getDerivedStateFromProps;(we=typeof Re=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(K!==xe||ye!==ne)&&fb(o,A,g,ne),Ws=!1,ye=o.memoizedState,A.state=ye,pu(o,g,A,v);var Oe=o.memoizedState;K!==xe||ye!==Oe||An.current||Ws?(typeof Re=="function"&&(cf(o,d,Re,g),Oe=o.memoizedState),(he=Ws||db(o,d,he,g,ye,Oe,ne)||!1)?(we||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,Oe,ne),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,Oe,ne)),typeof A.componentDidUpdate=="function"&&(o.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof A.componentDidUpdate!="function"||K===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||K===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=Oe),A.props=g,A.state=Oe,A.context=ne,g=he):(typeof A.componentDidUpdate!="function"||K===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||K===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),g=!1)}return pf(r,o,d,g,k,v)}function pf(r,o,d,g,v,k){_b(r,o);var A=(o.flags&128)!==0;if(!g&&!A)return v&&T0(o,d,!1),ps(r,o,k);g=o.stateNode,_M.current=o;var K=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&A?(o.child=ci(o,r.child,null,k),o.child=ci(o,null,K,k)):_n(r,o,K,k),o.memoizedState=g.state,v&&T0(o,d,!0),o.child}function Sb(r){var o=r.stateNode;o.pendingContext?E0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&E0(r,o.context,!1),Xh(r,o.containerInfo)}function jb(r,o,d,g,v){return li(),Uh(v),o.flags|=256,_n(r,o,d,g),o.child}var mf={dehydrated:null,treeContext:null,retryLane:0};function gf(r){return{baseLanes:r,cachePool:null,transitions:null}}function Eb(r,o,d){var g=o.pendingProps,v=Mt.current,k=!1,A=(o.flags&128)!==0,K;if((K=A)||(K=r!==null&&r.memoizedState===null?!1:(v&2)!==0),K?(k=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),Et(Mt,v&1),r===null)return zh(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(A=g.children,r=g.fallback,k?(g=o.mode,k=o.child,A={mode:"hidden",children:A},(g&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=A):k=Ou(A,g,0,null),r=ro(r,g,d,null),k.return=o,r.return=o,k.sibling=r,o.child=k,o.child.memoizedState=gf(d),o.memoizedState=mf,r):yf(o,A));if(v=r.memoizedState,v!==null&&(K=v.dehydrated,K!==null))return NM(r,o,A,g,K,v,d);if(k){k=g.fallback,A=o.mode,v=r.child,K=v.sibling;var ne={mode:"hidden",children:g.children};return(A&1)===0&&o.child!==v?(g=o.child,g.childLanes=0,g.pendingProps=ne,o.deletions=null):(g=Zs(v,ne),g.subtreeFlags=v.subtreeFlags&14680064),K!==null?k=Zs(K,k):(k=ro(k,A,d,null),k.flags|=2),k.return=o,g.return=o,g.sibling=k,o.child=g,g=k,k=o.child,A=r.child.memoizedState,A=A===null?gf(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},k.memoizedState=A,k.childLanes=r.childLanes&~d,o.memoizedState=mf,g}return k=r.child,r=k.sibling,g=Zs(k,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=d),g.return=o,g.sibling=null,r!==null&&(d=o.deletions,d===null?(o.deletions=[r],o.flags|=16):d.push(r)),o.child=g,o.memoizedState=null,g}function yf(r,o){return o=Ou({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function ku(r,o,d,g){return g!==null&&Uh(g),ci(o,r.child,null,d),r=yf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function NM(r,o,d,g,v,k,A){if(d)return o.flags&256?(o.flags&=-257,g=df(Error(n(422))),ku(r,o,A,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(k=g.fallback,v=o.mode,g=Ou({mode:"visible",children:g.children},v,0,null),k=ro(k,v,A,null),k.flags|=2,g.return=o,k.return=o,g.sibling=k,o.child=g,(o.mode&1)!==0&&ci(o,r.child,null,A),o.child.memoizedState=gf(A),o.memoizedState=mf,k);if((o.mode&1)===0)return ku(r,o,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var K=g.dgst;return g=K,k=Error(n(419)),g=df(k,g,void 0),ku(r,o,A,g)}if(K=(A&r.childLanes)!==0,Mn||K){if(g=tn,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==k.retryLane&&(k.retryLane=v,hs(r,v),Nr(g,r,v,-1))}return If(),g=df(Error(n(421))),ku(r,o,A,g)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=LM.bind(null,r),v._reactRetry=o,null):(r=k.treeContext,Bn=vr(v.nextSibling),Fn=o,At=!0,xr=null,r!==null&&(Zn[Qn++]=us,Zn[Qn++]=ds,Zn[Qn++]=Ya,us=r.id,ds=r.overflow,Ya=o),o=yf(o,g.children),o.flags|=4096,o)}function Cb(r,o,d){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),Vh(r.return,o,d)}function wf(r,o,d,g,v){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(k.isBackwards=o,k.rendering=null,k.renderingStartTime=0,k.last=g,k.tail=d,k.tailMode=v)}function Tb(r,o,d){var g=o.pendingProps,v=g.revealOrder,k=g.tail;if(_n(r,o,g.children,d),g=Mt.current,(g&2)!==0)g=g&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Cb(r,d,o);else if(r.tag===19)Cb(r,d,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}if(Et(Mt,g),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)r=d.alternate,r!==null&&mu(r)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),wf(o,!1,v,d,k);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&mu(r)===null){o.child=v;break}r=v.sibling,v.sibling=d,d=v,v=r}wf(o,!0,d,null,k);break;case"together":wf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function _u(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function ps(r,o,d){if(r!==null&&(o.dependencies=r.dependencies),Ja|=o.lanes,(d&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,d=Zs(r,r.pendingProps),o.child=d,d.return=o;r.sibling!==null;)r=r.sibling,d=d.sibling=Zs(r,r.pendingProps),d.return=o;d.sibling=null}return o.child}function SM(r,o,d){switch(o.tag){case 3:Sb(o),li();break;case 5:U0(o);break;case 1:Rn(o.type)&&au(o);break;case 4:Xh(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,v=o.memoizedProps.value;Et(du,g._currentValue),g._currentValue=v;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(Et(Mt,Mt.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?Eb(r,o,d):(Et(Mt,Mt.current&1),r=ps(r,o,d),r!==null?r.sibling:null);Et(Mt,Mt.current&1);break;case 19:if(g=(d&o.childLanes)!==0,(r.flags&128)!==0){if(g)return Tb(r,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Et(Mt,Mt.current),g)break;return null;case 22:case 23:return o.lanes=0,kb(r,o,d)}return ps(r,o,d)}var Ab,vf,Rb,Mb;Ab=function(r,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},vf=function(){},Rb=function(r,o,d,g){var v=r.memoizedProps;if(v!==g){r=o.stateNode,Za(Ur.current);var k=null;switch(d){case"input":v=Pe(r,v),g=Pe(r,g),k=[];break;case"select":v=Y({},v,{value:void 0}),g=Y({},g,{value:void 0}),k=[];break;case"textarea":v=ce(r,v),g=ce(r,g),k=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=is)}bt(d,g);var A;d=null;for(he in v)if(!g.hasOwnProperty(he)&&v.hasOwnProperty(he)&&v[he]!=null)if(he==="style"){var K=v[he];for(A in K)K.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(a.hasOwnProperty(he)?k||(k=[]):(k=k||[]).push(he,null));for(he in g){var ne=g[he];if(K=v!=null?v[he]:void 0,g.hasOwnProperty(he)&&ne!==K&&(ne!=null||K!=null))if(he==="style")if(K){for(A in K)!K.hasOwnProperty(A)||ne&&ne.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in ne)ne.hasOwnProperty(A)&&K[A]!==ne[A]&&(d||(d={}),d[A]=ne[A])}else d||(k||(k=[]),k.push(he,d)),d=ne;else he==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,K=K?K.__html:void 0,ne!=null&&K!==ne&&(k=k||[]).push(he,ne)):he==="children"?typeof ne!="string"&&typeof ne!="number"||(k=k||[]).push(he,""+ne):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(a.hasOwnProperty(he)?(ne!=null&&he==="onScroll"&&xt("scroll",r),k||K===ne||(k=[])):(k=k||[]).push(he,ne))}d&&(k=k||[]).push("style",d);var he=k;(o.updateQueue=he)&&(o.flags|=4)}},Mb=function(r,o,d,g){d!==g&&(o.flags|=4)};function Pl(r,o){if(!At)switch(r.tailMode){case"hidden":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function gn(r){var o=r.alternate!==null&&r.alternate.child===r.child,d=0,g=0;if(o)for(var v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=g,r.childLanes=d,o}function jM(r,o,d){var g=o.pendingProps;switch(Fh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(o),null;case 1:return Rn(o.type)&&su(),gn(o),null;case 3:return g=o.stateNode,hi(),Ct(An),Ct(pn),Jh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(cu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,xr!==null&&(Af(xr),xr=null))),vf(r,o),gn(o),null;case 5:Zh(o);var v=Za(Rl.current);if(d=o.type,r!==null&&o.stateNode!=null)Rb(r,o,d,g,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return gn(o),null}if(r=Za(Ur.current),cu(o)){g=o.stateNode,d=o.type;var k=o.memoizedProps;switch(g[zr]=o,g[jl]=k,r=(o.mode&1)!==0,d){case"dialog":xt("cancel",g),xt("close",g);break;case"iframe":case"object":case"embed":xt("load",g);break;case"video":case"audio":for(v=0;v<os.length;v++)xt(os[v],g);break;case"source":xt("error",g);break;case"img":case"image":case"link":xt("error",g),xt("load",g);break;case"details":xt("toggle",g);break;case"input":Se(g,k),xt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!k.multiple},xt("invalid",g);break;case"textarea":ke(g,k),xt("invalid",g)}bt(d,k),v=null;for(var A in k)if(k.hasOwnProperty(A)){var K=k[A];A==="children"?typeof K=="string"?g.textContent!==K&&(k.suppressHydrationWarning!==!0&&an(g.textContent,K,r),v=["children",K]):typeof K=="number"&&g.textContent!==""+K&&(k.suppressHydrationWarning!==!0&&an(g.textContent,K,r),v=["children",""+K]):a.hasOwnProperty(A)&&K!=null&&A==="onScroll"&&xt("scroll",g)}switch(d){case"input":Te(g),be(g,k,!0);break;case"textarea":Te(g),Ze(g);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(g.onclick=is)}g=v,o.updateQueue=g,g!==null&&(o.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Xe(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=A.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=A.createElement(d,{is:g.is}):(r=A.createElement(d),d==="select"&&(A=r,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):r=A.createElementNS(r,d),r[zr]=o,r[jl]=g,Ab(r,o,!1,!1),o.stateNode=r;e:{switch(A=st(d,g),d){case"dialog":xt("cancel",r),xt("close",r),v=g;break;case"iframe":case"object":case"embed":xt("load",r),v=g;break;case"video":case"audio":for(v=0;v<os.length;v++)xt(os[v],r);v=g;break;case"source":xt("error",r),v=g;break;case"img":case"image":case"link":xt("error",r),xt("load",r),v=g;break;case"details":xt("toggle",r),v=g;break;case"input":Se(r,g),v=Pe(r,g),xt("invalid",r);break;case"option":v=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},v=Y({},g,{value:void 0}),xt("invalid",r);break;case"textarea":ke(r,g),v=ce(r,g),xt("invalid",r);break;default:v=g}bt(d,v),K=v;for(k in K)if(K.hasOwnProperty(k)){var ne=K[k];k==="style"?rt(r,ne):k==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&Ne(r,ne)):k==="children"?typeof ne=="string"?(d!=="textarea"||ne!=="")&&Be(r,ne):typeof ne=="number"&&Be(r,""+ne):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(a.hasOwnProperty(k)?ne!=null&&k==="onScroll"&&xt("scroll",r):ne!=null&&E(r,k,ne,A))}switch(d){case"input":Te(r),be(r,g,!1);break;case"textarea":Te(r),Ze(r);break;case"option":g.value!=null&&r.setAttribute("value",""+de(g.value));break;case"select":r.multiple=!!g.multiple,k=g.value,k!=null?Ye(r,!!g.multiple,k,!1):g.defaultValue!=null&&Ye(r,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=is)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return gn(o),null;case 6:if(r&&o.stateNode!=null)Mb(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(d=Za(Rl.current),Za(Ur.current),cu(o)){if(g=o.stateNode,d=o.memoizedProps,g[zr]=o,(k=g.nodeValue!==d)&&(r=Fn,r!==null))switch(r.tag){case 3:an(g.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&an(g.nodeValue,d,(r.mode&1)!==0)}k&&(o.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[zr]=o,o.stateNode=g}return gn(o),null;case 13:if(Ct(Mt),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(At&&Bn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)O0(),li(),o.flags|=98560,k=!1;else if(k=cu(o),g!==null&&g.dehydrated!==null){if(r===null){if(!k)throw Error(n(318));if(k=o.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[zr]=o}else li(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;gn(o),k=!1}else xr!==null&&(Af(xr),xr=null),k=!0;if(!k)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Mt.current&1)!==0?Kt===0&&(Kt=3):If())),o.updateQueue!==null&&(o.flags|=4),gn(o),null);case 4:return hi(),vf(r,o),r===null&&D(o.stateNode.containerInfo),gn(o),null;case 10:return Gh(o.type._context),gn(o),null;case 17:return Rn(o.type)&&su(),gn(o),null;case 19:if(Ct(Mt),k=o.memoizedState,k===null)return gn(o),null;if(g=(o.flags&128)!==0,A=k.rendering,A===null)if(g)Pl(k,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(A=mu(r),A!==null){for(o.flags|=128,Pl(k,!1),g=A.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=d,d=o.child;d!==null;)k=d,r=g,k.flags&=14680066,A=k.alternate,A===null?(k.childLanes=0,k.lanes=r,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=A.childLanes,k.lanes=A.lanes,k.child=A.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=A.memoizedProps,k.memoizedState=A.memoizedState,k.updateQueue=A.updateQueue,k.type=A.type,r=A.dependencies,k.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return Et(Mt,Mt.current&1|2),o.child}r=r.sibling}k.tail!==null&&jt()>gi&&(o.flags|=128,g=!0,Pl(k,!1),o.lanes=4194304)}else{if(!g)if(r=mu(A),r!==null){if(o.flags|=128,g=!0,d=r.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),Pl(k,!0),k.tail===null&&k.tailMode==="hidden"&&!A.alternate&&!At)return gn(o),null}else 2*jt()-k.renderingStartTime>gi&&d!==1073741824&&(o.flags|=128,g=!0,Pl(k,!1),o.lanes=4194304);k.isBackwards?(A.sibling=o.child,o.child=A):(d=k.last,d!==null?d.sibling=A:o.child=A,k.last=A)}return k.tail!==null?(o=k.tail,k.rendering=o,k.tail=o.sibling,k.renderingStartTime=jt(),o.sibling=null,d=Mt.current,Et(Mt,g?d&1|2:d&1),o):(gn(o),null);case 22:case 23:return Mf(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(zn&1073741824)!==0&&(gn(o),o.subtreeFlags&6&&(o.flags|=8192)):gn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function EM(r,o){switch(Fh(o),o.tag){case 1:return Rn(o.type)&&su(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return hi(),Ct(An),Ct(pn),Jh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Zh(o),null;case 13:if(Ct(Mt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));li()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ct(Mt),null;case 4:return hi(),null;case 10:return Gh(o.type._context),null;case 22:case 23:return Mf(),null;case 24:return null;default:return null}}var Nu=!1,yn=!1,CM=typeof WeakSet=="function"?WeakSet:Set,$e=null;function pi(r,o){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Pt(r,o,g)}else d.current=null}function xf(r,o,d){try{d()}catch(g){Pt(r,o,g)}}var Ib=!1;function TM(r,o){if(Jo=Ta,r=Wo(),Ds(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{d.nodeType,k.nodeType}catch{d=null;break e}var A=0,K=-1,ne=-1,he=0,we=0,xe=r,ye=null;t:for(;;){for(var Re;xe!==d||v!==0&&xe.nodeType!==3||(K=A+v),xe!==k||g!==0&&xe.nodeType!==3||(ne=A+g),xe.nodeType===3&&(A+=xe.nodeValue.length),(Re=xe.firstChild)!==null;)ye=xe,xe=Re;for(;;){if(xe===r)break t;if(ye===d&&++he===v&&(K=A),ye===k&&++we===g&&(ne=A),(Re=xe.nextSibling)!==null)break;xe=ye,ye=xe.parentNode}xe=Re}d=K===-1||ne===-1?null:{start:K,end:ne}}else d=null}d=d||{start:0,end:0}}else d=null;for(Nl={focusedElem:r,selectionRange:d},Ta=!1,$e=o;$e!==null;)if(o=$e,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,$e=r;else for(;$e!==null;){o=$e;try{var Oe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var Le=Oe.memoizedProps,Ut=Oe.memoizedState,le=o.stateNode,se=le.getSnapshotBeforeUpdate(o.elementType===o.type?Le:br(o.type,Le),Ut);le.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ue=o.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(_e){Pt(o,o.return,_e)}if(r=o.sibling,r!==null){r.return=o.return,$e=r;break}$e=o.return}return Oe=Ib,Ib=!1,Oe}function Ll(r,o,d){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&r)===r){var k=v.destroy;v.destroy=void 0,k!==void 0&&xf(o,d,k)}v=v.next}while(v!==g)}}function Su(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&r)===r){var g=d.create;d.destroy=g()}d=d.next}while(d!==o)}}function bf(r){var o=r.ref;if(o!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof o=="function"?o(r):o.current=r}}function $b(r){var o=r.alternate;o!==null&&(r.alternate=null,$b(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[zr],delete o[jl],delete o[Ph],delete o[dM],delete o[hM])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Ob(r){return r.tag===5||r.tag===3||r.tag===4}function Pb(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ob(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function kf(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(r,o):d.insertBefore(r,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(r,d)):(o=d,o.appendChild(r)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=is));else if(g!==4&&(r=r.child,r!==null))for(kf(r,o,d),r=r.sibling;r!==null;)kf(r,o,d),r=r.sibling}function _f(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.insertBefore(r,o):d.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(_f(r,o,d),r=r.sibling;r!==null;)_f(r,o,d),r=r.sibling}var on=null,kr=!1;function Gs(r,o,d){for(d=d.child;d!==null;)Lb(r,o,d),d=d.sibling}function Lb(r,o,d){if(vn&&typeof vn.onCommitFiberUnmount=="function")try{vn.onCommitFiberUnmount(dr,d)}catch{}switch(d.tag){case 5:yn||pi(d,o);case 6:var g=on,v=kr;on=null,Gs(r,o,d),on=g,kr=v,on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):on.removeChild(d.stateNode));break;case 18:on!==null&&(kr?(r=on,d=d.stateNode,r.nodeType===8?Ot(r.parentNode,d):r.nodeType===1&&Ot(r,d),Ca(r)):Ot(on,d.stateNode));break;case 4:g=on,v=kr,on=d.stateNode.containerInfo,kr=!0,Gs(r,o,d),on=g,kr=v;break;case 0:case 11:case 14:case 15:if(!yn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var k=v,A=k.destroy;k=k.tag,A!==void 0&&((k&2)!==0||(k&4)!==0)&&xf(d,o,A),v=v.next}while(v!==g)}Gs(r,o,d);break;case 1:if(!yn&&(pi(d,o),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(K){Pt(d,o,K)}Gs(r,o,d);break;case 21:Gs(r,o,d);break;case 22:d.mode&1?(yn=(g=yn)||d.memoizedState!==null,Gs(r,o,d),yn=g):Gs(r,o,d);break;default:Gs(r,o,d)}}function Db(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new CM),o.forEach(function(g){var v=DM.bind(null,r,g);d.has(g)||(d.add(g),g.then(v,v))})}}function _r(r,o){var d=o.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var k=r,A=o,K=A;e:for(;K!==null;){switch(K.tag){case 5:on=K.stateNode,kr=!1;break e;case 3:on=K.stateNode.containerInfo,kr=!0;break e;case 4:on=K.stateNode.containerInfo,kr=!0;break e}K=K.return}if(on===null)throw Error(n(160));Lb(k,A,v),on=null,kr=!1;var ne=v.alternate;ne!==null&&(ne.return=null),v.return=null}catch(he){Pt(v,o,he)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)qb(o,r),o=o.sibling}function qb(r,o){var d=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(_r(o,r),Hr(r),g&4){try{Ll(3,r,r.return),Su(3,r)}catch(Le){Pt(r,r.return,Le)}try{Ll(5,r,r.return)}catch(Le){Pt(r,r.return,Le)}}break;case 1:_r(o,r),Hr(r),g&512&&d!==null&&pi(d,d.return);break;case 5:if(_r(o,r),Hr(r),g&512&&d!==null&&pi(d,d.return),r.flags&32){var v=r.stateNode;try{Be(v,"")}catch(Le){Pt(r,r.return,Le)}}if(g&4&&(v=r.stateNode,v!=null)){var k=r.memoizedProps,A=d!==null?d.memoizedProps:k,K=r.type,ne=r.updateQueue;if(r.updateQueue=null,ne!==null)try{K==="input"&&k.type==="radio"&&k.name!=null&&nt(v,k),st(K,A);var he=st(K,k);for(A=0;A<ne.length;A+=2){var we=ne[A],xe=ne[A+1];we==="style"?rt(v,xe):we==="dangerouslySetInnerHTML"?Ne(v,xe):we==="children"?Be(v,xe):E(v,we,xe,he)}switch(K){case"input":je(v,k);break;case"textarea":Ee(v,k);break;case"select":var ye=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!k.multiple;var Re=k.value;Re!=null?Ye(v,!!k.multiple,Re,!1):ye!==!!k.multiple&&(k.defaultValue!=null?Ye(v,!!k.multiple,k.defaultValue,!0):Ye(v,!!k.multiple,k.multiple?[]:"",!1))}v[jl]=k}catch(Le){Pt(r,r.return,Le)}}break;case 6:if(_r(o,r),Hr(r),g&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,k=r.memoizedProps;try{v.nodeValue=k}catch(Le){Pt(r,r.return,Le)}}break;case 3:if(_r(o,r),Hr(r),g&4&&d!==null&&d.memoizedState.isDehydrated)try{Ca(o.containerInfo)}catch(Le){Pt(r,r.return,Le)}break;case 4:_r(o,r),Hr(r);break;case 13:_r(o,r),Hr(r),v=r.child,v.flags&8192&&(k=v.memoizedState!==null,v.stateNode.isHidden=k,!k||v.alternate!==null&&v.alternate.memoizedState!==null||(jf=jt())),g&4&&Db(r);break;case 22:if(we=d!==null&&d.memoizedState!==null,r.mode&1?(yn=(he=yn)||we,_r(o,r),yn=he):_r(o,r),Hr(r),g&8192){if(he=r.memoizedState!==null,(r.stateNode.isHidden=he)&&!we&&(r.mode&1)!==0)for($e=r,we=r.child;we!==null;){for(xe=$e=we;$e!==null;){switch(ye=$e,Re=ye.child,ye.tag){case 0:case 11:case 14:case 15:Ll(4,ye,ye.return);break;case 1:pi(ye,ye.return);var Oe=ye.stateNode;if(typeof Oe.componentWillUnmount=="function"){g=ye,d=ye.return;try{o=g,Oe.props=o.memoizedProps,Oe.state=o.memoizedState,Oe.componentWillUnmount()}catch(Le){Pt(g,d,Le)}}break;case 5:pi(ye,ye.return);break;case 22:if(ye.memoizedState!==null){zb(xe);continue}}Re!==null?(Re.return=ye,$e=Re):zb(xe)}we=we.sibling}e:for(we=null,xe=r;;){if(xe.tag===5){if(we===null){we=xe;try{v=xe.stateNode,he?(k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(K=xe.stateNode,ne=xe.memoizedProps.style,A=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,K.style.display=tt("display",A))}catch(Le){Pt(r,r.return,Le)}}}else if(xe.tag===6){if(we===null)try{xe.stateNode.nodeValue=he?"":xe.memoizedProps}catch(Le){Pt(r,r.return,Le)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===r)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===r)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===r)break e;we===xe&&(we=null),xe=xe.return}we===xe&&(we=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:_r(o,r),Hr(r),g&4&&Db(r);break;case 21:break;default:_r(o,r),Hr(r)}}function Hr(r){var o=r.flags;if(o&2){try{e:{for(var d=r.return;d!==null;){if(Ob(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Be(v,""),g.flags&=-33);var k=Pb(r);_f(r,k,v);break;case 3:case 4:var A=g.stateNode.containerInfo,K=Pb(r);kf(r,K,A);break;default:throw Error(n(161))}}catch(ne){Pt(r,r.return,ne)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function AM(r,o,d){$e=r,Fb(r)}function Fb(r,o,d){for(var g=(r.mode&1)!==0;$e!==null;){var v=$e,k=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||Nu;if(!A){var K=v.alternate,ne=K!==null&&K.memoizedState!==null||yn;K=Nu;var he=yn;if(Nu=A,(yn=ne)&&!he)for($e=v;$e!==null;)A=$e,ne=A.child,A.tag===22&&A.memoizedState!==null?Ub(v):ne!==null?(ne.return=A,$e=ne):Ub(v);for(;k!==null;)$e=k,Fb(k),k=k.sibling;$e=v,Nu=K,yn=he}Bb(r)}else(v.subtreeFlags&8772)!==0&&k!==null?(k.return=v,$e=k):Bb(r)}}function Bb(r){for(;$e!==null;){var o=$e;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:yn||Su(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!yn)if(d===null)g.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:br(o.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var k=o.updateQueue;k!==null&&z0(o,k,g);break;case 3:var A=o.updateQueue;if(A!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}z0(o,A,d)}break;case 5:var K=o.stateNode;if(d===null&&o.flags&4){d=K;var ne=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&d.focus();break;case"img":ne.src&&(d.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var he=o.alternate;if(he!==null){var we=he.memoizedState;if(we!==null){var xe=we.dehydrated;xe!==null&&Ca(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}yn||o.flags&512&&bf(o)}catch(ye){Pt(o,o.return,ye)}}if(o===r){$e=null;break}if(d=o.sibling,d!==null){d.return=o.return,$e=d;break}$e=o.return}}function zb(r){for(;$e!==null;){var o=$e;if(o===r){$e=null;break}var d=o.sibling;if(d!==null){d.return=o.return,$e=d;break}$e=o.return}}function Ub(r){for(;$e!==null;){var o=$e;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Su(4,o)}catch(ne){Pt(o,d,ne)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var v=o.return;try{g.componentDidMount()}catch(ne){Pt(o,v,ne)}}var k=o.return;try{bf(o)}catch(ne){Pt(o,k,ne)}break;case 5:var A=o.return;try{bf(o)}catch(ne){Pt(o,A,ne)}}}catch(ne){Pt(o,o.return,ne)}if(o===r){$e=null;break}var K=o.sibling;if(K!==null){K.return=o.return,$e=K;break}$e=o.return}}var RM=Math.ceil,ju=C.ReactCurrentDispatcher,Nf=C.ReactCurrentOwner,tr=C.ReactCurrentBatchConfig,ht=0,tn=null,Wt=null,ln=0,zn=0,mi=Bs(0),Kt=0,Dl=null,Ja=0,Eu=0,Sf=0,ql=null,In=null,jf=0,gi=1/0,ms=null,Cu=!1,Ef=null,Vs=null,Tu=!1,Ys=null,Au=0,Fl=0,Cf=null,Ru=-1,Mu=0;function Nn(){return(ht&6)!==0?jt():Ru!==-1?Ru:Ru=jt()}function Ks(r){return(r.mode&1)===0?1:(ht&2)!==0&&ln!==0?ln&-ln:pM.transition!==null?(Mu===0&&(Mu=Tn()),Mu):(r=yt,r!==0||(r=window.event,r=r===void 0?16:Dc(r.type)),r)}function Nr(r,o,d,g){if(50<Fl)throw Fl=0,Cf=null,Error(n(185));Na(r,d,g),((ht&2)===0||r!==tn)&&(r===tn&&((ht&2)===0&&(Eu|=d),Kt===4&&Xs(r,ln)),$n(r,g),d===1&&ht===0&&(o.mode&1)===0&&(gi=jt()+500,ou&&Us()))}function $n(r,o){var d=r.callbackNode;jh(r,o);var g=ka(r,r===tn?ln:0);if(g===0)d!==null&&Ns(d),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(d!=null&&Ns(d),o===1)r.tag===0?fM(Hb.bind(null,r)):A0(Hb.bind(null,r)),Wa(function(){(ht&6)===0&&Us()}),d=null;else{switch(hr(g)){case 1:d=Ss;break;case 4:d=So;break;case 16:d=Lr;break;case 536870912:d=jo;break;default:d=Lr}d=Jb(d,Wb.bind(null,r))}r.callbackPriority=o,r.callbackNode=d}}function Wb(r,o){if(Ru=-1,Mu=0,(ht&6)!==0)throw Error(n(327));var d=r.callbackNode;if(yi()&&r.callbackNode!==d)return null;var g=ka(r,r===tn?ln:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=Iu(r,g);else{o=g;var v=ht;ht|=2;var k=Vb();(tn!==r||ln!==o)&&(ms=null,gi=jt()+500,to(r,o));do try{$M();break}catch(K){Gb(r,K)}while(!0);Hh(),ju.current=k,ht=v,Wt!==null?o=0:(tn=null,ln=0,o=Kt)}if(o!==0){if(o===2&&(v=Eo(r),v!==0&&(g=v,o=Tf(r,v))),o===1)throw d=Dl,to(r,0),Xs(r,g),$n(r,jt()),d;if(o===6)Xs(r,g);else{if(v=r.current.alternate,(g&30)===0&&!MM(v)&&(o=Iu(r,g),o===2&&(k=Eo(r),k!==0&&(g=k,o=Tf(r,k))),o===1))throw d=Dl,to(r,0),Xs(r,g),$n(r,jt()),d;switch(r.finishedWork=v,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:no(r,In,ms);break;case 3:if(Xs(r,g),(g&130023424)===g&&(o=jf+500-jt(),10<o)){if(ka(r,0)!==0)break;if(v=r.suspendedLanes,(v&g)!==g){Nn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=Sl(no.bind(null,r,In,ms),o);break}no(r,In,ms);break;case 4:if(Xs(r,g),(g&4194240)===g)break;for(o=r.eventTimes,v=-1;0<g;){var A=31-Cn(g);k=1<<A,A=o[A],A>v&&(v=A),g&=~k}if(g=v,g=jt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*RM(g/1960))-g,10<g){r.timeoutHandle=Sl(no.bind(null,r,In,ms),g);break}no(r,In,ms);break;case 5:no(r,In,ms);break;default:throw Error(n(329))}}}return $n(r,jt()),r.callbackNode===d?Wb.bind(null,r):null}function Tf(r,o){var d=ql;return r.current.memoizedState.isDehydrated&&(to(r,o).flags|=256),r=Iu(r,o),r!==2&&(o=In,In=d,o!==null&&Af(o)),r}function Af(r){In===null?In=r:In.push.apply(In,r)}function MM(r){for(var o=r;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],k=v.getSnapshot;v=v.value;try{if(!kn(k(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Xs(r,o){for(o&=~Sf,o&=~Eu,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var d=31-Cn(o),g=1<<d;r[d]=-1,o&=~g}}function Hb(r){if((ht&6)!==0)throw Error(n(327));yi();var o=ka(r,0);if((o&1)===0)return $n(r,jt()),null;var d=Iu(r,o);if(r.tag!==0&&d===2){var g=Eo(r);g!==0&&(o=g,d=Tf(r,g))}if(d===1)throw d=Dl,to(r,0),Xs(r,o),$n(r,jt()),d;if(d===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,no(r,In,ms),$n(r,jt()),null}function Rf(r,o){var d=ht;ht|=1;try{return r(o)}finally{ht=d,ht===0&&(gi=jt()+500,ou&&Us())}}function eo(r){Ys!==null&&Ys.tag===0&&(ht&6)===0&&yi();var o=ht;ht|=1;var d=tr.transition,g=yt;try{if(tr.transition=null,yt=1,r)return r()}finally{yt=g,tr.transition=d,ht=o,(ht&6)===0&&Us()}}function Mf(){zn=mi.current,Ct(mi)}function to(r,o){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,nu(d)),Wt!==null)for(d=Wt.return;d!==null;){var g=d;switch(Fh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&su();break;case 3:hi(),Ct(An),Ct(pn),Jh();break;case 5:Zh(g);break;case 4:hi();break;case 13:Ct(Mt);break;case 19:Ct(Mt);break;case 10:Gh(g.type._context);break;case 22:case 23:Mf()}d=d.return}if(tn=r,Wt=r=Zs(r.current,null),ln=zn=o,Kt=0,Dl=null,Sf=Eu=Ja=0,In=ql=null,Xa!==null){for(o=0;o<Xa.length;o++)if(d=Xa[o],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,k=d.pending;if(k!==null){var A=k.next;k.next=v,g.next=A}d.pending=g}Xa=null}return r}function Gb(r,o){do{var d=Wt;try{if(Hh(),gu.current=xu,yu){for(var g=It.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}yu=!1}if(Qa=0,en=Yt=It=null,Ml=!1,Il=0,Nf.current=null,d===null||d.return===null){Kt=1,Dl=o,Wt=null;break}e:{var k=r,A=d.return,K=d,ne=o;if(o=ln,K.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var he=ne,we=K,xe=we.tag;if((we.mode&1)===0&&(xe===0||xe===11||xe===15)){var ye=we.alternate;ye?(we.updateQueue=ye.updateQueue,we.memoizedState=ye.memoizedState,we.lanes=ye.lanes):(we.updateQueue=null,we.memoizedState=null)}var Re=yb(A);if(Re!==null){Re.flags&=-257,wb(Re,A,K,k,o),Re.mode&1&&gb(k,he,o),o=Re,ne=he;var Oe=o.updateQueue;if(Oe===null){var Le=new Set;Le.add(ne),o.updateQueue=Le}else Oe.add(ne);break e}else{if((o&1)===0){gb(k,he,o),If();break e}ne=Error(n(426))}}else if(At&&K.mode&1){var Ut=yb(A);if(Ut!==null){(Ut.flags&65536)===0&&(Ut.flags|=256),wb(Ut,A,K,k,o),Uh(fi(ne,K));break e}}k=ne=fi(ne,K),Kt!==4&&(Kt=2),ql===null?ql=[k]:ql.push(k),k=A;do{switch(k.tag){case 3:k.flags|=65536,o&=-o,k.lanes|=o;var le=pb(k,ne,o);B0(k,le);break e;case 1:K=ne;var se=k.type,ue=k.stateNode;if((k.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&(Vs===null||!Vs.has(ue)))){k.flags|=65536,o&=-o,k.lanes|=o;var _e=mb(k,K,o);B0(k,_e);break e}}k=k.return}while(k!==null)}Kb(d)}catch(qe){o=qe,Wt===d&&d!==null&&(Wt=d=d.return);continue}break}while(!0)}function Vb(){var r=ju.current;return ju.current=xu,r===null?xu:r}function If(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),tn===null||(Ja&268435455)===0&&(Eu&268435455)===0||Xs(tn,ln)}function Iu(r,o){var d=ht;ht|=2;var g=Vb();(tn!==r||ln!==o)&&(ms=null,to(r,o));do try{IM();break}catch(v){Gb(r,v)}while(!0);if(Hh(),ht=d,ju.current=g,Wt!==null)throw Error(n(261));return tn=null,ln=0,Kt}function IM(){for(;Wt!==null;)Yb(Wt)}function $M(){for(;Wt!==null&&!ma();)Yb(Wt)}function Yb(r){var o=Qb(r.alternate,r,zn);r.memoizedProps=r.pendingProps,o===null?Kb(r):Wt=o,Nf.current=null}function Kb(r){var o=r;do{var d=o.alternate;if(r=o.return,(o.flags&32768)===0){if(d=jM(d,o,zn),d!==null){Wt=d;return}}else{if(d=EM(d,o),d!==null){d.flags&=32767,Wt=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Kt=6,Wt=null;return}}if(o=o.sibling,o!==null){Wt=o;return}Wt=o=r}while(o!==null);Kt===0&&(Kt=5)}function no(r,o,d){var g=yt,v=tr.transition;try{tr.transition=null,yt=1,OM(r,o,d,g)}finally{tr.transition=v,yt=g}return null}function OM(r,o,d,g){do yi();while(Ys!==null);if((ht&6)!==0)throw Error(n(327));d=r.finishedWork;var v=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var k=d.lanes|d.childLanes;if(Ji(r,k),r===tn&&(Wt=tn=null,ln=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Tu||(Tu=!0,Jb(Lr,function(){return yi(),null})),k=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||k){k=tr.transition,tr.transition=null;var A=yt;yt=1;var K=ht;ht|=4,Nf.current=null,TM(r,d),qb(d,r),yl(Nl),Ta=!!Jo,Nl=Jo=null,r.current=d,AM(d),ga(),ht=K,yt=A,tr.transition=k}else r.current=d;if(Tu&&(Tu=!1,Ys=r,Au=v),k=r.pendingLanes,k===0&&(Vs=null),Dr(d.stateNode),$n(r,jt()),o!==null)for(g=r.onRecoverableError,d=0;d<o.length;d++)v=o[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(Cu)throw Cu=!1,r=Ef,Ef=null,r;return(Au&1)!==0&&r.tag!==0&&yi(),k=r.pendingLanes,(k&1)!==0?r===Cf?Fl++:(Fl=0,Cf=r):Fl=0,Us(),null}function yi(){if(Ys!==null){var r=hr(Au),o=tr.transition,d=yt;try{if(tr.transition=null,yt=16>r?16:r,Ys===null)var g=!1;else{if(r=Ys,Ys=null,Au=0,(ht&6)!==0)throw Error(n(331));var v=ht;for(ht|=4,$e=r.current;$e!==null;){var k=$e,A=k.child;if(($e.flags&16)!==0){var K=k.deletions;if(K!==null){for(var ne=0;ne<K.length;ne++){var he=K[ne];for($e=he;$e!==null;){var we=$e;switch(we.tag){case 0:case 11:case 15:Ll(8,we,k)}var xe=we.child;if(xe!==null)xe.return=we,$e=xe;else for(;$e!==null;){we=$e;var ye=we.sibling,Re=we.return;if($b(we),we===he){$e=null;break}if(ye!==null){ye.return=Re,$e=ye;break}$e=Re}}}var Oe=k.alternate;if(Oe!==null){var Le=Oe.child;if(Le!==null){Oe.child=null;do{var Ut=Le.sibling;Le.sibling=null,Le=Ut}while(Le!==null)}}$e=k}}if((k.subtreeFlags&2064)!==0&&A!==null)A.return=k,$e=A;else e:for(;$e!==null;){if(k=$e,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Ll(9,k,k.return)}var le=k.sibling;if(le!==null){le.return=k.return,$e=le;break e}$e=k.return}}var se=r.current;for($e=se;$e!==null;){A=$e;var ue=A.child;if((A.subtreeFlags&2064)!==0&&ue!==null)ue.return=A,$e=ue;else e:for(A=se;$e!==null;){if(K=$e,(K.flags&2048)!==0)try{switch(K.tag){case 0:case 11:case 15:Su(9,K)}}catch(qe){Pt(K,K.return,qe)}if(K===A){$e=null;break e}var _e=K.sibling;if(_e!==null){_e.return=K.return,$e=_e;break e}$e=K.return}}if(ht=v,Us(),vn&&typeof vn.onPostCommitFiberRoot=="function")try{vn.onPostCommitFiberRoot(dr,r)}catch{}g=!0}return g}finally{yt=d,tr.transition=o}}return!1}function Xb(r,o,d){o=fi(d,o),o=pb(r,o,1),r=Hs(r,o,1),o=Nn(),r!==null&&(Na(r,1,o),$n(r,o))}function Pt(r,o,d){if(r.tag===3)Xb(r,r,d);else for(;o!==null;){if(o.tag===3){Xb(o,r,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Vs===null||!Vs.has(g))){r=fi(d,r),r=mb(o,r,1),o=Hs(o,r,1),r=Nn(),o!==null&&(Na(o,1,r),$n(o,r));break}}o=o.return}}function PM(r,o,d){var g=r.pingCache;g!==null&&g.delete(o),o=Nn(),r.pingedLanes|=r.suspendedLanes&d,tn===r&&(ln&d)===d&&(Kt===4||Kt===3&&(ln&130023424)===ln&&500>jt()-jf?to(r,0):Sf|=d),$n(r,o)}function Zb(r,o){o===0&&((r.mode&1)===0?o=1:(o=xa,xa<<=1,(xa&130023424)===0&&(xa=4194304)));var d=Nn();r=hs(r,o),r!==null&&(Na(r,o,d),$n(r,d))}function LM(r){var o=r.memoizedState,d=0;o!==null&&(d=o.retryLane),Zb(r,d)}function DM(r,o){var d=0;switch(r.tag){case 13:var g=r.stateNode,v=r.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),Zb(r,d)}var Qb;Qb=function(r,o,d){if(r!==null)if(r.memoizedProps!==o.pendingProps||An.current)Mn=!0;else{if((r.lanes&d)===0&&(o.flags&128)===0)return Mn=!1,SM(r,o,d);Mn=(r.flags&131072)!==0}else Mn=!1,At&&(o.flags&1048576)!==0&&R0(o,lu,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;_u(r,o),r=o.pendingProps;var v=ai(o,pn.current);di(o,d),v=nf(null,o,g,r,v,d);var k=rf();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Rn(g)?(k=!0,au(o)):k=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Kh(o),v.updater=bu,o.stateNode=v,v._reactInternals=o,uf(o,g,r,d),o=pf(null,o,g,!0,k,d)):(o.tag=0,At&&k&&qh(o),_n(null,o,v,d),o=o.child),o;case 16:g=o.elementType;e:{switch(_u(r,o),r=o.pendingProps,v=g._init,g=v(g._payload),o.type=g,v=o.tag=FM(g),r=br(g,r),v){case 0:o=ff(null,o,g,r,d);break e;case 1:o=Nb(null,o,g,r,d);break e;case 11:o=vb(null,o,g,r,d);break e;case 14:o=xb(null,o,g,br(g.type,r),d);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),ff(r,o,g,v,d);case 1:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),Nb(r,o,g,v,d);case 3:e:{if(Sb(o),r===null)throw Error(n(387));g=o.pendingProps,k=o.memoizedState,v=k.element,F0(r,o),pu(o,g,null,d);var A=o.memoizedState;if(g=A.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},o.updateQueue.baseState=k,o.memoizedState=k,o.flags&256){v=fi(Error(n(423)),o),o=jb(r,o,g,d,v);break e}else if(g!==v){v=fi(Error(n(424)),o),o=jb(r,o,g,d,v);break e}else for(Bn=vr(o.stateNode.containerInfo.firstChild),Fn=o,At=!0,xr=null,d=D0(o,null,g,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(li(),g===v){o=ps(r,o,d);break e}_n(r,o,g,d)}o=o.child}return o;case 5:return U0(o),r===null&&zh(o),g=o.type,v=o.pendingProps,k=r!==null?r.memoizedProps:null,A=v.children,ei(g,v)?A=null:k!==null&&ei(g,k)&&(o.flags|=32),_b(r,o),_n(r,o,A,d),o.child;case 6:return r===null&&zh(o),null;case 13:return Eb(r,o,d);case 4:return Xh(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=ci(o,null,g,d):_n(r,o,g,d),o.child;case 11:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),vb(r,o,g,v,d);case 7:return _n(r,o,o.pendingProps,d),o.child;case 8:return _n(r,o,o.pendingProps.children,d),o.child;case 12:return _n(r,o,o.pendingProps.children,d),o.child;case 10:e:{if(g=o.type._context,v=o.pendingProps,k=o.memoizedProps,A=v.value,Et(du,g._currentValue),g._currentValue=A,k!==null)if(kn(k.value,A)){if(k.children===v.children&&!An.current){o=ps(r,o,d);break e}}else for(k=o.child,k!==null&&(k.return=o);k!==null;){var K=k.dependencies;if(K!==null){A=k.child;for(var ne=K.firstContext;ne!==null;){if(ne.context===g){if(k.tag===1){ne=fs(-1,d&-d),ne.tag=2;var he=k.updateQueue;if(he!==null){he=he.shared;var we=he.pending;we===null?ne.next=ne:(ne.next=we.next,we.next=ne),he.pending=ne}}k.lanes|=d,ne=k.alternate,ne!==null&&(ne.lanes|=d),Vh(k.return,d,o),K.lanes|=d;break}ne=ne.next}}else if(k.tag===10)A=k.type===o.type?null:k.child;else if(k.tag===18){if(A=k.return,A===null)throw Error(n(341));A.lanes|=d,K=A.alternate,K!==null&&(K.lanes|=d),Vh(A,d,o),A=k.sibling}else A=k.child;if(A!==null)A.return=k;else for(A=k;A!==null;){if(A===o){A=null;break}if(k=A.sibling,k!==null){k.return=A.return,A=k;break}A=A.return}k=A}_n(r,o,v.children,d),o=o.child}return o;case 9:return v=o.type,g=o.pendingProps.children,di(o,d),v=Jn(v),g=g(v),o.flags|=1,_n(r,o,g,d),o.child;case 14:return g=o.type,v=br(g,o.pendingProps),v=br(g.type,v),xb(r,o,g,v,d);case 15:return bb(r,o,o.type,o.pendingProps,d);case 17:return g=o.type,v=o.pendingProps,v=o.elementType===g?v:br(g,v),_u(r,o),o.tag=1,Rn(g)?(r=!0,au(o)):r=!1,di(o,d),hb(o,g,v),uf(o,g,v,d),pf(null,o,g,!0,r,d);case 19:return Tb(r,o,d);case 22:return kb(r,o,d)}throw Error(n(156,o.tag))};function Jb(r,o){return pa(r,o)}function qM(r,o,d,g){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(r,o,d,g){return new qM(r,o,d,g)}function $f(r){return r=r.prototype,!(!r||!r.isReactComponent)}function FM(r){if(typeof r=="function")return $f(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Q)return 11;if(r===X)return 14}return 2}function Zs(r,o){var d=r.alternate;return d===null?(d=nr(r.tag,o,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=o,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,o=r.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function $u(r,o,d,g,v,k){var A=2;if(g=r,typeof r=="function")$f(r)&&(A=1);else if(typeof r=="string")A=5;else e:switch(r){case I:return ro(d.children,v,k,o);case L:A=8,v|=8;break;case H:return r=nr(12,d,o,v|2),r.elementType=H,r.lanes=k,r;case J:return r=nr(13,d,o,v),r.elementType=J,r.lanes=k,r;case M:return r=nr(19,d,o,v),r.elementType=M,r.lanes=k,r;case P:return Ou(d,v,k,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case $:A=10;break e;case V:A=9;break e;case Q:A=11;break e;case X:A=14;break e;case G:A=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=nr(A,d,o,v),o.elementType=r,o.type=g,o.lanes=k,o}function ro(r,o,d,g){return r=nr(7,r,g,o),r.lanes=d,r}function Ou(r,o,d,g){return r=nr(22,r,g,o),r.elementType=P,r.lanes=d,r.stateNode={isHidden:!1},r}function Of(r,o,d){return r=nr(6,r,null,o),r.lanes=d,r}function Pf(r,o,d){return o=nr(4,r.children!==null?r.children:[],r.key,o),o.lanes=d,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function BM(r,o,d,g,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=js(0),this.expirationTimes=js(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=js(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Lf(r,o,d,g,v,k,A,K,ne){return r=new BM(r,o,d,K,ne),o===1?(o=1,k===!0&&(o|=8)):o=0,k=nr(3,null,null,o),r.current=k,k.stateNode=r,k.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kh(k),r}function zM(r,o,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:r,containerInfo:o,implementation:d}}function ek(r){if(!r)return zs;r=r._reactInternals;e:{if(rn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Rn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var d=r.type;if(Rn(d))return C0(r,d,o)}return o}function tk(r,o,d,g,v,k,A,K,ne){return r=Lf(d,g,!0,r,v,k,A,K,ne),r.context=ek(null),d=r.current,g=Nn(),v=Ks(d),k=fs(g,v),k.callback=o??null,Hs(d,k,v),r.current.lanes=v,Na(r,v,g),$n(r,g),r}function Pu(r,o,d,g){var v=o.current,k=Nn(),A=Ks(v);return d=ek(d),o.context===null?o.context=d:o.pendingContext=d,o=fs(k,A),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Hs(v,o,A),r!==null&&(Nr(r,v,A,k),fu(r,v,A)),A}function Lu(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function nk(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<o?d:o}}function Df(r,o){nk(r,o),(r=r.alternate)&&nk(r,o)}function UM(){return null}var rk=typeof reportError=="function"?reportError:function(r){console.error(r)};function qf(r){this._internalRoot=r}Du.prototype.render=qf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Pu(r,o,null,null)},Du.prototype.unmount=qf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;eo(function(){Pu(null,r,null,null)}),o[ls]=null}};function Du(r){this._internalRoot=r}Du.prototype.unstable_scheduleHydration=function(r){if(r){var o=fr();r={blockedOn:null,target:r,priority:o};for(var d=0;d<Dn.length&&o!==0&&o<Dn[d].priority;d++);Dn.splice(d,0,r),d===0&&rl(r)}};function Ff(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function qu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function sk(){}function WM(r,o,d,g,v){if(v){if(typeof g=="function"){var k=g;g=function(){var he=Lu(A);k.call(he)}}var A=tk(o,g,r,0,null,!1,!1,"",sk);return r._reactRootContainer=A,r[ls]=A.current,D(r.nodeType===8?r.parentNode:r),eo(),A}for(;v=r.lastChild;)r.removeChild(v);if(typeof g=="function"){var K=g;g=function(){var he=Lu(ne);K.call(he)}}var ne=Lf(r,0,!1,null,null,!1,!1,"",sk);return r._reactRootContainer=ne,r[ls]=ne.current,D(r.nodeType===8?r.parentNode:r),eo(function(){Pu(o,ne,d,g)}),ne}function Fu(r,o,d,g,v){var k=d._reactRootContainer;if(k){var A=k;if(typeof v=="function"){var K=v;v=function(){var ne=Lu(A);K.call(ne)}}Pu(o,A,r,v)}else A=WM(d,o,r,v,g);return Lu(A)}Sa=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var d=ba(o.pendingLanes);d!==0&&(Bt(o,d|1),$n(o,jt()),(ht&6)===0&&(gi=jt()+500,Us()))}break;case 13:eo(function(){var g=hs(r,1);if(g!==null){var v=Nn();Nr(g,r,1,v)}}),Df(r,1)}},Co=function(r){if(r.tag===13){var o=hs(r,134217728);if(o!==null){var d=Nn();Nr(o,r,134217728,d)}Df(r,134217728)}},Pc=function(r){if(r.tag===13){var o=Ks(r),d=hs(r,o);if(d!==null){var g=Nn();Nr(d,r,o,g)}Df(r,o)}},fr=function(){return yt},ja=function(r,o){var d=yt;try{return yt=r,o()}finally{yt=d}},Dt=function(r,o,d){switch(o){case"input":if(je(r,d),o=d.name,d.type==="radio"&&o!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var g=d[o];if(g!==r&&g.form===r.form){var v=ru(g);if(!v)throw Error(n(90));Ue(g),je(g,v)}}}break;case"textarea":Ee(r,d);break;case"select":o=d.value,o!=null&&Ye(r,!!d.multiple,o,!1)}},Yn=Rf,qt=eo;var HM={usingClientEntryPoint:!1,Events:[El,ri,ru,jn,En,Rf]},Bl={findFiberByHostInstance:Ga,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GM={bundleType:Bl.bundleType,version:Bl.version,rendererPackageName:Bl.rendererPackageName,rendererConfig:Bl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=ha(r),r===null?null:r.stateNode},findFiberByHostInstance:Bl.findFiberByHostInstance||UM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bu.isDisabled&&Bu.supportsFiber)try{dr=Bu.inject(GM),vn=Bu}catch{}}return On.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HM,On.createPortal=function(r,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ff(o))throw Error(n(200));return zM(r,o,null,d)},On.createRoot=function(r,o){if(!Ff(r))throw Error(n(299));var d=!1,g="",v=rk;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Lf(r,1,!1,null,null,d,!1,g,v),r[ls]=o.current,D(r.nodeType===8?r.parentNode:r),new qf(o)},On.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=ha(o),r=r===null?null:r.stateNode,r},On.flushSync=function(r){return eo(r)},On.hydrate=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!0,d)},On.hydrateRoot=function(r,o,d){if(!Ff(r))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,k="",A=rk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(k=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),o=tk(o,null,r,1,d??null,v,!1,k,A),r[ls]=o.current,D(r),g)for(r=0;r<g.length;r++)d=g[r],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Du(o)},On.render=function(r,o,d){if(!qu(o))throw Error(n(200));return Fu(null,r,o,!1,d)},On.unmountComponentAtNode=function(r){if(!qu(r))throw Error(n(40));return r._reactRootContainer?(eo(function(){Fu(null,null,r,!1,function(){r._reactRootContainer=null,r[ls]=null})}),!0):!1},On.unstable_batchedUpdates=Rf,On.unstable_renderSubtreeIntoContainer=function(r,o,d,g){if(!qu(d))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Fu(r,o,d,!1,g)},On.version="18.3.1-next-f1338f8080-20240426",On}var hk;function wT(){if(hk)return Uf.exports;hk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Uf.exports=JM(),Uf.exports}var fk;function eI(){if(fk)return Uu;fk=1;var e=wT();return Uu.createRoot=e.createRoot,Uu.hydrateRoot=e.hydrateRoot,Uu}var tI=eI();const nI="modulepreload",rI=function(e){return"/"+e},pk={},vT=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=rI(p),p in pk)return;pk[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":nI,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,N)=>{y.addEventListener("load",w),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};var x=bc();const fe=xx(x);function un(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=un(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Vf={},Yf={exports:{}},Kf={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -45,7 +45,7 @@ Error generating stack: `+b.message+`
|
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/var mk;function sI(){if(mk)return Kf;mk=1;var e=bc();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),_=N[0].inst,
|
|
48
|
+
*/var mk;function sI(){if(mk)return Kf;mk=1;var e=bc();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),_=N[0].inst,S=N[1];return i(function(){_.value=w,_.getSnapshot=y,f(_)&&S({inst:_})},[m,w,y]),a(function(){return f(_)&&S({inst:_}),m(function(){f(_)&&S({inst:_})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Kf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Kf}var gk;function aI(){return gk||(gk=1,Yf.exports=sI()),Yf.exports}/**
|
|
49
49
|
* @license React
|
|
50
50
|
* use-sync-external-store-shim/with-selector.production.js
|
|
51
51
|
*
|
|
@@ -53,44 +53,44 @@ Error generating stack: `+b.message+`
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var yk;function oI(){if(yk)return Vf;yk=1;var e=bc(),t=aI();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Vf.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var N=i(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=u(function(){function k(R){if(!S){if(S=!0,E=R,R=y(R),w!==void 0&&_.hasValue){var I=_.value;if(w(I,R))return C=I}return C=R}if(I=C,s(E,R))return I;var F=y(R);return w!==void 0&&w(I,F)?(E=R,I):(E=R,C=F)}var S=!1,E,C,T=m===void 0?null:m;return[function(){return k(h())},T===null?void 0:function(){return k(T())}]},[h,m,y,w]);var j=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=j},[j]),f(j),j},Vf}var wk;function iI(){return wk||(wk=1,Gf.exports=oI()),Gf.exports}var lI=iI();const cI=xx(lI),uI={},vk=e=>{let t;const n=new Set,s=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(uI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},dI=e=>e?vk(e):vk,{useDebugValue:hI}=pe,{useSyncExternalStoreWithSelector:fI}=cI,pI=e=>e;function xT(e,t=pI,n){const s=fI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hI(s),s}const xk=(e,t)=>{const n=dI(e),s=(a,i=t)=>xT(n,a,i);return Object.assign(s,n),s},mI=(e,t)=>e?xk(e,t):xk;function Qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,a]of e)if(!Object.is(a,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var gI={value:()=>{}};function Gd(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new fd(n)}function fd(e){this._=e}function yI(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",a=n.indexOf(".");if(a>=0&&(s=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}fd.prototype=Gd.prototype={constructor:fd,on:function(e,t){var n=this._,s=yI(e+"",n),a,i=-1,c=s.length;if(arguments.length<2){for(;++i<c;)if((a=(e=s[i]).type)&&(a=wI(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<c;)if(a=(e=s[i]).type)n[a]=bk(n[a],e.name,t);else if(t==null)for(a in n)n[a]=bk(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new fd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function wI(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function bk(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=gI,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bv="http://www.w3.org/1999/xhtml";const kk={svg:"http://www.w3.org/2000/svg",xhtml:Bv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),kk.hasOwnProperty(t)?{space:kk[t],local:e}:e}function vI(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bv&&t.documentElement.namespaceURI===Bv?t.createElement(e):t.createElementNS(n,e)}}function xI(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bT(e){var t=Vd(e);return(t.local?xI:vI)(t)}function bI(){}function bx(e){return e==null?bI:function(){return this.querySelector(e)}}function kI(e){typeof e!="function"&&(e=bx(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=new Array(c),f,p,h=0;h<c;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Wn(s,this._parents)}function _I(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function NI(){return[]}function kT(e){return e==null?NI:function(){return this.querySelectorAll(e)}}function SI(e){return function(){return _I(e.apply(this,arguments))}}function jI(e){typeof e=="function"?e=SI(e):e=kT(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var c=t[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),a.push(f));return new Wn(s,a)}function _T(e){return function(){return this.matches(e)}}function NT(e){return function(t){return t.matches(e)}}var EI=Array.prototype.find;function CI(e){return function(){return EI.call(this.children,e)}}function TI(){return this.firstElementChild}function AI(e){return this.select(e==null?TI:CI(typeof e=="function"?e:NT(e)))}var RI=Array.prototype.filter;function MI(){return Array.from(this.children)}function II(e){return function(){return RI.call(this.children,e)}}function $I(e){return this.selectAll(e==null?MI:II(typeof e=="function"?e:NT(e)))}function OI(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new Wn(s,this._parents)}function ST(e){return new Array(e.length)}function PI(){return new Wn(this._enter||this._groups.map(ST),this._parents)}function Nd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nd.prototype={constructor:Nd,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 LI(e){return function(){return e}}function DI(e,t,n,s,a,i){for(var c=0,u,f=t.length,p=i.length;c<p;++c)(u=t[c])?(u.__data__=i[c],s[c]=u):n[c]=new Nd(e,i[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function qI(e,t,n,s,a,i,c){var u,f,p=new Map,h=t.length,m=i.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,i[u],u,i)+"",(f=p.get(w))?(s[u]=f,f.__data__=i[u],p.delete(w)):n[u]=new Nd(e,i[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function FI(e){return e.__data__}function BI(e,t){if(!arguments.length)return Array.from(this,FI);var n=t?qI:DI,s=this._parents,a=this._groups;typeof e!="function"&&(e=LI(e));for(var i=a.length,c=new Array(i),u=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],m=a[p],y=m.length,w=zI(e.call(h,h&&h.__data__,p,s)),N=w.length,_=u[p]=new Array(N),j=c[p]=new Array(N),k=f[p]=new Array(y);n(h,m,_,j,k,w,t);for(var S=0,E=0,C,T;S<N;++S)if(C=_[S]){for(S>=E&&(E=S+1);!(T=j[E])&&++E<N;);C._next=T||null}}return c=new Wn(c,s),c._enter=u,c._exit=f,c}function zI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UI(){return new Wn(this._exit||this._groups.map(ST),this._parents)}function WI(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function HI(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,c=Math.min(a,i),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=s[f],m=p.length,y=u[f]=new Array(m),w,N=0;N<m;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)u[f]=n[f];return new Wn(u,this._parents)}function GI(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],c;--a>=0;)(c=s[a])&&(i&&c.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(c,i),i=c);return this}function VI(e){e||(e=YI);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var c=n[i],u=c.length,f=a[i]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new Wn(a,this._parents).order()}function YI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XI(){return Array.from(this)}function ZI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var c=s[a];if(c)return c}return null}function QI(){let e=0;for(const t of this)++e;return e}function JI(){return!this.node()}function e$(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,c=a.length,u;i<c;++i)(u=a[i])&&e.call(u,u.__data__,i,a);return this}function t$(e){return function(){this.removeAttribute(e)}}function n$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function r$(e,t){return function(){this.setAttribute(e,t)}}function s$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function a$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function o$(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 i$(e,t){var n=Vd(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?n$:t$:typeof t=="function"?n.local?o$:a$:n.local?s$:r$)(n,t))}function jT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l$(e){return function(){this.style.removeProperty(e)}}function c$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function u$(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function d$(e,t,n){return arguments.length>1?this.each((t==null?l$:typeof t=="function"?u$:c$)(e,t,n??"")):$i(this.node(),e)}function $i(e,t){return e.style.getPropertyValue(t)||jT(e).getComputedStyle(e,null).getPropertyValue(t)}function h$(e){return function(){delete this[e]}}function f$(e,t){return function(){this[e]=t}}function p$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function m$(e,t){return arguments.length>1?this.each((t==null?h$:typeof t=="function"?p$:f$)(e,t)):this.node()[e]}function ET(e){return e.trim().split(/^|\s+/)}function kx(e){return e.classList||new CT(e)}function CT(e){this._node=e,this._names=ET(e.getAttribute("class")||"")}CT.prototype={add:function(e){var t=this._names.indexOf(e);t<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 TT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function AT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function g$(e){return function(){TT(this,e)}}function y$(e){return function(){AT(this,e)}}function w$(e,t){return function(){(t.apply(this,arguments)?TT:AT)(this,e)}}function v$(e,t){var n=ET(e+"");if(arguments.length<2){for(var s=kx(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?w$:t?g$:y$)(n,t))}function x$(){this.textContent=""}function b$(e){return function(){this.textContent=e}}function k$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _$(e){return arguments.length?this.each(e==null?x$:(typeof e=="function"?k$:b$)(e)):this.node().textContent}function N$(){this.innerHTML=""}function S$(e){return function(){this.innerHTML=e}}function j$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function E$(e){return arguments.length?this.each(e==null?N$:(typeof e=="function"?j$:S$)(e)):this.node().innerHTML}function C$(){this.nextSibling&&this.parentNode.appendChild(this)}function T$(){return this.each(C$)}function A$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R$(){return this.each(A$)}function M$(e){var t=typeof e=="function"?e:bT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function I$(){return null}function $$(e,t){var n=typeof e=="function"?e:bT(e),s=t==null?I$:typeof t=="function"?t:bx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function O$(){var e=this.parentNode;e&&e.removeChild(this)}function P$(){return this.each(O$)}function L$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function q$(e){return this.select(e?D$:L$)}function F$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function B$(e){return function(t){e.call(this,t,this.__data__)}}function z$(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function U$(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function W$(e,t,n){return function(){var s=this.__on,a,i=B$(t);if(s){for(var c=0,u=s.length;c<u;++c)if((a=s[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function H$(e,t,n){var s=z$(e+""),a,i=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<i;++a)if((c=s[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?W$:U$,a=0;a<i;++a)this.each(u(s[a],t,n));return this}function RT(e,t,n){var s=jT(e),a=s.CustomEvent;typeof a=="function"?a=new a(t,n):(a=s.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function G$(e,t){return function(){return RT(this,e,t)}}function V$(e,t){return function(){return RT(this,e,t.apply(this,arguments))}}function Y$(e,t){return this.each((typeof t=="function"?V$:G$)(e,t))}function*K$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,c;a<i;++a)(c=s[a])&&(yield c)}var MT=[null];function Wn(e,t){this._groups=e,this._parents=t}function kc(){return new Wn([[document.documentElement]],MT)}function X$(){return this}Wn.prototype=kc.prototype={constructor:Wn,select:kI,selectAll:jI,selectChild:AI,selectChildren:$I,filter:OI,data:BI,enter:PI,exit:UI,join:WI,merge:HI,selection:X$,order:GI,sort:VI,call:KI,nodes:XI,node:ZI,size:QI,empty:JI,each:e$,attr:i$,style:d$,property:m$,classed:v$,text:_$,html:E$,raise:T$,lower:R$,append:M$,insert:$$,remove:P$,clone:q$,datum:F$,on:H$,dispatch:Y$,[Symbol.iterator]:K$};function ar(e){return typeof e=="string"?new Wn([[document.querySelector(e)]],[document.documentElement]):new Wn([[e]],MT)}function Z$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jr(e,t){if(e=Z$(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Q$={passive:!1},oc={capture:!0,passive:!1};function Xf(e){e.stopImmediatePropagation()}function Ti(e){e.preventDefault(),e.stopImmediatePropagation()}function IT(e){var t=e.document.documentElement,n=ar(e).on("dragstart.drag",Ti,oc);"onselectstart"in t?n.on("selectstart.drag",Ti,oc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $T(e,t){var n=e.document.documentElement,s=ar(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ti,oc),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Wu=e=>()=>e;function zv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}zv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function J$(e){return!e.ctrlKey&&!e.button}function eO(){return this.parentNode}function tO(e,t){return t??{x:e.x,y:e.y}}function nO(){return navigator.maxTouchPoints||"ontouchstart"in this}function rO(){var e=J$,t=eO,n=tO,s=nO,a={},i=Gd("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",j).on("touchmove.drag",k,Q$).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(ar(C.view).on("mousemove.drag",N,oc).on("mouseup.drag",_,oc),IT(C.view),Xf(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function N(C){if(Ti(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){ar(C.view).on("mousemove.drag mouseup.drag",null),$T(C.view,p),Ti(C),a.mouse("end",C)}function j(C,T){if(e.call(this,C,T)){var R=C.changedTouches,I=t.call(this,C,T),F=R.length,W,O;for(W=0;W<F;++W)(O=E(this,I,C,T,R[W].identifier,R[W]))&&(Xf(C),O("start",C,R[W]))}}function k(C){var T=C.changedTouches,R=T.length,I,F;for(I=0;I<R;++I)(F=a[T[I].identifier])&&(Ti(C),F("drag",C,T[I]))}function S(C){var T=C.changedTouches,R=T.length,I,F;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<R;++I)(F=a[T[I].identifier])&&(Xf(C),F("end",C,T[I]))}function E(C,T,R,I,F,W){var O=i.copy(),B=jr(W||R,T),Z,Q,M;if((M=n.call(C,new zv("beforestart",{sourceEvent:R,target:y,identifier:F,active:c,x:B[0],y:B[1],dx:0,dy:0,dispatch:O}),I))!=null)return Z=M.x-B[0]||0,Q=M.y-B[1]||0,function K(G,P,H){var L=B,U;switch(G){case"start":a[F]=K,U=c++;break;case"end":delete a[F],--c;case"drag":B=jr(H||P,T),U=c;break}O.call(G,C,new zv(G,{sourceEvent:P,subject:M,target:y,identifier:F,active:U,x:B[0]+Z,y:B[1]+Q,dx:B[0]-L[0],dy:B[1]-L[1],dispatch:O}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Wu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Wu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Wu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Wu(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function _x(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function OT(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function _c(){}var ic=.7,Sd=1/ic,Ai="\\s*([+-]?\\d+)\\s*",lc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sO=/^#([0-9a-f]{3,8})$/,aO=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),oO=new RegExp(`^rgb\\(${Hr},${Hr},${Hr}\\)$`),iO=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${lc}\\)$`),lO=new RegExp(`^rgba\\(${Hr},${Hr},${Hr},${lc}\\)$`),cO=new RegExp(`^hsl\\(${lc},${Hr},${Hr}\\)$`),uO=new RegExp(`^hsla\\(${lc},${Hr},${Hr},${lc}\\)$`),_k={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};_x(_c,cc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nk,formatHex:Nk,formatHex8:dO,formatHsl:hO,formatRgb:Sk,toString:Sk});function Nk(){return this.rgb().formatHex()}function dO(){return this.rgb().formatHex8()}function hO(){return PT(this).formatHsl()}function Sk(){return this.rgb().formatRgb()}function cc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jk(t):n===3?new $n(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Hu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Hu(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=aO.exec(e))?new $n(t[1],t[2],t[3],1):(t=oO.exec(e))?new $n(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iO.exec(e))?Hu(t[1],t[2],t[3],t[4]):(t=lO.exec(e))?Hu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,1):(t=uO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,t[4]):_k.hasOwnProperty(e)?jk(_k[e]):e==="transparent"?new $n(NaN,NaN,NaN,0):null}function jk(e){return new $n(e>>16&255,e>>8&255,e&255,1)}function Hu(e,t,n,s){return s<=0&&(e=t=n=NaN),new $n(e,t,n,s)}function fO(e){return e instanceof _c||(e=cc(e)),e?(e=e.rgb(),new $n(e.r,e.g,e.b,e.opacity)):new $n}function Uv(e,t,n,s){return arguments.length===1?fO(e):new $n(e,t,n,s??1)}function $n(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}_x($n,Uv,OT(_c,{brighter(e){return e=e==null?Sd:Math.pow(Sd,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ic:Math.pow(ic,e),new $n(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $n(oo(this.r),oo(this.g),oo(this.b),jd(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:Ek,formatHex:Ek,formatHex8:pO,formatRgb:Ck,toString:Ck}));function Ek(){return`#${so(this.r)}${so(this.g)}${so(this.b)}`}function pO(){return`#${so(this.r)}${so(this.g)}${so(this.b)}${so((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ck(){const e=jd(this.opacity);return`${e===1?"rgb(":"rgba("}${oo(this.r)}, ${oo(this.g)}, ${oo(this.b)}${e===1?")":`, ${e})`}`}function jd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function so(e){return e=oo(e),(e<16?"0":"")+e.toString(16)}function Tk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Er(e,t,n,s)}function PT(e){if(e instanceof Er)return new Er(e.h,e.s,e.l,e.opacity);if(e instanceof _c||(e=cc(e)),!e)return new Er;if(e instanceof Er)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),c=NaN,u=i-a,f=(i+a)/2;return u?(t===i?c=(n-s)/u+(n<s)*6:n===i?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?i+a:2-i-a,c*=60):u=f>0&&f<1?0:c,new Er(c,u,f,e.opacity)}function mO(e,t,n,s){return arguments.length===1?PT(e):new Er(e,t,n,s??1)}function Er(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}_x(Er,mO,OT(_c,{brighter(e){return e=e==null?Sd:Math.pow(Sd,e),new Er(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ic:Math.pow(ic,e),new Er(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,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new $n(Zf(e>=240?e-240:e+120,a,s),Zf(e,a,s),Zf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new Er(Ak(this.h),Gu(this.s),Gu(this.l),jd(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(){const e=jd(this.opacity);return`${e===1?"hsl(":"hsla("}${Ak(this.h)}, ${Gu(this.s)*100}%, ${Gu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ak(e){return e=(e||0)%360,e<0?e+360:e}function Gu(e){return Math.max(0,Math.min(1,e||0))}function Zf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const LT=e=>()=>e;function gO(e,t){return function(n){return e+n*t}}function yO(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function wO(e){return(e=+e)==1?DT:function(t,n){return n-t?yO(t,n,e):LT(isNaN(t)?n:t)}}function DT(e,t){var n=t-e;return n?gO(e,n):LT(isNaN(e)?t:e)}const Rk=(function e(t){var n=wO(t);function s(a,i){var c=n((a=Uv(a)).r,(i=Uv(i)).r),u=n(a.g,i.g),f=n(a.b,i.b),p=DT(a.opacity,i.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function ta(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Wv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qf=new RegExp(Wv.source,"g");function vO(e){return function(){return e}}function xO(e){return function(t){return e(t)+""}}function bO(e,t){var n=Wv.lastIndex=Qf.lastIndex=0,s,a,i,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Wv.exec(e))&&(a=Qf.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),u[c]?u[c]+=i:u[++c]=i),(s=s[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:ta(s,a)})),n=Qf.lastIndex;return n<t.length&&(i=t.slice(n),u[c]?u[c]+=i:u[++c]=i),u.length<2?f[0]?xO(f[0].x):vO(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var Mk=180/Math.PI,Hv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qT(e,t,n,s,a,i){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Mk,skewX:Math.atan(f)*Mk,scaleX:c,scaleY:u}}var Vu;function kO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hv:qT(t.a,t.b,t.c,t.d,t.e,t.f)}function _O(e){return e==null||(Vu||(Vu=document.createElementNS("http://www.w3.org/2000/svg","g")),Vu.setAttribute("transform",e),!(e=Vu.transform.baseVal.consolidate()))?Hv:(e=e.matrix,qT(e.a,e.b,e.c,e.d,e.e,e.f))}function FT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push("translate(",null,t,null,n);N.push({i:_-4,x:ta(p,m)},{i:_-2,x:ta(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:ta(p,h)})):h&&m.push(a(m)+"rotate("+h+s)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:ta(p,h)}):h&&m.push(a(m)+"skewX("+h+s)}function f(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push(a(w)+"scale(",null,",",null,")");N.push({i:_-4,x:ta(p,m)},{i:_-2,x:ta(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var N=-1,_=y.length,j;++N<_;)m[(j=y[N]).i]=j.x(w);return m.join("")}}}var NO=FT(kO,"px, ","px)","deg)"),SO=FT(_O,", ",")",")"),jO=1e-12;function Ik(e){return((e=Math.exp(e))+1/e)/2}function EO(e){return((e=Math.exp(e))-1/e)/2}function CO(e){return((e=Math.exp(2*e))-1)/(e+1)}const TO=(function e(t,n,s){function a(i,c){var u=i[0],f=i[1],p=i[2],h=c[0],m=c[1],y=c[2],w=h-u,N=m-f,_=w*w+N*N,j,k;if(_<jO)k=Math.log(y/p)/t,j=function(I){return[u+I*w,f+I*N,p*Math.exp(t*I*k)]};else{var S=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*S),C=(y*y-p*p-s*_)/(2*y*n*S),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);k=(R-T)/t,j=function(I){var F=I*k,W=Ik(T),O=p/(n*S)*(W*CO(t*F+T)-EO(T));return[u+O*w,f+O*N,p*W/Ik(t*F+T)]}}return j.duration=k*1e3*t/Math.SQRT2,j}return a.rho=function(i){var c=Math.max(.001,+i),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var Oi=0,Zl=0,Bl=0,BT=1e3,Ed,Ql,Cd=0,lo=0,Yd=0,uc=typeof performance=="object"&&performance.now?performance:Date,zT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nx(){return lo||(zT(AO),lo=uc.now()+Yd)}function AO(){lo=0}function Td(){this._call=this._time=this._next=null}Td.prototype=UT.prototype={constructor:Td,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nx():+n)+(t==null?0:+t),!this._next&&Ql!==this&&(Ql?Ql._next=this:Ed=this,Ql=this),this._call=e,this._time=n,Gv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gv())}};function UT(e,t,n){var s=new Td;return s.restart(e,t,n),s}function RO(){Nx(),++Oi;for(var e=Ed,t;e;)(t=lo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oi}function $k(){lo=(Cd=uc.now())+Yd,Oi=Zl=0;try{RO()}finally{Oi=0,IO(),lo=0}}function MO(){var e=uc.now(),t=e-Cd;t>BT&&(Yd-=t,Cd=e)}function IO(){for(var e,t=Ed,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ed=n);Ql=e,Gv(s)}function Gv(e){if(!Oi){Zl&&(Zl=clearTimeout(Zl));var t=e-lo;t>24?(e<1/0&&(Zl=setTimeout($k,e-uc.now()-Yd)),Bl&&(Bl=clearInterval(Bl))):(Bl||(Cd=uc.now(),Bl=setInterval(MO,BT)),Oi=1,zT($k))}}function Ok(e,t,n){var s=new Td;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var $O=Gd("start","end","cancel","interrupt"),OO=[],WT=0,Pk=1,Vv=2,pd=3,Lk=4,Yv=5,md=6;function Kd(e,t,n,s,a,i){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;PO(e,n,{name:t,index:s,group:a,on:$O,tween:OO,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:WT})}function Sx(e,t){var n=Mr(e,t);if(n.state>WT)throw new Error("too late; already scheduled");return n}function Yr(e,t){var n=Mr(e,t);if(n.state>pd)throw new Error("too late; already running");return n}function Mr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PO(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=UT(i,0,n.time);function i(p){n.state=Pk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==Pk)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===pd)return Ok(c);w.state===Lk?(w.state=md,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=md,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Ok(function(){n.state===pd&&(n.state=Lk,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Vv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vv){for(n.state=pd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Yv,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Yv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=md,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function gd(e,t){var n=e.__transition,s,a,i=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){i=!1;continue}a=s.state>Vv&&s.state<Yv,s.state=md,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}i&&delete e.__transition}}function LO(e){return this.each(function(){gd(this,e)})}function DO(e,t){var n,s;return function(){var a=Yr(this,e),i=a.tween;if(i!==n){s=n=i;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function qO(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Yr(this,e),c=i.tween;if(c!==s){a=(s=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}i.tween=a}}function FO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Mr(this.node(),n).tween,a=0,i=s.length,c;a<i;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?DO:qO)(n,e,t))}function jx(e,t,n){var s=e._id;return e.each(function(){var a=Yr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Mr(a,s).value[t]}}function HT(e,t){var n;return(typeof t=="number"?ta:t instanceof cc?Rk:(n=cc(t))?(t=n,Rk):bO)(e,t)}function BO(e){return function(){this.removeAttribute(e)}}function zO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttribute(e);return c===a?null:c===s?i:i=t(s=c,n)}}function WO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?i:i=t(s=c,n)}}function HO(e,t,n){var s,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u)))}}function GO(e,t,n){var s,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u)))}}function VO(e,t){var n=Vd(e),s=n==="transform"?SO:HT;return this.attrTween(e,typeof t=="function"?(n.local?GO:HO)(n,s,jx(this,"attr."+e,t)):t==null?(n.local?zO:BO)(n):(n.local?WO:UO)(n,s,t))}function YO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function KO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function XO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&KO(e,i)),n}return a._value=t,a}function ZO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&YO(e,i)),n}return a._value=t,a}function QO(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 new Error;var s=Vd(e);return this.tween(n,(s.local?XO:ZO)(s,t))}function JO(e,t){return function(){Sx(this,e).delay=+t.apply(this,arguments)}}function e3(e,t){return t=+t,function(){Sx(this,e).delay=t}}function t3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?JO:e3)(t,e)):Mr(this.node(),t).delay}function n3(e,t){return function(){Yr(this,e).duration=+t.apply(this,arguments)}}function r3(e,t){return t=+t,function(){Yr(this,e).duration=t}}function s3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n3:r3)(t,e)):Mr(this.node(),t).duration}function a3(e,t){if(typeof t!="function")throw new Error;return function(){Yr(this,e).ease=t}}function o3(e){var t=this._id;return arguments.length?this.each(a3(t,e)):Mr(this.node(),t).ease}function i3(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Yr(this,e).ease=n}}function l3(e){if(typeof e!="function")throw new Error;return this.each(i3(this._id,e))}function c3(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new vs(s,this._parents,this._name,this._id)}function u3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),c=new Array(s),u=0;u<i;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<s;++u)c[u]=t[u];return new vs(c,this._parents,this._name,this._id)}function d3(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function h3(e,t,n){var s,a,i=d3(t)?Sx:Yr;return function(){var c=i(this,e),u=c.on;u!==s&&(a=(s=u).copy()).on(t,n),c.on=a}}function f3(e,t){var n=this._id;return arguments.length<2?Mr(this.node(),n).on.on(e):this.each(h3(n,e,t))}function p3(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function m3(){return this.on("end.remove",p3(this._id))}function g3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bx(e));for(var s=this._groups,a=s.length,i=new Array(a),c=0;c<a;++c)for(var u=s[c],f=u.length,p=i[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,Kd(p[y],t,n,y,p,Mr(h,n)));return new vs(i,this._parents,t,n)}function y3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kT(e));for(var s=this._groups,a=s.length,i=[],c=[],u=0;u<a;++u)for(var f=s[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,N=Mr(h,n),_=0,j=y.length;_<j;++_)(w=y[_])&&Kd(w,t,n,_,y,N);i.push(y),c.push(h)}return new vs(i,c,t,n)}var w3=kc.prototype.constructor;function v3(){return new w3(this._groups,this._parents)}function x3(e,t){var n,s,a;return function(){var i=$i(this,e),c=(this.style.removeProperty(e),$i(this,e));return i===c?null:i===n&&c===s?a:a=t(n=i,s=c)}}function GT(e){return function(){this.style.removeProperty(e)}}function b3(e,t,n){var s,a=n+"",i;return function(){var c=$i(this,e);return c===a?null:c===s?i:i=t(s=c,n)}}function k3(e,t,n){var s,a,i;return function(){var c=$i(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),$i(this,e))),c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u))}}function _3(e,t){var n,s,a,i="style."+t,c="end."+i,u;return function(){var f=Yr(this,e),p=f.on,h=f.value[i]==null?u||(u=GT(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(c,a=h),f.on=s}}function N3(e,t,n){var s=(e+="")=="transform"?NO:HT;return t==null?this.styleTween(e,x3(e,s)).on("end.style."+e,GT(e)):typeof t=="function"?this.styleTween(e,k3(e,s,jx(this,"style."+e,t))).each(_3(this._id,e)):this.styleTween(e,b3(e,s,t),n).on("end.style."+e,null)}function S3(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function j3(e,t,n){var s,a;function i(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&S3(e,c,n)),s}return i._value=t,i}function E3(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,j3(e,t,n??""))}function C3(e){return function(){this.textContent=e}}function T3(e){return function(){var t=e(this);this.textContent=t??""}}function A3(e){return this.tween("text",typeof e=="function"?T3(jx(this,"text",e)):C3(e==null?"":e+""))}function R3(e){return function(t){this.textContent=e.call(this,t)}}function M3(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&R3(a)),t}return s._value=e,s}function I3(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 new Error;return this.tween(t,M3(e))}function $3(){for(var e=this._name,t=this._id,n=VT(),s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=Mr(f,t);Kd(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new vs(s,this._parents,e,n)}function O3(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,c){var u={value:c},f={value:function(){--a===0&&i()}};n.each(function(){var p=Yr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&i()})}var P3=0;function vs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function VT(){return++P3}var ms=kc.prototype;vs.prototype={constructor:vs,select:g3,selectAll:y3,selectChild:ms.selectChild,selectChildren:ms.selectChildren,filter:c3,merge:u3,selection:v3,transition:$3,call:ms.call,nodes:ms.nodes,node:ms.node,size:ms.size,empty:ms.empty,each:ms.each,on:f3,attr:VO,attrTween:QO,style:N3,styleTween:E3,text:A3,textTween:I3,remove:m3,tween:FO,delay:t3,duration:s3,ease:o3,easeVarying:l3,end:O3,[Symbol.iterator]:ms[Symbol.iterator]};function L3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D3={time:null,delay:0,duration:250,ease:L3};function q3(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function F3(e){var t,n;e instanceof vs?(t=e._id,e=e._name):(t=VT(),(n=D3).time=Nx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&Kd(f,e,t,p,c,n||q3(f,t));return new vs(s,this._parents,e,t)}kc.prototype.interrupt=LO;kc.prototype.transition=F3;const Yu=e=>()=>e;function B3(e,{sourceEvent:t,target:n,transform:s,dispatch:a}){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:s,enumerable:!0,configurable:!0},_:{value:a}})}function gs(e,t,n){this.k=e,this.x=t,this.y=n}gs.prototype={constructor:gs,scale:function(e){return e===1?this:new gs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new gs(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 ws=new gs(1,0,0);gs.prototype;function Jf(e){e.stopImmediatePropagation()}function zl(e){e.preventDefault(),e.stopImmediatePropagation()}function z3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U3(){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 Dk(){return this.__zoom||ws}function W3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H3(){return navigator.maxTouchPoints||"ontouchstart"in this}function G3(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>i?(i+c)/2:Math.min(0,i)||Math.max(0,c))}function YT(){var e=z3,t=U3,n=G3,s=W3,a=H3,i=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=TO,p=Gd("start","zoom","end"),h,m,y,w=500,N=150,_=0,j=10;function k(M){M.property("__zoom",Dk).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",B).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(M,K,G,P){var H=M.selection?M.selection():M;H.property("__zoom",Dk),M!==H?T(M,K,G,P):H.interrupt().each(function(){R(this,arguments).event(P).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},k.scaleBy=function(M,K,G,P){k.scaleTo(M,function(){var H=this.__zoom.k,L=typeof K=="function"?K.apply(this,arguments):K;return H*L},G,P)},k.scaleTo=function(M,K,G,P){k.transform(M,function(){var H=t.apply(this,arguments),L=this.__zoom,U=G==null?C(H):typeof G=="function"?G.apply(this,arguments):G,$=L.invert(U),V=typeof K=="function"?K.apply(this,arguments):K;return n(E(S(L,V),U,$),H,c)},G,P)},k.translateBy=function(M,K,G,P){k.transform(M,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,P)},k.translateTo=function(M,K,G,P,H){k.transform(M,function(){var L=t.apply(this,arguments),U=this.__zoom,$=P==null?C(L):typeof P=="function"?P.apply(this,arguments):P;return n(ws.translate($[0],$[1]).scale(U.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof G=="function"?-G.apply(this,arguments):-G),L,c)},P,H)};function S(M,K){return K=Math.max(i[0],Math.min(i[1],K)),K===M.k?M:new gs(K,M.x,M.y)}function E(M,K,G){var P=K[0]-G[0]*M.k,H=K[1]-G[1]*M.k;return P===M.x&&H===M.y?M:new gs(M.k,P,H)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,K,G,P){M.on("start.zoom",function(){R(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(P).end()}).tween("zoom",function(){var H=this,L=arguments,U=R(H,L).event(P),$=t.apply(H,L),V=G==null?C($):typeof G=="function"?G.apply(H,L):G,he=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),Y=H.__zoom,J=typeof K=="function"?K.apply(H,L):K,z=f(Y.invert(V).concat(he/Y.k),J.invert(V).concat(he/J.k));return function(re){if(re===1)re=J;else{var le=z(re),me=he/le[2];re=new gs(me,V[0]-le[0]*me,V[1]-le[1]*me)}U.zoom(null,re)}})}function R(M,K,G){return!G&&M.__zooming||new I(M,K)}function I(M,K){this.that=M,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,K),this.taps=0}I.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,K){return this.mouse&&M!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var K=ar(this.that).datum();p.call(M,this.that,new B3(M,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),K)}};function F(M,...K){if(!e.apply(this,arguments))return;var G=R(this,K).event(M),P=this.__zoom,H=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,s.apply(this,arguments)))),L=jr(M);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=P.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(P.k===H)return;G.mouse=[L,P.invert(L)],gd(this),G.start()}zl(M),G.wheel=setTimeout(U,N),G.zoom("mouse",n(E(S(P,H),G.mouse[0],G.mouse[1]),G.extent,c));function U(){G.wheel=null,G.end()}}function W(M,...K){if(y||!e.apply(this,arguments))return;var G=M.currentTarget,P=R(this,K,!0).event(M),H=ar(M.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",he,!0),L=jr(M,G),U=M.clientX,$=M.clientY;IT(M.view),Jf(M),P.mouse=[L,this.__zoom.invert(L)],gd(this),P.start();function V(Y){if(zl(Y),!P.moved){var J=Y.clientX-U,z=Y.clientY-$;P.moved=J*J+z*z>_}P.event(Y).zoom("mouse",n(E(P.that.__zoom,P.mouse[0]=jr(Y,G),P.mouse[1]),P.extent,c))}function he(Y){H.on("mousemove.zoom mouseup.zoom",null),$T(Y.view,P.moved),zl(Y),P.event(Y).end()}}function O(M,...K){if(e.apply(this,arguments)){var G=this.__zoom,P=jr(M.changedTouches?M.changedTouches[0]:M,this),H=G.invert(P),L=G.k*(M.shiftKey?.5:2),U=n(E(S(G,L),P,H),t.apply(this,K),c);zl(M),u>0?ar(this).transition().duration(u).call(T,U,P,M):ar(this).call(k.transform,U,P,M)}}function B(M,...K){if(e.apply(this,arguments)){var G=M.touches,P=G.length,H=R(this,K,M.changedTouches.length===P).event(M),L,U,$,V;for(Jf(M),U=0;U<P;++U)$=G[U],V=jr($,this),V=[V,this.__zoom.invert(V),$.identifier],H.touch0?!H.touch1&&H.touch0[2]!==V[2]&&(H.touch1=V,H.taps=0):(H.touch0=V,L=!0,H.taps=1+!!h);h&&(h=clearTimeout(h)),L&&(H.taps<2&&(m=V[0],h=setTimeout(function(){h=null},w)),gd(this),H.start())}}function Z(M,...K){if(this.__zooming){var G=R(this,K).event(M),P=M.changedTouches,H=P.length,L,U,$,V;for(zl(M),L=0;L<H;++L)U=P[L],$=jr(U,this),G.touch0&&G.touch0[2]===U.identifier?G.touch0[0]=$:G.touch1&&G.touch1[2]===U.identifier&&(G.touch1[0]=$);if(U=G.that.__zoom,G.touch1){var he=G.touch0[0],Y=G.touch0[1],J=G.touch1[0],z=G.touch1[1],re=(re=J[0]-he[0])*re+(re=J[1]-he[1])*re,le=(le=z[0]-Y[0])*le+(le=z[1]-Y[1])*le;U=S(U,Math.sqrt(re/le)),$=[(he[0]+J[0])/2,(he[1]+J[1])/2],V=[(Y[0]+z[0])/2,(Y[1]+z[1])/2]}else if(G.touch0)$=G.touch0[0],V=G.touch0[1];else return;G.zoom("touch",n(E(U,$,V),G.extent,c))}}function Q(M,...K){if(this.__zooming){var G=R(this,K).event(M),P=M.changedTouches,H=P.length,L,U;for(Jf(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),L=0;L<H;++L)U=P[L],G.touch0&&G.touch0[2]===U.identifier?delete G.touch0:G.touch1&&G.touch1[2]===U.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(U=jr(U,this),Math.hypot(m[0]-U[0],m[1]-U[1])<j)){var $=ar(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(M){return arguments.length?(s=typeof M=="function"?M:Yu(+M),k):s},k.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Yu(!!M),k):e},k.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:Yu(!!M),k):a},k.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Yu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),k):t},k.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],k):[i[0],i[1]]},k.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],k):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},k.constrain=function(M){return arguments.length?(n=M,k):n},k.duration=function(M){return arguments.length?(u=+M,k):u},k.interpolate=function(M){return arguments.length?(f=M,k):f},k.on=function(){var M=p.on.apply(p,arguments);return M===p?k:M},k.clickDistance=function(M){return arguments.length?(_=(M=+M)*M,k):Math.sqrt(_)},k.tapDistance=function(M){return arguments.length?(j=+M,k):j},k}var Kr=wT();const Xd=x.createContext(null),V3=Xd.Provider,xs={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},KT=xs.error001();function gt(e,t){const n=x.useContext(Xd);if(n===null)throw new Error(KT);return xT(n,e,t)}const Wt=()=>{const e=x.useContext(Xd);if(e===null)throw new Error(KT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Y3=e=>e.userSelectionActive?"none":"all";function Ex({position:e,children:t,className:n,style:s,...a}){const i=gt(Y3),c=`${e}`.split("-");return pe.createElement("div",{className:un(["react-flow__panel",n,...c]),style:{...s,pointerEvents:i},...a},t)}function K3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(Ex,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},pe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const X3=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),N=un(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),typeof n>"u"||!n?null:pe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&pe.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),f)};var Z3=x.memo(X3);const Cx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Pi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tx=(e={x:0,y:0},t)=>({x:Pi(e.x,t[0][0],t[1][0]),y:Pi(e.y,t[0][1],t[1][1])}),qk=(e,t,n)=>e<t?Pi(Math.abs(e-t),1,50)/50:e>n?-Pi(Math.abs(e-n),1,50)/50:0,XT=(e,t)=>{const n=qk(e.x,35,t.width-35)*20,s=qk(e.y,35,t.height-35)*20;return[n,s]},ZT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},QT=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),dc=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),JT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Fk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Q3=(e,t)=>JT(QT(dc(e),dc(t))),Kv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},J3=e=>or(e.width)&&or(e.height)&&or(e.x)&&or(e.y),or=e=>!isNaN(e)&&isFinite(e),Lt=Symbol.for("internals"),e2=["Enter"," ","Escape"],e4=(e,t)=>{},t4=e=>"nativeEvent"in e;function Xv(e){var a,i;const t=t4(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const t2=e=>"clientX"in e,aa=(e,t)=>{var i,c;const n=t2(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Ad=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Nc=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&or(n)&&or(s)?pe.createElement(Z3,{x:n,y:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Nc.displayName="BaseEdge";function Ul(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function n2({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[i,u,a,c]}function r2({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+i*.375+u*.375+s*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var co;(function(e){e.Strict="strict",e.Loose="loose"})(co||(co={}));var ao;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ao||(ao={}));var hc;(function(e){e.Partial="partial",e.Full="full"})(hc||(hc={}));var ra;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ra||(ra={}));var Rd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rd||(Rd={}));var ze;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ze||(ze={}));function Bk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===ze.Left||e===ze.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function s2({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top}){const[c,u]=Bk({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Bk({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,m,y,w]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${a}`,h,m,y,w]}const Ax=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:i=ze.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[j,k,S]=s2({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return pe.createElement(Nc,{path:j,labelX:k,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Ax.displayName="SimpleBezierEdge";const zk={[ze.Left]:{x:-1,y:0},[ze.Right]:{x:1,y:0},[ze.Top]:{x:0,y:-1},[ze.Bottom]:{x:0,y:1}},n4=({source:e,sourcePosition:t=ze.Bottom,target:n})=>t===ze.Left||t===ze.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Uk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function r4({source:e,sourcePosition:t=ze.Bottom,target:n,targetPosition:s=ze.Top,center:a,offset:i}){const c=zk[t],u=zk[s],f={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=n4({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],N,_;const j={x:0,y:0},k={x:0,y:0},[S,E,C,T]=n2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){N=a.x??S,_=a.y??E;const I=[{x:N,y:f.y},{x:N,y:p.y}],F=[{x:f.x,y:_},{x:p.x,y:_}];c[m]===y?w=m==="x"?I:F:w=m==="x"?F:I}else{const I=[{x:f.x,y:p.y}],F=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?F:I:w=c.y===y?I:F,t===s){const Q=Math.abs(e[m]-n[m]);if(Q<=i){const M=Math.min(i-1,i-Q);c[m]===y?j[m]=(f[m]>e[m]?-1:1)*M:k[m]=(p[m]>n[m]?-1:1)*M}}if(t!==s){const Q=m==="x"?"y":"x",M=c[m]===u[Q],K=f[Q]>p[Q],G=f[Q]<p[Q];(c[m]===1&&(!M&&K||M&&G)||c[m]!==1&&(!M&&G||M&&K))&&(w=m==="x"?I:F)}const W={x:f.x+j.x,y:f.y+j.y},O={x:p.x+k.x,y:p.y+k.y},B=Math.max(Math.abs(W.x-w[0].x),Math.abs(O.x-w[0].x)),Z=Math.max(Math.abs(W.y-w[0].y),Math.abs(O.y-w[0].y));B>=Z?(N=(W.x+O.x)/2,_=w[0].y):(N=w[0].x,_=(W.y+O.y)/2)}return[[e,{x:f.x+j.x,y:f.y+j.y},...w,{x:p.x+k.x,y:p.y+k.y},n],N,_,C,T]}function s4(e,t,n,s){const a=Math.min(Uk(e,t)/2,Uk(t,n)/2,s),{x:i,y:c}=t;if(e.x===i&&i===n.x||e.y===c&&c===n.y)return`L${i} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${c}Q ${i},${c} ${i},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${c+a*f}Q ${i},${c} ${i+a*u},${c}`}function Zv({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,N]=r4({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:u,y:f},offset:p});return[h.reduce((j,k,S)=>{let E="";return S>0&&S<h.length-1?E=s4(h[S-1],k,h[S+1],c):E=`${S===0?"M":"L"}${k.x} ${k.y}`,j+=E,j},""),m,y,w,N]}const Zd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=ze.Bottom,targetPosition:y=ze.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:j})=>{const[k,S,E]=Zv({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:s,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return pe.createElement(Nc,{path:k,labelX:S,labelY:E,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:j})});Zd.displayName="SmoothStepEdge";const Rx=x.memo(e=>{var t;return pe.createElement(Zd,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Rx.displayName="StepEdge";function a4({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,c,u]=n2({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,c,u]}const Mx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,j]=a4({sourceX:e,sourceY:t,targetX:n,targetY:s});return pe.createElement(Nc,{path:N,labelX:_,labelY:j,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});Mx.displayName="StraightEdge";function Ku(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wk({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case ze.Left:return[t-Ku(t-s,i),n];case ze.Right:return[t+Ku(s-t,i),n];case ze.Top:return[t,n-Ku(n-a,i)];case ze.Bottom:return[t,n+Ku(a-n,i)]}}function Ix({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:i=ze.Top,curvature:c=.25}){const[u,f]=Wk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,h]=Wk({pos:i,x1:s,y1:a,x2:e,y2:t,c}),[m,y,w,N]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${s},${a}`,m,y,w,N]}const Md=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:i=ze.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:j})=>{const[k,S,E]=Ix({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:_==null?void 0:_.curvature});return pe.createElement(Nc,{path:k,labelX:S,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:j})});Md.displayName="BezierEdge";const $x=x.createContext(null),o4=$x.Provider;$x.Consumer;const i4=()=>x.useContext($x),l4=e=>"id"in e&&"source"in e&&"target"in e,c4=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Qv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,u4=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),d4=(e,t)=>{if(!e.source||!e.target)return t;let n;return l4(e)?n={...e}:n={...e,id:c4(e)},u4(n,t)?t:t.concat(n)},Jv=({x:e,y:t},[n,s,a],i,[c,u])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},a2=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),io=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-s};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:a}},Qd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:c}=io(a,t).positionAbsolute;return QT(s,dc({x:i,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return JT(n)},o2=(e,t,[n,s,a]=[0,0,1],i=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=h;if(c&&!w||N)return!1;const{positionAbsolute:_}=io(h,u),j={x:_.x,y:_.y,width:m||0,height:y||0},k=Kv(f,j),S=typeof m>"u"||typeof y>"u"||m===null||y===null,E=i&&k>0,C=(m||0)*(y||0);(S||E||k>=C||h.dragging)&&p.push(h)}),p},i2=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},l2=(e,t,n,s,a,i=.1)=>{const c=t/(e.width*(1+i)),u=n/(e.height*(1+i)),f=Math.min(c,u),p=Pi(f,s,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},ro=(e,t=0)=>e.transition().duration(t);function Hk(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var c,u;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),a},[])}function h4(e,t,n,s,a,i){const{x:c,y:u}=aa(e),p=t.elementsFromPoint(c,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Ox(void 0,p),j=p.getAttribute("data-handleid"),k=i({nodeId:N,id:j,type:_});if(k){const S=a.find(E=>E.nodeId===N&&E.type===_&&E.id===j);return{handle:{id:j,type:_,nodeId:N,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:k}}}}let h=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const j=i(N);_<=m&&(_<m?h=[{handle:N,validHandleResult:j}]:_===m&&h.push({handle:N,validHandleResult:j}),m=_)}}),!h.length)return{handle:null,validHandleResult:c2()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||h[0]}const f4={source:null,target:null,sourceHandle:null,targetHandle:null},c2=()=>({handleDomNode:null,isValid:!1,connection:f4,endHandle:null});function u2(e,t,n,s,a,i,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...c2(),handleDomNode:f};if(f){const h=Ox(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),_={source:u?m:n,sourceHandle:u?y:s,target:u?n:m,targetHandle:u?s:y};p.connection=_,w&&N&&(t===co.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=i(_))}return p}function p4({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[Lt]){const{handleBounds:c}=i[Lt];let u=[],f=[];c&&(u=Hk(i,c,"source",`${t}-${n}-${s}`),f=Hk(i,c,"target",`${t}-${n}-${s}`)),a.push(...u,...f)}return a},[])}function Ox(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ep(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function m4(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function d2({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=ZT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:j,getNodes:k,cancelConnection:S}=i();let E=0,C;const{x:T,y:R}=aa(e),I=h==null?void 0:h.elementFromPoint(T,R),F=Ox(f,I),W=y==null?void 0:y.getBoundingClientRect();if(!W||!F)return;let O,B=aa(e,W),Z=!1,Q=null,M=!1,K=null;const G=p4({nodes:k(),nodeId:n,handleId:t,handleType:F}),P=()=>{if(!w)return;const[U,$]=XT(B,W);j({x:U,y:$}),E=requestAnimationFrame(P)};c({connectionPosition:B,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:F});function H(U){const{transform:$}=i();B=aa(U,W);const{handle:V,validHandleResult:he}=h4(U,h,Jv(B,$,!1,[1,1]),N,G,Y=>u2(Y,m,n,t,a?"target":"source",u,h));if(C=V,Z||(P(),Z=!0),K=he.handleDomNode,Q=he.connection,M=he.isValid,c({connectionPosition:C&&M?a2({x:C.x,y:C.y},$):B,connectionStatus:m4(!!C,M),connectionEndHandle:he.endHandle}),!C&&!M&&!K)return ep(O);Q.source!==Q.target&&K&&(ep(O),O=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",M),K.classList.toggle("react-flow__handle-valid",M))}function L(U){var $,V;(C||K)&&Q&&M&&(s==null||s(Q)),(V=($=i()).onConnectEnd)==null||V.call($,U),f&&(p==null||p(U)),ep(O),S(),cancelAnimationFrame(E),Z=!1,M=!1,Q=null,K=null,h.removeEventListener("mousemove",H),h.removeEventListener("mouseup",L),h.removeEventListener("touchmove",H),h.removeEventListener("touchend",L)}h.addEventListener("mousemove",H),h.addEventListener("mouseup",L),h.addEventListener("touchmove",H),h.addEventListener("touchend",L)}const Gk=()=>!0,g4=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),y4=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:c}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},h2=x.forwardRef(({type:e="source",position:t=ze.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var W,O;const N=c||null,_=e==="target",j=Wt(),k=i4(),{connectOnClick:S,noPanClassName:E}=gt(g4,Qt),{connecting:C,clickConnecting:T}=gt(y4(k,N,e),Qt);k||(O=(W=j.getState()).onError)==null||O.call(W,"010",xs.error010());const R=B=>{const{defaultEdgeOptions:Z,onConnect:Q,hasDefaultEdges:M}=j.getState(),K={...Z,...B};if(M){const{edges:G,setEdges:P}=j.getState();P(d4(K,G))}Q==null||Q(K),u==null||u(K)},I=B=>{if(!k)return;const Z=t2(B);a&&(Z&&B.button===0||!Z)&&d2({event:B,handleId:N,nodeId:k,onConnect:R,isTarget:_,getState:j.getState,setState:j.setState,isValidConnection:n||j.getState().isValidConnection||Gk}),Z?h==null||h(B):m==null||m(B)},F=B=>{const{onClickConnectStart:Z,onClickConnectEnd:Q,connectionClickStartHandle:M,connectionMode:K,isValidConnection:G}=j.getState();if(!k||!M&&!a)return;if(!M){Z==null||Z(B,{nodeId:k,handleId:N,handleType:e}),j.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const P=ZT(B.target),H=n||G||Gk,{connection:L,isValid:U}=u2({nodeId:k,id:N,type:e},K,M.nodeId,M.handleId||null,M.type,H,P);U&&R(L),Q==null||Q(B),j.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:un(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:i,connecting:T,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:S?F:void 0,ref:w,...y},f)});h2.displayName="Handle";var uo=x.memo(h2);const f2=({data:e,isConnectable:t,targetPosition:n=ze.Top,sourcePosition:s=ze.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(uo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(uo,{type:"source",position:s,isConnectable:t}));f2.displayName="DefaultNode";var ex=x.memo(f2);const p2=({data:e,isConnectable:t,sourcePosition:n=ze.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(uo,{type:"source",position:n,isConnectable:t}));p2.displayName="InputNode";var m2=x.memo(p2);const g2=({data:e,isConnectable:t,targetPosition:n=ze.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(uo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);g2.displayName="OutputNode";var y2=x.memo(g2);const Px=()=>null;Px.displayName="GroupNode";const w4=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Xu=e=>e.id;function v4(e,t){return Qt(e.selectedNodes.map(Xu),t.selectedNodes.map(Xu))&&Qt(e.selectedEdges.map(Xu),t.selectedEdges.map(Xu))}const w2=x.memo(({onSelectionChange:e})=>{const t=Wt(),{selectedNodes:n,selectedEdges:s}=gt(w4,v4);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});w2.displayName="SelectionListener";const x4=e=>!!e.onSelectionChange;function b4({onSelectionChange:e}){const t=gt(x4);return e||t?pe.createElement(w2,{onSelectionChange:e}):null}const k4=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function gi(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function at(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const _4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:j,nodeExtent:k,onNodesChange:S,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:I,translateExtent:F,connectOnClick:W,defaultEdgeOptions:O,fitView:B,fitViewOptions:Z,onNodesDelete:Q,onEdgesDelete:M,onNodeDrag:K,onNodeDragStart:G,onNodeDragStop:P,onSelectionDrag:H,onSelectionDragStart:L,onSelectionDragStop:U,noPanClassName:$,nodeOrigin:V,rfId:he,autoPanOnConnect:Y,autoPanOnNodeDrag:J,onError:z,connectionRadius:re,isValidConnection:le,nodeDragThreshold:me})=>{const{setNodes:ge,setEdges:Me,setDefaultNodesAndEdges:qe,setMinZoom:Ve,setMaxZoom:Ue,setTranslateExtent:Se,setNodeExtent:Qe,reset:Ne}=gt(k4,Qt),_e=Wt();return x.useEffect(()=>{const ue=s==null?void 0:s.map(je=>({...je,...O}));return qe(n,ue),()=>{Ne()}},[]),at("defaultEdgeOptions",O,_e.setState),at("connectionMode",T,_e.setState),at("onConnect",a,_e.setState),at("onConnectStart",i,_e.setState),at("onConnectEnd",c,_e.setState),at("onClickConnectStart",u,_e.setState),at("onClickConnectEnd",f,_e.setState),at("nodesDraggable",p,_e.setState),at("nodesConnectable",h,_e.setState),at("nodesFocusable",m,_e.setState),at("edgesFocusable",y,_e.setState),at("edgesUpdatable",w,_e.setState),at("elementsSelectable",C,_e.setState),at("elevateNodesOnSelect",N,_e.setState),at("snapToGrid",I,_e.setState),at("snapGrid",R,_e.setState),at("onNodesChange",S,_e.setState),at("onEdgesChange",E,_e.setState),at("connectOnClick",W,_e.setState),at("fitViewOnInit",B,_e.setState),at("fitViewOnInitOptions",Z,_e.setState),at("onNodesDelete",Q,_e.setState),at("onEdgesDelete",M,_e.setState),at("onNodeDrag",K,_e.setState),at("onNodeDragStart",G,_e.setState),at("onNodeDragStop",P,_e.setState),at("onSelectionDrag",H,_e.setState),at("onSelectionDragStart",L,_e.setState),at("onSelectionDragStop",U,_e.setState),at("noPanClassName",$,_e.setState),at("nodeOrigin",V,_e.setState),at("rfId",he,_e.setState),at("autoPanOnConnect",Y,_e.setState),at("autoPanOnNodeDrag",J,_e.setState),at("onError",z,_e.setState),at("connectionRadius",re,_e.setState),at("isValidConnection",le,_e.setState),at("nodeDragThreshold",me,_e.setState),gi(e,ge),gi(t,Me),gi(_,Ve),gi(j,Ue),gi(F,Se),gi(k,Qe),null},Vk={display:"none"},N4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},v2="react-flow__node-desc",x2="react-flow__edge-desc",S4="react-flow__aria-live",j4=e=>e.ariaLiveMessage;function E4({rfId:e}){const t=gt(j4);return pe.createElement("div",{id:`${S4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:N4},t)}function C4({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${v2}-${e}`,style:Vk},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),pe.createElement("div",{id:`${x2}-${e}`,style:Vk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement(E4,{rfId:e}))}var fc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),i=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);i.current.add(w[_]),Yk(c,i.current,!1)&&(w.preventDefault(),s(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);Yk(c,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[_]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,s]),n};function Yk(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Kk(e,t){return t.includes(e)?"code":"key"}function b2(e,t,n,s){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),c=io(i,s);return b2(i,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=i[Lt])==null?void 0:u.z)??0)>(n.z??0)?((f=i[Lt])==null?void 0:f.z)??0:n.z??0},s)}function k2(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:c,y:u,z:f}=b2(s,e,{...s.position,z:((i=s[Lt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:c,y:u},s[Lt].z=f,n!=null&&n[s.id]&&(s[Lt].isParent=!0)}})}function tp(e,t,n,s){const a=new Map,i={},c=s?1e3:0;return e.forEach(u=>{var w;const f=(or(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(i[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Lt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Lt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),k2(a,n,i),a}function _2(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const N=n().filter(j=>{var S;const k=t.includeHiddenNodes?j.width&&j.height:!j.hidden;return(S=t.nodes)!=null&&S.length?k&&t.nodes.some(E=>E.id===j.id):k}),_=N.every(j=>j.width&&j.height);if(N.length>0&&_){const j=Qd(N,m),{x:k,y:S,zoom:E}=l2(j,s,a,t.minZoom??i,t.maxZoom??c,t.padding??.1),C=ws.translate(k,S).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(ro(f,t.duration),C):u.transform(f,C),!0}}return!1}function T4(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Lt]:s[Lt],selected:n.selected})}),new Map(t)}function A4(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Zu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:T4(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:A4(t,i)}),u==null||u(t))}const yi=()=>{},R4={zoomIn:yi,zoomOut:yi,zoomTo:yi,getZoom:()=>1,setViewport:yi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:yi,fitBounds:yi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},M4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),I4=()=>{const e=Wt(),{d3Zoom:t,d3Selection:n}=gt(M4,Qt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ro(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ro(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ro(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[c,u,f]=e.getState().transform,p=ws.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(ro(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,c]=e.getState().transform;return{x:a,y:i,zoom:c}},fitView:a=>_2(e.getState,a),setCenter:(a,i,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-i*h,w=ws.translate(m,y).scale(h);t.transform(ro(n,c==null?void 0:c.duration),w)},fitBounds:(a,i)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=l2(a,c,u,f,p,(i==null?void 0:i.padding)??.1),w=ws.translate(h,m).scale(y);t.transform(ro(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Jv(a,i,c,u)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return Jv(m,i,c,u)},flowToScreenPosition:a=>{const{transform:i,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=a2(a,i);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:R4,[t,n])};function Sc(){const e=I4(),t=Wt(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(j=>({...j}))},[]),i=x.useCallback(_=>{const{edges:j=[]}=t.getState();return j.find(k=>k.id===_)},[]),c=x.useCallback(_=>{const{getNodes:j,setNodes:k,hasDefaultNodes:S,onNodesChange:E}=t.getState(),C=j(),T=typeof _=="function"?_(C):_;if(S)k(T);else if(E){const R=T.length===0?C.map(I=>({type:"remove",id:I.id})):T.map(I=>({item:I,type:"reset"}));E(R)}},[]),u=x.useCallback(_=>{const{edges:j=[],setEdges:k,hasDefaultEdges:S,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(j):_;if(S)k(C);else if(E){const T=C.length===0?j.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(_=>{const j=Array.isArray(_)?_:[_],{getNodes:k,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...k(),...j];S(R)}else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const j=Array.isArray(_)?_:[_],{edges:k=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)S([...k,...j]);else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:_,edges:j=[],transform:k}=t.getState(),[S,E,C]=k;return{nodes:_().map(T=>({...T})),edges:j.map(T=>({...T})),viewport:{x:S,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:j})=>{const{nodeInternals:k,getNodes:S,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:I,onNodesChange:F,onEdgesChange:W}=t.getState(),O=(_||[]).map(K=>K.id),B=(j||[]).map(K=>K.id),Z=S().reduce((K,G)=>{const P=G.parentNode||G.parentId,H=!O.includes(G.id)&&P&&K.find(U=>U.id===P);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(O.includes(G.id)||H)&&K.push(G),K},[]),Q=E.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),M=Q.filter(K=>B.includes(K.id));if(Z||M){const K=i2(Z,Q),G=[...M,...K],P=G.reduce((H,L)=>(H.includes(L.id)||H.push(L.id),H),[]);if((T||C)&&(T&&t.setState({edges:E.filter(H=>!P.includes(H.id))}),C&&(Z.forEach(H=>{k.delete(H.id)}),t.setState({nodeInternals:new Map(k)}))),P.length>0&&(I==null||I(G),W&&W(P.map(H=>({id:H,type:"remove"})))),Z.length>0&&(R==null||R(Z),F)){const H=Z.map(L=>({id:L.id,type:"remove"}));F(H)}}},[]),y=x.useCallback(_=>{const j=J3(_),k=j?null:t.getState().nodeInternals.get(_.id);return!j&&!k?[null,null,j]:[j?_:Fk(k),k,j]},[]),w=x.useCallback((_,j=!0,k)=>{const[S,E,C]=y(_);return S?(k||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=Fk(T),I=Kv(R,S);return j&&I>0||I>=S.width*S.height}):[]},[]),N=x.useCallback((_,j,k=!0)=>{const[S]=y(_);if(!S)return!1;const E=Kv(S,j);return k&&E>0||E>=S.width*S.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,c,u,f,p,h,m,w,N])}const $4={actInsideInputWithModifier:!1};var O4=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Wt(),{deleteElements:s}=Sc(),a=fc(e,$4),i=fc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function P4(e){const t=Wt();x.useEffect(()=>{let n;const s=()=>{var i,c;if(!e.current)return;const a=Cx(e.current);(a.height===0||a.width===0)&&((c=(i=t.getState()).onError)==null||c.call(i,"004",xs.error004())),t.setState({width:a.width||500,height:a.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Lx={position:"absolute",width:"100%",height:"100%",top:0,left:0},L4=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Qu=e=>({x:e.x,y:e.y,zoom:e.k}),wi=(e,t)=>e.target.closest(`.${t}`),Xk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zk=e=>{const t=e.ctrlKey&&Ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},D4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),q4=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=ao.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:j,preventScrolling:k=!0,children:S,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Wt(),I=x.useRef(!1),F=x.useRef(!1),W=x.useRef(null),O=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:B,d3Selection:Z,d3ZoomHandler:Q,userSelectionActive:M}=gt(D4,Qt),K=fc(j),G=x.useRef(0),P=x.useRef(!1),H=x.useRef();return P4(W),x.useEffect(()=>{if(W.current){const L=W.current.getBoundingClientRect(),U=YT().scaleExtent([N,_]).translateExtent(w),$=ar(W.current).call(U),V=ws.translate(y.x,y.y).scale(Pi(y.zoom,N,_)),he=[[0,0],[L.width,L.height]],Y=U.constrain()(V,he,w);U.transform($,Y),U.wheelDelta(Zk),R.setState({d3Zoom:U,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:W.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Z&&B&&(c&&!K&&!M?Z.on("wheel.zoom",L=>{if(wi(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const U=Z.property("__zoom").k||1;if(L.ctrlKey&&i){const le=jr(L),me=Zk(L),ge=U*Math.pow(2,me);B.scaleTo(Z,ge,le,L);return}const $=L.deltaMode===1?20:1;let V=f===ao.Vertical?0:L.deltaX*$,he=f===ao.Horizontal?0:L.deltaY*$;!Ad()&&L.shiftKey&&f!==ao.Vertical&&(V=L.deltaY*$,he=0),B.translateBy(Z,-(V/U)*u,-(he/U)*u,{internal:!0});const Y=Qu(Z.property("__zoom")),{onViewportChangeStart:J,onViewportChange:z,onViewportChangeEnd:re}=R.getState();clearTimeout(H.current),P.current||(P.current=!0,t==null||t(L,Y),J==null||J(Y)),P.current&&(e==null||e(L,Y),z==null||z(Y),H.current=setTimeout(()=>{n==null||n(L,Y),re==null||re(Y),P.current=!1},150))},{passive:!1}):typeof Q<"u"&&Z.on("wheel.zoom",function(L,U){if(!k&&L.type==="wheel"&&!L.ctrlKey||wi(L,E))return null;L.preventDefault(),Q.call(this,L,U)},{passive:!1}))},[M,c,f,Z,B,Q,K,i,k,E,t,e,n]),x.useEffect(()=>{B&&B.on("start",L=>{var V,he;if(!L.sourceEvent||L.sourceEvent.internal)return null;G.current=(V=L.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:U}=R.getState(),$=Qu(L.transform);I.current=!0,O.current=$,((he=L.sourceEvent)==null?void 0:he.type)==="mousedown"&&R.setState({paneDragging:!0}),U==null||U($),t==null||t(L.sourceEvent,$)})},[B,t]),x.useEffect(()=>{B&&(M&&!I.current?B.on("zoom",null):M||B.on("zoom",L=>{var $;const{onViewportChange:U}=R.getState();if(R.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),F.current=!!(s&&Xk(m,G.current??0)),(e||U)&&!(($=L.sourceEvent)!=null&&$.internal)){const V=Qu(L.transform);U==null||U(V),e==null||e(L.sourceEvent,V)}}))},[M,B,e,m,s]),x.useEffect(()=>{B&&B.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:U}=R.getState();if(I.current=!1,R.setState({paneDragging:!1}),s&&Xk(m,G.current??0)&&!F.current&&s(L.sourceEvent),F.current=!1,(n||U)&&L4(O.current,L.transform)){const $=Qu(L.transform);O.current=$,clearTimeout(T.current),T.current=setTimeout(()=>{U==null||U($),n==null||n(L.sourceEvent,$)},c?150:0)}})},[B,c,m,n,s]),x.useEffect(()=>{B&&B.filter(L=>{const U=K||a,$=i&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(wi(L,"react-flow__node")||wi(L,"react-flow__edge")))return!0;if(!m&&!U&&!c&&!p&&!i||M||!p&&L.type==="dblclick"||wi(L,E)&&L.type==="wheel"||wi(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!K)||!i&&L.ctrlKey&&L.type==="wheel"||!U&&!c&&!$&&L.type==="wheel"||!m&&(L.type==="mousedown"||L.type==="touchstart")||Array.isArray(m)&&!m.includes(L.button)&&L.type==="mousedown")return!1;const V=Array.isArray(m)&&m.includes(L.button)||!L.button||L.button<=1;return(!L.ctrlKey||L.type==="wheel")&&V})},[M,B,a,i,c,p,m,h,K]),pe.createElement("div",{className:"react-flow__renderer",ref:W,style:Lx},S)},F4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function B4(){const{userSelectionActive:e,userSelectionRect:t}=gt(F4,Qt);return e&&t?pe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Qk(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const c=Math.abs(t.position.x);s.position.x=s.position.x-c,s.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);s.position.y=s.position.y-c,s.style.height+=c,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function z4(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(u=>u.id===a.id);if(i.length===0)return s.push(a),s;const c={...a};for(const u of i)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&Qk(s,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&Qk(s,c);break}case"remove":return s}return s.push(c),s},n)}function U4(e,t){return z4(e,t)}const na=(e,t)=>({id:e,type:"select",selected:t});function Si(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(na(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(na(s.id,!1))),n},[])}const np=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},W4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),N2=x.memo(({isSelecting:e,selectionMode:t=hc.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Wt(),N=x.useRef(0),_=x.useRef(0),j=x.useRef(),{userSelectionActive:k,elementsSelectable:S,dragging:E}=gt(W4,Qt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=Q=>{i==null||i(Q),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=Q=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Q.preventDefault();return}c==null||c(Q)},I=u?Q=>u(Q):void 0,F=Q=>{const{resetSelectedElements:M,domNode:K}=w.getState();if(j.current=K==null?void 0:K.getBoundingClientRect(),!S||!e||Q.button!==0||Q.target!==y.current||!j.current)return;const{x:G,y:P}=aa(Q,j.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:P,x:G,y:P}}),s==null||s(Q)},W=Q=>{const{userSelectionRect:M,nodeInternals:K,edges:G,transform:P,onNodesChange:H,onEdgesChange:L,nodeOrigin:U,getNodes:$}=w.getState();if(!e||!j.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=aa(Q,j.current),he=M.startX??0,Y=M.startY??0,J={...M,x:V.x<he?V.x:he,y:V.y<Y?V.y:Y,width:Math.abs(V.x-he),height:Math.abs(V.y-Y)},z=$(),re=o2(K,J,P,t===hc.Partial,!0,U),le=i2(re,G).map(ge=>ge.id),me=re.map(ge=>ge.id);if(N.current!==me.length){N.current=me.length;const ge=Si(z,me);ge.length&&(H==null||H(ge))}if(_.current!==le.length){_.current=le.length;const ge=Si(G,le);ge.length&&(L==null||L(ge))}w.setState({userSelectionRect:J})},O=Q=>{if(Q.button!==0)return;const{userSelectionRect:M}=w.getState();!k&&M&&Q.target===y.current&&(T==null||T(Q)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(Q)},B=Q=>{k&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(Q)),C()},Z=S&&(e||k);return pe.createElement("div",{className:un(["react-flow__pane",{dragging:E,selection:e}]),onClick:Z?void 0:np(T,y),onContextMenu:np(R,y),onWheel:np(I,y),onMouseEnter:Z?void 0:f,onMouseDown:Z?F:void 0,onMouseMove:Z?W:p,onMouseUp:Z?O:void 0,onMouseLeave:Z?B:h,ref:y,style:Lx},m,pe.createElement(B4,null))});N2.displayName="Pane";function S2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:S2(s,t):!1}function Jk(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function H4(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!S2(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function G4(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function j2(e,t,n,s,a=[0,0],i){const c=G4(e,e.extent||s);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=io(m,a).positionAbsolute;u=m&&or(y)&&or(w)&&or(m.width)&&or(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else i==null||i("005",xs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=io(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=io(m,a).positionAbsolute}const h=u&&u!=="parent"?Tx(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function rp({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?s.find(a=>a.id===e):s[0],s]}const e1=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...Cx(f)}})};function Wl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function tx({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",xs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function V4(){const e=Wt();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function sp(e){return(t,n,s)=>e==null?void 0:e(t,s)}function E2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:c}){const u=Wt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),j=x.useRef(!1),k=x.useRef(!1),S=x.useRef(!1),E=V4();return x.useEffect(()=>{if(e!=null&&e.current){const C=ar(e.current),T=({x:F,y:W})=>{const{nodeInternals:O,onNodeDrag:B,onSelectionDrag:Z,updateNodePositions:Q,nodeExtent:M,snapGrid:K,snapToGrid:G,nodeOrigin:P,onError:H}=u.getState();m.current={x:F,y:W};let L=!1,U={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const V=Qd(h.current,P);U=dc(V)}if(h.current=h.current.map(V=>{const he={x:F-V.distance.x,y:W-V.distance.y};G&&(he.x=K[0]*Math.round(he.x/K[0]),he.y=K[1]*Math.round(he.y/K[1]));const Y=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!V.extent&&(Y[0][0]=V.positionAbsolute.x-U.x+M[0][0],Y[1][0]=V.positionAbsolute.x+(V.width??0)-U.x2+M[1][0],Y[0][1]=V.positionAbsolute.y-U.y+M[0][1],Y[1][1]=V.positionAbsolute.y+(V.height??0)-U.y2+M[1][1]);const J=j2(V,he,O,Y,P,H);return L=L||V.position.x!==J.position.x||V.position.y!==J.position.y,V.position=J.position,V.positionAbsolute=J.positionAbsolute,V}),!L)return;Q(h.current,!0,!0),p(!0);const $=a?B:sp(Z);if($&&_.current){const[V,he]=rp({nodeId:a,dragItems:h.current,nodeInternals:O});$(_.current,V,he)}},R=()=>{if(!w.current)return;const[F,W]=XT(N.current,w.current);if(F!==0||W!==0){const{transform:O,panBy:B}=u.getState();m.current.x=(m.current.x??0)-F/O[2],m.current.y=(m.current.y??0)-W/O[2],B({x:F,y:W})&&T(m.current)}y.current=requestAnimationFrame(R)},I=F=>{var P;const{nodeInternals:W,multiSelectionActive:O,nodesDraggable:B,unselectNodesAndEdges:Z,onNodeDragStart:Q,onSelectionDragStart:M}=u.getState();k.current=!0;const K=a?Q:sp(M);(!c||!i)&&!O&&a&&((P=W.get(a))!=null&&P.selected||Z()),a&&i&&c&&tx({id:a,store:u,nodeRef:e});const G=E(F);if(m.current=G,h.current=H4(W,B,G,a),K&&h.current){const[H,L]=rp({nodeId:a,dragItems:h.current,nodeInternals:W});K(F.sourceEvent,H,L)}};if(t)C.on(".drag",null);else{const F=rO().on("start",W=>{const{domNode:O,nodeDragThreshold:B}=u.getState();B===0&&I(W),S.current=!1;const Z=E(W);m.current=Z,w.current=(O==null?void 0:O.getBoundingClientRect())||null,N.current=aa(W.sourceEvent,w.current)}).on("drag",W=>{var Q,M;const O=E(W),{autoPanOnNodeDrag:B,nodeDragThreshold:Z}=u.getState();if(W.sourceEvent.type==="touchmove"&&W.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!j.current&&k.current&&B&&(j.current=!0,R()),!k.current){const K=O.xSnapped-(((Q=m==null?void 0:m.current)==null?void 0:Q.x)??0),G=O.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(K*K+G*G)>Z&&I(W)}(m.current.x!==O.xSnapped||m.current.y!==O.ySnapped)&&h.current&&k.current&&(_.current=W.sourceEvent,N.current=aa(W.sourceEvent,w.current),T(O))}}).on("end",W=>{if(!(!k.current||S.current)&&(p(!1),j.current=!1,k.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:O,nodeInternals:B,onNodeDragStop:Z,onSelectionDragStop:Q}=u.getState(),M=a?Z:sp(Q);if(O(h.current,!1,!1),M){const[K,G]=rp({nodeId:a,dragItems:h.current,nodeInternals:B});M(W.sourceEvent,K,G)}}}).filter(W=>{const O=W.target;return!W.button&&(!n||!Jk(O,`.${n}`,e))&&(!s||Jk(O,s,e))});return C.call(F),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,u,a,c,E]),f}function C2(){const e=Wt();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,j=n.y*w*N,k=m.map(S=>{if(S.positionAbsolute){const E={x:S.positionAbsolute.x+_,y:S.positionAbsolute.y+j};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=j2(S,E,s,a,void 0,p);S.position=T,S.positionAbsolute=C}return S});i(k,!0,!1)},[])}const Ri={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Hl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:j,className:k,isDraggable:S,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:I,targetPosition:F,hidden:W,resizeObserver:O,dragHandle:B,zIndex:Z,isParent:Q,noDragClassName:M,noPanClassName:K,initialized:G,disableKeyboardA11y:P,ariaLabel:H,rfId:L,hasHandleBounds:U})=>{const $=Wt(),V=x.useRef(null),he=x.useRef(null),Y=x.useRef(I),J=x.useRef(F),z=x.useRef(s),re=E||S||h||m||y||w,le=C2(),me=Wl(n,$.getState,m),ge=Wl(n,$.getState,y),Me=Wl(n,$.getState,w),qe=Wl(n,$.getState,N),Ve=Wl(n,$.getState,_),Ue=Ne=>{const{nodeDragThreshold:_e}=$.getState();if(E&&(!R||!S||_e>0)&&tx({id:n,store:$,nodeRef:V}),h){const ue=$.getState().nodeInternals.get(n);ue&&h(Ne,{...ue})}},Se=Ne=>{if(!Xv(Ne)&&!P)if(e2.includes(Ne.key)&&E){const _e=Ne.key==="Escape";tx({id:n,store:$,unselect:_e,nodeRef:V})}else S&&p&&Object.prototype.hasOwnProperty.call(Ri,Ne.key)&&($.setState({ariaLiveMessage:`Moved selected node ${Ne.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~c}`}),le({x:Ri[Ne.key].x,y:Ri[Ne.key].y,isShiftPressed:Ne.shiftKey}))};x.useEffect(()=>()=>{he.current&&(O==null||O.unobserve(he.current),he.current=null)},[]),x.useEffect(()=>{if(V.current&&!W){const Ne=V.current;(!G||!U||he.current!==Ne)&&(he.current&&(O==null||O.unobserve(he.current)),O==null||O.observe(Ne),he.current=Ne)}},[W,G,U]),x.useEffect(()=>{const Ne=z.current!==s,_e=Y.current!==I,ue=J.current!==F;V.current&&(Ne||_e||ue)&&(Ne&&(z.current=s),_e&&(Y.current=I),ue&&(J.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,I,F]);const Qe=E2({nodeRef:V,disabled:W||!S,noDragClassName:M,handleSelector:B,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return W?null:pe.createElement("div",{className:un(["react-flow__node",`react-flow__node-${s}`,{[K]:S},k,{selected:p,selectable:E,parent:Q,dragging:Qe}]),ref:V,style:{zIndex:Z,transform:`translate(${u}px,${f}px)`,pointerEvents:re?"all":"none",visibility:G?"visible":"hidden",...j},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ge,onMouseLeave:Me,onContextMenu:qe,onClick:Ue,onDoubleClick:Ve,onKeyDown:T?Se:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":P?void 0:`${v2}-${L}`,"aria-label":H},pe.createElement(o4,{value:n},pe.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:c,selected:p,isConnectable:C,sourcePosition:I,targetPosition:F,dragging:Qe,dragHandle:B,zIndex:Z})))};return t.displayName="NodeWrapper",x.memo(t)};const Y4=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Qd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function K4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Wt(),{width:a,height:i,x:c,y:u,transformString:f,userSelectionActive:p}=gt(Y4,Qt),h=C2(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),E2({nodeRef:m}),p||!a||!i)return null;const y=e?N=>{const _=s.getState().getNodes().filter(j=>j.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ri,N.key)&&h({x:Ri[N.key].x,y:Ri[N.key].y,isShiftPressed:N.shiftKey})};return pe.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:u,left:c}}))}var X4=x.memo(K4);const Z4=e=>e.nodesSelectionActive,T2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:j,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:W,panOnDrag:O,defaultViewport:B,translateExtent:Z,minZoom:Q,maxZoom:M,preventScrolling:K,onSelectionContextMenu:G,noWheelClassName:P,noPanClassName:H,disableKeyboardA11y:L})=>{const U=gt(Z4),$=fc(m),V=fc(k),he=V||O,Y=V||R,J=$||y&&he!==!0;return O4({deleteKeyCode:u,multiSelectionKeyCode:j}),pe.createElement(q4,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:Y,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:W,panOnDrag:!$&&he,defaultViewport:B,translateExtent:Z,minZoom:Q,maxZoom:M,zoomActivationKeyCode:S,preventScrolling:K,noWheelClassName:P,noPanClassName:H},pe.createElement(N2,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,panOnDrag:he,isSelecting:!!J,selectionMode:w},e,U&&pe.createElement(X4,{onSelectionContextMenu:G,noPanClassName:H,disableKeyboardA11y:L})))};T2.displayName="FlowRenderer";var Q4=x.memo(T2);function J4(e){return gt(x.useCallback(n=>e?o2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function eP(e){const t={input:Hl(e.input||m2),default:Hl(e.default||ex),output:Hl(e.output||y2),group:Hl(e.group||Px)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=Hl(e[i]||ex),a),n);return{...t,...s}}const tP=({x:e,y:t,width:n,height:s,origin:a})=>!n||!s?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-s*a[1]},nP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),A2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:c}=gt(nP,Qt),u=J4(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:Lx},u.map(h=>{var T,R,I;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",xs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),_=!!(h.connectable||n&&typeof h.connectable>"u"),j=!!(h.focusable||s&&typeof h.focusable>"u"),k=e.nodeExtent?Tx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=tP({x:S,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||ze.Bottom,targetPosition:h.targetPosition||ze.Top,hidden:h.hidden,xPos:S,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:j,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Lt])==null?void 0:T.z)??0,isParent:!!((R=h[Lt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[Lt])!=null&&I.handleBounds)})}))};A2.displayName="NodeRenderer";var rP=x.memo(A2);const sP=(e,t,n)=>n===ze.Left?e-t:n===ze.Right?e+t:e,aP=(e,t,n)=>n===ze.Top?e-t:n===ze.Bottom?e+t:e,t1="react-flow__edgeupdater",n1=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:c,type:u})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:c,className:un([t1,`${t1}-${u}`]),cx:sP(t,s,e),cy:aP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),oP=()=>!0;var vi=e=>{const t=({id:n,className:s,type:a,data:i,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:j,source:k,target:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:F,elementsSelectable:W,hidden:O,sourceHandleId:B,targetHandleId:Z,onContextMenu:Q,onMouseEnter:M,onMouseMove:K,onMouseLeave:G,reconnectRadius:P,onReconnect:H,onReconnectStart:L,onReconnectEnd:U,markerEnd:$,markerStart:V,rfId:he,ariaLabel:Y,isFocusable:J,isReconnectable:z,pathOptions:re,interactionWidth:le,disableKeyboardA11y:me})=>{const ge=x.useRef(null),[Me,qe]=x.useState(!1),[Ve,Ue]=x.useState(!1),Se=Wt(),Qe=x.useMemo(()=>`url('#${Qv(V,he)}')`,[V,he]),Ne=x.useMemo(()=>`url('#${Qv($,he)}')`,[$,he]);if(O)return null;const _e=et=>{var nt;const{edges:ht,addSelectedEdges:Je,unselectNodesAndEdges:tt,multiSelectionActive:it}=Se.getState(),bt=ht.find(pt=>pt.id===n);bt&&(W&&(Se.setState({nodesSelectionActive:!1}),bt.selected&&it?(tt({nodes:[],edges:[bt]}),(nt=ge.current)==null||nt.blur()):Je([n])),c&&c(et,bt))},ue=Ul(n,Se.getState,u),je=Ul(n,Se.getState,Q),Ce=Ul(n,Se.getState,M),Fe=Ul(n,Se.getState,K),We=Ul(n,Se.getState,G),He=(et,ht)=>{if(et.button!==0)return;const{edges:Je,isValidConnection:tt}=Se.getState(),it=ht?S:k,bt=(ht?Z:B)||null,nt=ht?"target":"source",pt=tt||oP,fe=ht,lt=Je.find(Dt=>Dt.id===n);Ue(!0),L==null||L(et,lt,nt);const vt=Dt=>{Ue(!1),U==null||U(Dt,lt,nt)};d2({event:et,handleId:bt,nodeId:it,onConnect:Dt=>H==null?void 0:H(lt,Dt),isTarget:fe,getState:Se.getState,setState:Se.setState,isValidConnection:pt,edgeUpdaterType:nt,onReconnectEnd:vt})},ot=et=>He(et,!0),wt=et=>He(et,!1),ut=()=>qe(!0),ee=()=>qe(!1),ke=!W&&!c,Be=et=>{var ht;if(!me&&e2.includes(et.key)&&W){const{unselectNodesAndEdges:Je,addSelectedEdges:tt,edges:it}=Se.getState();et.key==="Escape"?((ht=ge.current)==null||ht.blur(),Je({edges:[it.find(nt=>nt.id===n)]})):tt([n])}};return pe.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:ke,updating:Me}]),onClick:_e,onDoubleClick:ue,onContextMenu:je,onMouseEnter:Ce,onMouseMove:Fe,onMouseLeave:We,onKeyDown:J?Be:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${k} to ${S}`,"aria-describedby":J?`${x2}-${he}`:void 0,ref:ge},!Ve&&pe.createElement(e,{id:n,source:k,target:S,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:i,style:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:F,sourceHandleId:B,targetHandleId:Z,markerStart:Qe,markerEnd:Ne,pathOptions:re,interactionWidth:le}),z&&pe.createElement(pe.Fragment,null,(z==="source"||z===!0)&&pe.createElement(n1,{position:I,centerX:E,centerY:C,radius:P,onMouseDown:ot,onMouseEnter:ut,onMouseOut:ee,type:"source"}),(z==="target"||z===!0)&&pe.createElement(n1,{position:F,centerX:T,centerY:R,radius:P,onMouseDown:wt,onMouseEnter:ut,onMouseOut:ee,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function iP(e){const t={default:vi(e.default||Md),straight:vi(e.bezier||Mx),step:vi(e.step||Rx),smoothstep:vi(e.step||Zd),simplebezier:vi(e.simplebezier||Ax)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=vi(e[i]||Md),a),n);return{...t,...s}}function r1(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case ze.Top:return{x:s+i/2,y:a};case ze.Right:return{x:s+i,y:a+c/2};case ze.Bottom:return{x:s+i/2,y:a+c};case ze.Left:return{x:s,y:a+c/2}}}function s1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const lP=(e,t,n,s,a,i)=>{const c=r1(n,e,t),u=r1(i,s,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function cP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=dc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function a1(e){var s,a,i,c,u;const t=((s=e==null?void 0:e[Lt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const uP=[{level:0,isMaxLevel:!0,edges:[]}];function dP(e,t,n=!1){let s=-1;const a=e.reduce((c,u)=>{var h,m;const f=or(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((h=w==null?void 0:w[Lt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Lt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(N?_:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),i=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return i.length===0?uP:i}function hP(e,t,n){const s=gt(x.useCallback(a=>e?a.edges.filter(i=>{const c=t.get(i.source),u=t.get(i.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&cP({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return dP(s,t,n)}const fP=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),pP=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),o1={[Rd.Arrow]:fP,[Rd.ArrowClosed]:pP};function mP(e){const t=Wt();return x.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(o1,e)?o1[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",xs.error009(e)),null)},[e])}const gP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=mP(t);return f?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},pe.createElement(f,{color:n,strokeWidth:c})):null},yP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Qv(c,t);s.includes(u)||(a.push({id:u,color:c.color||e,...c}),s.push(u))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},R2=({defaultColor:e,rfId:t})=>{const n=gt(x.useCallback(yP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,c)=>i.id!==a[c].id)));return pe.createElement("defs",null,n.map(s=>pe.createElement(gP,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};R2.displayName="MarkerDefinitions";var wP=x.memo(R2);const vP=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),M2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:j,disableKeyboardA11y:k})=>{const{edgesFocusable:S,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:I,nodeInternals:F,onError:W}=gt(vP,Qt),O=hP(t,F,n);return T?pe.createElement(pe.Fragment,null,O.map(({level:B,edges:Z,isMaxLevel:Q})=>pe.createElement("svg",{key:B,style:{zIndex:B},width:T,height:R,className:"react-flow__edges react-flow__container"},Q&&pe.createElement(wP,{defaultColor:e,rfId:s}),pe.createElement("g",null,Z.map(M=>{const[K,G,P]=a1(F.get(M.source)),[H,L,U]=a1(F.get(M.target));if(!P||!U)return null;let $=M.type||"default";a[$]||(W==null||W("011",xs.error011($)),$="default");const V=a[$]||a.default,he=I===co.Strict?L.target:(L.target??[]).concat(L.source??[]),Y=s1(G.source,M.sourceHandle),J=s1(he,M.targetHandle),z=(Y==null?void 0:Y.position)||ze.Bottom,re=(J==null?void 0:J.position)||ze.Top,le=!!(M.focusable||S&&typeof M.focusable>"u"),me=M.reconnectable||M.updatable,ge=typeof y<"u"&&(me||E&&typeof me>"u");if(!Y||!J)return W==null||W("008",xs.error008(Y,M)),null;const{sourceX:Me,sourceY:qe,targetX:Ve,targetY:Ue}=lP(K,Y,z,H,J,re);return pe.createElement(V,{key:M.id,id:M.id,className:un([M.className,i]),type:$,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Me,sourceY:qe,targetX:Ve,targetY:Ue,sourcePosition:z,targetPosition:re,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:M.ariaLabel,isFocusable:le,isReconnectable:ge,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:k})})))),j):null};M2.displayName="EdgeRenderer";var xP=x.memo(M2);const bP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function kP({children:e}){const t=gt(bP);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function _P(e){const t=Sc(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const NP={[ze.Left]:ze.Right,[ze.Right]:ze.Left,[ze.Top]:ze.Bottom,[ze.Bottom]:ze.Top},I2=({nodeId:e,handleType:t,style:n,type:s=ra.Bezier,CustomComponent:a,connectionStatus:i})=>{var R,I,F;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=gt(x.useCallback(W=>({fromNode:W.nodeInternals.get(e),handleId:W.connectionHandleId,toX:(W.connectionPosition.x-W.transform[0])/W.transform[2],toY:(W.connectionPosition.y-W.transform[1])/W.transform[2],connectionMode:W.connectionMode}),[e]),Qt),m=(R=c==null?void 0:c[Lt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===co.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(W=>W.id===u):y[0],N=w?w.x+w.width/2:(c.width??0)/2,_=w?w.y+w.height/2:c.height??0,j=(((I=c.positionAbsolute)==null?void 0:I.x)??0)+N,k=(((F=c.positionAbsolute)==null?void 0:F.y)??0)+_,S=w==null?void 0:w.position,E=S?NP[S]:null;if(!S||!E)return null;if(a)return pe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:j,fromY:k,toX:f,toY:p,fromPosition:S,toPosition:E,connectionStatus:i});let C="";const T={sourceX:j,sourceY:k,sourcePosition:S,targetX:f,targetY:p,targetPosition:E};return s===ra.Bezier?[C]=Ix(T):s===ra.Step?[C]=Zv({...T,borderRadius:0}):s===ra.SmoothStep?[C]=Zv(T):s===ra.SimpleBezier?[C]=s2(T):C=`M${j},${k} ${f},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};I2.displayName="ConnectionLine";const SP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function jP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:c,width:u,height:f,connectionStatus:p}=gt(SP,Qt);return!(a&&i&&u&&c)?null:pe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:un(["react-flow__connection",p])},pe.createElement(I2,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function i1(e,t){return x.useRef(null),Wt(),x.useMemo(()=>t(e),[e])}const $2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:j,connectionLineType:k,connectionLineStyle:S,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,multiSelectionKeyCode:F,panActivationKeyCode:W,zoomActivationKeyCode:O,deleteKeyCode:B,onlyRenderVisibleElements:Z,elementsSelectable:Q,selectNodesOnDrag:M,defaultViewport:K,translateExtent:G,minZoom:P,maxZoom:H,preventScrolling:L,defaultMarkerColor:U,zoomOnScroll:$,zoomOnPinch:V,panOnScroll:he,panOnScrollSpeed:Y,panOnScrollMode:J,zoomOnDoubleClick:z,panOnDrag:re,onPaneClick:le,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Me,onPaneScroll:qe,onPaneContextMenu:Ve,onEdgeContextMenu:Ue,onEdgeMouseEnter:Se,onEdgeMouseMove:Qe,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:ue,onReconnectEnd:je,reconnectRadius:Ce,noDragClassName:Fe,noWheelClassName:We,noPanClassName:He,elevateEdgesOnSelect:ot,disableKeyboardA11y:wt,nodeOrigin:ut,nodeExtent:ee,rfId:ke})=>{const Be=i1(e,eP),et=i1(t,iP);return _P(i),pe.createElement(Q4,{onPaneClick:le,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Me,onPaneContextMenu:Ve,onPaneScroll:qe,deleteKeyCode:B,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,onSelectionStart:_,onSelectionEnd:j,multiSelectionKeyCode:F,panActivationKeyCode:W,zoomActivationKeyCode:O,elementsSelectable:Q,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:$,zoomOnPinch:V,zoomOnDoubleClick:z,panOnScroll:he,panOnScrollSpeed:Y,panOnScrollMode:J,panOnDrag:re,defaultViewport:K,translateExtent:G,minZoom:P,maxZoom:H,onSelectionContextMenu:N,preventScrolling:L,noDragClassName:Fe,noWheelClassName:We,noPanClassName:He,disableKeyboardA11y:wt},pe.createElement(kP,null,pe.createElement(xP,{edgeTypes:et,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Z,onEdgeContextMenu:Ue,onEdgeMouseEnter:Se,onEdgeMouseMove:Qe,onEdgeMouseLeave:Ne,onReconnect:_e,onReconnectStart:ue,onReconnectEnd:je,reconnectRadius:Ce,defaultMarkerColor:U,noPanClassName:He,elevateEdgesOnSelect:!!ot,disableKeyboardA11y:wt,rfId:ke},pe.createElement(jP,{style:S,type:k,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(rP,{nodeTypes:Be,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:Z,noPanClassName:He,noDragClassName:Fe,disableKeyboardA11y:wt,nodeOrigin:ut,nodeExtent:ee,rfId:ke})))};$2.displayName="GraphView";var EP=x.memo($2);const nx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qs={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:nx,nodeExtent:nx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:co.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:e4,isValidConnection:void 0},CP=()=>mI((e,t)=>({...Qs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:tp(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",c=a?tp(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((_,j)=>{const k=a.get(j.id);if(k!=null&&k.hidden)a.set(k.id,{...k,[Lt]:{...k[Lt],handleBounds:void 0}});else if(k){const S=Cx(j.nodeElement);!!(S.width&&S.height&&(k.width!==S.width||k.height!==S.height||j.forceUpdate))&&(a.set(k.id,{...k,[Lt]:{...k[Lt],handleBounds:{source:e1(".source",j.nodeElement,y,p),target:e1(".target",j.nodeElement,y,p)}},...S}),_.push({id:k.id,type:"dimensions",dimensions:S}))}return _},[]);k2(a,p);const N=c||i&&!c&&_2(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});i(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=U4(n,u()),h=tp(p,a,c,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>na(f,!0)):(c=Si(i(),n),u=Si(a,[])),Zu({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>na(f,!0)):(c=Si(a,n),u=Si(i(),[])),Zu({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),c=n||i(),u=s||a,f=c.map(h=>(h.selected=!1,na(h.id,!1))),p=u.map(h=>na(h.id,!1));Zu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(u=>u.selected).map(u=>na(u.id,!1)),c=n.filter(u=>u.selected).map(u=>na(u.id,!1));Zu({changedNodes:i,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Tx(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=ws.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Qs.connectionNodeId,connectionHandleId:Qs.connectionHandleId,connectionHandleType:Qs.connectionHandleType,connectionStatus:Qs.connectionStatus,connectionStartHandle:Qs.connectionStartHandle,connectionEndHandle:Qs.connectionEndHandle}),reset:()=>e({...Qs})}),Object.is),Dx=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=CP()),pe.createElement(V3,{value:t.current},e)};Dx.displayName="ReactFlowProvider";const O2=({children:e})=>x.useContext(Xd)?pe.createElement(pe.Fragment,null,e):pe.createElement(Dx,null,e);O2.displayName="ReactFlowWrapper";const TP={input:m2,default:ex,output:y2,group:Px},AP={default:Md,straight:Mx,step:Rx,smoothstep:Zd,simplebezier:Ax},RP=[0,0],MP=[15,15],IP={x:0,y:0,zoom:1},$P={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},P2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=TP,edgeTypes:c=AP,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:k,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:W,onNodesDelete:O,onEdgesDelete:B,onSelectionChange:Z,onSelectionDragStart:Q,onSelectionDrag:M,onSelectionDragStop:K,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:H,connectionMode:L=co.Strict,connectionLineType:U=ra.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:he,deleteKeyCode:Y="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:z=!1,selectionMode:re=hc.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:me=Ad()?"Meta":"Control",zoomActivationKeyCode:ge=Ad()?"Meta":"Control",snapToGrid:Me=!1,snapGrid:qe=MP,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:Ue=!0,nodesDraggable:Se,nodesConnectable:Qe,nodesFocusable:Ne,nodeOrigin:_e=RP,edgesFocusable:ue,edgesUpdatable:je,elementsSelectable:Ce,defaultViewport:Fe=IP,minZoom:We=.5,maxZoom:He=2,translateExtent:ot=nx,preventScrolling:wt=!0,nodeExtent:ut,defaultMarkerColor:ee="#b1b1b7",zoomOnScroll:ke=!0,zoomOnPinch:Be=!0,panOnScroll:et=!1,panOnScrollSpeed:ht=.5,panOnScrollMode:Je=ao.Free,zoomOnDoubleClick:tt=!0,panOnDrag:it=!0,onPaneClick:bt,onPaneMouseEnter:nt,onPaneMouseMove:pt,onPaneMouseLeave:fe,onPaneScroll:lt,onPaneContextMenu:vt,children:Gt,onEdgeContextMenu:Dt,onEdgeDoubleClick:Gn,onEdgeMouseEnter:It,onEdgeMouseMove:Vn,onEdgeMouseLeave:Yn,onEdgeUpdate:qt,onEdgeUpdateStart:Kn,onEdgeUpdateEnd:te,onReconnect:Ae,onReconnectStart:Oe,onReconnectEnd:Re,reconnectRadius:Le=10,edgeUpdaterRadius:ct=10,onNodesChange:Ct,onEdgesChange:yt,noDragClassName:Zr="nodrag",noWheelClassName:kt="nowheel",noPanClassName:Jt="nopan",fitView:rn=!1,fitViewOptions:$r,connectOnClick:ko=!0,attributionPosition:Ki,proOptions:ua,defaultEdgeOptions:da,elevateNodesOnSelect:ha=!0,elevateEdgesOnSelect:_s=!1,disableKeyboardA11y:fa=!1,autoPanOnConnect:pa=!0,autoPanOnNodeDrag:St=!0,connectionRadius:Xi=20,isValidConnection:Ns,onError:_o,style:Or,id:ma,nodeDragThreshold:No,...dr},vn)=>{const Pr=ma||"1";return pe.createElement("div",{...dr,style:{...Or,...$P},ref:vn,className:un(["react-flow",a]),"data-testid":"rf__wrapper",id:ma},pe.createElement(O2,null,pe.createElement(EP,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:c,connectionLineType:U,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:he,selectionKeyCode:J,selectionOnDrag:z,selectionMode:re,deleteKeyCode:Y,multiSelectionKeyCode:me,panActivationKeyCode:le,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Ve,selectNodesOnDrag:Ue,defaultViewport:Fe,translateExtent:ot,minZoom:We,maxZoom:He,preventScrolling:wt,zoomOnScroll:ke,zoomOnPinch:Be,zoomOnDoubleClick:tt,panOnScroll:et,panOnScrollSpeed:ht,panOnScrollMode:Je,panOnDrag:it,onPaneClick:bt,onPaneMouseEnter:nt,onPaneMouseMove:pt,onPaneMouseLeave:fe,onPaneScroll:lt,onPaneContextMenu:vt,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:H,onEdgeContextMenu:Dt,onEdgeDoubleClick:Gn,onEdgeMouseEnter:It,onEdgeMouseMove:Vn,onEdgeMouseLeave:Yn,onReconnect:Ae??qt,onReconnectStart:Oe??Kn,onReconnectEnd:Re??te,reconnectRadius:Le??ct,defaultMarkerColor:ee,noDragClassName:Zr,noWheelClassName:kt,noPanClassName:Jt,elevateEdgesOnSelect:_s,rfId:Pr,disableKeyboardA11y:fa,nodeOrigin:_e,nodeExtent:ut}),pe.createElement(_4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:k,nodesDraggable:Se,nodesConnectable:Qe,nodesFocusable:Ne,edgesFocusable:ue,edgesUpdatable:je,elementsSelectable:Ce,elevateNodesOnSelect:ha,minZoom:We,maxZoom:He,nodeExtent:ut,onNodesChange:Ct,onEdgesChange:yt,snapToGrid:Me,snapGrid:qe,connectionMode:L,translateExtent:ot,connectOnClick:ko,defaultEdgeOptions:da,fitView:rn,fitViewOptions:$r,onNodesDelete:O,onEdgesDelete:B,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:W,onSelectionDrag:M,onSelectionDragStart:Q,onSelectionDragStop:K,noPanClassName:Jt,nodeOrigin:_e,rfId:Pr,autoPanOnConnect:pa,autoPanOnNodeDrag:St,onError:_o,connectionRadius:Xi,isValidConnection:Ns,nodeDragThreshold:No}),pe.createElement(b4,{onSelectionChange:Z}),Gt,pe.createElement(K3,{proOptions:ua,position:Ki}),pe.createElement(C4,{rfId:Pr,disableKeyboardA11y:fa})))});P2.displayName="ReactFlow";const OP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function L2(){return gt(OP,Qt)}const D2=({id:e,x:t,y:n,width:s,height:a,style:i,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=i||{},j=c||N||_;return pe.createElement("rect",{className:un(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:j,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};D2.displayName="MiniMapNode";var PP=x.memo(D2);const LP=e=>e.nodeOrigin,DP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),ap=e=>e instanceof Function?e:()=>e;function qP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=PP,onClick:c}){const u=gt(DP,Qt),f=gt(LP),p=ap(t),h=ap(e),m=ap(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,u.map(w=>{const{x:N,y:_}=io(w,f).positionAbsolute;return pe.createElement(i,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var FP=x.memo(qP);const BP=200,zP=150,UP=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?Q3(Qd(t,e.nodeOrigin),n):n,rfId:e.rfId}},WP="react-flow__minimap-desc";function q2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:j="React Flow mini map",inversePan:k=!1,zoomStep:S=10,offsetScale:E=5}){const C=Wt(),T=x.useRef(null),{boundingRect:R,viewBB:I,rfId:F}=gt(UP,Qt),W=(e==null?void 0:e.width)??BP,O=(e==null?void 0:e.height)??zP,B=R.width/W,Z=R.height/O,Q=Math.max(B,Z),M=Q*W,K=Q*O,G=E*Q,P=R.x-(M-R.width)/2-G,H=R.y-(K-R.height)/2-G,L=M+G*2,U=K+G*2,$=`${WP}-${F}`,V=x.useRef(0);V.current=Q,x.useEffect(()=>{if(T.current){const J=ar(T.current),z=me=>{const{transform:ge,d3Selection:Me,d3Zoom:qe}=C.getState();if(me.sourceEvent.type!=="wheel"||!Me||!qe)return;const Ve=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*S,Ue=ge[2]*Math.pow(2,Ve);qe.scaleTo(Me,Ue)},re=me=>{const{transform:ge,d3Selection:Me,d3Zoom:qe,translateExtent:Ve,width:Ue,height:Se}=C.getState();if(me.sourceEvent.type!=="mousemove"||!Me||!qe)return;const Qe=V.current*Math.max(1,ge[2])*(k?-1:1),Ne={x:ge[0]-me.sourceEvent.movementX*Qe,y:ge[1]-me.sourceEvent.movementY*Qe},_e=[[0,0],[Ue,Se]],ue=ws.translate(Ne.x,Ne.y).scale(ge[2]),je=qe.constrain()(ue,_e,Ve);qe.transform(Me,je)},le=YT().on("zoom",N?re:null).on("zoom.wheel",_?z:null);return J.call(le),()=>{J.on("zoom",null)}}},[N,_,k,S]);const he=y?J=>{const z=jr(J);y(J,{x:z[0],y:z[1]})}:void 0,Y=w?(J,z)=>{const re=C.getState().nodeInternals.get(z);w(J,re)}:void 0;return pe.createElement(Ex,{position:m,style:e,className:un(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:W,height:O,viewBox:`${P} ${H} ${L} ${U}`,role:"img","aria-labelledby":$,ref:T,onClick:he},j&&pe.createElement("title",{id:$},j),pe.createElement(FP,{onClick:Y,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${P-G},${H-G}h${L+G*2}v${U+G*2}h${-L-G*2}z
|
|
57
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}q2.displayName="MiniMap";var HP=x.memo(q2);function GP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},pe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function VP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function YP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},pe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function KP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function XP(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const sr=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:un(["react-flow__controls-button",t]),...n},e);sr.displayName="ControlButton";const ZP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),F2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Wt(),[w,N]=x.useState(!1),{isInteractive:_,minZoomReached:j,maxZoomReached:k}=gt(ZP,Qt),{zoomIn:S,zoomOut:E,fitView:C}=Sc();if(x.useEffect(()=>{N(!0)},[]),!w)return null;const T=()=>{S(),i==null||i()},R=()=>{E(),c==null||c()},I=()=>{C(a),u==null||u()},F=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return pe.createElement(Ex,{className:un(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(sr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},pe.createElement(GP,null)),pe.createElement(sr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:j},pe.createElement(VP,null))),n&&pe.createElement(sr,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},pe.createElement(YP,null)),s&&pe.createElement(sr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},_?pe.createElement(XP,null):pe.createElement(KP,null)),h)};F2.displayName="Controls";var QP=x.memo(F2),Tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Tr||(Tr={}));function JP({color:e,dimensions:t,lineWidth:n}){return pe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function eL({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const tL={[Tr.Dots]:"#91919a",[Tr.Lines]:"#eee",[Tr.Cross]:"#e2e2e2"},nL={[Tr.Dots]:1,[Tr.Lines]:1,[Tr.Cross]:6},rL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function B2({id:e,variant:t=Tr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=gt(rL,Qt),y=c||tL[t],w=s||nL[t],N=t===Tr.Dots,_=t===Tr.Cross,j=Array.isArray(n)?n:[n,n],k=[j[0]*h[2]||1,j[1]*h[2]||1],S=w*h[2],E=_?[S,S]:k,C=N?[S/i,S/i]:[E[0]/i,E[1]/i];return pe.createElement("svg",{className:un(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.createElement("pattern",{id:m+e,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?pe.createElement(eL,{color:y,radius:S/i}):pe.createElement(JP,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}B2.displayName="Background";var sL=x.memo(B2);const aL=["us-gov","global","apac","us","eu","jp","au"],oL=new RegExp(`^(?:(?:${aL.join("|")})\\.)?anthropic\\.`,"i");function jc(e){return e.replace(oL,"")}const iL=["command","cmd","file_path","path","url","pattern","notebook_path"],l1=120,op=e=>e.length>l1?`${e.slice(0,l1-1)}…`:e;function lL(e){if(typeof e=="string")return e.trim()?op(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of iL){const s=t[n];if(typeof s=="string"&&s.trim())return op(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return op(a)}}return null}const cL=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function c1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const u1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function qx(e){const t=cL.exec(e);if(!t)return null;const n=c1(t[1],"status");return{label:(n&&Object.hasOwn(u1,n)?u1[n]:void 0)??"background task update",detail:c1(t[1],"summary")}}function z2(e){return e.filter(t=>!qx(t.text))}const uL=/[0-9a-f]{16,}/i,dL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function U2(e){return uL.test(e)||dL.test(e)}function hL(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!U2(t[n]))return t[n];return t[t.length-1]}function W2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Fx(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(a??0)}}function fL(e){const t=Fx(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function pL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=fL(s));return Object.keys(t).length?t:void 0}function H2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...Fx(n)};for(const s of Object.values(n)){const a=H2(s,t+1);if(a)return a}return null}const mL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,gL=new Set(["tool_input","tool_response"]);function G2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&mL.test(jc(n.model)))return n.model;for(const[s,a]of Object.entries(n)){if(gL.has(s))continue;const i=G2(a,t+1);if(i)return i}return null}function rx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function oa(e){return hL(e)}function d1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Li(e,t){return`${e}::${t}`}function ia(e,t){return`${e}\0${t}`}function Id(e){const t=e.agent_type??e.subagent_type;return t&&!U2(t)?t:"subagent"}function rc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function ji(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:W2()},e.agents.set(a,i),i)}function V2(e,t,n,s){const a=Li(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=oa(s.cwd));const c=Id(s);return c&&(i.label==="subagent"||!i.label)&&(i.label=c),i}function yL(e,t,n){const s=t.session_id??"unknown",a=rc(t);if(a){const f=V2(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),c=i&&i.length>0?i[i.length-1]:null;if(c){const f=e.agents.get(Li(s,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=oa(t.cwd)),f}const u=ji(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=oa(t.cwd)),u.label==="session"&&t.cwd&&(u.label=oa(t.cwd)??"session"),u}function wL(e,t,n,s,a){const i=Li(t,n),c=ji(e,t,a,!0);let u=e.agents.get(i);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=oa(s.cwd));const f=Id(s);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:i,sessionId:t,label:Id(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:oa(s.cwd),toolCount:0,childCount:0,usage:W2()},e.agents.set(i,u),c.childCount+=1,u}function vL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function h1(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let a=s.length-1;a>=0;a--)if(s[a]===n){s.splice(a,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Ju(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const f1=200;function xL(e,t){for(const n of e.values()){const s=n.tools.find(a=>a.id===t);if(s)return s}return null}const bL=25;function kL(e,t){const n=t.tools;if(n.length>f1){const s=n.splice(0,n.length-f1);for(const a of s){const i=ia(t.sessionId,a.id);e.toolIndex.get(i)===a&&e.toolIndex.delete(i)}}for(let s=n.length-bL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function _L(e,t,n){const s=e.toolIndex.get(ia(t.sessionId,n));if(s)return s;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const p1=2e3;function NL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-p1)return!1;if(a.text===n&&a.at<=t+p1)return!0}return!1}const ed=2e3;function SL(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function Y2(e,t){for(const n of t.tools){const s=ia(t.sessionId,n.id);e.toolIndex.get(s)===n&&e.toolIndex.delete(s)}}function Ec(e,t){return t&&(e.revision+=1),t}function jL(e,t,n,s,a){if(e.agents.size<=n)return!1;const i=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>s,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}i(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(Y2(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!i(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return Ec(e,f>0)}function EL(e,t,n,s,a){const i=new Map;for(const[h,m]of e.agents){let y=i.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},i.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...i].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>s).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...i.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&Y2(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Ec(e,p)}function CL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(ia((n==null?void 0:n.session_id)??"unknown",a))}function TL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Ec(e,t)}function AL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),c=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(ia(a.sessionId,u.id)),s=!0)}}return Ec(e,s)}const m1=90*6e4;function RL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return Ec(e,s)}function ML(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const IL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function $L(e,t){let n=null;for(const s of e.toolIndex.values()){const a=s.agentId?e.agents.get(s.agentId):void 0;!a||a.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const OL=3e4;function PL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>OL)&&!(e.startedAt>t))return{name:e.name,preview:lL(e.input)??""}}function LL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=$L(e,t),c={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(c.subagentId=i.explicitSubagentId);const u=PL(i,a);return u&&(c.tool=u),c}function DL(e,t,n){if(e.kind==="idle")return!0;const s=rc(t);return s==null?!0:e.subagentId!=null&&Li(n,s)===e.subagentId}function g1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...rx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=s.session_id??"unknown";if(!IL.has(i)){const h=e.agents.get(c);h!=null&&h.waiting&&DL(h.waiting,s,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??d1(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??d1(),w=(_,j)=>typeof h[_]=="number"?h[_]:j,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=s.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(i==="OutputObserved"){const h=s.kind==="thinking"||s.kind==="text"||s.kind==="tool_use"?s.kind:null,m=typeof s.at=="number"&&Number.isFinite(s.at)?s.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(N=>m-N<qL);w.push(m),y.outputs=w.length>y1?w.slice(-y1):w}return e.revision+=1,e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=Fx(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=pL(s.usageByModel)}}return e}const f=yL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=G2(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=ji(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=oa(s.cwd)),h.label==="session"&&s.cwd&&(h.label=oa(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=ji(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!NL(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!qx(m)&&(h.firstPrompt=Ju(m,120)));break}case"PreToolUse":{const h=s.tool_use_id?_L(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=Ju(s.tool_input));break}const m=s.tool_use_id??`${f.id}:${f.toolCount}`,y=rc(s),w={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Ju(s.tool_input),agentId:f.id,explicitSubagentId:y?Li(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(ia(f.sessionId,m),w),kL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;const m=ia(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const _ of e.agents.values()){if(_.sessionId!==c)continue;const j=_.tools.find(k=>k.id===h);if(j){y=j,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=i==="PostToolUse",y.trimmed||(y.response=s.tool_response),i==="PostToolUseFailure"?y.errorPreview=Ju(s.tool_response):w&&(y.errorPreview=void 0);const N=H2(s.tool_response);N&&(y.usage=N),e.toolIndex.delete(m);break}case"SubagentStart":{const h=rc(s);if(!h)break;const m=wL(e,c,h,s,a),y=Id(s);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const N=m.endedAt!=null&&a-m.endedAt<=ed,_=w!=null&&a-w<=ed;if(N||_){const j=_?w:m.endedAt;m.state="done",m.endedAt=j,m.startedAt=Math.min(m.startedAt,j),h1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,vL(e,c,h);break}case"SubagentStop":{const h=rc(s);if(!h)break;const m=V2(e,c,h,s);if(!m){for(const[y,w]of e.subagentTombstones)a-w>ed&&e.subagentTombstones.delete(y);e.subagentTombstones.set(Li(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),h1(e,c,h);break}case"Stop":case"SessionEnd":{const h=ji(e,c,a,!1),m=SL(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+ed)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const N of w.tools)N.endedAt==null&&N.explicitSubagentId==null&&(N.endedAt=a,N.ok=!1,N.errorPreview=N.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(ia(w.sessionId,N.id)));i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=ML(s.notification_type);if(!h)break;const m=ji(e,c,a,!1),y=typeof s.message=="string"?s.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:LL(e,c,h,y,a);break}}return e}const qL=6e4,y1=64;function $d(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const FL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},BL=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:FL},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function zL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Ui(e,t=Date.now()){if(!e)return null;const n=jc(e);for(const s of BL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function K2(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*c/1e6}}function X2(e,t,n=Date.now()){if(!zL(t))return e.inputTokens;const s=Ui(t,n),a=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Bx(e,t,n=Date.now()){const s=Ui(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=X2(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,u=K2(e,s),f=u.usd5m+u.usd1h;return{input:a,output:i,cacheRead:c,cacheWrite:f,total:a+i+c+f}}const w1=2e5,UL=1e6,WL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],HL=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function GL(e){if(!e)return w1;const t=jc(e);for(const n of WL)if(n.test(t))return UL;for(const n of HL)if(n.match.test(t))return n.window;return w1}function Z2(e,t){return typeof e=="number"&&e>0?e:GL(t)}const Ni="not priced";function Nt(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function zx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Nt(s)}/min`:`${Nt(n*3600)}/hr`}function VL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function YL(e,t){let n=0,s=0,a=0,i=0,c=0,u=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,i+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Cc(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=YL(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(c=>c.model===e.model);i>=0?s[i]={model:s[i].model,usage:VL(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function Hn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Cc(e)){const a=Bx(s.usage,s.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function Od(e,t=Date.now()){let n=0;for(const s of Cc(e))Ui(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function Q2(e){const t=[];for(const n of Cc(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function J2(e){return Q2(e).filter(t=>t!==e.model)}const KL=new Set(["untrusted","on-request","on-failure"]);function XL(e){return typeof e!="string"||!e?null:KL.has(e)?!0:e==="never"?!1:null}function ZL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=XL(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
-
|
|
59
|
-
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function v1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function
|
|
60
|
-
Likely on: ${n}`:t}function t5(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!go(i.waiting))continue;const c=eh(i.id,i.waiting);t.has(c)||a.push({key:c,title:i.label,body:e5(i.waiting),sessionId:i.id})}return a}function n5(e,t,n){const s=new Set;for(const i of e)s.add(eh(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function lp(e){return new Set(e.map(t=>eh(t.id,t.waiting)))}function r5(e,t){return e!==t}function s5(e,t){return!e&&t!=null}function a5(e,t){return e!==null&&t!=null}function wn(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Pd(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),c=a%60;return`${i}m ${String(c).padStart(2,"0")}s`}function tA(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function nA(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const o5=1;function i5(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const c=e.indexOf(i);c!==-1&&e.splice(c,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const a=n();return a!=null&&a.dismiss===s},depth(){return e.length}}}const Ld=i5();function l5(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function x1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function c5(e,t){return!e||!e.isConnected||x1(e)?!1:t==null||x1(t)}const b1="a[href], button, input, select, textarea, [tabindex]";function u5(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function d5(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function h5({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function th(e){return e.ctrlKey||e.metaKey||e.altKey}const f5=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),p5=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),m5=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function Ux(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function g5(e){return Ux(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Wx(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=Ux(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!f5.has(String(e.type??"text").toLowerCase())}function y5(e,t){if(!e)return!1;if(Wx(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&g5(e))return!1;if(p5.has(Ux(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(s=>m5.has(s))}function w5({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function rA(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(b1))return u5({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&d5({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(b1)!=null})}):[]}function v5(e,t){const n=rA(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function dn(e,t={}){const{focusRef:n,layer:s}=t,a=x.useRef(null),i=x.useRef(e);i.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>i.current());const u=c.current;return x.useEffect(()=>Ld.push(u,s),[u,s]),x.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??rA(a.current)[0])==null||p.focus(),()=>{c5(f,document.activeElement)&&f.focus()}},[]),x.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||th(p))return;const h=a.current;if(!h)return;const m=document.activeElement;if(!(m!=null&&h.contains(m))&&!Ld.isTop(u))return;const w=v5(h,m),N=h5({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function x5(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function rr(e){return e.toLocaleString()}function b5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const k5=60;function _5(e,t=k5){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function N5({agent:e,onClose:t}){var y;const n=x.useRef(null),s=dn(t,{focusRef:n}),a=e.context,i=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=Z2(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Hn(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,m=x5(e.provider);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[l.jsxs("header",{className:"ctx-modal-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),l.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),l.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("section",{className:"ctx-window-row",children:[l.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:l.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),l.jsxs("div",{className:"ctx-window-meta",children:[l.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),l.jsxs("span",{children:[rr(c)," / ",rr(u)," tok (",m.windowScope,")"]})]})]}),l.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"input tokens",val:rr(i.inputTokens)}),l.jsx(Sr,{label:"output tokens",val:rr(i.outputTokens)}),l.jsx(Sr,{label:"cache reads",val:rr(i.cacheReadTokens)}),l.jsx(Sr,{label:"cache writes",val:rr(i.cacheCreateTokens)}),l.jsx(Sr,{label:"cumulative total",val:rr(h)}),l.jsx(Sr,{label:"estimated cost",val:Nt(p.total),accent:!0})]}),l.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"user messages",val:rr((a==null?void 0:a.msgsUser)??0)}),l.jsx(Sr,{label:"assistant messages",val:rr((a==null?void 0:a.msgsAssistant)??0)}),l.jsx(Sr,{label:"tool uses",val:rr((a==null?void 0:a.toolUses)??0)}),l.jsx(Sr,{label:"tool results",val:rr((a==null?void 0:a.toolResults)??0)}),l.jsx(Sr,{label:"system-reminders",val:rr((a==null?void 0:a.systemReminders)??0)})]}):l.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),l.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?l.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):l.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>l.jsxs("li",{children:[l.jsx("span",{className:"ctx-md-path",title:w.path,children:_5(w.path)}),l.jsx("span",{className:"ctx-md-size",children:b5(w.bytes)})]},w.path))})]})})}function Sr({label:e,val:t,accent:n}){return l.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[l.jsx("span",{className:"ctx-row-label",children:e}),l.jsx("span",{className:"ctx-row-val",children:t})]})}function S5({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=Z2(n,t),c=Math.min(1,e/i),u=s/2-3,f=s/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return l.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:l.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[l.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),l.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),l.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const k1=new Map;function sA(e){let t=k1.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},k1.set(e,t)),t}function j5(e,t){const n=sA(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const s of n.listeners)s()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function E5(e){return sA(e).now}const _1=new Map,N1=new Map;function nh(e=1e3){let t=_1.get(e);t||(t=s=>j5(e,s),_1.set(e,t));let n=N1.get(e);return n||(n=()=>E5(e),N1.set(e,n)),x.useSyncExternalStore(t,n,n)}function rh(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const C5="1",S1="agent-dag.schema",T5=["agent-dag.layout","agent-dag.viewport"];function yo(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function A5(e,t=C5){let n=null;try{n=e.getItem(S1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of T5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(S1,t)}catch{}return s}const aA="agent-dag.recapsDismissed",j1=200;function R5(){const e=yo(aA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Di=new Set(R5());const sx=new Set;let oA=0;function iA(e){return sx.add(e),()=>{sx.delete(e)}}function lA(e){if(Di=e,oA++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(aA,JSON.stringify(t.length>j1?t.slice(-j1):t))}catch{}for(const t of sx)t()}function cA(e,t){return`${e}@${t}`}function M5(e){return Di.has(e)}function I5(e){if(Di.has(e))return;const t=new Set(Di);t.add(e),lA(t)}function $5(e){const t=new Set(Di);t.delete(e)||t.add(e),lA(t)}function O5(e){return x.useSyncExternalStore(iA,()=>e!=null&&Di.has(e),()=>!1)}function Hx(e){return`recap:${e}`}function P5(e){return e.startsWith("recap:")}function L5(){return x.useSyncExternalStore(iA,()=>oA,()=>0)}function E1(e,t){const n=Ui(t);if(!n)return`model: ${t}
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Bx(e,t),c=K2(e,n),u=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${
|
|
62
|
-
`)}function C1(e){const t=Cc(e);return t.length<=1?E1(e.usage,e.model):[...t.map(n=>E1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${
|
|
63
|
-
`)}function D5({data:e,selected:t}){var
|
|
56
|
+
*/var yk;function oI(){if(yk)return Vf;yk=1;var e=bc(),t=aI();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Vf.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var N=i(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=u(function(){function b(R){if(!j){if(j=!0,E=R,R=y(R),w!==void 0&&_.hasValue){var I=_.value;if(w(I,R))return C=I}return C=R}if(I=C,s(E,R))return I;var L=y(R);return w!==void 0&&w(I,L)?(E=R,I):(E=R,C=L)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return b(h())},T===null?void 0:function(){return b(T())}]},[h,m,y,w]);var S=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),f(S),S},Vf}var wk;function iI(){return wk||(wk=1,Gf.exports=oI()),Gf.exports}var lI=iI();const cI=xx(lI),uI={},vk=e=>{let t;const n=new Set,s=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(uI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},dI=e=>e?vk(e):vk,{useDebugValue:hI}=fe,{useSyncExternalStoreWithSelector:fI}=cI,pI=e=>e;function xT(e,t=pI,n){const s=fI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hI(s),s}const xk=(e,t)=>{const n=dI(e),s=(a,i=t)=>xT(n,a,i);return Object.assign(s,n),s},mI=(e,t)=>e?xk(e,t):xk;function Qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,a]of e)if(!Object.is(a,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var gI={value:()=>{}};function Gd(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new hd(n)}function hd(e){this._=e}function yI(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",a=n.indexOf(".");if(a>=0&&(s=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}hd.prototype=Gd.prototype={constructor:hd,on:function(e,t){var n=this._,s=yI(e+"",n),a,i=-1,c=s.length;if(arguments.length<2){for(;++i<c;)if((a=(e=s[i]).type)&&(a=wI(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<c;)if(a=(e=s[i]).type)n[a]=bk(n[a],e.name,t);else if(t==null)for(a in n)n[a]=bk(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new hd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function wI(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function bk(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=gI,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bv="http://www.w3.org/1999/xhtml";const kk={svg:"http://www.w3.org/2000/svg",xhtml:Bv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),kk.hasOwnProperty(t)?{space:kk[t],local:e}:e}function vI(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bv&&t.documentElement.namespaceURI===Bv?t.createElement(e):t.createElementNS(n,e)}}function xI(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bT(e){var t=Vd(e);return(t.local?xI:vI)(t)}function bI(){}function bx(e){return e==null?bI:function(){return this.querySelector(e)}}function kI(e){typeof e!="function"&&(e=bx(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=new Array(c),f,p,h=0;h<c;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Gn(s,this._parents)}function _I(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function NI(){return[]}function kT(e){return e==null?NI:function(){return this.querySelectorAll(e)}}function SI(e){return function(){return _I(e.apply(this,arguments))}}function jI(e){typeof e=="function"?e=SI(e):e=kT(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var c=t[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),a.push(f));return new Gn(s,a)}function _T(e){return function(){return this.matches(e)}}function NT(e){return function(t){return t.matches(e)}}var EI=Array.prototype.find;function CI(e){return function(){return EI.call(this.children,e)}}function TI(){return this.firstElementChild}function AI(e){return this.select(e==null?TI:CI(typeof e=="function"?e:NT(e)))}var RI=Array.prototype.filter;function MI(){return Array.from(this.children)}function II(e){return function(){return RI.call(this.children,e)}}function $I(e){return this.selectAll(e==null?MI:II(typeof e=="function"?e:NT(e)))}function OI(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new Gn(s,this._parents)}function ST(e){return new Array(e.length)}function PI(){return new Gn(this._enter||this._groups.map(ST),this._parents)}function _d(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_d.prototype={constructor:_d,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 LI(e){return function(){return e}}function DI(e,t,n,s,a,i){for(var c=0,u,f=t.length,p=i.length;c<p;++c)(u=t[c])?(u.__data__=i[c],s[c]=u):n[c]=new _d(e,i[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function qI(e,t,n,s,a,i,c){var u,f,p=new Map,h=t.length,m=i.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,i[u],u,i)+"",(f=p.get(w))?(s[u]=f,f.__data__=i[u],p.delete(w)):n[u]=new _d(e,i[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function FI(e){return e.__data__}function BI(e,t){if(!arguments.length)return Array.from(this,FI);var n=t?qI:DI,s=this._parents,a=this._groups;typeof e!="function"&&(e=LI(e));for(var i=a.length,c=new Array(i),u=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],m=a[p],y=m.length,w=zI(e.call(h,h&&h.__data__,p,s)),N=w.length,_=u[p]=new Array(N),S=c[p]=new Array(N),b=f[p]=new Array(y);n(h,m,_,S,b,w,t);for(var j=0,E=0,C,T;j<N;++j)if(C=_[j]){for(j>=E&&(E=j+1);!(T=S[E])&&++E<N;);C._next=T||null}}return c=new Gn(c,s),c._enter=u,c._exit=f,c}function zI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UI(){return new Gn(this._exit||this._groups.map(ST),this._parents)}function WI(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function HI(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,c=Math.min(a,i),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=s[f],m=p.length,y=u[f]=new Array(m),w,N=0;N<m;++N)(w=p[N]||h[N])&&(y[N]=w);for(;f<a;++f)u[f]=n[f];return new Gn(u,this._parents)}function GI(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],c;--a>=0;)(c=s[a])&&(i&&c.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(c,i),i=c);return this}function VI(e){e||(e=YI);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var c=n[i],u=c.length,f=a[i]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new Gn(a,this._parents).order()}function YI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XI(){return Array.from(this)}function ZI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var c=s[a];if(c)return c}return null}function QI(){let e=0;for(const t of this)++e;return e}function JI(){return!this.node()}function e$(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,c=a.length,u;i<c;++i)(u=a[i])&&e.call(u,u.__data__,i,a);return this}function t$(e){return function(){this.removeAttribute(e)}}function n$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function r$(e,t){return function(){this.setAttribute(e,t)}}function s$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function a$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function o$(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 i$(e,t){var n=Vd(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?n$:t$:typeof t=="function"?n.local?o$:a$:n.local?s$:r$)(n,t))}function jT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function l$(e){return function(){this.style.removeProperty(e)}}function c$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function u$(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function d$(e,t,n){return arguments.length>1?this.each((t==null?l$:typeof t=="function"?u$:c$)(e,t,n??"")):Pi(this.node(),e)}function Pi(e,t){return e.style.getPropertyValue(t)||jT(e).getComputedStyle(e,null).getPropertyValue(t)}function h$(e){return function(){delete this[e]}}function f$(e,t){return function(){this[e]=t}}function p$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function m$(e,t){return arguments.length>1?this.each((t==null?h$:typeof t=="function"?p$:f$)(e,t)):this.node()[e]}function ET(e){return e.trim().split(/^|\s+/)}function kx(e){return e.classList||new CT(e)}function CT(e){this._node=e,this._names=ET(e.getAttribute("class")||"")}CT.prototype={add:function(e){var t=this._names.indexOf(e);t<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 TT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function AT(e,t){for(var n=kx(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function g$(e){return function(){TT(this,e)}}function y$(e){return function(){AT(this,e)}}function w$(e,t){return function(){(t.apply(this,arguments)?TT:AT)(this,e)}}function v$(e,t){var n=ET(e+"");if(arguments.length<2){for(var s=kx(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?w$:t?g$:y$)(n,t))}function x$(){this.textContent=""}function b$(e){return function(){this.textContent=e}}function k$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _$(e){return arguments.length?this.each(e==null?x$:(typeof e=="function"?k$:b$)(e)):this.node().textContent}function N$(){this.innerHTML=""}function S$(e){return function(){this.innerHTML=e}}function j$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function E$(e){return arguments.length?this.each(e==null?N$:(typeof e=="function"?j$:S$)(e)):this.node().innerHTML}function C$(){this.nextSibling&&this.parentNode.appendChild(this)}function T$(){return this.each(C$)}function A$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R$(){return this.each(A$)}function M$(e){var t=typeof e=="function"?e:bT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function I$(){return null}function $$(e,t){var n=typeof e=="function"?e:bT(e),s=t==null?I$:typeof t=="function"?t:bx(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function O$(){var e=this.parentNode;e&&e.removeChild(this)}function P$(){return this.each(O$)}function L$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function D$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function q$(e){return this.select(e?D$:L$)}function F$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function B$(e){return function(t){e.call(this,t,this.__data__)}}function z$(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function U$(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function W$(e,t,n){return function(){var s=this.__on,a,i=B$(t);if(s){for(var c=0,u=s.length;c<u;++c)if((a=s[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function H$(e,t,n){var s=z$(e+""),a,i=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<i;++a)if((c=s[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?W$:U$,a=0;a<i;++a)this.each(u(s[a],t,n));return this}function RT(e,t,n){var s=jT(e),a=s.CustomEvent;typeof a=="function"?a=new a(t,n):(a=s.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function G$(e,t){return function(){return RT(this,e,t)}}function V$(e,t){return function(){return RT(this,e,t.apply(this,arguments))}}function Y$(e,t){return this.each((typeof t=="function"?V$:G$)(e,t))}function*K$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,c;a<i;++a)(c=s[a])&&(yield c)}var MT=[null];function Gn(e,t){this._groups=e,this._parents=t}function kc(){return new Gn([[document.documentElement]],MT)}function X$(){return this}Gn.prototype=kc.prototype={constructor:Gn,select:kI,selectAll:jI,selectChild:AI,selectChildren:$I,filter:OI,data:BI,enter:PI,exit:UI,join:WI,merge:HI,selection:X$,order:GI,sort:VI,call:KI,nodes:XI,node:ZI,size:QI,empty:JI,each:e$,attr:i$,style:d$,property:m$,classed:v$,text:_$,html:E$,raise:T$,lower:R$,append:M$,insert:$$,remove:P$,clone:q$,datum:F$,on:H$,dispatch:Y$,[Symbol.iterator]:K$};function ar(e){return typeof e=="string"?new Gn([[document.querySelector(e)]],[document.documentElement]):new Gn([[e]],MT)}function Z$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jr(e,t){if(e=Z$(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Q$={passive:!1},ic={capture:!0,passive:!1};function Xf(e){e.stopImmediatePropagation()}function Ri(e){e.preventDefault(),e.stopImmediatePropagation()}function IT(e){var t=e.document.documentElement,n=ar(e).on("dragstart.drag",Ri,ic);"onselectstart"in t?n.on("selectstart.drag",Ri,ic):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $T(e,t){var n=e.document.documentElement,s=ar(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ri,ic),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Wu=e=>()=>e;function zv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}zv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function J$(e){return!e.ctrlKey&&!e.button}function eO(){return this.parentNode}function tO(e,t){return t??{x:e.x,y:e.y}}function nO(){return navigator.maxTouchPoints||"ontouchstart"in this}function rO(){var e=J$,t=eO,n=tO,s=nO,a={},i=Gd("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",S).on("touchmove.drag",b,Q$).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(ar(C.view).on("mousemove.drag",N,ic).on("mouseup.drag",_,ic),IT(C.view),Xf(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function N(C){if(Ri(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){ar(C.view).on("mousemove.drag mouseup.drag",null),$T(C.view,p),Ri(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,I=t.call(this,C,T),L=R.length,H,$;for(H=0;H<L;++H)($=E(this,I,C,T,R[H].identifier,R[H]))&&(Xf(C),$("start",C,R[H]))}}function b(C){var T=C.changedTouches,R=T.length,I,L;for(I=0;I<R;++I)(L=a[T[I].identifier])&&(Ri(C),L("drag",C,T[I]))}function j(C){var T=C.changedTouches,R=T.length,I,L;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<R;++I)(L=a[T[I].identifier])&&(Xf(C),L("end",C,T[I]))}function E(C,T,R,I,L,H){var $=i.copy(),V=jr(H||R,T),Q,J,M;if((M=n.call(C,new zv("beforestart",{sourceEvent:R,target:y,identifier:L,active:c,x:V[0],y:V[1],dx:0,dy:0,dispatch:$}),I))!=null)return Q=M.x-V[0]||0,J=M.y-V[1]||0,function X(G,P,B){var W=V,Y;switch(G){case"start":a[L]=X,Y=c++;break;case"end":delete a[L],--c;case"drag":V=jr(B||P,T),Y=c;break}$.call(G,C,new zv(G,{sourceEvent:P,subject:M,target:y,identifier:L,active:Y,x:V[0]+Q,y:V[1]+J,dx:V[0]-W[0],dy:V[1]-W[1],dispatch:$}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Wu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Wu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Wu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Wu(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function _x(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function OT(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function _c(){}var lc=.7,Nd=1/lc,Mi="\\s*([+-]?\\d+)\\s*",cc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sO=/^#([0-9a-f]{3,8})$/,aO=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),oO=new RegExp(`^rgb\\(${Vr},${Vr},${Vr}\\)$`),iO=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${cc}\\)$`),lO=new RegExp(`^rgba\\(${Vr},${Vr},${Vr},${cc}\\)$`),cO=new RegExp(`^hsl\\(${cc},${Vr},${Vr}\\)$`),uO=new RegExp(`^hsla\\(${cc},${Vr},${Vr},${cc}\\)$`),_k={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};_x(_c,uc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nk,formatHex:Nk,formatHex8:dO,formatHsl:hO,formatRgb:Sk,toString:Sk});function Nk(){return this.rgb().formatHex()}function dO(){return this.rgb().formatHex8()}function hO(){return PT(this).formatHsl()}function Sk(){return this.rgb().formatRgb()}function uc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jk(t):n===3?new Pn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Hu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Hu(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=aO.exec(e))?new Pn(t[1],t[2],t[3],1):(t=oO.exec(e))?new Pn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iO.exec(e))?Hu(t[1],t[2],t[3],t[4]):(t=lO.exec(e))?Hu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,1):(t=uO.exec(e))?Tk(t[1],t[2]/100,t[3]/100,t[4]):_k.hasOwnProperty(e)?jk(_k[e]):e==="transparent"?new Pn(NaN,NaN,NaN,0):null}function jk(e){return new Pn(e>>16&255,e>>8&255,e&255,1)}function Hu(e,t,n,s){return s<=0&&(e=t=n=NaN),new Pn(e,t,n,s)}function fO(e){return e instanceof _c||(e=uc(e)),e?(e=e.rgb(),new Pn(e.r,e.g,e.b,e.opacity)):new Pn}function Uv(e,t,n,s){return arguments.length===1?fO(e):new Pn(e,t,n,s??1)}function Pn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}_x(Pn,Uv,OT(_c,{brighter(e){return e=e==null?Nd:Math.pow(Nd,e),new Pn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lc:Math.pow(lc,e),new Pn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pn(lo(this.r),lo(this.g),lo(this.b),Sd(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:Ek,formatHex:Ek,formatHex8:pO,formatRgb:Ck,toString:Ck}));function Ek(){return`#${oo(this.r)}${oo(this.g)}${oo(this.b)}`}function pO(){return`#${oo(this.r)}${oo(this.g)}${oo(this.b)}${oo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ck(){const e=Sd(this.opacity);return`${e===1?"rgb(":"rgba("}${lo(this.r)}, ${lo(this.g)}, ${lo(this.b)}${e===1?")":`, ${e})`}`}function Sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function lo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oo(e){return e=lo(e),(e<16?"0":"")+e.toString(16)}function Tk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Cr(e,t,n,s)}function PT(e){if(e instanceof Cr)return new Cr(e.h,e.s,e.l,e.opacity);if(e instanceof _c||(e=uc(e)),!e)return new Cr;if(e instanceof Cr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),c=NaN,u=i-a,f=(i+a)/2;return u?(t===i?c=(n-s)/u+(n<s)*6:n===i?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?i+a:2-i-a,c*=60):u=f>0&&f<1?0:c,new Cr(c,u,f,e.opacity)}function mO(e,t,n,s){return arguments.length===1?PT(e):new Cr(e,t,n,s??1)}function Cr(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}_x(Cr,mO,OT(_c,{brighter(e){return e=e==null?Nd:Math.pow(Nd,e),new Cr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lc:Math.pow(lc,e),new Cr(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,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new Pn(Zf(e>=240?e-240:e+120,a,s),Zf(e,a,s),Zf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new Cr(Ak(this.h),Gu(this.s),Gu(this.l),Sd(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(){const e=Sd(this.opacity);return`${e===1?"hsl(":"hsla("}${Ak(this.h)}, ${Gu(this.s)*100}%, ${Gu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ak(e){return e=(e||0)%360,e<0?e+360:e}function Gu(e){return Math.max(0,Math.min(1,e||0))}function Zf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const LT=e=>()=>e;function gO(e,t){return function(n){return e+n*t}}function yO(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function wO(e){return(e=+e)==1?DT:function(t,n){return n-t?yO(t,n,e):LT(isNaN(t)?n:t)}}function DT(e,t){var n=t-e;return n?gO(e,n):LT(isNaN(e)?t:e)}const Rk=(function e(t){var n=wO(t);function s(a,i){var c=n((a=Uv(a)).r,(i=Uv(i)).r),u=n(a.g,i.g),f=n(a.b,i.b),p=DT(a.opacity,i.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function na(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Wv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qf=new RegExp(Wv.source,"g");function vO(e){return function(){return e}}function xO(e){return function(t){return e(t)+""}}function bO(e,t){var n=Wv.lastIndex=Qf.lastIndex=0,s,a,i,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Wv.exec(e))&&(a=Qf.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),u[c]?u[c]+=i:u[++c]=i),(s=s[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:na(s,a)})),n=Qf.lastIndex;return n<t.length&&(i=t.slice(n),u[c]?u[c]+=i:u[++c]=i),u.length<2?f[0]?xO(f[0].x):vO(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var Mk=180/Math.PI,Hv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qT(e,t,n,s,a,i){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Mk,skewX:Math.atan(f)*Mk,scaleX:c,scaleY:u}}var Vu;function kO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hv:qT(t.a,t.b,t.c,t.d,t.e,t.f)}function _O(e){return e==null||(Vu||(Vu=document.createElementNS("http://www.w3.org/2000/svg","g")),Vu.setAttribute("transform",e),!(e=Vu.transform.baseVal.consolidate()))?Hv:(e=e.matrix,qT(e.a,e.b,e.c,e.d,e.e,e.f))}function FT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push("translate(",null,t,null,n);N.push({i:_-4,x:na(p,m)},{i:_-2,x:na(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:na(p,h)})):h&&m.push(a(m)+"rotate("+h+s)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:na(p,h)}):h&&m.push(a(m)+"skewX("+h+s)}function f(p,h,m,y,w,N){if(p!==m||h!==y){var _=w.push(a(w)+"scale(",null,",",null,")");N.push({i:_-4,x:na(p,m)},{i:_-2,x:na(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var NO=FT(kO,"px, ","px)","deg)"),SO=FT(_O,", ",")",")"),jO=1e-12;function Ik(e){return((e=Math.exp(e))+1/e)/2}function EO(e){return((e=Math.exp(e))-1/e)/2}function CO(e){return((e=Math.exp(2*e))-1)/(e+1)}const TO=(function e(t,n,s){function a(i,c){var u=i[0],f=i[1],p=i[2],h=c[0],m=c[1],y=c[2],w=h-u,N=m-f,_=w*w+N*N,S,b;if(_<jO)b=Math.log(y/p)/t,S=function(I){return[u+I*w,f+I*N,p*Math.exp(t*I*b)]};else{var j=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*j),C=(y*y-p*p-s*_)/(2*y*n*j),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);b=(R-T)/t,S=function(I){var L=I*b,H=Ik(T),$=p/(n*j)*(H*CO(t*L+T)-EO(T));return[u+$*w,f+$*N,p*H/Ik(t*L+T)]}}return S.duration=b*1e3*t/Math.SQRT2,S}return a.rho=function(i){var c=Math.max(.001,+i),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var Li=0,Ql=0,Ul=0,BT=1e3,jd,Jl,Ed=0,uo=0,Yd=0,dc=typeof performance=="object"&&performance.now?performance:Date,zT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nx(){return uo||(zT(AO),uo=dc.now()+Yd)}function AO(){uo=0}function Cd(){this._call=this._time=this._next=null}Cd.prototype=UT.prototype={constructor:Cd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nx():+n)+(t==null?0:+t),!this._next&&Jl!==this&&(Jl?Jl._next=this:jd=this,Jl=this),this._call=e,this._time=n,Gv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gv())}};function UT(e,t,n){var s=new Cd;return s.restart(e,t,n),s}function RO(){Nx(),++Li;for(var e=jd,t;e;)(t=uo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Li}function $k(){uo=(Ed=dc.now())+Yd,Li=Ql=0;try{RO()}finally{Li=0,IO(),uo=0}}function MO(){var e=dc.now(),t=e-Ed;t>BT&&(Yd-=t,Ed=e)}function IO(){for(var e,t=jd,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:jd=n);Jl=e,Gv(s)}function Gv(e){if(!Li){Ql&&(Ql=clearTimeout(Ql));var t=e-uo;t>24?(e<1/0&&(Ql=setTimeout($k,e-dc.now()-Yd)),Ul&&(Ul=clearInterval(Ul))):(Ul||(Ed=dc.now(),Ul=setInterval(MO,BT)),Li=1,zT($k))}}function Ok(e,t,n){var s=new Cd;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var $O=Gd("start","end","cancel","interrupt"),OO=[],WT=0,Pk=1,Vv=2,fd=3,Lk=4,Yv=5,pd=6;function Kd(e,t,n,s,a,i){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;PO(e,n,{name:t,index:s,group:a,on:$O,tween:OO,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:WT})}function Sx(e,t){var n=Ir(e,t);if(n.state>WT)throw new Error("too late; already scheduled");return n}function Xr(e,t){var n=Ir(e,t);if(n.state>fd)throw new Error("too late; already running");return n}function Ir(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PO(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=UT(i,0,n.time);function i(p){n.state=Pk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==Pk)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===fd)return Ok(c);w.state===Lk?(w.state=pd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=pd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Ok(function(){n.state===fd&&(n.state=Lk,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Vv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vv){for(n.state=fd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Yv,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Yv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=pd,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function md(e,t){var n=e.__transition,s,a,i=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){i=!1;continue}a=s.state>Vv&&s.state<Yv,s.state=pd,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}i&&delete e.__transition}}function LO(e){return this.each(function(){md(this,e)})}function DO(e,t){var n,s;return function(){var a=Xr(this,e),i=a.tween;if(i!==n){s=n=i;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function qO(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Xr(this,e),c=i.tween;if(c!==s){a=(s=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}i.tween=a}}function FO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Ir(this.node(),n).tween,a=0,i=s.length,c;a<i;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?DO:qO)(n,e,t))}function jx(e,t,n){var s=e._id;return e.each(function(){var a=Xr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Ir(a,s).value[t]}}function HT(e,t){var n;return(typeof t=="number"?na:t instanceof uc?Rk:(n=uc(t))?(t=n,Rk):bO)(e,t)}function BO(e){return function(){this.removeAttribute(e)}}function zO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttribute(e);return c===a?null:c===s?i:i=t(s=c,n)}}function WO(e,t,n){var s,a=n+"",i;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?i:i=t(s=c,n)}}function HO(e,t,n){var s,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u)))}}function GO(e,t,n){var s,a,i;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u)))}}function VO(e,t){var n=Vd(e),s=n==="transform"?SO:HT;return this.attrTween(e,typeof t=="function"?(n.local?GO:HO)(n,s,jx(this,"attr."+e,t)):t==null?(n.local?zO:BO)(n):(n.local?WO:UO)(n,s,t))}function YO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function KO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function XO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&KO(e,i)),n}return a._value=t,a}function ZO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&YO(e,i)),n}return a._value=t,a}function QO(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 new Error;var s=Vd(e);return this.tween(n,(s.local?XO:ZO)(s,t))}function JO(e,t){return function(){Sx(this,e).delay=+t.apply(this,arguments)}}function e3(e,t){return t=+t,function(){Sx(this,e).delay=t}}function t3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?JO:e3)(t,e)):Ir(this.node(),t).delay}function n3(e,t){return function(){Xr(this,e).duration=+t.apply(this,arguments)}}function r3(e,t){return t=+t,function(){Xr(this,e).duration=t}}function s3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?n3:r3)(t,e)):Ir(this.node(),t).duration}function a3(e,t){if(typeof t!="function")throw new Error;return function(){Xr(this,e).ease=t}}function o3(e){var t=this._id;return arguments.length?this.each(a3(t,e)):Ir(this.node(),t).ease}function i3(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Xr(this,e).ease=n}}function l3(e){if(typeof e!="function")throw new Error;return this.each(i3(this._id,e))}function c3(e){typeof e!="function"&&(e=_T(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],c=i.length,u=s[a]=[],f,p=0;p<c;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new xs(s,this._parents,this._name,this._id)}function u3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),c=new Array(s),u=0;u<i;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<s;++u)c[u]=t[u];return new xs(c,this._parents,this._name,this._id)}function d3(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function h3(e,t,n){var s,a,i=d3(t)?Sx:Xr;return function(){var c=i(this,e),u=c.on;u!==s&&(a=(s=u).copy()).on(t,n),c.on=a}}function f3(e,t){var n=this._id;return arguments.length<2?Ir(this.node(),n).on.on(e):this.each(h3(n,e,t))}function p3(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function m3(){return this.on("end.remove",p3(this._id))}function g3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bx(e));for(var s=this._groups,a=s.length,i=new Array(a),c=0;c<a;++c)for(var u=s[c],f=u.length,p=i[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,Kd(p[y],t,n,y,p,Ir(h,n)));return new xs(i,this._parents,t,n)}function y3(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kT(e));for(var s=this._groups,a=s.length,i=[],c=[],u=0;u<a;++u)for(var f=s[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,N=Ir(h,n),_=0,S=y.length;_<S;++_)(w=y[_])&&Kd(w,t,n,_,y,N);i.push(y),c.push(h)}return new xs(i,c,t,n)}var w3=kc.prototype.constructor;function v3(){return new w3(this._groups,this._parents)}function x3(e,t){var n,s,a;return function(){var i=Pi(this,e),c=(this.style.removeProperty(e),Pi(this,e));return i===c?null:i===n&&c===s?a:a=t(n=i,s=c)}}function GT(e){return function(){this.style.removeProperty(e)}}function b3(e,t,n){var s,a=n+"",i;return function(){var c=Pi(this,e);return c===a?null:c===s?i:i=t(s=c,n)}}function k3(e,t,n){var s,a,i;return function(){var c=Pi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Pi(this,e))),c===f?null:c===s&&f===a?i:(a=f,i=t(s=c,u))}}function _3(e,t){var n,s,a,i="style."+t,c="end."+i,u;return function(){var f=Xr(this,e),p=f.on,h=f.value[i]==null?u||(u=GT(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(c,a=h),f.on=s}}function N3(e,t,n){var s=(e+="")=="transform"?NO:HT;return t==null?this.styleTween(e,x3(e,s)).on("end.style."+e,GT(e)):typeof t=="function"?this.styleTween(e,k3(e,s,jx(this,"style."+e,t))).each(_3(this._id,e)):this.styleTween(e,b3(e,s,t),n).on("end.style."+e,null)}function S3(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function j3(e,t,n){var s,a;function i(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&S3(e,c,n)),s}return i._value=t,i}function E3(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,j3(e,t,n??""))}function C3(e){return function(){this.textContent=e}}function T3(e){return function(){var t=e(this);this.textContent=t??""}}function A3(e){return this.tween("text",typeof e=="function"?T3(jx(this,"text",e)):C3(e==null?"":e+""))}function R3(e){return function(t){this.textContent=e.call(this,t)}}function M3(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&R3(a)),t}return s._value=e,s}function I3(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 new Error;return this.tween(t,M3(e))}function $3(){for(var e=this._name,t=this._id,n=VT(),s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=Ir(f,t);Kd(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new xs(s,this._parents,e,n)}function O3(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,c){var u={value:c},f={value:function(){--a===0&&i()}};n.each(function(){var p=Xr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&i()})}var P3=0;function xs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function VT(){return++P3}var gs=kc.prototype;xs.prototype={constructor:xs,select:g3,selectAll:y3,selectChild:gs.selectChild,selectChildren:gs.selectChildren,filter:c3,merge:u3,selection:v3,transition:$3,call:gs.call,nodes:gs.nodes,node:gs.node,size:gs.size,empty:gs.empty,each:gs.each,on:f3,attr:VO,attrTween:QO,style:N3,styleTween:E3,text:A3,textTween:I3,remove:m3,tween:FO,delay:t3,duration:s3,ease:o3,easeVarying:l3,end:O3,[Symbol.iterator]:gs[Symbol.iterator]};function L3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D3={time:null,delay:0,duration:250,ease:L3};function q3(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function F3(e){var t,n;e instanceof xs?(t=e._id,e=e._name):(t=VT(),(n=D3).time=Nx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var c=s[i],u=c.length,f,p=0;p<u;++p)(f=c[p])&&Kd(f,e,t,p,c,n||q3(f,t));return new xs(s,this._parents,e,t)}kc.prototype.interrupt=LO;kc.prototype.transition=F3;const Yu=e=>()=>e;function B3(e,{sourceEvent:t,target:n,transform:s,dispatch:a}){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:s,enumerable:!0,configurable:!0},_:{value:a}})}function ys(e,t,n){this.k=e,this.x=t,this.y=n}ys.prototype={constructor:ys,scale:function(e){return e===1?this:new ys(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ys(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 vs=new ys(1,0,0);ys.prototype;function Jf(e){e.stopImmediatePropagation()}function Wl(e){e.preventDefault(),e.stopImmediatePropagation()}function z3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function U3(){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 Dk(){return this.__zoom||vs}function W3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H3(){return navigator.maxTouchPoints||"ontouchstart"in this}function G3(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),c>i?(i+c)/2:Math.min(0,i)||Math.max(0,c))}function YT(){var e=z3,t=U3,n=G3,s=W3,a=H3,i=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=TO,p=Gd("start","zoom","end"),h,m,y,w=500,N=150,_=0,S=10;function b(M){M.property("__zoom",Dk).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",$).filter(a).on("touchstart.zoom",V).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,X,G,P){var B=M.selection?M.selection():M;B.property("__zoom",Dk),M!==B?T(M,X,G,P):B.interrupt().each(function(){R(this,arguments).event(P).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},b.scaleBy=function(M,X,G,P){b.scaleTo(M,function(){var B=this.__zoom.k,W=typeof X=="function"?X.apply(this,arguments):X;return B*W},G,P)},b.scaleTo=function(M,X,G,P){b.transform(M,function(){var B=t.apply(this,arguments),W=this.__zoom,Y=G==null?C(B):typeof G=="function"?G.apply(this,arguments):G,O=W.invert(Y),F=typeof X=="function"?X.apply(this,arguments):X;return n(E(j(W,F),Y,O),B,c)},G,P)},b.translateBy=function(M,X,G,P){b.transform(M,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,P)},b.translateTo=function(M,X,G,P,B){b.transform(M,function(){var W=t.apply(this,arguments),Y=this.__zoom,O=P==null?C(W):typeof P=="function"?P.apply(this,arguments):P;return n(vs.translate(O[0],O[1]).scale(Y.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof G=="function"?-G.apply(this,arguments):-G),W,c)},P,B)};function j(M,X){return X=Math.max(i[0],Math.min(i[1],X)),X===M.k?M:new ys(X,M.x,M.y)}function E(M,X,G){var P=X[0]-G[0]*M.k,B=X[1]-G[1]*M.k;return P===M.x&&B===M.y?M:new ys(M.k,P,B)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,X,G,P){M.on("start.zoom",function(){R(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(P).end()}).tween("zoom",function(){var B=this,W=arguments,Y=R(B,W).event(P),O=t.apply(B,W),F=G==null?C(O):typeof G=="function"?G.apply(B,W):G,oe=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),z=B.__zoom,Z=typeof X=="function"?X.apply(B,W):X,U=f(z.invert(F).concat(oe/z.k),Z.invert(F).concat(oe/Z.k));return function(re){if(re===1)re=Z;else{var de=U(re),pe=oe/de[2];re=new ys(pe,F[0]-de[0]*pe,F[1]-de[1]*pe)}Y.zoom(null,re)}})}function R(M,X,G){return!G&&M.__zooming||new I(M,X)}function I(M,X){this.that=M,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,X),this.taps=0}I.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,X){return this.mouse&&M!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var X=ar(this.that).datum();p.call(M,this.that,new B3(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),X)}};function L(M,...X){if(!e.apply(this,arguments))return;var G=R(this,X).event(M),P=this.__zoom,B=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,s.apply(this,arguments)))),W=jr(M);if(G.wheel)(G.mouse[0][0]!==W[0]||G.mouse[0][1]!==W[1])&&(G.mouse[1]=P.invert(G.mouse[0]=W)),clearTimeout(G.wheel);else{if(P.k===B)return;G.mouse=[W,P.invert(W)],md(this),G.start()}Wl(M),G.wheel=setTimeout(Y,N),G.zoom("mouse",n(E(j(P,B),G.mouse[0],G.mouse[1]),G.extent,c));function Y(){G.wheel=null,G.end()}}function H(M,...X){if(y||!e.apply(this,arguments))return;var G=M.currentTarget,P=R(this,X,!0).event(M),B=ar(M.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",oe,!0),W=jr(M,G),Y=M.clientX,O=M.clientY;IT(M.view),Jf(M),P.mouse=[W,this.__zoom.invert(W)],md(this),P.start();function F(z){if(Wl(z),!P.moved){var Z=z.clientX-Y,U=z.clientY-O;P.moved=Z*Z+U*U>_}P.event(z).zoom("mouse",n(E(P.that.__zoom,P.mouse[0]=jr(z,G),P.mouse[1]),P.extent,c))}function oe(z){B.on("mousemove.zoom mouseup.zoom",null),$T(z.view,P.moved),Wl(z),P.event(z).end()}}function $(M,...X){if(e.apply(this,arguments)){var G=this.__zoom,P=jr(M.changedTouches?M.changedTouches[0]:M,this),B=G.invert(P),W=G.k*(M.shiftKey?.5:2),Y=n(E(j(G,W),P,B),t.apply(this,X),c);Wl(M),u>0?ar(this).transition().duration(u).call(T,Y,P,M):ar(this).call(b.transform,Y,P,M)}}function V(M,...X){if(e.apply(this,arguments)){var G=M.touches,P=G.length,B=R(this,X,M.changedTouches.length===P).event(M),W,Y,O,F;for(Jf(M),Y=0;Y<P;++Y)O=G[Y],F=jr(O,this),F=[F,this.__zoom.invert(F),O.identifier],B.touch0?!B.touch1&&B.touch0[2]!==F[2]&&(B.touch1=F,B.taps=0):(B.touch0=F,W=!0,B.taps=1+!!h);h&&(h=clearTimeout(h)),W&&(B.taps<2&&(m=F[0],h=setTimeout(function(){h=null},w)),md(this),B.start())}}function Q(M,...X){if(this.__zooming){var G=R(this,X).event(M),P=M.changedTouches,B=P.length,W,Y,O,F;for(Wl(M),W=0;W<B;++W)Y=P[W],O=jr(Y,this),G.touch0&&G.touch0[2]===Y.identifier?G.touch0[0]=O:G.touch1&&G.touch1[2]===Y.identifier&&(G.touch1[0]=O);if(Y=G.that.__zoom,G.touch1){var oe=G.touch0[0],z=G.touch0[1],Z=G.touch1[0],U=G.touch1[1],re=(re=Z[0]-oe[0])*re+(re=Z[1]-oe[1])*re,de=(de=U[0]-z[0])*de+(de=U[1]-z[1])*de;Y=j(Y,Math.sqrt(re/de)),O=[(oe[0]+Z[0])/2,(oe[1]+Z[1])/2],F=[(z[0]+U[0])/2,(z[1]+U[1])/2]}else if(G.touch0)O=G.touch0[0],F=G.touch0[1];else return;G.zoom("touch",n(E(Y,O,F),G.extent,c))}}function J(M,...X){if(this.__zooming){var G=R(this,X).event(M),P=M.changedTouches,B=P.length,W,Y;for(Jf(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),W=0;W<B;++W)Y=P[W],G.touch0&&G.touch0[2]===Y.identifier?delete G.touch0:G.touch1&&G.touch1[2]===Y.identifier&&delete G.touch1;if(G.touch1&&!G.touch0&&(G.touch0=G.touch1,delete G.touch1),G.touch0)G.touch0[1]=this.__zoom.invert(G.touch0[0]);else if(G.end(),G.taps===2&&(Y=jr(Y,this),Math.hypot(m[0]-Y[0],m[1]-Y[1])<S)){var O=ar(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(s=typeof M=="function"?M:Yu(+M),b):s},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Yu(!!M),b):e},b.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:Yu(!!M),b):a},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Yu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),b):t},b.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],b):[i[0],i[1]]},b.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(M){return arguments.length?(n=M,b):n},b.duration=function(M){return arguments.length?(u=+M,b):u},b.interpolate=function(M){return arguments.length?(f=M,b):f},b.on=function(){var M=p.on.apply(p,arguments);return M===p?b:M},b.clickDistance=function(M){return arguments.length?(_=(M=+M)*M,b):Math.sqrt(_)},b.tapDistance=function(M){return arguments.length?(S=+M,b):S},b}var $r=wT();const Xd=x.createContext(null),V3=Xd.Provider,bs={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},KT=bs.error001();function wt(e,t){const n=x.useContext(Xd);if(n===null)throw new Error(KT);return xT(n,e,t)}const Ht=()=>{const e=x.useContext(Xd);if(e===null)throw new Error(KT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Y3=e=>e.userSelectionActive?"none":"all";function Ex({position:e,children:t,className:n,style:s,...a}){const i=wt(Y3),c=`${e}`.split("-");return fe.createElement("div",{className:un(["react-flow__panel",n,...c]),style:{...s,pointerEvents:i},...a},t)}function K3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:fe.createElement(Ex,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const X3=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),N=un(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),typeof n>"u"||!n?null:fe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...h},a&&fe.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),fe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),f)};var Z3=x.memo(X3);const Cx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Di=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tx=(e={x:0,y:0},t)=>({x:Di(e.x,t[0][0],t[1][0]),y:Di(e.y,t[0][1],t[1][1])}),qk=(e,t,n)=>e<t?Di(Math.abs(e-t),1,50)/50:e>n?-Di(Math.abs(e-n),1,50)/50:0,XT=(e,t)=>{const n=qk(e.x,35,t.width-35)*20,s=qk(e.y,35,t.height-35)*20;return[n,s]},ZT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},QT=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),hc=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),JT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Fk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Q3=(e,t)=>JT(QT(hc(e),hc(t))),Kv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},J3=e=>or(e.width)&&or(e.height)&&or(e.x)&&or(e.y),or=e=>!isNaN(e)&&isFinite(e),Lt=Symbol.for("internals"),e2=["Enter"," ","Escape"],e4=(e,t)=>{},t4=e=>"nativeEvent"in e;function Xv(e){var a,i;const t=t4(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const t2=e=>"clientX"in e,ia=(e,t)=>{var i,c;const n=t2(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Td=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Nc=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&fe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&or(n)&&or(s)?fe.createElement(Z3,{x:n,y:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Nc.displayName="BaseEdge";function Hl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function n2({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[i,u,a,c]}function r2({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+i*.375+u*.375+s*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var ho;(function(e){e.Strict="strict",e.Loose="loose"})(ho||(ho={}));var io;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(io||(io={}));var fc;(function(e){e.Partial="partial",e.Full="full"})(fc||(fc={}));var sa;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(sa||(sa={}));var Ad;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ad||(Ad={}));var Fe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Fe||(Fe={}));function Bk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Fe.Left||e===Fe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function s2({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:s,targetY:a,targetPosition:i=Fe.Top}){const[c,u]=Bk({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Bk({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,m,y,w]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${a}`,h,m,y,w]}const Ax=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Fe.Bottom,targetPosition:i=Fe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[S,b,j]=s2({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return fe.createElement(Nc,{path:S,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});Ax.displayName="SimpleBezierEdge";const zk={[Fe.Left]:{x:-1,y:0},[Fe.Right]:{x:1,y:0},[Fe.Top]:{x:0,y:-1},[Fe.Bottom]:{x:0,y:1}},n4=({source:e,sourcePosition:t=Fe.Bottom,target:n})=>t===Fe.Left||t===Fe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Uk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function r4({source:e,sourcePosition:t=Fe.Bottom,target:n,targetPosition:s=Fe.Top,center:a,offset:i}){const c=zk[t],u=zk[s],f={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=n4({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],N,_;const S={x:0,y:0},b={x:0,y:0},[j,E,C,T]=n2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){N=a.x??j,_=a.y??E;const I=[{x:N,y:f.y},{x:N,y:p.y}],L=[{x:f.x,y:_},{x:p.x,y:_}];c[m]===y?w=m==="x"?I:L:w=m==="x"?L:I}else{const I=[{x:f.x,y:p.y}],L=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?L:I:w=c.y===y?I:L,t===s){const J=Math.abs(e[m]-n[m]);if(J<=i){const M=Math.min(i-1,i-J);c[m]===y?S[m]=(f[m]>e[m]?-1:1)*M:b[m]=(p[m]>n[m]?-1:1)*M}}if(t!==s){const J=m==="x"?"y":"x",M=c[m]===u[J],X=f[J]>p[J],G=f[J]<p[J];(c[m]===1&&(!M&&X||M&&G)||c[m]!==1&&(!M&&G||M&&X))&&(w=m==="x"?I:L)}const H={x:f.x+S.x,y:f.y+S.y},$={x:p.x+b.x,y:p.y+b.y},V=Math.max(Math.abs(H.x-w[0].x),Math.abs($.x-w[0].x)),Q=Math.max(Math.abs(H.y-w[0].y),Math.abs($.y-w[0].y));V>=Q?(N=(H.x+$.x)/2,_=w[0].y):(N=w[0].x,_=(H.y+$.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},n],N,_,C,T]}function s4(e,t,n,s){const a=Math.min(Uk(e,t)/2,Uk(t,n)/2,s),{x:i,y:c}=t;if(e.x===i&&i===n.x||e.y===c&&c===n.y)return`L${i} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${c}Q ${i},${c} ${i},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${c+a*f}Q ${i},${c} ${i+a*u},${c}`}function Zv({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:s,targetY:a,targetPosition:i=Fe.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,N]=r4({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:u,y:f},offset:p});return[h.reduce((S,b,j)=>{let E="";return j>0&&j<h.length-1?E=s4(h[j-1],b,h[j+1],c):E=`${j===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const Zd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=Fe.Bottom,targetPosition:y=Fe.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,j,E]=Zv({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:s,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return fe.createElement(Nc,{path:b,labelX:j,labelY:E,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:S})});Zd.displayName="SmoothStepEdge";const Rx=x.memo(e=>{var t;return fe.createElement(Zd,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Rx.displayName="StepEdge";function a4({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,c,u]=n2({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,c,u]}const Mx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,S]=a4({sourceX:e,sourceY:t,targetX:n,targetY:s});return fe.createElement(Nc,{path:N,labelX:_,labelY:S,label:a,labelStyle:i,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});Mx.displayName="StraightEdge";function Ku(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wk({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case Fe.Left:return[t-Ku(t-s,i),n];case Fe.Right:return[t+Ku(s-t,i),n];case Fe.Top:return[t,n-Ku(n-a,i)];case Fe.Bottom:return[t,n+Ku(a-n,i)]}}function Ix({sourceX:e,sourceY:t,sourcePosition:n=Fe.Bottom,targetX:s,targetY:a,targetPosition:i=Fe.Top,curvature:c=.25}){const[u,f]=Wk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,h]=Wk({pos:i,x1:s,y1:a,x2:e,y2:t,c}),[m,y,w,N]=r2({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${s},${a}`,m,y,w,N]}const Rd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Fe.Bottom,targetPosition:i=Fe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,j,E]=Ix({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:_==null?void 0:_.curvature});return fe.createElement(Nc,{path:b,labelX:j,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});Rd.displayName="BezierEdge";const $x=x.createContext(null),o4=$x.Provider;$x.Consumer;const i4=()=>x.useContext($x),l4=e=>"id"in e&&"source"in e&&"target"in e,c4=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Qv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,u4=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),d4=(e,t)=>{if(!e.source||!e.target)return t;let n;return l4(e)?n={...e}:n={...e,id:c4(e)},u4(n,t)?t:t.concat(n)},Jv=({x:e,y:t},[n,s,a],i,[c,u])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},a2=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),co=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-s};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:a}},Qd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:c}=co(a,t).positionAbsolute;return QT(s,hc({x:i,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return JT(n)},o2=(e,t,[n,s,a]=[0,0,1],i=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=h;if(c&&!w||N)return!1;const{positionAbsolute:_}=co(h,u),S={x:_.x,y:_.y,width:m||0,height:y||0},b=Kv(f,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=i&&b>0,C=(m||0)*(y||0);(j||E||b>=C||h.dragging)&&p.push(h)}),p},i2=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},l2=(e,t,n,s,a,i=.1)=>{const c=t/(e.width*(1+i)),u=n/(e.height*(1+i)),f=Math.min(c,u),p=Di(f,s,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},ao=(e,t=0)=>e.transition().duration(t);function Hk(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var c,u;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),a},[])}function h4(e,t,n,s,a,i){const{x:c,y:u}=ia(e),p=t.elementsFromPoint(c,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Ox(void 0,p),S=p.getAttribute("data-handleid"),b=i({nodeId:N,id:S,type:_});if(b){const j=a.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const S=i(N);_<=m&&(_<m?h=[{handle:N,validHandleResult:S}]:_===m&&h.push({handle:N,validHandleResult:S}),m=_)}}),!h.length)return{handle:null,validHandleResult:c2()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||h[0]}const f4={source:null,target:null,sourceHandle:null,targetHandle:null},c2=()=>({handleDomNode:null,isValid:!1,connection:f4,endHandle:null});function u2(e,t,n,s,a,i,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...c2(),handleDomNode:f};if(f){const h=Ox(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),_={source:u?m:n,sourceHandle:u?y:s,target:u?n:m,targetHandle:u?s:y};p.connection=_,w&&N&&(t===ho.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=i(_))}return p}function p4({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[Lt]){const{handleBounds:c}=i[Lt];let u=[],f=[];c&&(u=Hk(i,c,"source",`${t}-${n}-${s}`),f=Hk(i,c,"target",`${t}-${n}-${s}`)),a.push(...u,...f)}return a},[])}function Ox(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ep(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function m4(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function d2({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=ZT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:j}=i();let E=0,C;const{x:T,y:R}=ia(e),I=h==null?void 0:h.elementFromPoint(T,R),L=Ox(f,I),H=y==null?void 0:y.getBoundingClientRect();if(!H||!L)return;let $,V=ia(e,H),Q=!1,J=null,M=!1,X=null;const G=p4({nodes:b(),nodeId:n,handleId:t,handleType:L}),P=()=>{if(!w)return;const[Y,O]=XT(V,H);S({x:Y,y:O}),E=requestAnimationFrame(P)};c({connectionPosition:V,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:L,connectionStartHandle:{nodeId:n,handleId:t,type:L},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:L});function B(Y){const{transform:O}=i();V=ia(Y,H);const{handle:F,validHandleResult:oe}=h4(Y,h,Jv(V,O,!1,[1,1]),N,G,z=>u2(z,m,n,t,a?"target":"source",u,h));if(C=F,Q||(P(),Q=!0),X=oe.handleDomNode,J=oe.connection,M=oe.isValid,c({connectionPosition:C&&M?a2({x:C.x,y:C.y},O):V,connectionStatus:m4(!!C,M),connectionEndHandle:oe.endHandle}),!C&&!M&&!X)return ep($);J.source!==J.target&&X&&(ep($),$=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",M),X.classList.toggle("react-flow__handle-valid",M))}function W(Y){var O,F;(C||X)&&J&&M&&(s==null||s(J)),(F=(O=i()).onConnectEnd)==null||F.call(O,Y),f&&(p==null||p(Y)),ep($),j(),cancelAnimationFrame(E),Q=!1,M=!1,J=null,X=null,h.removeEventListener("mousemove",B),h.removeEventListener("mouseup",W),h.removeEventListener("touchmove",B),h.removeEventListener("touchend",W)}h.addEventListener("mousemove",B),h.addEventListener("mouseup",W),h.addEventListener("touchmove",B),h.addEventListener("touchend",W)}const Gk=()=>!0,g4=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),y4=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:c}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},h2=x.forwardRef(({type:e="source",position:t=Fe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var H,$;const N=c||null,_=e==="target",S=Ht(),b=i4(),{connectOnClick:j,noPanClassName:E}=wt(g4,Qt),{connecting:C,clickConnecting:T}=wt(y4(b,N,e),Qt);b||($=(H=S.getState()).onError)==null||$.call(H,"010",bs.error010());const R=V=>{const{defaultEdgeOptions:Q,onConnect:J,hasDefaultEdges:M}=S.getState(),X={...Q,...V};if(M){const{edges:G,setEdges:P}=S.getState();P(d4(X,G))}J==null||J(X),u==null||u(X)},I=V=>{if(!b)return;const Q=t2(V);a&&(Q&&V.button===0||!Q)&&d2({event:V,handleId:N,nodeId:b,onConnect:R,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Gk}),Q?h==null||h(V):m==null||m(V)},L=V=>{const{onClickConnectStart:Q,onClickConnectEnd:J,connectionClickStartHandle:M,connectionMode:X,isValidConnection:G}=S.getState();if(!b||!M&&!a)return;if(!M){Q==null||Q(V,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const P=ZT(V.target),B=n||G||Gk,{connection:W,isValid:Y}=u2({nodeId:b,id:N,type:e},X,M.nodeId,M.handleId||null,M.type,B,P);Y&&R(W),J==null||J(V),S.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${N}-${e}`,className:un(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:i,connecting:T,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:j?L:void 0,ref:w,...y},f)});h2.displayName="Handle";var fo=x.memo(h2);const f2=({data:e,isConnectable:t,targetPosition:n=Fe.Top,sourcePosition:s=Fe.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(fo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,fe.createElement(fo,{type:"source",position:s,isConnectable:t}));f2.displayName="DefaultNode";var ex=x.memo(f2);const p2=({data:e,isConnectable:t,sourcePosition:n=Fe.Bottom})=>fe.createElement(fe.Fragment,null,e==null?void 0:e.label,fe.createElement(fo,{type:"source",position:n,isConnectable:t}));p2.displayName="InputNode";var m2=x.memo(p2);const g2=({data:e,isConnectable:t,targetPosition:n=Fe.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(fo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);g2.displayName="OutputNode";var y2=x.memo(g2);const Px=()=>null;Px.displayName="GroupNode";const w4=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Xu=e=>e.id;function v4(e,t){return Qt(e.selectedNodes.map(Xu),t.selectedNodes.map(Xu))&&Qt(e.selectedEdges.map(Xu),t.selectedEdges.map(Xu))}const w2=x.memo(({onSelectionChange:e})=>{const t=Ht(),{selectedNodes:n,selectedEdges:s}=wt(w4,v4);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});w2.displayName="SelectionListener";const x4=e=>!!e.onSelectionChange;function b4({onSelectionChange:e}){const t=wt(x4);return e||t?fe.createElement(w2,{onSelectionChange:e}):null}const k4=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function wi(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function it(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const _4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:I,translateExtent:L,connectOnClick:H,defaultEdgeOptions:$,fitView:V,fitViewOptions:Q,onNodesDelete:J,onEdgesDelete:M,onNodeDrag:X,onNodeDragStart:G,onNodeDragStop:P,onSelectionDrag:B,onSelectionDragStart:W,onSelectionDragStop:Y,noPanClassName:O,nodeOrigin:F,rfId:oe,autoPanOnConnect:z,autoPanOnNodeDrag:Z,onError:U,connectionRadius:re,isValidConnection:de,nodeDragThreshold:pe})=>{const{setNodes:ge,setEdges:Te,setDefaultNodesAndEdges:Ue,setMinZoom:He,setMaxZoom:Pe,setTranslateExtent:Se,setNodeExtent:nt,reset:je}=wt(k4,Qt),be=Ht();return x.useEffect(()=>{const Ke=s==null?void 0:s.map(ct=>({...ct,...$}));return Ue(n,Ke),()=>{je()}},[]),it("defaultEdgeOptions",$,be.setState),it("connectionMode",T,be.setState),it("onConnect",a,be.setState),it("onConnectStart",i,be.setState),it("onConnectEnd",c,be.setState),it("onClickConnectStart",u,be.setState),it("onClickConnectEnd",f,be.setState),it("nodesDraggable",p,be.setState),it("nodesConnectable",h,be.setState),it("nodesFocusable",m,be.setState),it("edgesFocusable",y,be.setState),it("edgesUpdatable",w,be.setState),it("elementsSelectable",C,be.setState),it("elevateNodesOnSelect",N,be.setState),it("snapToGrid",I,be.setState),it("snapGrid",R,be.setState),it("onNodesChange",j,be.setState),it("onEdgesChange",E,be.setState),it("connectOnClick",H,be.setState),it("fitViewOnInit",V,be.setState),it("fitViewOnInitOptions",Q,be.setState),it("onNodesDelete",J,be.setState),it("onEdgesDelete",M,be.setState),it("onNodeDrag",X,be.setState),it("onNodeDragStart",G,be.setState),it("onNodeDragStop",P,be.setState),it("onSelectionDrag",B,be.setState),it("onSelectionDragStart",W,be.setState),it("onSelectionDragStop",Y,be.setState),it("noPanClassName",O,be.setState),it("nodeOrigin",F,be.setState),it("rfId",oe,be.setState),it("autoPanOnConnect",z,be.setState),it("autoPanOnNodeDrag",Z,be.setState),it("onError",U,be.setState),it("connectionRadius",re,be.setState),it("isValidConnection",de,be.setState),it("nodeDragThreshold",pe,be.setState),wi(e,ge),wi(t,Te),wi(_,He),wi(S,Pe),wi(L,Se),wi(b,nt),null},Vk={display:"none"},N4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},v2="react-flow__node-desc",x2="react-flow__edge-desc",S4="react-flow__aria-live",j4=e=>e.ariaLiveMessage;function E4({rfId:e}){const t=wt(j4);return fe.createElement("div",{id:`${S4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:N4},t)}function C4({rfId:e,disableKeyboardA11y:t}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${v2}-${e}`,style:Vk},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${x2}-${e}`,style:Vk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&fe.createElement(E4,{rfId:e}))}var pc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),i=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);i.current.add(w[_]),Yk(c,i.current,!1)&&(w.preventDefault(),s(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Xv(w))return!1;const _=Kk(w.code,u);Yk(c,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[_]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,s]),n};function Yk(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Kk(e,t){return t.includes(e)?"code":"key"}function b2(e,t,n,s){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),c=co(i,s);return b2(i,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=i[Lt])==null?void 0:u.z)??0)>(n.z??0)?((f=i[Lt])==null?void 0:f.z)??0:n.z??0},s)}function k2(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:c,y:u,z:f}=b2(s,e,{...s.position,z:((i=s[Lt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:c,y:u},s[Lt].z=f,n!=null&&n[s.id]&&(s[Lt].isParent=!0)}})}function tp(e,t,n,s){const a=new Map,i={},c=s?1e3:0;return e.forEach(u=>{var w;const f=(or(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(i[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Lt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Lt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),k2(a,n,i),a}function _2(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const N=n().filter(S=>{var j;const b=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?b&&t.nodes.some(E=>E.id===S.id):b}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Qd(N,m),{x:b,y:j,zoom:E}=l2(S,s,a,t.minZoom??i,t.maxZoom??c,t.padding??.1),C=vs.translate(b,j).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(ao(f,t.duration),C):u.transform(f,C),!0}}return!1}function T4(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Lt]:s[Lt],selected:n.selected})}),new Map(t)}function A4(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Zu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:T4(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:A4(t,i)}),u==null||u(t))}const vi=()=>{},R4={zoomIn:vi,zoomOut:vi,zoomTo:vi,getZoom:()=>1,setViewport:vi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:vi,fitBounds:vi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},M4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),I4=()=>{const e=Ht(),{d3Zoom:t,d3Selection:n}=wt(M4,Qt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ao(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ao(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ao(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[c,u,f]=e.getState().transform,p=vs.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(ao(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,c]=e.getState().transform;return{x:a,y:i,zoom:c}},fitView:a=>_2(e.getState,a),setCenter:(a,i,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-i*h,w=vs.translate(m,y).scale(h);t.transform(ao(n,c==null?void 0:c.duration),w)},fitBounds:(a,i)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=l2(a,c,u,f,p,(i==null?void 0:i.padding)??.1),w=vs.translate(h,m).scale(y);t.transform(ao(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Jv(a,i,c,u)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return Jv(m,i,c,u)},flowToScreenPosition:a=>{const{transform:i,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=a2(a,i);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:R4,[t,n])};function Sc(){const e=I4(),t=Ht(),n=x.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=x.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=x.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(S=>({...S}))},[]),i=x.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(b=>b.id===_)},[]),c=x.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof _=="function"?_(C):_;if(j)b(T);else if(E){const R=T.length===0?C.map(I=>({type:"remove",id:I.id})):T.map(I=>({item:I,type:"reset"}));E(R)}},[]),u=x.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(S):_;if(j)b(C);else if(E){const T=C.length===0?S.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...b(),...S];j(R)}else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...b,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=t.getState(),[j,E,C]=b;return{nodes:_().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:j,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:I,onNodesChange:L,onEdgesChange:H}=t.getState(),$=(_||[]).map(X=>X.id),V=(S||[]).map(X=>X.id),Q=j().reduce((X,G)=>{const P=G.parentNode||G.parentId,B=!$.includes(G.id)&&P&&X.find(Y=>Y.id===P);return(typeof G.deletable=="boolean"?G.deletable:!0)&&($.includes(G.id)||B)&&X.push(G),X},[]),J=E.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),M=J.filter(X=>V.includes(X.id));if(Q||M){const X=i2(Q,J),G=[...M,...X],P=G.reduce((B,W)=>(B.includes(W.id)||B.push(W.id),B),[]);if((T||C)&&(T&&t.setState({edges:E.filter(B=>!P.includes(B.id))}),C&&(Q.forEach(B=>{b.delete(B.id)}),t.setState({nodeInternals:new Map(b)}))),P.length>0&&(I==null||I(G),H&&H(P.map(B=>({id:B,type:"remove"})))),Q.length>0&&(R==null||R(Q),L)){const B=Q.map(W=>({id:W.id,type:"remove"}));L(B)}}},[]),y=x.useCallback(_=>{const S=J3(_),b=S?null:t.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:Fk(b),b,S]},[]),w=x.useCallback((_,S=!0,b)=>{const[j,E,C]=y(_);return j?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=Fk(T),I=Kv(R,j);return S&&I>0||I>=j.width*j.height}):[]},[]),N=x.useCallback((_,S,b=!0)=>{const[j]=y(_);if(!j)return!1;const E=Kv(j,S);return b&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,c,u,f,p,h,m,w,N])}const $4={actInsideInputWithModifier:!1};var O4=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Ht(),{deleteElements:s}=Sc(),a=pc(e,$4),i=pc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function P4(e){const t=Ht();x.useEffect(()=>{let n;const s=()=>{var i,c;if(!e.current)return;const a=Cx(e.current);(a.height===0||a.width===0)&&((c=(i=t.getState()).onError)==null||c.call(i,"004",bs.error004())),t.setState({width:a.width||500,height:a.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Lx={position:"absolute",width:"100%",height:"100%",top:0,left:0},L4=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Qu=e=>({x:e.x,y:e.y,zoom:e.k}),xi=(e,t)=>e.target.closest(`.${t}`),Xk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zk=e=>{const t=e.ctrlKey&&Td()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},D4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),q4=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=io.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Ht(),I=x.useRef(!1),L=x.useRef(!1),H=x.useRef(null),$=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:V,d3Selection:Q,d3ZoomHandler:J,userSelectionActive:M}=wt(D4,Qt),X=pc(S),G=x.useRef(0),P=x.useRef(!1),B=x.useRef();return P4(H),x.useEffect(()=>{if(H.current){const W=H.current.getBoundingClientRect(),Y=YT().scaleExtent([N,_]).translateExtent(w),O=ar(H.current).call(Y),F=vs.translate(y.x,y.y).scale(Di(y.zoom,N,_)),oe=[[0,0],[W.width,W.height]],z=Y.constrain()(F,oe,w);Y.transform(O,z),Y.wheelDelta(Zk),R.setState({d3Zoom:Y,d3Selection:O,d3ZoomHandler:O.on("wheel.zoom"),transform:[z.x,z.y,z.k],domNode:H.current.closest(".react-flow")})}},[]),x.useEffect(()=>{Q&&V&&(c&&!X&&!M?Q.on("wheel.zoom",W=>{if(xi(W,E))return!1;W.preventDefault(),W.stopImmediatePropagation();const Y=Q.property("__zoom").k||1;if(W.ctrlKey&&i){const de=jr(W),pe=Zk(W),ge=Y*Math.pow(2,pe);V.scaleTo(Q,ge,de,W);return}const O=W.deltaMode===1?20:1;let F=f===io.Vertical?0:W.deltaX*O,oe=f===io.Horizontal?0:W.deltaY*O;!Td()&&W.shiftKey&&f!==io.Vertical&&(F=W.deltaY*O,oe=0),V.translateBy(Q,-(F/Y)*u,-(oe/Y)*u,{internal:!0});const z=Qu(Q.property("__zoom")),{onViewportChangeStart:Z,onViewportChange:U,onViewportChangeEnd:re}=R.getState();clearTimeout(B.current),P.current||(P.current=!0,t==null||t(W,z),Z==null||Z(z)),P.current&&(e==null||e(W,z),U==null||U(z),B.current=setTimeout(()=>{n==null||n(W,z),re==null||re(z),P.current=!1},150))},{passive:!1}):typeof J<"u"&&Q.on("wheel.zoom",function(W,Y){if(!b&&W.type==="wheel"&&!W.ctrlKey||xi(W,E))return null;W.preventDefault(),J.call(this,W,Y)},{passive:!1}))},[M,c,f,Q,V,J,X,i,b,E,t,e,n]),x.useEffect(()=>{V&&V.on("start",W=>{var F,oe;if(!W.sourceEvent||W.sourceEvent.internal)return null;G.current=(F=W.sourceEvent)==null?void 0:F.button;const{onViewportChangeStart:Y}=R.getState(),O=Qu(W.transform);I.current=!0,$.current=O,((oe=W.sourceEvent)==null?void 0:oe.type)==="mousedown"&&R.setState({paneDragging:!0}),Y==null||Y(O),t==null||t(W.sourceEvent,O)})},[V,t]),x.useEffect(()=>{V&&(M&&!I.current?V.on("zoom",null):M||V.on("zoom",W=>{var O;const{onViewportChange:Y}=R.getState();if(R.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),L.current=!!(s&&Xk(m,G.current??0)),(e||Y)&&!((O=W.sourceEvent)!=null&&O.internal)){const F=Qu(W.transform);Y==null||Y(F),e==null||e(W.sourceEvent,F)}}))},[M,V,e,m,s]),x.useEffect(()=>{V&&V.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:Y}=R.getState();if(I.current=!1,R.setState({paneDragging:!1}),s&&Xk(m,G.current??0)&&!L.current&&s(W.sourceEvent),L.current=!1,(n||Y)&&L4($.current,W.transform)){const O=Qu(W.transform);$.current=O,clearTimeout(T.current),T.current=setTimeout(()=>{Y==null||Y(O),n==null||n(W.sourceEvent,O)},c?150:0)}})},[V,c,m,n,s]),x.useEffect(()=>{V&&V.filter(W=>{const Y=X||a,O=i&&W.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&W.button===1&&W.type==="mousedown"&&(xi(W,"react-flow__node")||xi(W,"react-flow__edge")))return!0;if(!m&&!Y&&!c&&!p&&!i||M||!p&&W.type==="dblclick"||xi(W,E)&&W.type==="wheel"||xi(W,C)&&(W.type!=="wheel"||c&&W.type==="wheel"&&!X)||!i&&W.ctrlKey&&W.type==="wheel"||!Y&&!c&&!O&&W.type==="wheel"||!m&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(m)&&!m.includes(W.button)&&W.type==="mousedown")return!1;const F=Array.isArray(m)&&m.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&F})},[M,V,a,i,c,p,m,h,X]),fe.createElement("div",{className:"react-flow__renderer",ref:H,style:Lx},j)},F4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function B4(){const{userSelectionActive:e,userSelectionRect:t}=wt(F4,Qt);return e&&t?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Qk(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const c=Math.abs(t.position.x);s.position.x=s.position.x-c,s.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);s.position.y=s.position.y-c,s.style.height+=c,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function z4(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(u=>u.id===a.id);if(i.length===0)return s.push(a),s;const c={...a};for(const u of i)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&Qk(s,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&Qk(s,c);break}case"remove":return s}return s.push(c),s},n)}function U4(e,t){return z4(e,t)}const ra=(e,t)=>({id:e,type:"select",selected:t});function Ei(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(ra(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(ra(s.id,!1))),n},[])}const np=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},W4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),N2=x.memo(({isSelecting:e,selectionMode:t=fc.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Ht(),N=x.useRef(0),_=x.useRef(0),S=x.useRef(),{userSelectionActive:b,elementsSelectable:j,dragging:E}=wt(W4,Qt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=J=>{i==null||i(J),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=J=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){J.preventDefault();return}c==null||c(J)},I=u?J=>u(J):void 0,L=J=>{const{resetSelectedElements:M,domNode:X}=w.getState();if(S.current=X==null?void 0:X.getBoundingClientRect(),!j||!e||J.button!==0||J.target!==y.current||!S.current)return;const{x:G,y:P}=ia(J,S.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:G,startY:P,x:G,y:P}}),s==null||s(J)},H=J=>{const{userSelectionRect:M,nodeInternals:X,edges:G,transform:P,onNodesChange:B,onEdgesChange:W,nodeOrigin:Y,getNodes:O}=w.getState();if(!e||!S.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const F=ia(J,S.current),oe=M.startX??0,z=M.startY??0,Z={...M,x:F.x<oe?F.x:oe,y:F.y<z?F.y:z,width:Math.abs(F.x-oe),height:Math.abs(F.y-z)},U=O(),re=o2(X,Z,P,t===fc.Partial,!0,Y),de=i2(re,G).map(ge=>ge.id),pe=re.map(ge=>ge.id);if(N.current!==pe.length){N.current=pe.length;const ge=Ei(U,pe);ge.length&&(B==null||B(ge))}if(_.current!==de.length){_.current=de.length;const ge=Ei(G,de);ge.length&&(W==null||W(ge))}w.setState({userSelectionRect:Z})},$=J=>{if(J.button!==0)return;const{userSelectionRect:M}=w.getState();!b&&M&&J.target===y.current&&(T==null||T(J)),w.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(J)},V=J=>{b&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(J)),C()},Q=j&&(e||b);return fe.createElement("div",{className:un(["react-flow__pane",{dragging:E,selection:e}]),onClick:Q?void 0:np(T,y),onContextMenu:np(R,y),onWheel:np(I,y),onMouseEnter:Q?void 0:f,onMouseDown:Q?L:void 0,onMouseMove:Q?H:p,onMouseUp:Q?$:void 0,onMouseLeave:Q?V:h,ref:y,style:Lx},m,fe.createElement(B4,null))});N2.displayName="Pane";function S2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:S2(s,t):!1}function Jk(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function H4(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!S2(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function G4(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function j2(e,t,n,s,a=[0,0],i){const c=G4(e,e.extent||s);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=co(m,a).positionAbsolute;u=m&&or(y)&&or(w)&&or(m.width)&&or(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else i==null||i("005",bs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=co(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=co(m,a).positionAbsolute}const h=u&&u!=="parent"?Tx(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function rp({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?s.find(a=>a.id===e):s[0],s]}const e1=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...Cx(f)}})};function Gl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function tx({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",bs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function V4(){const e=Ht();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function sp(e){return(t,n,s)=>e==null?void 0:e(t,s)}function E2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:c}){const u=Ht(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),S=x.useRef(!1),b=x.useRef(!1),j=x.useRef(!1),E=V4();return x.useEffect(()=>{if(e!=null&&e.current){const C=ar(e.current),T=({x:L,y:H})=>{const{nodeInternals:$,onNodeDrag:V,onSelectionDrag:Q,updateNodePositions:J,nodeExtent:M,snapGrid:X,snapToGrid:G,nodeOrigin:P,onError:B}=u.getState();m.current={x:L,y:H};let W=!1,Y={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const F=Qd(h.current,P);Y=hc(F)}if(h.current=h.current.map(F=>{const oe={x:L-F.distance.x,y:H-F.distance.y};G&&(oe.x=X[0]*Math.round(oe.x/X[0]),oe.y=X[1]*Math.round(oe.y/X[1]));const z=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!F.extent&&(z[0][0]=F.positionAbsolute.x-Y.x+M[0][0],z[1][0]=F.positionAbsolute.x+(F.width??0)-Y.x2+M[1][0],z[0][1]=F.positionAbsolute.y-Y.y+M[0][1],z[1][1]=F.positionAbsolute.y+(F.height??0)-Y.y2+M[1][1]);const Z=j2(F,oe,$,z,P,B);return W=W||F.position.x!==Z.position.x||F.position.y!==Z.position.y,F.position=Z.position,F.positionAbsolute=Z.positionAbsolute,F}),!W)return;J(h.current,!0,!0),p(!0);const O=a?V:sp(Q);if(O&&_.current){const[F,oe]=rp({nodeId:a,dragItems:h.current,nodeInternals:$});O(_.current,F,oe)}},R=()=>{if(!w.current)return;const[L,H]=XT(N.current,w.current);if(L!==0||H!==0){const{transform:$,panBy:V}=u.getState();m.current.x=(m.current.x??0)-L/$[2],m.current.y=(m.current.y??0)-H/$[2],V({x:L,y:H})&&T(m.current)}y.current=requestAnimationFrame(R)},I=L=>{var P;const{nodeInternals:H,multiSelectionActive:$,nodesDraggable:V,unselectNodesAndEdges:Q,onNodeDragStart:J,onSelectionDragStart:M}=u.getState();b.current=!0;const X=a?J:sp(M);(!c||!i)&&!$&&a&&((P=H.get(a))!=null&&P.selected||Q()),a&&i&&c&&tx({id:a,store:u,nodeRef:e});const G=E(L);if(m.current=G,h.current=H4(H,V,G,a),X&&h.current){const[B,W]=rp({nodeId:a,dragItems:h.current,nodeInternals:H});X(L.sourceEvent,B,W)}};if(t)C.on(".drag",null);else{const L=rO().on("start",H=>{const{domNode:$,nodeDragThreshold:V}=u.getState();V===0&&I(H),j.current=!1;const Q=E(H);m.current=Q,w.current=($==null?void 0:$.getBoundingClientRect())||null,N.current=ia(H.sourceEvent,w.current)}).on("drag",H=>{var J,M;const $=E(H),{autoPanOnNodeDrag:V,nodeDragThreshold:Q}=u.getState();if(H.sourceEvent.type==="touchmove"&&H.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&b.current&&V&&(S.current=!0,R()),!b.current){const X=$.xSnapped-(((J=m==null?void 0:m.current)==null?void 0:J.x)??0),G=$.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(X*X+G*G)>Q&&I(H)}(m.current.x!==$.xSnapped||m.current.y!==$.ySnapped)&&h.current&&b.current&&(_.current=H.sourceEvent,N.current=ia(H.sourceEvent,w.current),T($))}}).on("end",H=>{if(!(!b.current||j.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:$,nodeInternals:V,onNodeDragStop:Q,onSelectionDragStop:J}=u.getState(),M=a?Q:sp(J);if($(h.current,!1,!1),M){const[X,G]=rp({nodeId:a,dragItems:h.current,nodeInternals:V});M(H.sourceEvent,X,G)}}}).filter(H=>{const $=H.target;return!H.button&&(!n||!Jk($,`.${n}`,e))&&(!s||Jk($,s,e))});return C.call(L),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,u,a,c,E]),f}function C2(){const e=Ht();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,S=n.y*w*N,b=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+_,y:j.positionAbsolute.y+S};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=j2(j,E,s,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});i(b,!0,!1)},[])}const Ii={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Vl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:S,className:b,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:I,targetPosition:L,hidden:H,resizeObserver:$,dragHandle:V,zIndex:Q,isParent:J,noDragClassName:M,noPanClassName:X,initialized:G,disableKeyboardA11y:P,ariaLabel:B,rfId:W,hasHandleBounds:Y})=>{const O=Ht(),F=x.useRef(null),oe=x.useRef(null),z=x.useRef(I),Z=x.useRef(L),U=x.useRef(s),re=E||j||h||m||y||w,de=C2(),pe=Gl(n,O.getState,m),ge=Gl(n,O.getState,y),Te=Gl(n,O.getState,w),Ue=Gl(n,O.getState,N),He=Gl(n,O.getState,_),Pe=je=>{const{nodeDragThreshold:be}=O.getState();if(E&&(!R||!j||be>0)&&tx({id:n,store:O,nodeRef:F}),h){const Ke=O.getState().nodeInternals.get(n);Ke&&h(je,{...Ke})}},Se=je=>{if(!Xv(je)&&!P)if(e2.includes(je.key)&&E){const be=je.key==="Escape";tx({id:n,store:O,unselect:be,nodeRef:F})}else j&&p&&Object.prototype.hasOwnProperty.call(Ii,je.key)&&(O.setState({ariaLiveMessage:`Moved selected node ${je.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~c}`}),de({x:Ii[je.key].x,y:Ii[je.key].y,isShiftPressed:je.shiftKey}))};x.useEffect(()=>()=>{oe.current&&($==null||$.unobserve(oe.current),oe.current=null)},[]),x.useEffect(()=>{if(F.current&&!H){const je=F.current;(!G||!Y||oe.current!==je)&&(oe.current&&($==null||$.unobserve(oe.current)),$==null||$.observe(je),oe.current=je)}},[H,G,Y]),x.useEffect(()=>{const je=U.current!==s,be=z.current!==I,Ke=Z.current!==L;F.current&&(je||be||Ke)&&(je&&(U.current=s),be&&(z.current=I),Ke&&(Z.current=L),O.getState().updateNodeDimensions([{id:n,nodeElement:F.current,forceUpdate:!0}]))},[n,s,I,L]);const nt=E2({nodeRef:F,disabled:H||!j,noDragClassName:M,handleSelector:V,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return H?null:fe.createElement("div",{className:un(["react-flow__node",`react-flow__node-${s}`,{[X]:j},b,{selected:p,selectable:E,parent:J,dragging:nt}]),ref:F,style:{zIndex:Q,transform:`translate(${u}px,${f}px)`,pointerEvents:re?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:ge,onMouseLeave:Te,onContextMenu:Ue,onClick:Pe,onDoubleClick:He,onKeyDown:T?Se:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":P?void 0:`${v2}-${W}`,"aria-label":B},fe.createElement(o4,{value:n},fe.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:c,selected:p,isConnectable:C,sourcePosition:I,targetPosition:L,dragging:nt,dragHandle:V,zIndex:Q})))};return t.displayName="NodeWrapper",x.memo(t)};const Y4=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Qd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function K4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Ht(),{width:a,height:i,x:c,y:u,transformString:f,userSelectionActive:p}=wt(Y4,Qt),h=C2(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),E2({nodeRef:m}),p||!a||!i)return null;const y=e?N=>{const _=s.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ii,N.key)&&h({x:Ii[N.key].x,y:Ii[N.key].y,isShiftPressed:N.shiftKey})};return fe.createElement("div",{className:un(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},fe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:u,left:c}}))}var X4=x.memo(K4);const Z4=e=>e.nodesSelectionActive,T2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:H,panOnDrag:$,defaultViewport:V,translateExtent:Q,minZoom:J,maxZoom:M,preventScrolling:X,onSelectionContextMenu:G,noWheelClassName:P,noPanClassName:B,disableKeyboardA11y:W})=>{const Y=wt(Z4),O=pc(m),F=pc(b),oe=F||$,z=F||R,Z=O||y&&oe!==!0;return O4({deleteKeyCode:u,multiSelectionKeyCode:S}),fe.createElement(q4,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:z,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:H,panOnDrag:!O&&oe,defaultViewport:V,translateExtent:Q,minZoom:J,maxZoom:M,zoomActivationKeyCode:j,preventScrolling:X,noWheelClassName:P,noPanClassName:B},fe.createElement(N2,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:c,panOnDrag:oe,isSelecting:!!Z,selectionMode:w},e,Y&&fe.createElement(X4,{onSelectionContextMenu:G,noPanClassName:B,disableKeyboardA11y:W})))};T2.displayName="FlowRenderer";var Q4=x.memo(T2);function J4(e){return wt(x.useCallback(n=>e?o2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function eP(e){const t={input:Vl(e.input||m2),default:Vl(e.default||ex),output:Vl(e.output||y2),group:Vl(e.group||Px)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=Vl(e[i]||ex),a),n);return{...t,...s}}const tP=({x:e,y:t,width:n,height:s,origin:a})=>!n||!s?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-s*a[1]},nP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),A2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:c}=wt(nP,Qt),u=J4(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:Lx},u.map(h=>{var T,R,I;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",bs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),_=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||s&&typeof h.focusable>"u"),b=e.nodeExtent?Tx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,j=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=tP({x:j,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return fe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Fe.Bottom,targetPosition:h.targetPosition||Fe.Top,hidden:h.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Lt])==null?void 0:T.z)??0,isParent:!!((R=h[Lt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[Lt])!=null&&I.handleBounds)})}))};A2.displayName="NodeRenderer";var rP=x.memo(A2);const sP=(e,t,n)=>n===Fe.Left?e-t:n===Fe.Right?e+t:e,aP=(e,t,n)=>n===Fe.Top?e-t:n===Fe.Bottom?e+t:e,t1="react-flow__edgeupdater",n1=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:c,type:u})=>fe.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:c,className:un([t1,`${t1}-${u}`]),cx:sP(t,s,e),cy:aP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),oP=()=>!0;var bi=e=>{const t=({id:n,className:s,type:a,data:i,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:b,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:L,elementsSelectable:H,hidden:$,sourceHandleId:V,targetHandleId:Q,onContextMenu:J,onMouseEnter:M,onMouseMove:X,onMouseLeave:G,reconnectRadius:P,onReconnect:B,onReconnectStart:W,onReconnectEnd:Y,markerEnd:O,markerStart:F,rfId:oe,ariaLabel:z,isFocusable:Z,isReconnectable:U,pathOptions:re,interactionWidth:de,disableKeyboardA11y:pe})=>{const ge=x.useRef(null),[Te,Ue]=x.useState(!1),[He,Pe]=x.useState(!1),Se=Ht(),nt=x.useMemo(()=>`url('#${Qv(F,oe)}')`,[F,oe]),je=x.useMemo(()=>`url('#${Qv(O,oe)}')`,[O,oe]);if($)return null;const be=et=>{var st;const{edges:pt,addSelectedEdges:tt,unselectNodesAndEdges:rt,multiSelectionActive:lt}=Se.getState(),bt=pt.find(mt=>mt.id===n);bt&&(H&&(Se.setState({nodesSelectionActive:!1}),bt.selected&<?(rt({nodes:[],edges:[bt]}),(st=ge.current)==null||st.blur()):tt([n])),c&&c(et,bt))},Ke=Hl(n,Se.getState,u),ct=Hl(n,Se.getState,J),Ye=Hl(n,Se.getState,M),ce=Hl(n,Se.getState,X),ke=Hl(n,Se.getState,G),Ee=(et,pt)=>{if(et.button!==0)return;const{edges:tt,isValidConnection:rt}=Se.getState(),lt=pt?j:b,bt=(pt?Q:V)||null,st=pt?"target":"source",mt=rt||oP,ze=pt,Dt=tt.find(kt=>kt.id===n);Pe(!0),W==null||W(et,Dt,st);const me=kt=>{Pe(!1),Y==null||Y(kt,Dt,st)};d2({event:et,handleId:bt,nodeId:lt,onConnect:kt=>B==null?void 0:B(Dt,kt),isTarget:ze,getState:Se.getState,setState:Se.setState,isValidConnection:mt,edgeUpdaterType:st,onReconnectEnd:me})},Ze=et=>Ee(et,!0),Xe=et=>Ee(et,!1),ut=()=>Ue(!0),ee=()=>Ue(!1),Ne=!H&&!c,Be=et=>{var pt;if(!pe&&e2.includes(et.key)&&H){const{unselectNodesAndEdges:tt,addSelectedEdges:rt,edges:lt}=Se.getState();et.key==="Escape"?((pt=ge.current)==null||pt.blur(),tt({edges:[lt.find(st=>st.id===n)]})):rt([n])}};return fe.createElement("g",{className:un(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:Ne,updating:Te}]),onClick:be,onDoubleClick:Ke,onContextMenu:ct,onMouseEnter:Ye,onMouseMove:ce,onMouseLeave:ke,onKeyDown:Z?Be:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":z===null?void 0:z||`Edge from ${b} to ${j}`,"aria-describedby":Z?`${x2}-${oe}`:void 0,ref:ge},!He&&fe.createElement(e,{id:n,source:b,target:j,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:i,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:I,targetPosition:L,sourceHandleId:V,targetHandleId:Q,markerStart:nt,markerEnd:je,pathOptions:re,interactionWidth:de}),U&&fe.createElement(fe.Fragment,null,(U==="source"||U===!0)&&fe.createElement(n1,{position:I,centerX:E,centerY:C,radius:P,onMouseDown:Ze,onMouseEnter:ut,onMouseOut:ee,type:"source"}),(U==="target"||U===!0)&&fe.createElement(n1,{position:L,centerX:T,centerY:R,radius:P,onMouseDown:Xe,onMouseEnter:ut,onMouseOut:ee,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function iP(e){const t={default:bi(e.default||Rd),straight:bi(e.bezier||Mx),step:bi(e.step||Rx),smoothstep:bi(e.step||Zd),simplebezier:bi(e.simplebezier||Ax)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=bi(e[i]||Rd),a),n);return{...t,...s}}function r1(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case Fe.Top:return{x:s+i/2,y:a};case Fe.Right:return{x:s+i,y:a+c/2};case Fe.Bottom:return{x:s+i/2,y:a+c};case Fe.Left:return{x:s,y:a+c/2}}}function s1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const lP=(e,t,n,s,a,i)=>{const c=r1(n,e,t),u=r1(i,s,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function cP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=hc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function a1(e){var s,a,i,c,u;const t=((s=e==null?void 0:e[Lt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const uP=[{level:0,isMaxLevel:!0,edges:[]}];function dP(e,t,n=!1){let s=-1;const a=e.reduce((c,u)=>{var h,m;const f=or(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((h=w==null?void 0:w[Lt])==null?void 0:h.z)||0,((m=y==null?void 0:y[Lt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(N?_:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),i=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return i.length===0?uP:i}function hP(e,t,n){const s=wt(x.useCallback(a=>e?a.edges.filter(i=>{const c=t.get(i.source),u=t.get(i.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&cP({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return dP(s,t,n)}const fP=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),pP=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),o1={[Ad.Arrow]:fP,[Ad.ArrowClosed]:pP};function mP(e){const t=Ht();return x.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(o1,e)?o1[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",bs.error009(e)),null)},[e])}const gP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=mP(t);return f?fe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},fe.createElement(f,{color:n,strokeWidth:c})):null},yP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Qv(c,t);s.includes(u)||(a.push({id:u,color:c.color||e,...c}),s.push(u))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},R2=({defaultColor:e,rfId:t})=>{const n=wt(x.useCallback(yP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,c)=>i.id!==a[c].id)));return fe.createElement("defs",null,n.map(s=>fe.createElement(gP,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};R2.displayName="MarkerDefinitions";var wP=x.memo(R2);const vP=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),M2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:I,nodeInternals:L,onError:H}=wt(vP,Qt),$=hP(t,L,n);return T?fe.createElement(fe.Fragment,null,$.map(({level:V,edges:Q,isMaxLevel:J})=>fe.createElement("svg",{key:V,style:{zIndex:V},width:T,height:R,className:"react-flow__edges react-flow__container"},J&&fe.createElement(wP,{defaultColor:e,rfId:s}),fe.createElement("g",null,Q.map(M=>{const[X,G,P]=a1(L.get(M.source)),[B,W,Y]=a1(L.get(M.target));if(!P||!Y)return null;let O=M.type||"default";a[O]||(H==null||H("011",bs.error011(O)),O="default");const F=a[O]||a.default,oe=I===ho.Strict?W.target:(W.target??[]).concat(W.source??[]),z=s1(G.source,M.sourceHandle),Z=s1(oe,M.targetHandle),U=(z==null?void 0:z.position)||Fe.Bottom,re=(Z==null?void 0:Z.position)||Fe.Top,de=!!(M.focusable||j&&typeof M.focusable>"u"),pe=M.reconnectable||M.updatable,ge=typeof y<"u"&&(pe||E&&typeof pe>"u");if(!z||!Z)return H==null||H("008",bs.error008(z,M)),null;const{sourceX:Te,sourceY:Ue,targetX:He,targetY:Pe}=lP(X,z,U,B,Z,re);return fe.createElement(F,{key:M.id,id:M.id,className:un([M.className,i]),type:O,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Te,sourceY:Ue,targetX:He,targetY:Pe,sourcePosition:U,targetPosition:re,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:M.ariaLabel,isFocusable:de,isReconnectable:ge,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),S):null};M2.displayName="EdgeRenderer";var xP=x.memo(M2);const bP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function kP({children:e}){const t=wt(bP);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function _P(e){const t=Sc(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const NP={[Fe.Left]:Fe.Right,[Fe.Right]:Fe.Left,[Fe.Top]:Fe.Bottom,[Fe.Bottom]:Fe.Top},I2=({nodeId:e,handleType:t,style:n,type:s=sa.Bezier,CustomComponent:a,connectionStatus:i})=>{var R,I,L;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=wt(x.useCallback(H=>({fromNode:H.nodeInternals.get(e),handleId:H.connectionHandleId,toX:(H.connectionPosition.x-H.transform[0])/H.transform[2],toY:(H.connectionPosition.y-H.transform[1])/H.transform[2],connectionMode:H.connectionMode}),[e]),Qt),m=(R=c==null?void 0:c[Lt])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===ho.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(H=>H.id===u):y[0],N=w?w.x+w.width/2:(c.width??0)/2,_=w?w.y+w.height/2:c.height??0,S=(((I=c.positionAbsolute)==null?void 0:I.x)??0)+N,b=(((L=c.positionAbsolute)==null?void 0:L.y)??0)+_,j=w==null?void 0:w.position,E=j?NP[j]:null;if(!j||!E)return null;if(a)return fe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:S,fromY:b,toX:f,toY:p,fromPosition:j,toPosition:E,connectionStatus:i});let C="";const T={sourceX:S,sourceY:b,sourcePosition:j,targetX:f,targetY:p,targetPosition:E};return s===sa.Bezier?[C]=Ix(T):s===sa.Step?[C]=Zv({...T,borderRadius:0}):s===sa.SmoothStep?[C]=Zv(T):s===sa.SimpleBezier?[C]=s2(T):C=`M${S},${b} ${f},${p}`,fe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};I2.displayName="ConnectionLine";const SP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function jP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:c,width:u,height:f,connectionStatus:p}=wt(SP,Qt);return!(a&&i&&u&&c)?null:fe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:un(["react-flow__connection",p])},fe.createElement(I2,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function i1(e,t){return x.useRef(null),Ht(),x.useMemo(()=>t(e),[e])}const $2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,multiSelectionKeyCode:L,panActivationKeyCode:H,zoomActivationKeyCode:$,deleteKeyCode:V,onlyRenderVisibleElements:Q,elementsSelectable:J,selectNodesOnDrag:M,defaultViewport:X,translateExtent:G,minZoom:P,maxZoom:B,preventScrolling:W,defaultMarkerColor:Y,zoomOnScroll:O,zoomOnPinch:F,panOnScroll:oe,panOnScrollSpeed:z,panOnScrollMode:Z,zoomOnDoubleClick:U,panOnDrag:re,onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Te,onPaneScroll:Ue,onPaneContextMenu:He,onEdgeContextMenu:Pe,onEdgeMouseEnter:Se,onEdgeMouseMove:nt,onEdgeMouseLeave:je,onReconnect:be,onReconnectStart:Ke,onReconnectEnd:ct,reconnectRadius:Ye,noDragClassName:ce,noWheelClassName:ke,noPanClassName:Ee,elevateEdgesOnSelect:Ze,disableKeyboardA11y:Xe,nodeOrigin:ut,nodeExtent:ee,rfId:Ne})=>{const Be=i1(e,eP),et=i1(t,iP);return _P(i),fe.createElement(Q4,{onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Te,onPaneContextMenu:He,onPaneScroll:Ue,deleteKeyCode:V,selectionKeyCode:T,selectionOnDrag:R,selectionMode:I,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:L,panActivationKeyCode:H,zoomActivationKeyCode:$,elementsSelectable:J,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:O,zoomOnPinch:F,zoomOnDoubleClick:U,panOnScroll:oe,panOnScrollSpeed:z,panOnScrollMode:Z,panOnDrag:re,defaultViewport:X,translateExtent:G,minZoom:P,maxZoom:B,onSelectionContextMenu:N,preventScrolling:W,noDragClassName:ce,noWheelClassName:ke,noPanClassName:Ee,disableKeyboardA11y:Xe},fe.createElement(kP,null,fe.createElement(xP,{edgeTypes:et,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Q,onEdgeContextMenu:Pe,onEdgeMouseEnter:Se,onEdgeMouseMove:nt,onEdgeMouseLeave:je,onReconnect:be,onReconnectStart:Ke,onReconnectEnd:ct,reconnectRadius:Ye,defaultMarkerColor:Y,noPanClassName:Ee,elevateEdgesOnSelect:!!Ze,disableKeyboardA11y:Xe,rfId:Ne},fe.createElement(jP,{style:j,type:b,component:E,containerStyle:C})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(rP,{nodeTypes:Be,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:Q,noPanClassName:Ee,noDragClassName:ce,disableKeyboardA11y:Xe,nodeOrigin:ut,nodeExtent:ee,rfId:Ne})))};$2.displayName="GraphView";var EP=x.memo($2);const nx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Js={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:nx,nodeExtent:nx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ho.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:e4,isValidConnection:void 0},CP=()=>mI((e,t)=>({...Js,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:tp(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",c=a?tp(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((_,S)=>{const b=a.get(S.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[Lt]:{...b[Lt],handleBounds:void 0}});else if(b){const j=Cx(S.nodeElement);!!(j.width&&j.height&&(b.width!==j.width||b.height!==j.height||S.forceUpdate))&&(a.set(b.id,{...b,[Lt]:{...b[Lt],handleBounds:{source:e1(".source",S.nodeElement,y,p),target:e1(".target",S.nodeElement,y,p)}},...j}),_.push({id:b.id,type:"dimensions",dimensions:j}))}return _},[]);k2(a,p);const N=c||i&&!c&&_2(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});i(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=U4(n,u()),h=tp(p,a,c,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>ra(f,!0)):(c=Ei(i(),n),u=Ei(a,[])),Zu({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let c,u=null;s?c=n.map(f=>ra(f,!0)):(c=Ei(a,n),u=Ei(i(),[])),Zu({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),c=n||i(),u=s||a,f=c.map(h=>(h.selected=!1,ra(h.id,!1))),p=u.map(h=>ra(h.id,!1));Zu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(u=>u.selected).map(u=>ra(u.id,!1)),c=n.filter(u=>u.selected).map(u=>ra(u.id,!1));Zu({changedNodes:i,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Tx(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=vs.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Js.connectionNodeId,connectionHandleId:Js.connectionHandleId,connectionHandleType:Js.connectionHandleType,connectionStatus:Js.connectionStatus,connectionStartHandle:Js.connectionStartHandle,connectionEndHandle:Js.connectionEndHandle}),reset:()=>e({...Js})}),Object.is),Dx=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=CP()),fe.createElement(V3,{value:t.current},e)};Dx.displayName="ReactFlowProvider";const O2=({children:e})=>x.useContext(Xd)?fe.createElement(fe.Fragment,null,e):fe.createElement(Dx,null,e);O2.displayName="ReactFlowWrapper";const TP={input:m2,default:ex,output:y2,group:Px},AP={default:Rd,straight:Mx,step:Rx,smoothstep:Zd,simplebezier:Ax},RP=[0,0],MP=[15,15],IP={x:0,y:0,zoom:1},$P={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},P2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=TP,edgeTypes:c=AP,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:I,onNodeDrag:L,onNodeDragStop:H,onNodesDelete:$,onEdgesDelete:V,onSelectionChange:Q,onSelectionDragStart:J,onSelectionDrag:M,onSelectionDragStop:X,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:B,connectionMode:W=ho.Strict,connectionLineType:Y=sa.Bezier,connectionLineStyle:O,connectionLineComponent:F,connectionLineContainerStyle:oe,deleteKeyCode:z="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:U=!1,selectionMode:re=fc.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:pe=Td()?"Meta":"Control",zoomActivationKeyCode:ge=Td()?"Meta":"Control",snapToGrid:Te=!1,snapGrid:Ue=MP,onlyRenderVisibleElements:He=!1,selectNodesOnDrag:Pe=!0,nodesDraggable:Se,nodesConnectable:nt,nodesFocusable:je,nodeOrigin:be=RP,edgesFocusable:Ke,edgesUpdatable:ct,elementsSelectable:Ye,defaultViewport:ce=IP,minZoom:ke=.5,maxZoom:Ee=2,translateExtent:Ze=nx,preventScrolling:Xe=!0,nodeExtent:ut,defaultMarkerColor:ee="#b1b1b7",zoomOnScroll:Ne=!0,zoomOnPinch:Be=!0,panOnScroll:et=!1,panOnScrollSpeed:pt=.5,panOnScrollMode:tt=io.Free,zoomOnDoubleClick:rt=!0,panOnDrag:lt=!0,onPaneClick:bt,onPaneMouseEnter:st,onPaneMouseMove:mt,onPaneMouseLeave:ze,onPaneScroll:Dt,onPaneContextMenu:me,children:gt,onEdgeContextMenu:kt,onEdgeDoubleClick:jn,onEdgeMouseEnter:En,onEdgeMouseMove:Yn,onEdgeMouseLeave:qt,onEdgeUpdate:Ft,onEdgeUpdateStart:Kn,onEdgeUpdateEnd:te,onReconnect:Ae,onReconnectStart:Ie,onReconnectEnd:Me,reconnectRadius:De=10,edgeUpdaterRadius:dt=10,onNodesChange:Tt,onEdgesChange:vt,noDragClassName:Qr="nodrag",noWheelClassName:_t="nowheel",noPanClassName:Jt="nopan",fitView:rn=!1,fitViewOptions:Pr,connectOnClick:No=!0,attributionPosition:Zi,proOptions:ha,defaultEdgeOptions:fa,elevateNodesOnSelect:pa=!0,elevateEdgesOnSelect:Ns=!1,disableKeyboardA11y:ma=!1,autoPanOnConnect:ga=!0,autoPanOnNodeDrag:jt=!0,connectionRadius:Qi=20,isValidConnection:Ss,onError:So,style:Lr,id:ya,nodeDragThreshold:jo,...dr},vn)=>{const Dr=ya||"1";return fe.createElement("div",{...dr,style:{...Lr,...$P},ref:vn,className:un(["react-flow",a]),"data-testid":"rf__wrapper",id:ya},fe.createElement(O2,null,fe.createElement(EP,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:c,connectionLineType:Y,connectionLineStyle:O,connectionLineComponent:F,connectionLineContainerStyle:oe,selectionKeyCode:Z,selectionOnDrag:U,selectionMode:re,deleteKeyCode:z,multiSelectionKeyCode:pe,panActivationKeyCode:de,zoomActivationKeyCode:ge,onlyRenderVisibleElements:He,selectNodesOnDrag:Pe,defaultViewport:ce,translateExtent:Ze,minZoom:ke,maxZoom:Ee,preventScrolling:Xe,zoomOnScroll:Ne,zoomOnPinch:Be,zoomOnDoubleClick:rt,panOnScroll:et,panOnScrollSpeed:pt,panOnScrollMode:tt,panOnDrag:lt,onPaneClick:bt,onPaneMouseEnter:st,onPaneMouseMove:mt,onPaneMouseLeave:ze,onPaneScroll:Dt,onPaneContextMenu:me,onSelectionContextMenu:G,onSelectionStart:P,onSelectionEnd:B,onEdgeContextMenu:kt,onEdgeDoubleClick:jn,onEdgeMouseEnter:En,onEdgeMouseMove:Yn,onEdgeMouseLeave:qt,onReconnect:Ae??Ft,onReconnectStart:Ie??Kn,onReconnectEnd:Me??te,reconnectRadius:De??dt,defaultMarkerColor:ee,noDragClassName:Qr,noWheelClassName:_t,noPanClassName:Jt,elevateEdgesOnSelect:Ns,rfId:Dr,disableKeyboardA11y:ma,nodeOrigin:be,nodeExtent:ut}),fe.createElement(_4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:Se,nodesConnectable:nt,nodesFocusable:je,edgesFocusable:Ke,edgesUpdatable:ct,elementsSelectable:Ye,elevateNodesOnSelect:pa,minZoom:ke,maxZoom:Ee,nodeExtent:ut,onNodesChange:Tt,onEdgesChange:vt,snapToGrid:Te,snapGrid:Ue,connectionMode:W,translateExtent:Ze,connectOnClick:No,defaultEdgeOptions:fa,fitView:rn,fitViewOptions:Pr,onNodesDelete:$,onEdgesDelete:V,onNodeDragStart:I,onNodeDrag:L,onNodeDragStop:H,onSelectionDrag:M,onSelectionDragStart:J,onSelectionDragStop:X,noPanClassName:Jt,nodeOrigin:be,rfId:Dr,autoPanOnConnect:ga,autoPanOnNodeDrag:jt,onError:So,connectionRadius:Qi,isValidConnection:Ss,nodeDragThreshold:jo}),fe.createElement(b4,{onSelectionChange:Q}),gt,fe.createElement(K3,{proOptions:ha,position:Zi}),fe.createElement(C4,{rfId:Dr,disableKeyboardA11y:ma})))});P2.displayName="ReactFlow";const OP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function L2(){return wt(OP,Qt)}const D2=({id:e,x:t,y:n,width:s,height:a,style:i,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=i||{},S=c||N||_;return fe.createElement("rect",{className:un(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:S,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};D2.displayName="MiniMapNode";var PP=x.memo(D2);const LP=e=>e.nodeOrigin,DP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),ap=e=>e instanceof Function?e:()=>e;function qP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=PP,onClick:c}){const u=wt(DP,Qt),f=wt(LP),p=ap(t),h=ap(e),m=ap(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,u.map(w=>{const{x:N,y:_}=co(w,f).positionAbsolute;return fe.createElement(i,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var FP=x.memo(qP);const BP=200,zP=150,UP=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?Q3(Qd(t,e.nodeOrigin),n):n,rfId:e.rfId}},WP="react-flow__minimap-desc";function q2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:j=10,offsetScale:E=5}){const C=Ht(),T=x.useRef(null),{boundingRect:R,viewBB:I,rfId:L}=wt(UP,Qt),H=(e==null?void 0:e.width)??BP,$=(e==null?void 0:e.height)??zP,V=R.width/H,Q=R.height/$,J=Math.max(V,Q),M=J*H,X=J*$,G=E*J,P=R.x-(M-R.width)/2-G,B=R.y-(X-R.height)/2-G,W=M+G*2,Y=X+G*2,O=`${WP}-${L}`,F=x.useRef(0);F.current=J,x.useEffect(()=>{if(T.current){const Z=ar(T.current),U=pe=>{const{transform:ge,d3Selection:Te,d3Zoom:Ue}=C.getState();if(pe.sourceEvent.type!=="wheel"||!Te||!Ue)return;const He=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*j,Pe=ge[2]*Math.pow(2,He);Ue.scaleTo(Te,Pe)},re=pe=>{const{transform:ge,d3Selection:Te,d3Zoom:Ue,translateExtent:He,width:Pe,height:Se}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!Te||!Ue)return;const nt=F.current*Math.max(1,ge[2])*(b?-1:1),je={x:ge[0]-pe.sourceEvent.movementX*nt,y:ge[1]-pe.sourceEvent.movementY*nt},be=[[0,0],[Pe,Se]],Ke=vs.translate(je.x,je.y).scale(ge[2]),ct=Ue.constrain()(Ke,be,He);Ue.transform(Te,ct)},de=YT().on("zoom",N?re:null).on("zoom.wheel",_?U:null);return Z.call(de),()=>{Z.on("zoom",null)}}},[N,_,b,j]);const oe=y?Z=>{const U=jr(Z);y(Z,{x:U[0],y:U[1]})}:void 0,z=w?(Z,U)=>{const re=C.getState().nodeInternals.get(U);w(Z,re)}:void 0;return fe.createElement(Ex,{position:m,style:e,className:un(["react-flow__minimap",t]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:H,height:$,viewBox:`${P} ${B} ${W} ${Y}`,role:"img","aria-labelledby":O,ref:T,onClick:oe},S&&fe.createElement("title",{id:O},S),fe.createElement(FP,{onClick:z,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${P-G},${B-G}h${W+G*2}v${Y+G*2}h${-W-G*2}z
|
|
57
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}q2.displayName="MiniMap";var HP=x.memo(q2);function GP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function VP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function YP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function KP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function XP(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const sr=({children:e,className:t,...n})=>fe.createElement("button",{type:"button",className:un(["react-flow__controls-button",t]),...n},e);sr.displayName="ControlButton";const ZP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),F2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Ht(),[w,N]=x.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:b}=wt(ZP,Qt),{zoomIn:j,zoomOut:E,fitView:C}=Sc();if(x.useEffect(()=>{N(!0)},[]),!w)return null;const T=()=>{j(),i==null||i()},R=()=>{E(),c==null||c()},I=()=>{C(a),u==null||u()},L=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return fe.createElement(Ex,{className:un(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&fe.createElement(fe.Fragment,null,fe.createElement(sr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},fe.createElement(GP,null)),fe.createElement(sr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},fe.createElement(VP,null))),n&&fe.createElement(sr,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},fe.createElement(YP,null)),s&&fe.createElement(sr,{className:"react-flow__controls-interactive",onClick:L,title:"toggle interactivity","aria-label":"toggle interactivity"},_?fe.createElement(XP,null):fe.createElement(KP,null)),h)};F2.displayName="Controls";var QP=x.memo(F2),Ar;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ar||(Ar={}));function JP({color:e,dimensions:t,lineWidth:n}){return fe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function eL({color:e,radius:t}){return fe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const tL={[Ar.Dots]:"#91919a",[Ar.Lines]:"#eee",[Ar.Cross]:"#e2e2e2"},nL={[Ar.Dots]:1,[Ar.Lines]:1,[Ar.Cross]:6},rL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function B2({id:e,variant:t=Ar.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=wt(rL,Qt),y=c||tL[t],w=s||nL[t],N=t===Ar.Dots,_=t===Ar.Cross,S=Array.isArray(n)?n:[n,n],b=[S[0]*h[2]||1,S[1]*h[2]||1],j=w*h[2],E=_?[j,j]:b,C=N?[j/i,j/i]:[E[0]/i,E[1]/i];return fe.createElement("svg",{className:un(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},fe.createElement("pattern",{id:m+e,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?fe.createElement(eL,{color:y,radius:j/i}):fe.createElement(JP,{dimensions:E,color:y,lineWidth:a})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}B2.displayName="Background";var sL=x.memo(B2);const aL=["us-gov","global","apac","us","eu","jp","au"],oL=new RegExp(`^(?:(?:${aL.join("|")})\\.)?anthropic\\.`,"i");function jc(e){return e.replace(oL,"")}const iL=["command","cmd","file_path","path","url","pattern","notebook_path"],l1=120,op=e=>e.length>l1?`${e.slice(0,l1-1)}…`:e;function lL(e){if(typeof e=="string")return e.trim()?op(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of iL){const s=t[n];if(typeof s=="string"&&s.trim())return op(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return op(a)}}return null}const cL=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function c1(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const u1={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function qx(e){const t=cL.exec(e);if(!t)return null;const n=c1(t[1],"status");return{label:(n&&Object.hasOwn(u1,n)?u1[n]:void 0)??"background task update",detail:c1(t[1],"summary")}}function z2(e){return e.filter(t=>!qx(t.text))}const uL=/[0-9a-f]{16,}/i,dL=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function U2(e){return uL.test(e)||dL.test(e)}function hL(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!U2(t[n]))return t[n];return t[t.length-1]}function W2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Fx(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(a??0)}}function fL(e){const t=Fx(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function pL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=fL(s));return Object.keys(t).length?t:void 0}function H2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...Fx(n)};for(const s of Object.values(n)){const a=H2(s,t+1);if(a)return a}return null}const mL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,gL=new Set(["tool_input","tool_response"]);function G2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&mL.test(jc(n.model)))return n.model;for(const[s,a]of Object.entries(n)){if(gL.has(s))continue;const i=G2(a,t+1);if(i)return i}return null}function rx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function la(e){return hL(e)}function d1(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function qi(e,t){return`${e}::${t}`}function ca(e,t){return`${e}\0${t}`}function Md(e){const t=e.agent_type??e.subagent_type;return t&&!U2(t)?t:"subagent"}function sc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ci(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:W2()},e.agents.set(a,i),i)}function V2(e,t,n,s){const a=qi(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=la(s.cwd));const c=Md(s);return c&&(i.label==="subagent"||!i.label)&&(i.label=c),i}function yL(e,t,n){const s=t.session_id??"unknown",a=sc(t);if(a){const f=V2(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),c=i&&i.length>0?i[i.length-1]:null;if(c){const f=e.agents.get(qi(s,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=la(t.cwd)),f}const u=Ci(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=la(t.cwd)),u.label==="session"&&t.cwd&&(u.label=la(t.cwd)??"session"),u}function wL(e,t,n,s,a){const i=qi(t,n),c=Ci(e,t,a,!0);let u=e.agents.get(i);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=la(s.cwd));const f=Md(s);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:i,sessionId:t,label:Md(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:la(s.cwd),toolCount:0,childCount:0,usage:W2()},e.agents.set(i,u),c.childCount+=1,u}function vL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function h1(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let a=s.length-1;a>=0;a--)if(s[a]===n){s.splice(a,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Ju(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const f1=200;function xL(e,t){for(const n of e.values()){const s=n.tools.find(a=>a.id===t);if(s)return s}return null}const bL=25;function kL(e,t){const n=t.tools;if(n.length>f1){const s=n.splice(0,n.length-f1);for(const a of s){const i=ca(t.sessionId,a.id);e.toolIndex.get(i)===a&&e.toolIndex.delete(i)}}for(let s=n.length-bL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function _L(e,t,n){const s=e.toolIndex.get(ca(t.sessionId,n));if(s)return s;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const p1=2e3;function NL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-p1)return!1;if(a.text===n&&a.at<=t+p1)return!0}return!1}const ed=2e3;function SL(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function Y2(e,t){for(const n of t.tools){const s=ca(t.sessionId,n.id);e.toolIndex.get(s)===n&&e.toolIndex.delete(s)}}function Ec(e,t){return t&&(e.revision+=1),t}function jL(e,t,n,s,a){if(e.agents.size<=n)return!1;const i=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>s,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}i(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(Y2(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!i(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return Ec(e,f>0)}function EL(e,t,n,s,a){const i=new Map;for(const[h,m]of e.agents){let y=i.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},i.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...i].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>s).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...i.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&Y2(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Ec(e,p)}function CL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(ca((n==null?void 0:n.session_id)??"unknown",a))}function TL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Ec(e,t)}function AL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),c=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(ca(a.sessionId,u.id)),s=!0)}}return Ec(e,s)}const m1=90*6e4;function RL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return Ec(e,s)}function ML(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const IL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function $L(e,t){let n=null;for(const s of e.toolIndex.values()){const a=s.agentId?e.agents.get(s.agentId):void 0;!a||a.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const OL=3e4;function PL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>OL)&&!(e.startedAt>t))return{name:e.name,preview:lL(e.input)??""}}function LL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=$L(e,t),c={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(c.subagentId=i.explicitSubagentId);const u=PL(i,a);return u&&(c.tool=u),c}function DL(e,t,n){if(e.kind==="idle")return!0;const s=sc(t);return s==null?!0:e.subagentId!=null&&qi(n,s)===e.subagentId}function g1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...rx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=s.session_id??"unknown";if(!IL.has(i)){const h=e.agents.get(c);h!=null&&h.waiting&&DL(h.waiting,s,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??d1(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??d1(),w=(_,S)=>typeof h[_]=="number"?h[_]:S,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=s.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(i==="OutputObserved"){const h=s.kind==="thinking"||s.kind==="text"||s.kind==="tool_use"?s.kind:null,m=typeof s.at=="number"&&Number.isFinite(s.at)?s.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(N=>m-N<qL);w.push(m),y.outputs=w.length>y1?w.slice(-y1):w}return e.revision+=1,e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=Fx(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=pL(s.usageByModel)}}return e}const f=yL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=G2(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=Ci(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=la(s.cwd)),h.label==="session"&&s.cwd&&(h.label=la(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=Ci(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!NL(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!qx(m)&&(h.firstPrompt=Ju(m,120)));break}case"PreToolUse":{const h=s.tool_use_id?_L(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=Ju(s.tool_input));break}const m=s.tool_use_id??`${f.id}:${f.toolCount}`,y=sc(s),w={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Ju(s.tool_input),agentId:f.id,explicitSubagentId:y?qi(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(ca(f.sessionId,m),w),kL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;const m=ca(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const _ of e.agents.values()){if(_.sessionId!==c)continue;const S=_.tools.find(b=>b.id===h);if(S){y=S,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=i==="PostToolUse",y.trimmed||(y.response=s.tool_response),i==="PostToolUseFailure"?y.errorPreview=Ju(s.tool_response):w&&(y.errorPreview=void 0);const N=H2(s.tool_response);N&&(y.usage=N),e.toolIndex.delete(m);break}case"SubagentStart":{const h=sc(s);if(!h)break;const m=wL(e,c,h,s,a),y=Md(s);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const N=m.endedAt!=null&&a-m.endedAt<=ed,_=w!=null&&a-w<=ed;if(N||_){const S=_?w:m.endedAt;m.state="done",m.endedAt=S,m.startedAt=Math.min(m.startedAt,S),h1(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,vL(e,c,h);break}case"SubagentStop":{const h=sc(s);if(!h)break;const m=V2(e,c,h,s);if(!m){for(const[y,w]of e.subagentTombstones)a-w>ed&&e.subagentTombstones.delete(y);e.subagentTombstones.set(qi(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),h1(e,c,h);break}case"Stop":case"SessionEnd":{const h=Ci(e,c,a,!1),m=SL(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+ed)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const N of w.tools)N.endedAt==null&&N.explicitSubagentId==null&&(N.endedAt=a,N.ok=!1,N.errorPreview=N.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(ca(w.sessionId,N.id)));i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=ML(s.notification_type);if(!h)break;const m=Ci(e,c,a,!1),y=typeof s.message=="string"?s.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:LL(e,c,h,y,a);break}}return e}const qL=6e4,y1=64;function Id(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const FL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},BL=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:FL},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function zL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Hi(e,t=Date.now()){if(!e)return null;const n=jc(e);for(const s of BL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function K2(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*c/1e6}}function X2(e,t,n=Date.now()){if(!zL(t))return e.inputTokens;const s=Hi(t,n),a=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Bx(e,t,n=Date.now()){const s=Hi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=X2(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,u=K2(e,s),f=u.usd5m+u.usd1h;return{input:a,output:i,cacheRead:c,cacheWrite:f,total:a+i+c+f}}const w1=2e5,UL=1e6,WL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],HL=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function GL(e){if(!e)return w1;const t=jc(e);for(const n of WL)if(n.test(t))return UL;for(const n of HL)if(n.match.test(t))return n.window;return w1}function Z2(e,t){return typeof e=="number"&&e>0?e:GL(t)}const ji="not priced";function St(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function zx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${St(s)}/min`:`${St(n*3600)}/hr`}function VL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function YL(e,t){let n=0,s=0,a=0,i=0,c=0,u=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,i+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Cc(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=YL(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(c=>c.model===e.model);i>=0?s[i]={model:s[i].model,usage:VL(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function Vn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Cc(e)){const a=Bx(s.usage,s.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function $d(e,t=Date.now()){let n=0;for(const s of Cc(e))Hi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function Q2(e){const t=[];for(const n of Cc(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function J2(e){return Q2(e).filter(t=>t!==e.model)}const KL=new Set(["untrusted","on-request","on-failure"]);function XL(e){return typeof e!="string"||!e?null:KL.has(e)?!0:e==="never"?!1:null}function ZL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=XL(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
+
|
|
59
|
+
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function v1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function po(e){const t=jc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=v1(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),i=s[2].split(/[-_]/).filter(Boolean).map(v1);return[`GPT-${a}`,...i].join(" ")}return e}function Jd(e){const t=jc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function wo(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function ip(e){const t=[];for(const n of e)n.kind==="root"&&wo(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function QL(e,t){if(e.length===0)return null;const n=e.findIndex(s=>s.id===t);return e[(n+1)%e.length]}function JL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function eh(e,t){return`${e}@${t.since}`}function eA(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?a?s:`${n} · ${s}`:a?null:n}function e5(e){const t=e.message||"Needs your permission",n=eA(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function t5(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!wo(i.waiting))continue;const c=eh(i.id,i.waiting);t.has(c)||a.push({key:c,title:i.label,body:e5(i.waiting),sessionId:i.id})}return a}function n5(e,t,n){const s=new Set;for(const i of e)s.add(eh(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function lp(e){return new Set(e.map(t=>eh(t.id,t.waiting)))}function r5(e,t){return e!==t}function s5(e,t){return!e&&t!=null}function a5(e,t){return e!==null&&t!=null}function wn(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Od(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),c=a%60;return`${i}m ${String(c).padStart(2,"0")}s`}function tA(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function nA(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const o5=1;function i5(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const c=e.indexOf(i);c!==-1&&e.splice(c,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const a=n();return a!=null&&a.dismiss===s},depth(){return e.length}}}const Pd=i5();function l5(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function x1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function c5(e,t){return!e||!e.isConnected||x1(e)?!1:t==null||x1(t)}const b1="a[href], button, input, select, textarea, [tabindex]";function u5(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function d5(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function h5({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function th(e){return e.ctrlKey||e.metaKey||e.altKey}const f5=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),p5=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),m5=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function Ux(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function g5(e){return Ux(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Wx(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=Ux(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!f5.has(String(e.type??"text").toLowerCase())}function y5(e,t){if(!e)return!1;if(Wx(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&g5(e))return!1;if(p5.has(Ux(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(s=>m5.has(s))}function w5({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function rA(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(b1))return u5({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&d5({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(b1)!=null})}):[]}function v5(e,t){const n=rA(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function dn(e,t={}){const{focusRef:n,layer:s}=t,a=x.useRef(null),i=x.useRef(e);i.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>i.current());const u=c.current;return x.useEffect(()=>Pd.push(u,s),[u,s]),x.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??rA(a.current)[0])==null||p.focus(),()=>{c5(f,document.activeElement)&&f.focus()}},[]),x.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||th(p))return;const h=a.current;if(!h)return;const m=document.activeElement;if(!(m!=null&&h.contains(m))&&!Pd.isTop(u))return;const w=v5(h,m),N=h5({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function x5(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function rr(e){return e.toLocaleString()}function b5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const k5=60;function _5(e,t=k5){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function N5({agent:e,onClose:t}){var y;const n=x.useRef(null),s=dn(t,{focusRef:n}),a=e.context,i=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=Z2(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Vn(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,m=x5(e.provider);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[l.jsxs("header",{className:"ctx-modal-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),l.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),l.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("section",{className:"ctx-window-row",children:[l.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:l.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),l.jsxs("div",{className:"ctx-window-meta",children:[l.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),l.jsxs("span",{children:[rr(c)," / ",rr(u)," tok (",m.windowScope,")"]})]})]}),l.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"input tokens",val:rr(i.inputTokens)}),l.jsx(Sr,{label:"output tokens",val:rr(i.outputTokens)}),l.jsx(Sr,{label:"cache reads",val:rr(i.cacheReadTokens)}),l.jsx(Sr,{label:"cache writes",val:rr(i.cacheCreateTokens)}),l.jsx(Sr,{label:"cumulative total",val:rr(h)}),l.jsx(Sr,{label:"estimated cost",val:St(p.total),accent:!0})]}),l.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?l.jsxs("div",{className:"ctx-grid",children:[l.jsx(Sr,{label:"user messages",val:rr((a==null?void 0:a.msgsUser)??0)}),l.jsx(Sr,{label:"assistant messages",val:rr((a==null?void 0:a.msgsAssistant)??0)}),l.jsx(Sr,{label:"tool uses",val:rr((a==null?void 0:a.toolUses)??0)}),l.jsx(Sr,{label:"tool results",val:rr((a==null?void 0:a.toolResults)??0)}),l.jsx(Sr,{label:"system-reminders",val:rr((a==null?void 0:a.systemReminders)??0)})]}):l.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),l.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?l.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):l.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>l.jsxs("li",{children:[l.jsx("span",{className:"ctx-md-path",title:w.path,children:_5(w.path)}),l.jsx("span",{className:"ctx-md-size",children:b5(w.bytes)})]},w.path))})]})})}function Sr({label:e,val:t,accent:n}){return l.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[l.jsx("span",{className:"ctx-row-label",children:e}),l.jsx("span",{className:"ctx-row-val",children:t})]})}function S5({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=Z2(n,t),c=Math.min(1,e/i),u=s/2-3,f=s/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return l.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:l.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[l.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),l.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),l.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const k1=new Map;function sA(e){let t=k1.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},k1.set(e,t)),t}function j5(e,t){const n=sA(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const s of n.listeners)s()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function E5(e){return sA(e).now}const _1=new Map,N1=new Map;function nh(e=1e3){let t=_1.get(e);t||(t=s=>j5(e,s),_1.set(e,t));let n=N1.get(e);return n||(n=()=>E5(e),N1.set(e,n)),x.useSyncExternalStore(t,n,n)}function rh(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const C5="1",S1="agent-dag.schema",T5=["agent-dag.layout","agent-dag.viewport"];function vo(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function A5(e,t=C5){let n=null;try{n=e.getItem(S1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of T5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(S1,t)}catch{}return s}const aA="agent-dag.recapsDismissed",j1=200;function R5(){const e=vo(aA);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let Fi=new Set(R5());const sx=new Set;let oA=0;function iA(e){return sx.add(e),()=>{sx.delete(e)}}function lA(e){if(Fi=e,oA++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(aA,JSON.stringify(t.length>j1?t.slice(-j1):t))}catch{}for(const t of sx)t()}function cA(e,t){return`${e}@${t}`}function M5(e){return Fi.has(e)}function I5(e){if(Fi.has(e))return;const t=new Set(Fi);t.add(e),lA(t)}function $5(e){const t=new Set(Fi);t.delete(e)||t.add(e),lA(t)}function O5(e){return x.useSyncExternalStore(iA,()=>e!=null&&Fi.has(e),()=>!1)}function Hx(e){return`recap:${e}`}function P5(e){return e.startsWith("recap:")}function L5(){return x.useSyncExternalStore(iA,()=>oA,()=>0)}function E1(e,t){const n=Hi(t);if(!n)return`model: ${t}
|
|
61
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Bx(e,t),c=K2(e,n),u=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${St(c.usd5m)}`,`cache w1h${s(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${St(c.usd1h)}`]:[`cache w ${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${St(c.usd5m)}`],f=X2(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${St(i.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${St(i.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${St(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${St(i.total)}`].join(`
|
|
62
|
+
`)}function C1(e){const t=Cc(e);return t.length<=1?E1(e.usage,e.model):[...t.map(n=>E1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${St(Vn(e).total)}`].join(`
|
|
63
|
+
`)}function D5({data:e,selected:t}){var S,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),s=e.tools.filter(j=>!j.endedAt).length,a=e.tools.filter(j=>j.ok===!1).length,i=Id(e.sessionId),c=((S=e.context)==null?void 0:S.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
64
|
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=J2(e),h=p.length>0?`${e.model}
|
|
65
65
|
spend on this card also covers:
|
|
66
66
|
${p.join(`
|
|
67
|
-
`)}`:e.model,m=nA(e.sessionName,e.sessionTitle),y=rh(e),w=y?cA(e.sessionId,y.at):null,N=O5(w),_=y!=null&&!N;return l.jsxs("div",{className:n,style:{"--session-hue":i},children:[l.jsx("span",{className:"accent-stripe"}),l.jsx(
|
|
68
|
-
burn: ${R}`:"");return l.jsx("span",{className:"cost-meta",title:I,children:l.jsxs("b",{children:[
|
|
69
|
-
Blocked for ${
|
|
67
|
+
`)}`:e.model,m=nA(e.sessionName,e.sessionTitle),y=rh(e),w=y?cA(e.sessionId,y.at):null,N=O5(w),_=y!=null&&!N;return l.jsxs("div",{className:n,style:{"--session-hue":i},children:[l.jsx("span",{className:"accent-stripe"}),l.jsx(fo,{type:"target",position:Fe.Left,style:{background:"transparent",border:"none"}}),l.jsxs("div",{className:"head",children:[l.jsxs("div",{className:"title",children:[l.jsx(B5,{state:e.state}),l.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&l.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&l.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":_,title:_?"Hide the recap":"Show Claude Code's recap",onClick:j=>{j.stopPropagation(),$5(w)},children:l.jsx(Gx,{})})]}),l.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&l.jsx(S5,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),l.jsxs("div",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",l.jsx(F5,{start:e.startedAt,end:e.endedAt})]})]})]}),l.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&l.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?l.jsxs("span",{className:"model-chip","data-family":Jd(e.model),title:h,children:[po(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?l.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&l.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&l.jsx(H5,{waiting:e.waiting}),(()=>{const j=ZL(e);return j?l.jsxs("div",{className:"approval-blind-row",title:j.detail,children:[l.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),l.jsx("span",{className:"approval-blind-said",children:j.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&l.jsx(G5,{tools:e.tools,outputs:e.outputs}),l.jsxs("div",{className:"meta",children:[l.jsxs("span",{children:[l.jsx("b",{children:e.toolCount})," tools"]}),a>0&&l.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[l.jsx("b",{children:a})," err"]}),s>0&&l.jsxs("span",{className:"inflight-meta",children:[l.jsx("b",{children:s})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&l.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[l.jsx("b",{children:wn(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const j=Hi(e.model),E=Vn(e),C=$d(e);if(!j&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:l.jsx("span",{className:"cost-unpriced",title:C1(e),children:ji});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?zx(E.total,T):null,I=C1(e)+(R?`
|
|
68
|
+
burn: ${R}`:"");return l.jsx("span",{className:"cost-meta",title:I,children:l.jsxs("b",{children:[St(E.total),C>0?"+":""]})})})()]}),l.jsx(fo,{type:"source",position:Fe.Right,style:{background:"transparent",border:"none"}})]})}const q5=x.memo(D5);function F5({start:e,end:t}){const n=nh(1e3);return l.jsx(l.Fragment,{children:Od(e,t,n)})}function mc(e){return e==="active"?"live":e==="done"?"done":"err"}function B5({state:e}){return l.jsx("span",{className:`state-pill state-${e}`,children:mc(e)})}function Bi(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function z5(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,s=Vn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",mc(e.state),wo(e.waiting)?Bi(e.waiting):null,e.model?po(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,s>0?`${St(s)}${$d(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function U5(e,t){const n=eA(e,t);return n?`Likely on: ${n}`:null}function W5(e){return e.kind==="idle"?"Your turn":Bi(e)}function H5({waiting:e}){const t=nh(1e3),n=wo(e),s=Bi(e);return l.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${Od(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?l.jsx("span",{className:"ap-pulse","aria-hidden":!0}):l.jsx("span",{className:"waiting-dot","aria-hidden":!0}),l.jsx("span",{className:"waiting-said",children:W5(e)}),l.jsx("b",{children:Od(e.since,void 0,t)})]})}function Gx(){return l.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M3.3 3.3l5.4 5.4M8.7 3.3l-5.4 5.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",fill:"none"}),l.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),l.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function G5({tools:e,outputs:t}){const n=nh(1e3),s=6e4,a=24,i=s/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=s)return;const T=a-1-Math.floor(C/i);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,N=h/(i/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<s).length,S=u-_,b=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return l.jsxs("div",{className:"tool-spark-row",title:j,children:[l.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===a-1&&E>0,L=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return l.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:L},R?`landed:${E}`:C)})}),l.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function V5(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function cp(e){return e!=="gone"}function up(e,t){const[n,s]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{s(i=>V5(e,i))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>s("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&s("here")},[n]),n}async function Vx(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}const Y5=60,K5=6e3,Yr=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Un=e=>typeof e=="string"?e:null;function mo(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),s=n?e.map((i,c)=>[String(c),i]):Object.entries(e);if(s.length===0)return n?"[]":"{}";const a=[];for(const[i,c]of s){const u=n?`${t}-`:`${t}${i}:`;if(typeof c=="string"&&c.includes(`
|
|
70
70
|
`)){a.push(u);for(const f of c.split(`
|
|
71
|
-
`))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=
|
|
71
|
+
`))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=mo(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
|
|
72
72
|
`)}function X5(e){return e.lines??e.text.split(`
|
|
73
|
-
`).map(t=>({text:t}))}function Z5(e,t){if(t)return{shown:e,cut:!1};const n=[];let s=0;for(const a of e){if(n.length===Y5)return{shown:n,cut:!0};const i=K5-s;if(a.text.length>i)return n.push({...a,text:`${a.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(a),s+=a.text.length+1}return{shown:n,cut:!1}}const Sn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),
|
|
73
|
+
`).map(t=>({text:t}))}function Z5(e,t){if(t)return{shown:e,cut:!1};const n=[];let s=0;for(const a of e){if(n.length===Y5)return{shown:n,cut:!0};const i=K5-s;if(a.text.length>i)return n.push({...a,text:`${a.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(a),s+=a.text.length+1}return{shown:n,cut:!1}}const Sn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),Wn=(e,t)=>({label:e,text:t,inline:!0}),uA=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
74
74
|
`),lines:t});function Q5(e,t){return[...e.split(`
|
|
75
75
|
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
76
|
-
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function J5(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!
|
|
77
|
-
`);if(e==="Read"&&t==="response"&&
|
|
76
|
+
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function J5(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Yr(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const s of n.lines){const a=String(s);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function T1(e){if(typeof e=="string")return[Sn(void 0,e)];if(!Yr(e))return[Sn(void 0,mo(e))];const t=[],n=Un(e.type);n==="create"&&t.push(Wn("result","created the file"));const s=J5(e.structuredPatch);return s&&t.push(uA("applied",s)),e.userModified===!0&&t.push(Wn("note","the user changed it before it was applied")),t.length?t:[Wn("result",n==="update"?"updated the file":"done")]}function e6(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const s=t??1;return n!=null?`${s}–${s+n-1}`:`from ${s}`}function t6(e){if(typeof e=="string")return[Sn(void 0,e)];const t=Yr(e)&&Yr(e.file)?e.file:null,n=Un(t==null?void 0:t.content);if(t&&n!=null){const a=[],i=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(i)&&Number.isFinite(c)&&c>0&&a.push(Wn("lines",i>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+i-1} of ${c}`:`${i} of ${c}`)),a.push(Sn("content",n)),a}const s=Yr(e)?Un(e.type):null;return s&&s!=="text"?[Wn("result",`${/^[aeiou]/i.test(s)?"an":"a"} ${s} file`)]:[Sn(void 0,mo(e))]}function n6(e){if(typeof e=="string")return[Sn("output",e)];if(!Yr(e))return[Sn(void 0,mo(e))];const t=Un(e.stdout),n=Un(e.stderr);if(t==null&&n==null)return[Sn(void 0,mo(e))];const s=[];return t&&s.push(Sn("output",t.replace(/\n$/,""))),n&&s.push(Sn("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&s.push(Wn("note","interrupted before it finished")),s.length?s:[Wn("output","none")]}function r6(e,t,n){const s=Yr(t)?t:null;if(s&&(e==="Edit"||e==="MultiEdit")){const a=Un(s.file_path),i=(e==="MultiEdit"?Array.isArray(s.edits)?s.edits:[]:[s]).filter(Yr).filter(c=>Un(c.old_string)!=null&&Un(c.new_string)!=null);if(a&&i.length){const c=[Wn("file",a)];return i.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(uA(i.length>1?`change ${f+1}${p}`:`change${p}`,Q5(u.old_string,u.new_string)))}),{input:c,response:T1(n)}}}if(s&&e==="Write"){const a=Un(s.file_path),i=Un(s.content);if(a&&i!=null)return{input:[Wn("file",a),Sn("content",i)],response:T1(n)}}if(s&&e==="Read"){const a=Un(s.file_path);if(a){const i=e6(s);return{input:i?[Wn("file",a),Wn("lines",i)]:[Wn("file",a)],response:t6(n)}}}if(s&&e==="Bash"){const a=Un(s.command);if(a!=null){const i=Un(s.description);return{input:i?[Sn("command",a),Wn("why",i)]:[Sn("command",a)],response:n6(n)}}}return{input:[Sn(void 0,mo(t))],response:[Sn(void 0,mo(n))]}}function A1(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Yr(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(s=>typeof s=="string"&&s!=="").join(`
|
|
77
|
+
`);if(e==="Read"&&t==="response"&&Yr(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function s6({tool:e,onClose:t}){const n=dn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,i=e.response??e.errorPreview,c=r6(e.name,a,i);return l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),l.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),l.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",children:tA(e,"in-flight…")}),l.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("section",{className:"modal-body",children:[e.trimmed&&l.jsx("div",{className:"modal-section",children:l.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsx("h4",{children:"Input"}),l.jsx(M1,{text:A1(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>l.jsx(R1,{block:u},f))]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("div",{className:"tm-head",children:[l.jsxs("h4",{children:["Response ",s==="err"&&l.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&l.jsx(M1,{text:A1(e.name,"response",i),what:"response"})]}),e.endedAt==null?l.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>l.jsx(R1,{block:u},f))]})]})]})})}const a6={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function R1({block:e}){const[t,n]=x.useState(!1);if(e.inline)return l.jsxs("p",{className:"tm-inline",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("code",{children:e.text})]});const{shown:s,cut:a}=Z5(X5(e),t);return l.jsxs("div",{className:"tm-block",children:[e.label&&l.jsx("span",{className:"tm-label",children:e.label}),l.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?s.map((i,c)=>l.jsxs("span",{className:i.tone?a6[i.tone]:void 0,children:[i.text,c<s.length-1?`
|
|
78
78
|
`:""]},c)):s.map(i=>i.text).join(`
|
|
79
|
-
`)}),a&&l.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function M1({text:e,what:t}){const[n,s]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),l.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Vx(e).then(i=>{!i||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const td=18,I1=26,o6=12,i6=240;function l6(e,t){return(e+i6)*(t||1)}function c6(e){return u6(e.nodeInternals.values())}function u6(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=P1(i)??h.label),i.kind==="root"&&(h.name=L1(i))):t.set(i.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:P1(i)??i.sessionId,name:L1(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const c=(n.get(i.label)??0)>1;s.push({sessionId:a,...f6(i.label,i.name,a,c),x:i.minX-td,y:i.minY-td-I1,w:i.maxX-i.minX+td*2,h:i.maxY-i.minY+td*2+I1})}return s}const ax=" · ",d6=32,h6=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function $1(e){return h6.test(e)?2:1}function O1(e,t=d6){const n=[...e];let s=0;for(const c of n)s+=$1(c);if(s<=t)return e;const a=[];let i=0;for(const c of n){const u=$1(c);if(i+u>t-1)break;a.push(c),i+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function f6(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?p6(n):void 0,c=[e,a||void 0,i].filter(Boolean);return{label:O1(e),name:a?O1(a):void 0,shortId:i,fullLabel:c.join(ax)}}function p6(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function P1(e){if(e.kind==="root")return e.label}function L1(e){if(e.kind==="root")return nA(e.sessionName,e.sessionTitle).face}function m6({onFit:e}){const{x:t,y:n,zoom:s}=L2(),a=Sc(),i=
|
|
80
|
-
drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?l.jsx("span",{className:"cluster-label-name",children:ax+f.name}):null,f.shortId?l.jsx("span",{className:"cluster-label-id",children:ax+f.shortId}):null]})]},f.sessionId)})})}function g6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.fullLabel!==a.fullLabel||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}function y6({data:e}){return l.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function dA(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function
|
|
81
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const pA=600,A6=4,R6=36,ix=16,M6=60,I6=6,q1=220,F1=96,$6=28,B1={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",...k6};function z1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(B1,e)?B1[e]:"✨"}const U1={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function mA(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return mA(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function O6(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=C6(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const P6=new Set(["Bash","PowerShell",...S6]),L6=N6;function D6(e,t){return L6.has(e)||e.startsWith("mcp__")?Math.max(F1,34+t.length*7.5):F1}function q6(e,t){if(!P6.has(e))return null;const n=O6(t);if(!n)return null;const s=mA(n);return s?{emoji:Object.hasOwn(U1,s)?U1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const F6=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),W1={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},H1={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function B6(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function z6(e){const t=e.toLowerCase();if(Object.hasOwn(H1,t))return H1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(W1,s))return W1[s]}return"📄"}function U6(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function W6(e,t){if(!F6.has(e))return null;const n=U6(e,t);if(!n)return null;const s=B6(n);return s?{emoji:e==="LS"?"📂":z6(s),label:s,category:"file",detail:n}:null}const G1={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function Yx(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function H6(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function gA(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:void 0}function G6(e,t){const n=Yx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=gA(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function V6(e,t){return q6(e,t)??W6(e,t)??G6(e)}const V1=_6,Y1=18;function Y6(e){const t=[...e];return t.length<=Y1?e:t.slice(0,Y1-1).join("")+"…"}function yA(e){const t=Yx(e);if(t){const s=gA(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:Y6(t.server),hue:H6(t.server)}}const n=Object.hasOwn(V1,e)?V1[e]:"";return n?{emoji:z1(e),label:n}:{emoji:z1(e),label:e}}function K6(e){let t=null,n="";for(const s of e){const a=Yx(s);if(a){if(!a.server)return null;if(t===null)t=a.server,n=s;else if(a.server!==t)return null}}return t===null?null:yA(n)}function X6(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Z6(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/pA)}function Q6(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function J6(e,t,n,s,a,i){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>pA)continue;const f=s.get(u.id)??n.get(u.id);if(!f)continue;const p=Q6(u.tools,A6);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??q1,q1),w=(m==null?void 0:m.height)??130,N=f.x,_=f.y,j=N+y,k=_+w/2;p.forEach((S,E)=>{const C=E*R6,T=N+y+M6,R=_+I6+C,I=Z6(i,h),F=S.inputPreview??"",W=X6(S),O=I<.999,B=yA(S.name);c.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:B.label,emoji:B.emoji,status:W,category:fA(S.name),mcpHue:B.hue,inputPreview:F,fade:I,fading:O,worldX:T,worldY:R,anchorX:j,anchorY:k,spawnDx:j-T,spawnDy:k-(R+ix)});const Z=V6(S.name,S.input);if(Z){const Q=D6(S.name,B.label),M=T+Q+$6,K=R,G=T+Q,P=R+ix;c.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:Z.label,emoji:Z.emoji,isSub:!0,status:W,category:Z.category,inputPreview:Z.detail??F,fade:I,fading:O,worldX:M,worldY:K,anchorX:G,anchorY:P,spawnDx:G-M,spawnDy:0})}})}return c}function eD({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:c,now:u,onOpenTool:f}){const p=J6(e,t,n,s,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return l.jsx(tD,{bursts:h,spotlight:i,onOpenTool:f})}function tD({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=L2();return l.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[l.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*i+s,f=c.anchorY*i+a,p=(c.worldX+6)*i+s,h=(c.worldY+ix)*i+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return l.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>l.jsx(rD,{b:c,x:s,y:a,zoom:i,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function nD(e,t){const n=e.b,s=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===s.id&&n.toolId===s.toolId&&n.worldX===s.worldX&&n.worldY===s.worldY&&n.spawnDx===s.spawnDx&&n.spawnDy===s.spawnDy&&n.status===s.status&&n.fading===s.fading&&n.category===s.category&&n.mcpHue===s.mcpHue&&n.isSub===s.isSub&&n.emoji===s.emoji&&n.name===s.name&&n.toolName===s.toolName&&n.inputPreview===s.inputPreview}const rD=x.memo(function({b:t,x:n,y:s,zoom:a,dim:i,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+s,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},N=i?" dim":"";return l.jsx("div",{className:"tool-burst-wrap",style:p,children:l.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${N}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[l.jsx("span",{className:"tb-emoji",children:t.emoji}),l.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&l.jsx("span",{className:"tb-spin"}),t.status==="done"&&l.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&l.jsx("span",{className:"tb-mark err",children:"×"})]})})},nD);function sD(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const c of e){const u=Hn(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,i+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const aD="spend on this board",oD="on this board",K1=`Everything on the board right now, and only that.
|
|
79
|
+
`)}),a&&l.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function M1({text:e,what:t}){const[n,s]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),l.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Vx(e).then(i=>{!i||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const td=18,I1=26,o6=12,i6=240;function l6(e,t){return(e+i6)*(t||1)}function c6(e){return u6(e.nodeInternals.values())}function u6(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=P1(i)??h.label),i.kind==="root"&&(h.name=L1(i))):t.set(i.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:P1(i)??i.sessionId,name:L1(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const c=(n.get(i.label)??0)>1;s.push({sessionId:a,...f6(i.label,i.name,a,c),x:i.minX-td,y:i.minY-td-I1,w:i.maxX-i.minX+td*2,h:i.maxY-i.minY+td*2+I1})}return s}const ax=" · ",d6=32,h6=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function $1(e){return h6.test(e)?2:1}function O1(e,t=d6){const n=[...e];let s=0;for(const c of n)s+=$1(c);if(s<=t)return e;const a=[];let i=0;for(const c of n){const u=$1(c);if(i+u>t-1)break;a.push(c),i+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function f6(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?p6(n):void 0,c=[e,a||void 0,i].filter(Boolean);return{label:O1(e),name:a?O1(a):void 0,shortId:i,fullLabel:c.join(ax)}}function p6(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function P1(e){if(e.kind==="root")return e.label}function L1(e){if(e.kind==="root")return nA(e.sessionName,e.sessionTitle).face}function m6({onFit:e}){const{x:t,y:n,zoom:s}=L2(),a=Sc(),i=wt(c6,g6);if(i.length<=1)return null;const c=f=>{try{const p=a.getNodes().filter(h=>{const m=h.data;return(m==null?void 0:m.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${s})`};return l.jsx("div",{className:"session-clusters",style:u,children:i.map(f=>{const p=Id(f.sessionId),h={position:"absolute",left:0,top:0,transform:`translate(${f.x}px, ${f.y}px)`,width:f.w,height:f.h,"--session-hue":p},m={position:"absolute",left:f.x+16,top:f.y-o6/(s||1),transform:`scale(${1/(s||1)})`,transformOrigin:"left top",maxWidth:l6(f.w,s),"--session-hue":p};return l.jsxs(fe.Fragment,{children:[l.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),l.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${f.fullLabel}
|
|
80
|
+
drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?l.jsx("span",{className:"cluster-label-name",children:ax+f.name}):null,f.shortId?l.jsx("span",{className:"cluster-label-id",children:ax+f.shortId}):null]})]},f.sessionId)})})}function g6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.fullLabel!==a.fullLabel||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}function y6({data:e}){return l.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function dA(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function gd(e){return dA(Math.floor(e/1e3))}function hA(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function w6(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ox(e,t,n){const s=new Date(e),a=gd(t-e);return{label:w6(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function v6({data:e}){const t=nh(3e4),n=ox(e.recap.at,t);return l.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[l.jsxs("div",{className:"recap-note-head",children:[l.jsxs("span",{className:"recap-note-mark",children:[l.jsx(Gx,{}),"recap"]}),l.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),l.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":"Hide the recap",title:"Hide — the ※ on the card brings it back",onClick:s=>{s.stopPropagation(),I5(e.noteKey)},children:"×"})]}),l.jsx("p",{className:"recap-note-text",children:e.recap.text}),l.jsx(fo,{type:"source",position:Fe.Right,style:{background:"transparent",border:"none"}})]})}function x6({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:i,style:c}){const[u]=Ix({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:.35});return l.jsxs("g",{className:"recap-tie",style:c,children:[l.jsx("path",{className:"recap-tie-thread",d:u}),l.jsx("path",{className:"recap-tie-beads",d:u}),l.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),l.jsx("circle",{className:"recap-tie-end",cx:n,cy:s,r:3.5})]})}const Tc={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},b6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.category])),k6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.emoji])),_6=Object.fromEntries(Object.entries(Tc).map(([e,t])=>[e,t.label])),N6=new Set(Object.keys(Tc)),S6=new Set(Object.entries(Tc).filter(([,e])=>e.shell).map(([e])=>e)),D1={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",...b6};function fA(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(D1,e)?D1[e]:"other"}const j6=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,E6=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function C6(e){if(typeof e!="string"||!e)return null;const t=j6.exec(e);if(t){const s=T6(t[2]);if(s.trim())return s}const n=E6.exec(e);return n?n[1]:null}function T6(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
81
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const pA=600,A6=4,R6=36,ix=16,M6=60,I6=6,q1=220,F1=96,$6=28,B1={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",...k6};function z1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(B1,e)?B1[e]:"✨"}const U1={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function mA(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return mA(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function O6(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=C6(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const P6=new Set(["Bash","PowerShell",...S6]),L6=N6;function D6(e,t){return L6.has(e)||e.startsWith("mcp__")?Math.max(F1,34+t.length*7.5):F1}function q6(e,t){if(!P6.has(e))return null;const n=O6(t);if(!n)return null;const s=mA(n);return s?{emoji:Object.hasOwn(U1,s)?U1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const F6=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),W1={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},H1={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function B6(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function z6(e){const t=e.toLowerCase();if(Object.hasOwn(H1,t))return H1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(W1,s))return W1[s]}return"📄"}function U6(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function W6(e,t){if(!F6.has(e))return null;const n=U6(e,t);if(!n)return null;const s=B6(n);return s?{emoji:e==="LS"?"📂":z6(s),label:s,category:"file",detail:n}:null}const G1={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function Yx(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function H6(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function gA(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:void 0}function G6(e,t){const n=Yx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=gA(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function V6(e,t){return q6(e,t)??W6(e,t)??G6(e)}const V1=_6,Y1=18;function Y6(e){const t=[...e];return t.length<=Y1?e:t.slice(0,Y1-1).join("")+"…"}function yA(e){const t=Yx(e);if(t){const s=gA(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:Y6(t.server),hue:H6(t.server)}}const n=Object.hasOwn(V1,e)?V1[e]:"";return n?{emoji:z1(e),label:n}:{emoji:z1(e),label:e}}function K6(e){let t=null,n="";for(const s of e){const a=Yx(s);if(a){if(!a.server)return null;if(t===null)t=a.server,n=s;else if(a.server!==t)return null}}return t===null?null:yA(n)}function X6(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Z6(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/pA)}function Q6(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function J6(e,t,n,s,a,i){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>pA)continue;const f=s.get(u.id)??n.get(u.id);if(!f)continue;const p=Q6(u.tools,A6);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??q1,q1),w=(m==null?void 0:m.height)??130,N=f.x,_=f.y,S=N+y,b=_+w/2;p.forEach((j,E)=>{const C=E*R6,T=N+y+M6,R=_+I6+C,I=Z6(i,h),L=j.inputPreview??"",H=X6(j),$=I<.999,V=yA(j.name);c.push({id:`${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:V.label,emoji:V.emoji,status:H,category:fA(j.name),mcpHue:V.hue,inputPreview:L,fade:I,fading:$,worldX:T,worldY:R,anchorX:S,anchorY:b,spawnDx:S-T,spawnDy:b-(R+ix)});const Q=V6(j.name,j.input);if(Q){const J=D6(j.name,V.label),M=T+J+$6,X=R,G=T+J,P=R+ix;c.push({id:`sub:${u.id}::${j.id}`,toolId:j.id,agentId:u.id,toolName:j.name,name:Q.label,emoji:Q.emoji,isSub:!0,status:H,category:Q.category,inputPreview:Q.detail??L,fade:I,fading:$,worldX:M,worldY:X,anchorX:G,anchorY:P,spawnDx:G-M,spawnDy:0})}})}return c}function eD({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:c,now:u,onOpenTool:f}){const p=J6(e,t,n,s,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return l.jsx(tD,{bursts:h,spotlight:i,onOpenTool:f})}function tD({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=L2();return l.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[l.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*i+s,f=c.anchorY*i+a,p=(c.worldX+6)*i+s,h=(c.worldY+ix)*i+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return l.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>l.jsx(rD,{b:c,x:s,y:a,zoom:i,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function nD(e,t){const n=e.b,s=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===s.id&&n.toolId===s.toolId&&n.worldX===s.worldX&&n.worldY===s.worldY&&n.spawnDx===s.spawnDx&&n.spawnDy===s.spawnDy&&n.status===s.status&&n.fading===s.fading&&n.category===s.category&&n.mcpHue===s.mcpHue&&n.isSub===s.isSub&&n.emoji===s.emoji&&n.name===s.name&&n.toolName===s.toolName&&n.inputPreview===s.inputPreview}const rD=x.memo(function({b:t,x:n,y:s,zoom:a,dim:i,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+s,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},N=i?" dim":"";return l.jsx("div",{className:"tool-burst-wrap",style:p,children:l.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${N}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[l.jsx("span",{className:"tb-emoji",children:t.emoji}),l.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&l.jsx("span",{className:"tb-spin"}),t.status==="done"&&l.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&l.jsx("span",{className:"tb-mark err",children:"×"})]})})},nD);function sD(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const c of e){const u=Vn(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,i+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const aD="spend on this board",oD="on this board",K1=`Everything on the board right now, and only that.
|
|
82
82
|
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
83
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,wA="session spend";function Kx({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,c,u)=>{if(i<=0)return null;const f=i/n*100;return l.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${
|
|
84
|
-
`),children:["waiting ",Z1(f.waiting.since,void 0,t),f.waiting.tool&&l.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):l.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Z1(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&l.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[l.jsx(Gx,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const dD=e=>1-Math.pow(1-e,5),vA=420;function hD(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function fD(e,t,n,s=vA){return n>=s?t:n<=0?e:e+(t-e)*dD(n/s)}function pD(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),c=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!hD(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(fD(e,t,w)),w<vA&&(h=i(y))};return h=i(y),()=>{m=!1,h&&c(h)}}const lx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function dp(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=Hn(s,t);n.set(s.sessionId,{cost:a.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function mD(e,t){if(!e)return lx;const n={...lx};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const c={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function xA(e,t,n){const s=yD*Math.max(1,n/kA);let a=0;for(const[i,c]of t){const u=e.get(i);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=s&&(a+=f)}return a}const Q1={samples:[],last:new Map,watched:0},bA=10*6e4,gD=6e4,kA=5e3,yD=20;function wD(e,t,n){const s=e.samples[e.samples.length-1];if(s&&t-s.t<kA)return e;const a=e.watched+xA(e.last,n,s?t-s.t:0),i=e.samples.filter(c=>t-c.t<=bA);return i.push({t,watched:a}),{samples:i,last:n,watched:a}}function vD(e,t,n){const s=e.samples[0];if(!s)return null;const a=t-s.t;if(a<gD)return null;const i=e.samples[e.samples.length-1].t,c=e.watched+xA(e.last,n,t-i)-s.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(bA/6e4,Math.ceil(a/6e4))}:null}function J1(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const sh=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function xD(e,t,n=sh.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function bD(e,t=new Date){return e==="today"?J1(1,t):e==="month"?J1(t.getDate(),t):"20200101"}const Un=e=>typeof e=="number"&&Number.isFinite(e)?e:0,wd=e=>typeof e=="string"?e:"";function _A(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const c=wd(i==null?void 0:i.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Un(i==null?void 0:i.cost),u.inputTokens+=Un(i==null?void 0:i.inputTokens),u.outputTokens+=Un(i==null?void 0:i.outputTokens),u.cacheReadTokens+=Un(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=Un(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const kD=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function _D(e){var t;return((t=kD.exec(e))==null?void 0:t[0])??e}function ND(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=wd(a==null?void 0:a.period);if(!i)continue;const c=_D(i),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:wd(a==null?void 0:a.agent)||"claude",cost:Un(a==null?void 0:a.totalCost),tokens:Un(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(wd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function NA(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Un(t.cacheReadTokens),p=Un(t.cacheCreationTokens),h=Un(t.inputTokens),m=Un(t.outputTokens);return{cost:Un(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Un(t.totalTokens)||h+m+f+p}}const n=_A(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),c=s(f=>f.cacheReadTokens),u=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+i+c+u}}function SD(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function e_(e,t){var n;return((n=sh.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function jD(e,t,n){const s=e!=null,a=NA(e);return{fromRange:s,cost:s?a.cost+n.cost:t.cost.total,inputTokens:s?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?a.cost>0:t.cost.total>0,tokenSum:s?a.tokens:t.sum,showCostBar:!s}}const Zt="ccdeck";function la(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function ah(e){return e==null}const cx="self";function sa(e,t=!1){const n=la(e?cx:null,cx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ys(e){return ah(e?cx:null)}function ED(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function t_(e){return e==null||e==="BODY"||e==="HTML"}const SA="agent-dag.usagePeriod";function CD(){const e=yo(SA);return sh.some(t=>t.key===e)?e:"today"}function TD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SA,e)}catch{}}const jA="agent-dag.usageSessionsOpen";function AD(){return yo(jA)==="1"}function RD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jA,e?"1":"0")}catch{}}function n_(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function MD(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const hp="__unknown__";function ID(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const c=Math.min(100,i/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function Js({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=i||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=s?hA(s,c):null,w=s&&a?ID(u,s,a,c):null,[N,_]=x.useState(!1),j=x.useId();return l.jsxs("div",{className:"qb-row",children:[l.jsxs("div",{className:"qb-meta",children:[l.jsxs("span",{className:"qb-label",children:[t,i&&l.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),l.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),l.jsxs("div",{className:"qb-track",children:[l.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&l.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:l.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),l.jsxs("div",{className:"qb-reset-row",children:[y?l.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?l.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&l.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":N,"aria-controls":N?j:void 0,onClick:()=>_(k=>!k),children:[l.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),N&&w&&l.jsxs("div",{id:j,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const $D=6e4,OD=2e4;function PD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ys(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(OD)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),$D),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function LD(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function DD(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const EA=6e4,r_=6e4;function qD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ys(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),EA),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function FD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,EA),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function BD(e,t,n){const[s,a]=x.useState(null),[i,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(_=>_+1)},w=window.setInterval(y,r_),N=()=>{m()&&Date.now()-p.current>=r_&&f(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,N=bD(w);return c(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(_=>_.ok?_.json():null).then(_=>{!m||!(_!=null&&_.ok)||(p.current=Date.now(),a({period:w,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...SD(s,e),loading:i}}function Gl(e){const[t,n]=x.useState(e),s=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{s.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return pD(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function zD({state:e,now:t,providers:n,leaving:s,onClose:a,liveSince:i=null}){var wt,ut;const{quota:c,loading:u,refresh:f}=PD(n.claude),{data:p,loading:h,refresh:m}=qD(n.codex),{data:y}=FD(n.codex),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ee=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ee)},[]);const _=x.useRef(Q1),j=x.useRef(null),{byModel:k,totalCost:S,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ee=new Map;for(const tt of e.agents.values())for(const it of Cc(tt)){const bt=it.model??hp,nt=Bx(it.usage,it.model),pt=ee.get(bt);pt?(pt.inputTokens+=it.usage.inputTokens,pt.outputTokens+=it.usage.outputTokens,pt.cacheReadTokens+=it.usage.cacheReadTokens,pt.cacheCreateTokens+=it.usage.cacheCreateTokens,pt.cost.total+=nt.total,pt.cost.input+=nt.input,pt.cost.output+=nt.output,pt.cost.cacheRead+=nt.cacheRead,pt.cost.cacheWrite+=nt.cacheWrite,pt.agentCount++):ee.set(bt,{model:bt,inputTokens:it.usage.inputTokens,outputTokens:it.usage.outputTokens,cacheReadTokens:it.usage.cacheReadTokens,cacheCreateTokens:it.usage.cacheCreateTokens,cost:{...nt},agentCount:1,priced:Ui(it.model)!=null})}const ke=Array.from(ee.values()).sort((tt,it)=>it.cost.total-tt.cost.total||it.inputTokens+it.outputTokens-(tt.inputTokens+tt.outputTokens)),Be=sD(e.agents.values());j.current!==i&&(j.current=i,_.current=Q1);const et=dp(e.agents.values(),t);i!=null&&(_.current=wD(_.current,t,et));const ht=i==null?null:vD(_.current,t,et),Je=ht?{label:zx(ht.spent,ht.spanSec),spanMin:ht.spanMin}:null;return{byModel:ke,totalCost:Be.cost,totalTokens:Be,burnRate:Je}},[e,e.revision,t,i]),T=x.useMemo(()=>{const ee=[];for(const ke of e.agents.values()){if(ke.kind!=="root")continue;let Be=Hn(ke).total,et=ke.usage.inputTokens,ht=ke.usage.outputTokens,Je=Od(ke);for(const tt of e.agents.values())tt.sessionId!==ke.sessionId||tt.kind==="root"||(Be+=Hn(tt).total,et+=tt.usage.inputTokens,ht+=tt.usage.outputTokens,Je+=Od(tt));ee.push({sessionId:ke.sessionId,label:ke.label||ke.cwdBasename||"session",state:ke.state,cost:Be,inputTokens:et,outputTokens:ht,unpricedTokens:Je})}return ee.sort((ke,Be)=>Be.cost-ke.cost||Be.inputTokens+Be.outputTokens-(ke.inputTokens+ke.outputTokens)).slice(0,12)},[e,e.revision]),[R,I]=x.useState(CD);x.useEffect(()=>{TD(R)},[R]);const[F,W]=x.useState(AD);x.useEffect(()=>{RD(F)},[F]);const O=x.useRef([]),[B,Z]=x.useState(0),Q=x.useRef(()=>new Map);Q.current=()=>dp(e.agents.values(),t);const M=x.useCallback(()=>Q.current(),[]),{data:K,shown:G,stale:P,loading:H,baseline:L}=BD(R,B,M),U=K!=null,$=H&&P,V=x.useMemo(()=>{const ee=new Map;for(const ke of e.agents.values()){if(ke.kind!=="root"||!ke.sessionId)continue;const Be=ke.label||ke.cwdBasename;Be&&ee.set(ke.sessionId,Be)}return ee},[e,e.revision]),he=x.useMemo(()=>{const ee=new Map;for(const ke of e.agents.values())ke.kind!=="root"||!ke.sessionId||ee.set(ke.sessionId,ke.state);return ee},[e,e.revision]),Y=x.useMemo(()=>U?_A(K):[],[K,U]),J=x.useMemo(()=>{if(!U)return[];const ee=ND(K,V).slice(0,12),ke=new Map;for(const Be of ee)Be.label&&ke.set(Be.label,(ke.get(Be.label)??0)+1);return ee.map(Be=>Be.label&&(ke.get(Be.label)??0)>1?{...Be,label:`${Be.label} ${Be.sessionId.slice(0,4)}`}:Be)},[K,U,V]),z=x.useMemo(()=>NA(K),[K]),re=e_(G,R),le=P?" up-stale":"",me=x.useMemo(()=>U?mD(L,dp(e.agents.values(),t)):lx,[e,e.revision,L,U,t]),ge=jD(K,{...E,cost:S},me),Me=ge.hasCost,qe=ge.tokenSum,Ve=Gl(ge.cost),Ue=Gl(ge.inputTokens),Se=Gl(ge.outputTokens),Qe=Gl(ge.cacheReadTokens),Ne=Gl(ge.cacheCreateTokens),_e=k.filter(ee=>ee.cost.total>0||ee.inputTokens+ee.outputTokens>0),ue=T.filter(ee=>ee.cost>0||ee.inputTokens+ee.outputTokens>0),je=U?Y.some(ee=>ee.cost<=0&&ee.tokens>0):_e.some(ee=>!ee.priced),Ce=u||h,Fe=n_(c==null?void 0:c.fetchedAt,w),We=n_(p==null?void 0:p.fetchedAt,w),He=()=>{f(),m(),Z(ee=>ee+1)},ot=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return l.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[l.jsxs("div",{className:"up-header",children:[l.jsx("h2",{children:"Usage"}),C&&l.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,l.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),l.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&l.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:He,...sa(Ce),"aria-label":ot,title:ot,children:Ce?"…":"↻"}),l.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Claude quota",Fe&&!u&&l.jsx("span",{className:"up-section-age",title:MD(c==null?void 0:c.source),children:Fe})]}),c!=null&&c.ok?l.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&l.jsx(Js,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&l.jsx(Js,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&l.jsx(Js,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&l.jsx(Js,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?l.jsx(Js,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&l.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:LD(c.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&l.jsx("span",{className:"up-plan-badge",children:p.planLabel}),We&&!h&&l.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:We})]}),p!=null&&p.ok?l.jsxs("div",{className:"up-quota-bars",children:[(wt=p.windows)==null?void 0:wt.map(ee=>l.jsx(Js,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,limitReached:p.limitReached&&ee.pct>=100,nowSec:w},ee.id)),(ut=p.extraWindows)==null?void 0:ut.map(ee=>l.jsx(Js,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,nowSec:w},ee.id)),p.creditLimit&&l.jsx(Js,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&l.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&l.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&l.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Zt} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&l.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&l.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:DD(p.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&l.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
|
|
85
|
-
last 5h: ${wn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[wn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),
|
|
86
|
-
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",re]}),l.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),l.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!
|
|
87
|
-
${ke.sessionId}`:ke.sessionId,children:ke.label??ke.sessionId.slice(0,8)}),l.jsx("span",{className:"up-session-tokens",children:wn(ke.tokens)}),ke.cost>0?l.jsx("span",{className:"up-session-cost",title:ke.models.join(", ")||void 0,children:Nt(ke.cost)}):l.jsx("span",{className:"up-session-cost up-unpriced",children:Ni})]},ke.sessionId)}),!U&&ue.map(ke=>l.jsxs("div",{className:"up-session-row",children:[l.jsx("span",{className:`sl-dot state-${ke.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:pc(ke.state)}),l.jsx("span",{className:"up-session-label",children:ke.label}),l.jsx("span",{className:"up-session-tokens",children:wn(ke.inputTokens+ke.outputTokens)}),ke.cost>0?l.jsxs("span",{className:"up-session-cost",title:ke.unpricedTokens>0?`${wn(ke.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Nt(ke.cost),ke.unpricedTokens>0?"+":""]}):l.jsx("span",{className:"up-session-cost up-unpriced",children:Ni})]},ke.sessionId))]})]})})(),je&&l.jsxs("div",{className:"up-hint",children:["“",Ni,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):l.jsx("div",{className:"up-empty",children:U?l.jsxs(l.Fragment,{children:["No usage ",re,".",l.jsx("br",{}),"Try a longer period."]}):l.jsxs(l.Fragment,{children:["No usage data yet.",l.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const cn={l:30,r:6,t:6,b:2},ea={l:0,r:0,t:2,b:1},oh=104,UD=64;function Cr(e,t=100,n=oh,s=cn){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function CA(e,t,n,s=100,a=oh,i=cn){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-i.l-i.r;return i.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${Cr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function TA(e,t,n,s=100,a=oh,i=cn){if(e.length<2)return"";const c=a-i.b,u=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)w+=`L${p(N.t).toFixed(1)} ${Cr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function WD(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function AA(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function HD(e,t,n=s=>sc(s)){const s=e.filter(c=>c.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function sc(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Xx(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),a=n%60;return a?`${s}h ${a}m`:`${s}h`}function GD({group:e,title:t,onClose:n}){const s=dn(n),[a,i]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&l.jsxs("span",{className:"hist-since",children:["since ",sc(u)," · ",Xx(u,f||Date.now())]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsx("div",{className:"hist-body",children:a==null?l.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?l.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>l.jsx(VD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function VD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[i,c]=x.useState(null);x.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([W])=>a(Math.max(160,W.contentRect.width)));return F.observe(I),()=>F.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w}=e,N=w?UD:oh,{now:_,peak:j}=WD(u),k=f==="C"?"°C":f,S=m==="Throttling"?HD(u,t):null,E=i!=null?u[i]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,T=I=>{const F=s-cn.l-cn.r;return cn.l+(C>0?F*(I-u[0].t)/C:F/2)},R=I=>{if(u.length<2)return;const F=I.currentTarget.getBoundingClientRect(),W=(I.clientX-F.left-cn.l)/Math.max(1,F.width-cn.l-cn.r),O=u[0].t+C*Math.max(0,Math.min(1,W));let B=0;for(let Z=1;Z<u.length;Z++)Math.abs(u[Z].t-O)<Math.abs(u[B].t-O)&&(B=Z);c(B)};return l.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[l.jsxs("div",{className:"hist-head",children:[l.jsx("span",{className:"hist-label",children:m}),l.jsxs("span",{className:"hist-stats",children:[_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{children:_}),l.jsxs("span",{children:[k," now"]})]}),j!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{className:AA(j,p,h),children:j}),l.jsxs("span",{children:[k," peak"]})]})]})]}),l.jsx("div",{className:"hist-plot",ref:n,children:l.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":_==null?`${m}: nothing measured yet`:`${m}: ${_}${k} now, peak ${j}${k}, over ${Xx(u[0].t,u[u.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([I,F])=>F==null||F>y?null:l.jsxs("g",{children:[l.jsx("line",{className:`hist-rule ${I}`,x1:cn.l,x2:s-cn.r,y1:Cr(F,y,N),y2:Cr(F,y,N)}),l.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:Cr(F,y,N)+3,children:F})]},I)),l.jsx("line",{className:"hist-floor",x1:cn.l,x2:s-cn.r,y1:N-cn.b,y2:N-cn.b}),l.jsx("path",{className:"hist-area",d:TA(u,s,t,y,N)}),l.jsx("path",{className:"hist-line",d:CA(u,s,t,y,N)}),u.length===1&&l.jsx("circle",{className:"hist-dot",cx:T(u[0].t),cy:Cr(u[0].v,y,N),r:3}),E&&l.jsxs("g",{children:[l.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:cn.t,y2:N-cn.b}),l.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:Cr(E.v,y,N),r:3})]})]})}),l.jsx("div",{className:"hist-axis",children:E?l.jsxs("span",{className:"hist-at",children:[sc(E.t)," — ",l.jsx("b",{children:E.v}),k]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:u.length?sc(u[0].t):""}),l.jsx("span",{children:u.length?sc(u[u.length-1].t):""})]})}),S&&l.jsx("div",{className:"hist-note",children:S})]})}const YD="thermal:Throttling";function KD(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[YD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function vd(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function nd(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:vd(e,t)}const s_=["cores","memory","load","thermal"],no=116,Wr=24,XD=60,ZD=6e4;function QD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function JD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function eq(e,t=XD){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function tq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(s_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),ZD);return()=>{c=!1,clearInterval(f)}},[]);const s=x.useMemo(()=>KD(e),[e]),a=x.useMemo(()=>s_.flatMap(c=>{const u=t[c];return u?u.series.filter(QD).map(f=>({series:eq(f),stepMs:u.stepMs})):[]}),[t]),i=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?Xx(c,u):"less than a minute"},[a]);return Object.keys(s).length?l.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:c,stepMs:u})=>l.jsx(nq,{series:c,stepMs:u,now:s[c.key],span:i},c.key))}):null}function nq({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:c,warnAt:u,critAt:f}=e,p=JD(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":AA(h,u,f),y=Math.max(...a.map(N=>N.v));return l.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${vd(y,c)} over the last ${s}`,u!=null?`over ${nd(u,c)} is uncomfortable`:"",f!=null?`over ${nd(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[l.jsxs("div",{className:"pl-cell-head",children:[l.jsx("span",{className:"pl-cell-label",children:p}),l.jsx("span",{className:"pl-cell-now",children:h==null?"—":vd(h,c)})]}),l.jsxs("svg",{className:"pl-spark",width:no,height:Wr,viewBox:`0 0 ${no} ${Wr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[l.jsx("line",{className:"pl-spark-floor",x1:0,x2:no,y1:Wr-ea.b,y2:Wr-ea.b}),l.jsx("path",{className:"pl-spark-area",d:TA(a,no,t,i,Wr,ea)}),u!=null&&l.jsx("line",{className:"pl-rule warn",x1:0,x2:no,y1:Cr(u,i,Wr,ea),y2:Cr(u,i,Wr,ea)}),f!=null&&l.jsx("line",{className:"pl-rule hot",x1:0,x2:no,y1:Cr(f,i,Wr,ea),y2:Cr(f,i,Wr,ea)}),l.jsx("path",{className:"pl-spark-line",d:CA(a,no,t,i,Wr,ea)})]}),l.jsxs("span",{className:"vis-hidden",children:["peak ",vd(y,c)," over the last ",s,u!=null&&`, uncomfortable over ${nd(u,c)}`,f!=null&&`, the machine acts over ${nd(f,c)}`]})]})}const rq={key:"cpu",dir:"desc"};function sq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function aq(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,c)=>{if(t.key==="name")return n*i.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=s(i),f=s(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((i,c)=>a(i,c)||(c.cpu??-1)-(i.cpu??-1)||c.mem-i.mem||i.pid-c.pid)}function oq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const iq=4e3;function lq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const c=await i.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,iq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function cq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function uq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function dq({sys:e,onClose:t}){const n=dn(t),[s,a]=x.useState(rq),i=lq(),c=i?aq(i.procs,s):null;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&l.jsxs("span",{className:"pl-count",children:[c.length," of ",i.total," running"]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("div",{className:"pl-split",children:[l.jsx("div",{className:"pl-body",children:c==null?l.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?l.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):l.jsxs("table",{className:"sd-procs pl-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(bi,{col:"cpu",label:"cpu",sort:s,onSort:a}),l.jsx(bi,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:s,onSort:a}),l.jsx(bi,{col:"threads",label:"threads",sort:s,onSort:a}),l.jsx(bi,{col:"uptime",label:"up",sort:s,onSort:a}),l.jsx(bi,{col:"user",label:"user",sort:s,onSort:a}),l.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),l.jsx(bi,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),l.jsx("tbody",{children:c.map(u=>l.jsxs("tr",{children:[l.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),l.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:cq(u.rssBytes)}),l.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),l.jsx("td",{className:"sd-num sd-dim",children:uq(u.uptimeSec)}),l.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),l.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),l.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&l.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),l.jsx(tq,{sys:e})]})]})}),document.body)}function bi({col:e,label:t,note:n,sort:s,onSort:a}){const i=oq(s,e);return l.jsx("th",{scope:"col","aria-sort":i,children:l.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
83
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,wA="session spend";function Kx({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,c,u)=>{if(i<=0)return null;const f=i/n*100;return l.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${St(i)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return l.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function iD({state:e,sessionId:t,onClose:n}){const s=x.useMemo(()=>lD(e,t),[e,t]),a=x.useRef(null),i=dn(n,{focusRef:a});return s?l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),l.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),l.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),l.jsxs("div",{className:"modal-actions",children:[l.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),l.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),l.jsxs("div",{className:"modal-body",children:[l.jsxs("section",{className:"ss-hero",children:[l.jsxs("div",{className:"ss-hero-left",children:[l.jsx("div",{className:"ss-cost-label",children:wA}),l.jsx("div",{className:"ss-cost",children:St(s.cost.total)}),s.modelChips.length>0&&l.jsx("div",{className:"ss-models",children:s.modelChips.map(c=>l.jsx("span",{className:"model-chip","data-family":Jd(c),title:c,children:po(c)},c))})]}),l.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&l.jsxs(l.Fragment,{children:[l.jsx(Kx,{cost:s.cost,size:"lg"}),l.jsxs("div",{className:"ss-cost-legend",children:[l.jsxs("span",{className:"ssl ssl-in",children:["input ",l.jsx("b",{children:St(s.cost.input)})]}),l.jsxs("span",{className:"ssl ssl-out",children:["output ",l.jsx("b",{children:St(s.cost.output)})]}),l.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",l.jsx("b",{children:St(s.cost.cacheRead)})]}),l.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",l.jsx("b",{children:St(s.cost.cacheWrite)})]})]})]})})]}),l.jsxs("section",{className:"ss-stats",children:[l.jsx(ki,{label:"agents",value:s.agentCount}),l.jsx(ki,{label:"subagents",value:s.subagentCount}),l.jsx(ki,{label:"tool calls",value:s.toolCount}),l.jsx(ki,{label:"prompts",value:s.promptCount}),l.jsx(ki,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&l.jsx(ki,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Most-used tools"}),l.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([c,u])=>l.jsxs("div",{className:"ss-tt",children:[l.jsx("span",{className:"ss-tt-name",children:c}),l.jsx("span",{className:"ss-tt-bar",children:l.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),l.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),s.firstPrompt&&l.jsxs("section",{className:"modal-section",children:[l.jsx("h4",{children:"Opening prompt"}),l.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function ki({label:e,value:t,tone:n}){return l.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[l.jsx("div",{className:"ss-stat-value",children:t}),l.jsx("div",{className:"ss-stat-label",children:e})]})}function lD(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const E of e.agents.values())E.sessionId===t&&s.push(E);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,w=1/0,N=0;for(const E of s){const C=Vn(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of Q2(E))i.add(R);E.model&&i.add(E.model),E.kind==="subagent"&&m++;const T=z2(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const _=Math.max(0,N-w),S=Math.floor(_/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,j=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:b,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:j,firstPrompt:y}}function X1(e){return e.waiting?wo(e.waiting)?0:1:e.state==="active"?2:3}function cD(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=Vn(s).total,c=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;a+=u.toolCount,i+=Vn(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,recap:rh(s),modelId:s.model,toolCount:a,cost:i,startedAt:s.startedAt,lastActivity:c})}return n.sort((s,a)=>{const i=X1(s),c=X1(a);return i!==c?i-c:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function Z1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function uD({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=x.useMemo(()=>cD(e),[e,e.revision,t]),c=i.filter(f=>f.state==="active").length,u=i.filter(f=>wo(f.waiting)).length;return l.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[l.jsxs("div",{className:"sl-header",children:[l.jsxs("h2",{children:["Sessions ",l.jsx("span",{className:"sl-count",children:i.length})]}),u>0&&l.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&l.jsxs("span",{className:"sl-live-count",children:[c," live"]}),l.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),l.jsxs("div",{className:"sl-rows",children:[i.length===0&&l.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return l.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[l.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:mc(f.state)}),l.jsxs("div",{className:"sl-row-body",children:[l.jsxs("div",{className:"sl-row-head",children:[l.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&l.jsx("span",{className:"model-chip","data-family":Jd(f.modelId),title:f.modelId,children:po(f.modelId)})]}),l.jsxs("div",{className:"sl-row-meta",children:[l.jsxs("span",{title:"tool calls",children:[l.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&l.jsx("span",{className:"sl-cost",title:wA,children:l.jsx("b",{children:St(f.cost)})}),f.waiting?l.jsxs("span",{className:"sl-waiting",title:[Bi(f.waiting),U5(f.waiting,Bi(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
84
|
+
`),children:["waiting ",Z1(f.waiting.since,void 0,t),f.waiting.tool&&l.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):l.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Z1(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&l.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[l.jsx(Gx,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const dD=e=>1-Math.pow(1-e,5),vA=420;function hD(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function fD(e,t,n,s=vA){return n>=s?t:n<=0?e:e+(t-e)*dD(n/s)}function pD(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),c=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!hD(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(fD(e,t,w)),w<vA&&(h=i(y))};return h=i(y),()=>{m=!1,h&&c(h)}}const lx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function dp(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=Vn(s,t);n.set(s.sessionId,{cost:a.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function mD(e,t){if(!e)return lx;const n={...lx};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const c={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function xA(e,t,n){const s=yD*Math.max(1,n/kA);let a=0;for(const[i,c]of t){const u=e.get(i);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=s&&(a+=f)}return a}const Q1={samples:[],last:new Map,watched:0},bA=10*6e4,gD=6e4,kA=5e3,yD=20;function wD(e,t,n){const s=e.samples[e.samples.length-1];if(s&&t-s.t<kA)return e;const a=e.watched+xA(e.last,n,s?t-s.t:0),i=e.samples.filter(c=>t-c.t<=bA);return i.push({t,watched:a}),{samples:i,last:n,watched:a}}function vD(e,t,n){const s=e.samples[0];if(!s)return null;const a=t-s.t;if(a<gD)return null;const i=e.samples[e.samples.length-1].t,c=e.watched+xA(e.last,n,t-i)-s.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(bA/6e4,Math.ceil(a/6e4))}:null}function J1(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const sh=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function xD(e,t,n=sh.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function bD(e,t=new Date){return e==="today"?J1(1,t):e==="month"?J1(t.getDate(),t):"20200101"}const Hn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,yd=e=>typeof e=="string"?e:"";function _A(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const c=yd(i==null?void 0:i.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Hn(i==null?void 0:i.cost),u.inputTokens+=Hn(i==null?void 0:i.inputTokens),u.outputTokens+=Hn(i==null?void 0:i.outputTokens),u.cacheReadTokens+=Hn(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=Hn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const kD=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function _D(e){var t;return((t=kD.exec(e))==null?void 0:t[0])??e}function ND(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=yd(a==null?void 0:a.period);if(!i)continue;const c=_D(i),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:yd(a==null?void 0:a.agent)||"claude",cost:Hn(a==null?void 0:a.totalCost),tokens:Hn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(yd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function NA(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Hn(t.cacheReadTokens),p=Hn(t.cacheCreationTokens),h=Hn(t.inputTokens),m=Hn(t.outputTokens);return{cost:Hn(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Hn(t.totalTokens)||h+m+f+p}}const n=_A(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),c=s(f=>f.cacheReadTokens),u=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+i+c+u}}function SD(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function e_(e,t){var n;return((n=sh.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function jD(e,t,n){const s=e!=null,a=NA(e);return{fromRange:s,cost:s?a.cost+n.cost:t.cost.total,inputTokens:s?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?a.cost>0:t.cost.total>0,tokenSum:s?a.tokens:t.sum,showCostBar:!s}}const Zt="ccdeck";function ua(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function ah(e){return e==null}const cx="self";function aa(e,t=!1){const n=ua(e?cx:null,cx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ws(e){return ah(e?cx:null)}function ED(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function t_(e){return e==null||e==="BODY"||e==="HTML"}const SA="agent-dag.usagePeriod";function CD(){const e=vo(SA);return sh.some(t=>t.key===e)?e:"today"}function TD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SA,e)}catch{}}const jA="agent-dag.usageSessionsOpen";function AD(){return vo(jA)==="1"}function RD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jA,e?"1":"0")}catch{}}function n_(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function MD(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const hp="__unknown__";function ID(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const c=Math.min(100,i/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function ea({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=i||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=s?hA(s,c):null,w=s&&a?ID(u,s,a,c):null,[N,_]=x.useState(!1),S=x.useId();return l.jsxs("div",{className:"qb-row",children:[l.jsxs("div",{className:"qb-meta",children:[l.jsxs("span",{className:"qb-label",children:[t,i&&l.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),l.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),l.jsxs("div",{className:"qb-track",children:[l.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&l.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:l.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),l.jsxs("div",{className:"qb-reset-row",children:[y?l.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?l.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&l.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":N,"aria-controls":N?S:void 0,onClick:()=>_(b=>!b),children:[l.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),N&&w&&l.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const $D=6e4,OD=2e4;function PD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ws(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(OD)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),$D),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function LD(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function DD(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const EA=6e4,r_=6e4;function qD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),i=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!ws(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),EA),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function FD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,EA),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function BD(e,t,n){const[s,a]=x.useState(null),[i,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(_=>_+1)},w=window.setInterval(y,r_),N=()=>{m()&&Date.now()-p.current>=r_&&f(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,N=bD(w);return c(!0),fetch(`/api/ccusage?since=${N}${y?"&refresh=1":""}`).then(_=>_.ok?_.json():null).then(_=>{!m||!(_!=null&&_.ok)||(p.current=Date.now(),a({period:w,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...SD(s,e),loading:i}}function Yl(e){const[t,n]=x.useState(e),s=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{s.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return pD(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function zD({state:e,now:t,providers:n,leaving:s,onClose:a,liveSince:i=null}){var Xe,ut;const{quota:c,loading:u,refresh:f}=PD(n.claude),{data:p,loading:h,refresh:m}=qD(n.codex),{data:y}=FD(n.codex),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ee=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ee)},[]);const _=x.useRef(Q1),S=x.useRef(null),{byModel:b,totalCost:j,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ee=new Map;for(const rt of e.agents.values())for(const lt of Cc(rt)){const bt=lt.model??hp,st=Bx(lt.usage,lt.model),mt=ee.get(bt);mt?(mt.inputTokens+=lt.usage.inputTokens,mt.outputTokens+=lt.usage.outputTokens,mt.cacheReadTokens+=lt.usage.cacheReadTokens,mt.cacheCreateTokens+=lt.usage.cacheCreateTokens,mt.cost.total+=st.total,mt.cost.input+=st.input,mt.cost.output+=st.output,mt.cost.cacheRead+=st.cacheRead,mt.cost.cacheWrite+=st.cacheWrite,mt.agentCount++):ee.set(bt,{model:bt,inputTokens:lt.usage.inputTokens,outputTokens:lt.usage.outputTokens,cacheReadTokens:lt.usage.cacheReadTokens,cacheCreateTokens:lt.usage.cacheCreateTokens,cost:{...st},agentCount:1,priced:Hi(lt.model)!=null})}const Ne=Array.from(ee.values()).sort((rt,lt)=>lt.cost.total-rt.cost.total||lt.inputTokens+lt.outputTokens-(rt.inputTokens+rt.outputTokens)),Be=sD(e.agents.values());S.current!==i&&(S.current=i,_.current=Q1);const et=dp(e.agents.values(),t);i!=null&&(_.current=wD(_.current,t,et));const pt=i==null?null:vD(_.current,t,et),tt=pt?{label:zx(pt.spent,pt.spanSec),spanMin:pt.spanMin}:null;return{byModel:Ne,totalCost:Be.cost,totalTokens:Be,burnRate:tt}},[e,e.revision,t,i]),T=x.useMemo(()=>{const ee=[];for(const Ne of e.agents.values()){if(Ne.kind!=="root")continue;let Be=Vn(Ne).total,et=Ne.usage.inputTokens,pt=Ne.usage.outputTokens,tt=$d(Ne);for(const rt of e.agents.values())rt.sessionId!==Ne.sessionId||rt.kind==="root"||(Be+=Vn(rt).total,et+=rt.usage.inputTokens,pt+=rt.usage.outputTokens,tt+=$d(rt));ee.push({sessionId:Ne.sessionId,label:Ne.label||Ne.cwdBasename||"session",state:Ne.state,cost:Be,inputTokens:et,outputTokens:pt,unpricedTokens:tt})}return ee.sort((Ne,Be)=>Be.cost-Ne.cost||Be.inputTokens+Be.outputTokens-(Ne.inputTokens+Ne.outputTokens)).slice(0,12)},[e,e.revision]),[R,I]=x.useState(CD);x.useEffect(()=>{TD(R)},[R]);const[L,H]=x.useState(AD);x.useEffect(()=>{RD(L)},[L]);const $=x.useRef([]),[V,Q]=x.useState(0),J=x.useRef(()=>new Map);J.current=()=>dp(e.agents.values(),t);const M=x.useCallback(()=>J.current(),[]),{data:X,shown:G,stale:P,loading:B,baseline:W}=BD(R,V,M),Y=X!=null,O=B&&P,F=x.useMemo(()=>{const ee=new Map;for(const Ne of e.agents.values()){if(Ne.kind!=="root"||!Ne.sessionId)continue;const Be=Ne.label||Ne.cwdBasename;Be&&ee.set(Ne.sessionId,Be)}return ee},[e,e.revision]),oe=x.useMemo(()=>{const ee=new Map;for(const Ne of e.agents.values())Ne.kind!=="root"||!Ne.sessionId||ee.set(Ne.sessionId,Ne.state);return ee},[e,e.revision]),z=x.useMemo(()=>Y?_A(X):[],[X,Y]),Z=x.useMemo(()=>{if(!Y)return[];const ee=ND(X,F).slice(0,12),Ne=new Map;for(const Be of ee)Be.label&&Ne.set(Be.label,(Ne.get(Be.label)??0)+1);return ee.map(Be=>Be.label&&(Ne.get(Be.label)??0)>1?{...Be,label:`${Be.label} ${Be.sessionId.slice(0,4)}`}:Be)},[X,Y,F]),U=x.useMemo(()=>NA(X),[X]),re=e_(G,R),de=P?" up-stale":"",pe=x.useMemo(()=>Y?mD(W,dp(e.agents.values(),t)):lx,[e,e.revision,W,Y,t]),ge=jD(X,{...E,cost:j},pe),Te=ge.hasCost,Ue=ge.tokenSum,He=Yl(ge.cost),Pe=Yl(ge.inputTokens),Se=Yl(ge.outputTokens),nt=Yl(ge.cacheReadTokens),je=Yl(ge.cacheCreateTokens),be=b.filter(ee=>ee.cost.total>0||ee.inputTokens+ee.outputTokens>0),Ke=T.filter(ee=>ee.cost>0||ee.inputTokens+ee.outputTokens>0),ct=Y?z.some(ee=>ee.cost<=0&&ee.tokens>0):be.some(ee=>!ee.priced),Ye=u||h,ce=n_(c==null?void 0:c.fetchedAt,w),ke=n_(p==null?void 0:p.fetchedAt,w),Ee=()=>{f(),m(),Q(ee=>ee+1)},Ze=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return l.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[l.jsxs("div",{className:"up-header",children:[l.jsx("h2",{children:"Usage"}),C&&l.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,l.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),l.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&l.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Ee,...aa(Ye),"aria-label":Ze,title:Ze,children:Ye?"…":"↻"}),l.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Claude quota",ce&&!u&&l.jsx("span",{className:"up-section-age",title:MD(c==null?void 0:c.source),children:ce})]}),c!=null&&c.ok?l.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&l.jsx(ea,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&l.jsx(ea,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&l.jsx(ea,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&l.jsx(ea,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?l.jsx(ea,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&l.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:LD(c.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&l.jsxs("section",{className:"up-section up-quota-section",children:[l.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&l.jsx("span",{className:"up-plan-badge",children:p.planLabel}),ke&&!h&&l.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:ke})]}),p!=null&&p.ok?l.jsxs("div",{className:"up-quota-bars",children:[(Xe=p.windows)==null?void 0:Xe.map(ee=>l.jsx(ea,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,limitReached:p.limitReached&&ee.pct>=100,nowSec:w},ee.id)),(ut=p.extraWindows)==null?void 0:ut.map(ee=>l.jsx(ea,{label:ee.label,pct:ee.pct,reset:ee.reset??void 0,resetAt:ee.resetAt??void 0,windowSec:ee.windowSec??void 0,nowSec:w},ee.id)),p.creditLimit&&l.jsx(ea,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&l.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&l.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&l.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Zt} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&l.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&l.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?l.jsxs("div",{className:"up-quota-na",children:[l.jsx("span",{children:"Quota unavailable."}),l.jsx("span",{className:"up-quota-hint",children:DD(p.reason)})]}):l.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&l.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
|
|
85
|
+
last 5h: ${wn(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[wn(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),Y&&l.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":O||void 0,onKeyDown:ee=>{var et;const Ne=$.current.indexOf(ee.target);if(Ne<0)return;const Be=xD(ee.key,Ne);Be!==null&&(ee.preventDefault(),(et=$.current[Be])==null||et.focus())},children:sh.map((ee,Ne)=>l.jsx("button",{type:"button",ref:Be=>{$.current[Ne]=Be},tabIndex:R===ee.key?0:-1,"aria-pressed":R===ee.key,"data-pending":R===ee.key&&O?"":void 0,title:R===ee.key&&O?`Reading ${ee.noun} from the transcripts on this machine…`:ee.hint,className:"uh-range-btn",onClick:()=>I(ee.key),children:ee.label},ee.key))}),Y&&l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:O?`Reading ${e_(R,R)}…`:""}),Ue>0?l.jsxs(l.Fragment,{children:[Te&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`up-total${de}`,title:Y?void 0:K1,children:[l.jsx("span",{className:"up-total-value",children:St(He)}),l.jsx("span",{className:"up-total-label",children:Y?re:aD})]}),ge.showCostBar&&l.jsx(Kx,{cost:j})]}),l.jsxs("div",{className:`up-tokens-row${de}`,title:Y?void 0:K1,children:[l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"in"}),wn(Pe)]}),l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"out"}),wn(Se)]}),ge.cacheReadTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache r"}),wn(nt)]}),ge.cacheCreateTokens>0&&l.jsxs("span",{className:"up-tok",children:[l.jsx("span",{className:"up-k",children:"cache c"}),wn(je)]}),!Te&&l.jsx("span",{className:"up-tok up-scope",children:oD})]}),(Y?z.length:be.length)>0&&l.jsxs("section",{className:`up-section${de}`,children:[l.jsx("h3",{className:"up-section-title",children:"By model"}),l.jsxs("table",{className:"up-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Tokens"}),l.jsx("th",{children:"Cost"})]})}),l.jsx("tbody",{children:Y?z.map(ee=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ee.model,children:po(ee.model)}),l.jsx("td",{className:"up-num",children:wn(ee.tokens)}),ee.cost>0?l.jsx("td",{className:"up-num up-cost-val",children:St(ee.cost)}):l.jsx("td",{className:"up-num up-unpriced",children:ji})]},ee.model)):be.map(ee=>l.jsxs("tr",{children:[l.jsx("td",{className:"up-model-name",title:ee.model===hp?"no model reported yet":ee.model,children:ee.model===hp?"unknown":po(ee.model)}),l.jsx("td",{className:"up-num",children:wn(ee.inputTokens+ee.outputTokens)}),ee.priced?l.jsx("td",{className:"up-num up-cost-val",children:St(ee.cost.total)}):l.jsx("td",{className:"up-num up-unpriced",children:ji})]},ee.model))})]})]}),Y&&Z.length===0&&U.tokens>0&&l.jsxs("section",{className:"up-section",children:[l.jsx("h3",{className:"up-section-title",children:"By session"}),l.jsxs("div",{className:"up-hint",children:["No session is dated ",re," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(Y?Z.length:Ke.length)>0&&(()=>{const ee=Y?Z.length:Ke.length;return l.jsxs("section",{className:`up-section${de}`,children:[l.jsx("h3",{className:"up-section-title",children:l.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":L,"aria-controls":"up-sessions",title:L?"Hide the per-session breakdown":`Show the per-session breakdown — ${ee} session${ee===1?"":"s"}`,onClick:()=>H(Ne=>!Ne),children:["By session",Y&&l.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${re}, each showing what that session has cost since it started.
|
|
86
|
+
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",re]}),l.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),l.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!L,children:[Y&&Z.map(Ne=>{const Be=oe.get(Ne.sessionId);return l.jsxs("div",{className:"up-session-row",children:[Be?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`sl-dot state-${Be}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:mc(Be)})]}):l.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),l.jsx("span",{className:`up-session-label${Ne.label?"":" up-session-id"}`,title:Ne.label?`${Ne.label}
|
|
87
|
+
${Ne.sessionId}`:Ne.sessionId,children:Ne.label??Ne.sessionId.slice(0,8)}),l.jsx("span",{className:"up-session-tokens",children:wn(Ne.tokens)}),Ne.cost>0?l.jsx("span",{className:"up-session-cost",title:Ne.models.join(", ")||void 0,children:St(Ne.cost)}):l.jsx("span",{className:"up-session-cost up-unpriced",children:ji})]},Ne.sessionId)}),!Y&&Ke.map(Ne=>l.jsxs("div",{className:"up-session-row",children:[l.jsx("span",{className:`sl-dot state-${Ne.state}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:mc(Ne.state)}),l.jsx("span",{className:"up-session-label",children:Ne.label}),l.jsx("span",{className:"up-session-tokens",children:wn(Ne.inputTokens+Ne.outputTokens)}),Ne.cost>0?l.jsxs("span",{className:"up-session-cost",title:Ne.unpricedTokens>0?`${wn(Ne.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[St(Ne.cost),Ne.unpricedTokens>0?"+":""]}):l.jsx("span",{className:"up-session-cost up-unpriced",children:ji})]},Ne.sessionId))]})]})})(),ct&&l.jsxs("div",{className:"up-hint",children:["“",ji,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):l.jsx("div",{className:"up-empty",children:Y?l.jsxs(l.Fragment,{children:["No usage ",re,".",l.jsx("br",{}),"Try a longer period."]}):l.jsxs(l.Fragment,{children:["No usage data yet.",l.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const cn={l:30,r:6,t:6,b:2},ta={l:0,r:0,t:2,b:1},oh=104,UD=64;function Tr(e,t=100,n=oh,s=cn){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function CA(e,t,n,s=100,a=oh,i=cn){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-i.l-i.r;return i.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${Tr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function TA(e,t,n,s=100,a=oh,i=cn){if(e.length<2)return"";const c=a-i.b,u=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)w+=`L${p(N.t).toFixed(1)} ${Tr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function WD(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function AA(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function HD(e,t,n=s=>ac(s)){const s=e.filter(c=>c.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function ac(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Xx(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),a=n%60;return a?`${s}h ${a}m`:`${s}h`}function GD({group:e,title:t,onClose:n}){const s=dn(n),[a,i]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&i(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&l.jsxs("span",{className:"hist-since",children:["since ",ac(u)," · ",Xx(u,f||Date.now())]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsx("div",{className:"hist-body",children:a==null?l.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?l.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>l.jsx(VD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function VD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[i,c]=x.useState(null);x.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const L=new ResizeObserver(([H])=>a(Math.max(160,H.contentRect.width)));return L.observe(I),()=>L.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w}=e,N=w?UD:oh,{now:_,peak:S}=WD(u),b=f==="C"?"°C":f,j=m==="Throttling"?HD(u,t):null,E=i!=null?u[i]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,T=I=>{const L=s-cn.l-cn.r;return cn.l+(C>0?L*(I-u[0].t)/C:L/2)},R=I=>{if(u.length<2)return;const L=I.currentTarget.getBoundingClientRect(),H=(I.clientX-L.left-cn.l)/Math.max(1,L.width-cn.l-cn.r),$=u[0].t+C*Math.max(0,Math.min(1,H));let V=0;for(let Q=1;Q<u.length;Q++)Math.abs(u[Q].t-$)<Math.abs(u[V].t-$)&&(V=Q);c(V)};return l.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[l.jsxs("div",{className:"hist-head",children:[l.jsx("span",{className:"hist-label",children:m}),l.jsxs("span",{className:"hist-stats",children:[_!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{children:_}),l.jsxs("span",{children:[b," now"]})]}),S!=null&&l.jsxs(l.Fragment,{children:[l.jsx("b",{className:AA(S,p,h),children:S}),l.jsxs("span",{children:[b," peak"]})]})]})]}),l.jsx("div",{className:"hist-plot",ref:n,children:l.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":_==null?`${m}: nothing measured yet`:`${m}: ${_}${b} now, peak ${S}${b}, over ${Xx(u[0].t,u[u.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([I,L])=>L==null||L>y?null:l.jsxs("g",{children:[l.jsx("line",{className:`hist-rule ${I}`,x1:cn.l,x2:s-cn.r,y1:Tr(L,y,N),y2:Tr(L,y,N)}),l.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:Tr(L,y,N)+3,children:L})]},I)),l.jsx("line",{className:"hist-floor",x1:cn.l,x2:s-cn.r,y1:N-cn.b,y2:N-cn.b}),l.jsx("path",{className:"hist-area",d:TA(u,s,t,y,N)}),l.jsx("path",{className:"hist-line",d:CA(u,s,t,y,N)}),u.length===1&&l.jsx("circle",{className:"hist-dot",cx:T(u[0].t),cy:Tr(u[0].v,y,N),r:3}),E&&l.jsxs("g",{children:[l.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:cn.t,y2:N-cn.b}),l.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:Tr(E.v,y,N),r:3})]})]})}),l.jsx("div",{className:"hist-axis",children:E?l.jsxs("span",{className:"hist-at",children:[ac(E.t)," — ",l.jsx("b",{children:E.v}),b]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:u.length?ac(u[0].t):""}),l.jsx("span",{children:u.length?ac(u[u.length-1].t):""})]})}),j&&l.jsx("div",{className:"hist-note",children:j})]})}const YD="thermal:Throttling";function KD(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[YD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function wd(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function nd(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:wd(e,t)}const s_=["cores","memory","load","thermal"],so=116,Gr=24,XD=60,ZD=6e4;function QD(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function JD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function eq(e,t=XD){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function tq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(s_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),ZD);return()=>{c=!1,clearInterval(f)}},[]);const s=x.useMemo(()=>KD(e),[e]),a=x.useMemo(()=>s_.flatMap(c=>{const u=t[c];return u?u.series.filter(QD).map(f=>({series:eq(f),stepMs:u.stepMs})):[]}),[t]),i=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?Xx(c,u):"less than a minute"},[a]);return Object.keys(s).length?l.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:c,stepMs:u})=>l.jsx(nq,{series:c,stepMs:u,now:s[c.key],span:i},c.key))}):null}function nq({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:c,warnAt:u,critAt:f}=e,p=JD(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":AA(h,u,f),y=Math.max(...a.map(N=>N.v));return l.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${wd(y,c)} over the last ${s}`,u!=null?`over ${nd(u,c)} is uncomfortable`:"",f!=null?`over ${nd(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[l.jsxs("div",{className:"pl-cell-head",children:[l.jsx("span",{className:"pl-cell-label",children:p}),l.jsx("span",{className:"pl-cell-now",children:h==null?"—":wd(h,c)})]}),l.jsxs("svg",{className:"pl-spark",width:so,height:Gr,viewBox:`0 0 ${so} ${Gr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[l.jsx("line",{className:"pl-spark-floor",x1:0,x2:so,y1:Gr-ta.b,y2:Gr-ta.b}),l.jsx("path",{className:"pl-spark-area",d:TA(a,so,t,i,Gr,ta)}),u!=null&&l.jsx("line",{className:"pl-rule warn",x1:0,x2:so,y1:Tr(u,i,Gr,ta),y2:Tr(u,i,Gr,ta)}),f!=null&&l.jsx("line",{className:"pl-rule hot",x1:0,x2:so,y1:Tr(f,i,Gr,ta),y2:Tr(f,i,Gr,ta)}),l.jsx("path",{className:"pl-spark-line",d:CA(a,so,t,i,Gr,ta)})]}),l.jsxs("span",{className:"vis-hidden",children:["peak ",wd(y,c)," over the last ",s,u!=null&&`, uncomfortable over ${nd(u,c)}`,f!=null&&`, the machine acts over ${nd(f,c)}`]})]})}const rq={key:"cpu",dir:"desc"};function sq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function aq(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,c)=>{if(t.key==="name")return n*i.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=s(i),f=s(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((i,c)=>a(i,c)||(c.cpu??-1)-(i.cpu??-1)||c.mem-i.mem||i.pid-c.pid)}function oq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const iq=4e3;function lq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const c=await i.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,iq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function cq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function uq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function dq({sys:e,onClose:t}){const n=dn(t),[s,a]=x.useState(rq),i=lq(),c=i?aq(i.procs,s):null;return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[l.jsxs("div",{className:"modal-head",children:[l.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&l.jsxs("span",{className:"pl-count",children:[c.length," of ",i.total," running"]}),l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),l.jsxs("div",{className:"pl-split",children:[l.jsx("div",{className:"pl-body",children:c==null?l.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?l.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):l.jsxs("table",{className:"sd-procs pl-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(_i,{col:"cpu",label:"cpu",sort:s,onSort:a}),l.jsx(_i,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:s,onSort:a}),l.jsx(_i,{col:"threads",label:"threads",sort:s,onSort:a}),l.jsx(_i,{col:"uptime",label:"up",sort:s,onSort:a}),l.jsx(_i,{col:"user",label:"user",sort:s,onSort:a}),l.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),l.jsx(_i,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),l.jsx("tbody",{children:c.map(u=>l.jsxs("tr",{children:[l.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),l.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:cq(u.rssBytes)}),l.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),l.jsx("td",{className:"sd-num sd-dim",children:uq(u.uptimeSec)}),l.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),l.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),l.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&l.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),l.jsx(tq,{sys:e})]})]})}),document.body)}function _i({col:e,label:t,note:n,sort:s,onSort:a}){const i=oq(s,e);return l.jsx("th",{scope:"col","aria-sort":i,children:l.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
88
88
|
|
|
89
|
-
${n}`:`Sort by ${t}`,onClick:()=>a(sq(s,e)),children:[t,l.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const hq=3e3;function fq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function pq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${mq(t.lastMs,n)}`:"running at full speed, and never held back"}}function mq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function Vl(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function gq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function yq(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,hq))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}i(),a()};return i(),document.addEventListener("visibilitychange",u),()=>{s=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function a_({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return l.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[l.jsxs("div",{className:"sd-head",children:[l.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&l.jsx("span",{className:"sd-sub",children:n}),l.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function wq({usageOpen:e,leaving:t,onClose:n}){const s=yq();if(!s||s.cpu==null||!s.memory)return l.jsx(a_,{usageOpen:e,leaving:t,onClose:n,children:l.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:i,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m}=s,y=a?a.total-a.available:0,w=h==="win32"?"Commit":"Swap",N=i&&i.total>0?i.used/i.total*100:0;return l.jsxs(a_,{usageOpen:e,leaving:t,sub:`up ${gq(p)} · ${f} cores`,onClose:n,children:[c&&c.length>0&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:l.jsx(xd,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:l.jsx("div",{className:"sd-cores",children:c.map((_,j)=>l.jsx("span",{className:"sd-core",title:`core ${j+1}: ${_}%`,children:l.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},j))})})}),l.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:l.jsxs(xd,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&l.jsx(Dd,{label:"Physical",value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Vl(y)})," of ",Vl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${Vl(a.available)} available`}),i&&i.total>0&&l.jsx(Dd,{label:w,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Vl(i.used)})," of ",Vl(i.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),u&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:l.jsxs(xd,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[l.jsx("div",{className:"sd-load",children:u.map((_,j)=>l.jsxs("span",{className:`sd-load-item${_>f?" over":""}`,children:[l.jsx("b",{children:_.toFixed(2)}),l.jsx("span",{children:["1m","5m","15m"][j]})]},j))}),l.jsx("div",{className:"sd-note",children:u[0]>f?`${(u[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]})}),l.jsx(vq,{thermal:m}),l.jsx(xq,{sys:s})]})}function xd({group:e,title:t,action:n,label:s,children:a}){const[i,c]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[l.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",l.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&l.jsx(GD,{group:e,title:t,onClose:()=>c(!1)})]})}function vq({thermal:e}){if(!e)return null;const t=e.throttle?pq(e.throttle.speedLimit,e.heldBack):null;return l.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:l.jsxs(xd,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>l.jsx(Dd,{label:n.label,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:fq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&l.jsx(Dd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function xq({sys:e}){const[t,n]=x.useState(!1);return l.jsxs("div",{className:"sd-section sd-door-section",children:[l.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:l.jsxs("span",{className:"sd-door-plate",children:[l.jsxs("span",{className:"sd-door-name",children:["Busiest processes",l.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&l.jsx(dq,{sys:e,onClose:()=>n(!1)})]})}function Dd({label:e,value:t,pct:n,tone:s="calm",note:a}){return l.jsxs("div",{className:"sd-row",children:[l.jsxs("div",{className:"sd-row-head",children:[l.jsx("span",{className:"sd-row-label",children:e}),l.jsx("span",{className:"sd-row-val",children:t})]}),l.jsx("span",{className:"sd-track",children:l.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&l.jsx("div",{className:"sd-note",children:a})]})}const o_=18,bq=1100,ki=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},kq=Array.from({length:o_},(e,t)=>{const n=-72+144*t/(o_-1)+(ki(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+ki(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+ki(t,3)*260),delay:Math.round(ki(t,4)*90),dur:760+Math.round(ki(t,5)*260),scale:.8+ki(t,6)*.45,hue:t%4,round:t%3===0}});function i_({anchor:e}){var a;const[t,n]=x.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const c=i.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),bq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:Kr.createPortal(l.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:kq.map((i,c)=>l.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},c))}),document.body)}const RA=new Set(["awaiting_url","awaiting_code","registering"]);function _q(e){return e!=null&&RA.has(e)}function MA(e){return e!=null&&e!=="done"&&!RA.has(e)}const Nq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Sq="the sign-in did not complete";function jq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Nq:Sq)}}function Eq({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}const Cq="done";function Tq(){let e=!1;return{shouldAnnounce(t){return t!==Cq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Zx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const Aq={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},Rq={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},Mq=`claude-swap could not read the login keychain — start ${Zt} from a Terminal window rather than a background service`;function ux(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(mc(e)))return Mq;const n=Zx(Rq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function mc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Iq={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},$q="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function Oq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const Pq="ccusage could not be started — the deck launched npx and Node could not load the npm script it points at. An older deck asked cmd.exe for a bare npx.cmd, which made the shim look for that script under the deck's working directory instead of beside itself; update the deck and reopen this modal",Lq="ccusage could not be started — the copy npx fetched will not load: Node could not resolve a file inside it. That copy is in npx's own cache, which the deck never rewrites, so clear it with `npm cache clean --force` and reopen this modal",Dq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),qq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,Fq=/[\\/]_npx[\\/]/i,Bq=`the copy of ccusage ${Zt} installed for itself`;function zq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function K7(e,t){const n=Uq(e,t),s=zq(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${Yl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Yl(n)}`;case"managed":return`${Bq} failed to run: ${Yl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Yl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Yl(n)}`;default:return n}}const Yl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function Uq(e,t){const n=mc(e);if(Dq(n)){if(Fq.test(n))return Lq;if(qq.test(n))return Pq}if(Oq(n))return $q;const s=Zx(Iq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ei(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&MA(e.state))return e.error;const n=Zx(Aq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function Wq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function IA(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function Hq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function Gq(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function Vq(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function Yq(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const u=n("present");u&&s.push(`${u} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const Kq=1500,rd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],l_="aa-panel",c_=e=>`aa-tab-${e}`;async function Kl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const dx=pe.forwardRef((e,t)=>l.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[l.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),l.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));dx.displayName="SuccessMark";function Xq({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[N,_]=x.useState(null),[j,k]=x.useState(null),[S,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),I=x.useRef(null),F=x.useRef(null),W=x.useRef(null),O=x.useRef(null),B=x.useRef([]),Z=x.useRef(!1),Q=x.useCallback(()=>{T.current&&Kl({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=dn(Q,{focusRef:W}),K=x.useCallback(async()=>{if(!ys(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const z=await Kl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"could not start the sign-in"));return}i(z)},[]);x.useEffect(()=>{if(!_q(a==null?void 0:a.state))return;const z=window.setInterval(async()=>{try{const re=await fetch("/api/claude-accounts/login");re.ok&&i(await re.json())}catch{}},Kq);return()=>window.clearInterval(z)},[a]);const G=x.useRef(t);G.current=t;const P=x.useState(Tq)[0];x.useEffect(()=>{var z;(a==null?void 0:a.state)==="awaiting_code"&&((z=I.current)==null||z.focus()),P.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,P]),x.useEffect(()=>{var z;n==="paste"&&!Z.current&&((z=F.current)==null||z.focus()),Z.current=!1},[n]);const H=x.useCallback(z=>{var le;const re=Wq(z,rd.findIndex(me=>me.id===n),rd.length);re.kind!=="pass"&&(z.preventDefault(),Z.current=!0,s(rd[re.index].id),(le=B.current[re.index])==null||le.focus())},[n]),L=x.useCallback(async()=>{var re;if(!ys(R.current))return;R.current=!0,m(!0),w(null);const z=await Kl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"the code was not accepted")),z!=null&&z.state&&i(z),(re=I.current)==null||re.select();return}u(""),i(z)},[c,a]),U=x.useCallback(async()=>{if(!ys(R.current))return;R.current=!0,m(!0),w(null);const z=await Kl({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(z!=null&&z.ok)){w(Ei(z,"the import failed"));return}C.current=f,p(""),E(null),_(z.results??[]),t()},[f,t]),$=x.useCallback(async z=>{const re=`${z.email}|${z.org??""}`;if(!ys(R.current)||!C.current)return;R.current=!0,m(!0),k(re),E(null);const le=await Kl({action:"import",blob:C.current,force:!0,only:{email:z.email,org:z.org??""}}).catch(()=>null);if(R.current=!1,m(!1),k(null),!(le!=null&&le.ok)){E({key:re,text:Ei(le,"that account could not be updated")});return}const me=(le.results??[])[0];me&&_(ge=>ge&&ge.map(Me=>`${Me.email}|${Me.org??""}`===re?me:Me)),t()},[t]),V=(a==null?void 0:a.state)==="done"?a.account:null,he=Eq({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),Y=MA(a==null?void 0:a.state)||!!(y&&T.current&&!h),J=jq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:Q,role:"presentation",children:l.jsxs("div",{ref:M,className:"modal aa-modal",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:H,children:rd.map((z,re)=>l.jsx("button",{type:"button",role:"tab",id:c_(z.id),ref:le=>{B.current[re]=le},"aria-selected":n===z.id,"aria-controls":l_,tabIndex:n===z.id?0:-1,className:`aa-tab${n===z.id?" on":""}`,onClick:()=>{Z.current=!1,s(z.id)},children:z.label},z.id))})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:Q,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body aa-body",id:l_,role:"tabpanel","aria-labelledby":c_(n),children:n==="login"?V?l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:O}),l.jsx(i_,{anchor:O}),l.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),l.jsxs("p",{className:"aa-note",children:[l.jsx("strong",{children:V.email}),V.added?he?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),he?l.jsx("p",{className:"aa-note aa-warn",role:"status",children:he}):null,l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"1 · Approve in the browser"}),l.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),l.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),l.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:I,type:"text",value:c,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&c.trim()&&!h&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),l.jsx("button",{type:"button",className:"btn primary",...sa(h,!c.trim()||a.state==="registering"),onClick:L,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&l.jsx("p",{className:"aa-err",children:y??a.error}),l.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):Y?l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:J.title}),l.jsx("p",{className:"aa-err",children:J.message}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,i(null),w(null),K()},children:"Try again"})]}):h||T.current?l.jsx("div",{className:"aa-step",children:l.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):l.jsxs("div",{className:"aa-step aa-primer",children:[l.jsx("h4",{children:"Sign in to Anthropic"}),l.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),l.jsx("div",{className:"aa-actions",children:l.jsx("button",{type:"button",ref:W,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):N?(()=>{const z=N.filter(re=>re.state==="imported").length;return l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:O}),z>0&&l.jsx(i_,{anchor:O}),l.jsx("h4",{children:Yq(N)}),N.length>0&&l.jsx("ul",{className:"aa-results",children:N.map(re=>{const le=`${re.email}|${re.org??""}`;return l.jsxs("li",{className:`aa-result ${re.state}`,children:[l.jsx("span",{className:"aa-result-who",children:re.email||(re.num?`slot ${re.num}`:"an account")}),l.jsx("span",{className:"aa-result-what",children:Vq(re.state)}),re.state==="present"&&l.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":j===le,title:`Overwrite the stored login for ${re.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(re),children:j===le?"updating…":"update anyway"}),(S==null?void 0:S.key)===le&&l.jsx("span",{className:"aa-result-err",children:S.text})]},le)})}),l.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",l.jsx("strong",{children:" update anyway"}),"."]}),l.jsxs("div",{className:"aa-actions",children:[l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"Paste an account shared from another deck"}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:F,type:"text",value:f,onChange:z=>p(z.target.value),onKeyDown:z=>{z.key==="Enter"&&f.trim()&&!h&&U()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),l.jsx("button",{type:"button",className:"btn primary",...sa(h,!f.trim()),onClick:U,children:h?"importing…":"Import"})]}),y&&l.jsx("p",{className:"aa-err",children:y}),l.jsxs("p",{className:"aa-note",children:["Use ",l.jsx("strong",{children:"share"})," on one account in the other deck, or ",l.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function Zq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:s===-1?0:(s+1)%n};case"ArrowUp":return{kind:"focus",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const sd=4,Xl=8;function Qq(e,t,n){const s=n.height-Xl-(e.bottom+sd),a=e.top-sd-Xl,i=t.height<=s||s>=a?"below":"above",c=i==="below"?s:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=i==="below"?e.bottom+sd:e.top-sd-f,h=Math.max(Xl,Math.min(e.right-t.width,n.width-Xl-t.width));return{top:Math.max(Xl,p),left:h,side:i,maxHeight:u?null:f}}const $A='[role="menuitem"]';function u_(e){return e?Array.from(e.querySelectorAll($A)).filter(t=>!t.disabled):[]}function d_({anchorId:e,boundaryId:t,id:n,className:s,role:a,labelledBy:i,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=dn(()=>{var _;(_=document.getElementById(e))==null||_.focus(),p.current()}),m=x.useCallback(()=>{var C;const _=h.current;if(!_)return;const j=document.getElementById(e);if(!j){p.current();return}const k=j.getBoundingClientRect(),S=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(S&&(k.bottom<=S.top||k.top>=S.bottom)){_.contains(document.activeElement)&&j.focus({preventScroll:!0}),p.current();return}_.style.maxHeight="";const E=Qq(k,{width:_.offsetWidth,height:_.offsetHeight},{width:window.innerWidth,height:window.innerHeight});_.style.top=`${E.top}px`,_.style.left=`${E.left}px`,_.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,_.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const _=j=>{var k;(k=h.current)!=null&&k.contains(j.target)||m()};return window.addEventListener("scroll",_,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const _=j=>{var S,E;const k=j.target;!k||(S=h.current)!=null&&S.contains(k)||(E=document.getElementById(e))!=null&&E.contains(k)||p.current()};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[e,h]),x.useEffect(()=>{var j;if(a!=="menu")return;const _=u_(h.current);(j=c==="last"?_[_.length-1]:_[0])==null||j.focus()},[]);const y=_=>{var j;if(a==="menu"&&_.key==="Tab"){_.stopPropagation(),(j=document.getElementById(e))==null||j.focus(),_.shiftKey&&_.preventDefault(),p.current();return}if(a==="menu"){const k=u_(h.current),S=Zq(_,k.indexOf(document.activeElement),k.length);S.kind==="focus"&&(_.preventDefault(),k[S.index].focus())}_.key.length===1&&_.stopPropagation()},w=_=>{_.target.closest("button, input, select, textarea, code")||_.preventDefault()},N=_=>{if(a!=="menu"||_.pointerType==="touch")return;const j=_.target.closest($A);j&&!j.disabled&&document.activeElement!==j&&j.focus({preventScroll:!0})};return Kr.createPortal(l.jsx("div",{ref:h,id:n,className:`anchored-popover${s?` ${s}`:""}`,role:a,"aria-labelledby":i,onKeyDown:y,onMouseDown:w,onPointerMove:N,children:f}),document.body)}async function Jq(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const eF=1800;function tF({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[i,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),j=x.useRef(!1),k=dn(t,{focusRef:_});x.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const O=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(O)},[i]);const S=Hq(e),E=e.filter(O=>!s.includes(O.num)).map(O=>O.num),C=E.length===e.length,T=O=>a(B=>B.includes(O)?B.filter(Z=>Z!==O):[...B,O]),R=x.useCallback(async()=>{if(!ys(j.current)||!E.length)return;j.current=!0,f(!0),h(null),y(!1);const O=await Jq({action:"share",accounts:E}).catch(()=>null);if(j.current=!1,f(!1),!(O!=null&&O.ok)){h(Ei(O,"the share could not be made"));return}c({blob:O.blob,expiresAt:O.expiresAt,shared:O.shared??[],failed:O.failed??[]})},[e,E]),I=i?IA(i.expiresAt,w):null,F=(I==null?void 0:I.tone)==="gone",W=(i==null?void 0:i.shared.length)??0;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:k,className:"modal sa-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("h3",{children:"Share accounts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body sa-body",children:i?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:F?"This share has expired":W===1?"1 account, ready to paste":`${W} accounts, ready to paste`}),l.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:i.blob}),l.jsxs("div",{className:"ap-share-foot",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(F){c(null),R();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),eF))},children:F?"make a new share":m?"copied":`copy ${W===1?"the share":"all "+W}`}),l.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[l.jsx("span",{className:"ap-share-warn",children:W===1?"this is the password":`this is ${W} passwords`})," · ",l.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&l.jsxs("div",{className:"sa-failed",role:"alert",children:[l.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),l.jsx("ul",{className:"sa-list",children:i.failed.map(O=>{var Z;const B=!!(O.email&&((Z=O.detail)!=null&&Z.includes(O.email)));return l.jsxs("li",{children:[!B&&l.jsx("span",{className:"sa-who",children:O.email||`account ${O.num}`}),l.jsx("span",{className:"sa-why",children:O.detail||"could not be exported"})]},`${O.num}-${O.email}`)})})]}),l.jsx("p",{className:"sa-note",children:F?l.jsx(l.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):l.jsxs(l.Fragment,{children:["Paste it into the other deck with ",l.jsx("strong",{children:"+"})," → ",l.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),l.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:"Nothing to share"}),l.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",l.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),l.jsx("div",{className:"sa-actions",children:l.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):l.jsxs("div",{className:"sa-step",children:[l.jsxs("h4",{children:["Which accounts go to the other ",Zt,"?"]}),l.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:Gq(E.length)}),l.jsx("ul",{className:"sa-list sa-pick",children:S.map(O=>l.jsx("li",{children:l.jsxs("label",{className:"sa-row",children:[l.jsx("input",{type:"checkbox",checked:E.includes(O.num),onChange:()=>T(O.num)}),l.jsx("span",{className:"sa-who",children:O.label}),O.sub&&l.jsx("span",{className:"sa-sub",children:O.sub})]})},O.num))}),p&&l.jsx("p",{className:"aa-err",children:p}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(O=>O.num):[]),children:C?"Clear all":"Select all"}),l.jsx("button",{type:"button",className:"btn primary",ref:_,...sa(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function nF(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function rF(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:a&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:s,displaced:t}:null}}function sF(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function aF(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function oF(e,t){return{label:"save",done:"saved",sends:e!==t,swaps:!1,title:`Switch the active account out once it passes ${e}% of its limit.`}}function h_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function iF(e){const t=e.filter(u=>!h_(u)),n=e.filter(u=>h_(u)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)i&&u.pct<=i.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:s,rest:a,fuller:c,peak:c??i}}const lF="\0";function Qx(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${lF}${n}`}function cF(e,t){const n=Qx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function uF(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Qx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const dF=64;function hF(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const fF=Object.freeze({text:"couldn't reach the deck server",reload:!0}),pF=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function f_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function mF(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=mc(t.body);return{text:ux(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function p_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}function OA({title:e,steps:t,finish:n,aside:s,onClose:a}){const i=x.useRef(null),c=dn(a,{focusRef:i}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=N=>f(Math.max(0,Math.min(t.length-1,N))),y=N=>{N.key!=="ArrowRight"&&N.key!=="ArrowLeft"||(N.preventDefault(),N.stopPropagation(),m(N.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),l.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("div",{className:"guide-stage",children:h.art},u),l.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),l.jsx("p",{className:"guide-tip",children:h.tip??""}),l.jsxs("div",{className:"guide-foot",children:[l.jsx("div",{className:"guide-dots",children:t.map((N,_)=>l.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===u?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&l.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),u>0&&l.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),l.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const hx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function lr({children:e}){return l.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function ir({x:e,y:t=34,w:n=176,h:s=132,label:a}){return l.jsxs(l.Fragment,{children:[a&&l.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),l.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function Ar({x:e,y:t,email:n,state:s,tone:a,bars:i}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:hx[a]}),l.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),l.jsx("text",{x:e+12,y:t+16,className:`ga-s ${hx[a]}`,children:s}),i==null?void 0:i.map((c,u)=>l.jsxs("g",{children:[l.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),l.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function PA({x:e,y:t,on:n}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),l.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function ad({x:e,y:t,name:n,here:s=!0}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),l.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function m_({x:e,y:t,on:n}){return n?l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),l.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):l.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function g_({x:e,y:t,d:n}){return l.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function Jx({x:e,y:t}){return l.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function e0(){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{r:9,className:"ga-key-bed"}),l.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[l.jsx("circle",{cx:4.6,cy:7,r:2.6}),l.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Ci({x:e,y:t,w:n,title:s,sub:a,tone:i}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),l.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:hx[i]}),l.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),l.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function Mi({x:e,y:t,label:n,live:s}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),l.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function qd({x:e,y:t}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),l.jsx(PA,{x:e+118,y:t-13,on:!0})]})}function gF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),l.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),l.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),l.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),l.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),l.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),l.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),l.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),l.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),l.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),l.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),l.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),l.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),l.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),l.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),l.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),l.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),l.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),l.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),l.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),l.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function yF(){return l.jsxs(lr,{children:[l.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),l.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),l.jsx(Ci,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),l.jsx(Ci,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),l.jsx(Ci,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),l.jsx(Ci,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),l.jsx(Mi,{x:326,y:28,label:"Read"}),l.jsx(Mi,{x:380,y:28,label:"Grep",live:!0}),l.jsx(Mi,{x:326,y:90,label:"Bash",live:!0})]})}function y_({x:e,y:t,label:n,pct:s,note:a}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-s",children:n}),l.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),l.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function wF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),l.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),l.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),l.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),l.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),l.jsx(y_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),l.jsx(y_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function vF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),l.jsx(Ci,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),l.jsx(Jx,{x:156,y:106}),l.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),l.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:200,y:22,w:226,h:160}),l.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),l.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),l.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),l.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),l.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),l.jsx(Mi,{x:214,y:122,label:"Read"}),l.jsx(Mi,{x:266,y:122,label:"Edit"}),l.jsx(Mi,{x:318,y:122,label:"Bash",live:!0}),l.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),l.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function xF(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:20,w:412,h:160}),l.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),l.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),l.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>l.jsxs("g",{children:[l.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),l.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),l.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),l.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),l.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),l.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),l.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),l.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),l.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),l.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),l.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),l.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function bF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),l.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),l.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[l.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),l.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),l.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),l.jsx("path",{d:"M210 100H238",className:"ga-arc"}),l.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),l.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Ci,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function kF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:16,w:232,h:170}),l.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),l.jsx(g_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),l.jsx(g_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),l.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),l.jsx(Ar,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),l.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),l.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),l.jsx(Ar,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),l.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),l.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),l.jsx(Jx,{x:221,y:161}),l.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),l.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Ar,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function _F(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(qd,{x:28,y:60}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Ar,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Ar,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(qd,{x:264,y:60}),l.jsx(Ar,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),l.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:l.jsx(e0,{})})]})}const NF=[{art:l.jsx(gF,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:l.jsx(yF,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:l.jsx(vF,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:l.jsx(wF,{}),line:"What each session costs, and how much quota is left."},{art:l.jsx(xF,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:l.jsx(kF,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:l.jsx(_F,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:l.jsx(bF,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function SF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),l.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),l.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),l.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Ar,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function jF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(qd,{x:28,y:60}),l.jsx(ad,{x:28,y:92,name:"Ana's MacBook"}),l.jsx(ad,{x:28,y:114,name:"Dorin's PC"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(qd,{x:264,y:60}),l.jsx(ad,{x:264,y:92,name:"Your MacBook"}),l.jsx(ad,{x:264,y:114,name:"Dorin's PC"}),l.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),l.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function EF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),l.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),l.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),l.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),l.jsx(m_,{x:106,y:88,on:!0}),l.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),l.jsx(m_,{x:106,y:112}),l.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),l.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),l.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),l.jsx(PA,{x:304,y:157,on:!0}),l.jsx(Jx,{x:115,y:97})]})}function CF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Ar,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Ar,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),l.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:l.jsx(e0,{})})]})}const TF=[{art:l.jsx(SF,{}),line:"A login can expire on one machine while it still works on another."},{art:l.jsx(jF,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:l.jsx(EF,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:l.jsx(CF,{}),line:"An expired login is copied from a paired machine within a minute."}];function AF(){return l.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[l.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),l.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),l.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),l.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),l.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),l.jsx("g",{transform:"translate(116 13)",children:l.jsx(e0,{})})]})}async function fp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const RF={not_an_invite:"That is not an invite — paste the whole line they sent you.",expired:"That invite has run out. Ask them for a fresh one.",not_running:"This deck is not on the network yet. Turn Local network on, then try again."},MF={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function w_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Xt(n,t)}function IF({status:e,manual:t,onClose:n,onChanged:s}){var P,H;const a=x.useRef(null),i=dn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState(null),[j,k]=x.useState(null),[S,E]=x.useState(()=>Date.now());x.useEffect(()=>{const L=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(L)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback(L=>ah(T.current)?(T.current=L,_(L),!0):!1,[]),I=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),F=L=>{const U=la(N,L);return{disabled:U.disabled,"aria-busy":U.busy}},W=L=>(h==null?void 0:h.field)===L?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},O=L=>m(U=>U&&U.field===L?null:U),B=x.useCallback(async()=>{const L=GF(c);if(!L){m({text:$F(c),field:"addr"});return}const U=`${L.addr}:${L.port}`,$=e.peers.find(V=>V.addr===L.addr&&V.port===L.port&&V.paired);if($){m({text:`Already paired with ${$.name} at that address.`,field:"addr"});return}if(t.includes(U)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await fp("/api/prefs",{lan:{manual:[...t,U]}});if(!C.current)return;V!=null&&V.ok?(m(null),u(""),s(),n()):m({text:Xt("add that address",V),field:"addr"})}catch{C.current&&m({text:Xt("add that address",null),field:"addr"})}finally{I()}},[c,t,e.peers,s,n,R,I]),Z=x.useCallback(async L=>{if(!R(`invite:${L}`))return;const U=L==="make"?"make an invite":"cancel that invite";try{const $=await fp("/api/lan/invite",{action:L});if(!C.current)return;$!=null&&$.ok?(m(null),w(null),s()):m({text:w_(MF,$,U)})}catch{C.current&&m({text:Xt(U,null)})}finally{I()}},[s,R,I]),Q=x.useCallback(async()=>{const L=f.trim();if(!(!L||!R("join"))){k(null);try{const U=await fp("/api/lan/invite",{action:"join",token:L});if(!C.current)return;U!=null&&U.ok?(p(""),m(null),s(),n()):(U==null?void 0:U.reason)==="unreachable"&&Array.isArray(U.tried)&&U.tried.length?(k(U.tried),m(null)):(k(null),m({text:w_(RF,U,"use that invite"),field:"join"}))}catch{C.current&&m({text:Xt("use that invite",null),field:"join"})}finally{I()}}},[f,s,n,R,I]),M=x.useCallback(async(L,U)=>{try{await navigator.clipboard.writeText(L),w(U),window.setTimeout(()=>{C.current&&w($=>$===U?null:$)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),K=e.invite&&e.invite.expiresAt>S?e.invite:null,G=((P=e.reach)==null?void 0:P.steps)??[];return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal lan-add",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[h&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((H=e.reach)==null?void 0:H.blocked)&&l.jsxs("div",{className:"ap-lan-reach",children:[l.jsx("p",{className:"lan-warn",children:e.reach.text}),l.jsx("p",{className:"lan-note",children:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."}),G.length>0&&l.jsxs("details",{className:"ap-lan-reach-fix",children:[l.jsx("summary",{children:"or let them find this deck on their own"}),l.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",l.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&l.jsx(l.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),l.jsx("pre",{className:"ap-lan-cmd",children:l.jsx("code",{children:G.join(`
|
|
90
|
-
`)})}),l.jsx("button",{type:"button",className:"ap-manage-btn",...
|
|
91
|
-
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"By address"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...W("addr"),onChange:L=>{u(L.target.value),O("addr")},onKeyDown:L=>{L.key==="Enter"&&B()}}),c.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...F("add"),onClick:()=>void B(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),l.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:["With an invite",!K&&l.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...F("invite:make"),onClick:()=>void Z("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...W("join"),onChange:L=>{p(L.target.value),k(null),O("join")},onKeyDown:L=>{L.key==="Enter"&&Q()}}),f.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...F("join"),onClick:()=>void Q(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),l.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),j&&l.jsxs("div",{className:"ap-lan-tried",children:[l.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),j.map(L=>l.jsxs("span",{className:"ap-lan-tried-row",children:[l.jsx("code",{className:"ap-lan-code",children:L.addr}),l.jsx("span",{className:"ap-lan-bad",children:L.why})]},L.addr))]}),K&&l.jsxs("div",{className:"ap-lan-invite",children:[l.jsxs("div",{className:"ap-lan-invite-head",children:[l.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),l.jsxs("span",{className:"ap-lan-invite-left",children:[YF(K.expiresAt,S)," left"]})]}),l.jsx("code",{className:"ap-lan-token",children:K.token}),l.jsxs("div",{className:"ap-lan-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...F("copy:invite"),onClick:()=>void M(K.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...F("invite:withdraw"),onClick:()=>void Z("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),l.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function $F(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const OF=1e3;function PF(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Vr(e,t);return`${n} · ${s==="now"?"just now":s}`}function v_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function LF(){return l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),l.jsx("path",{d:"M8.4 3.6l2 2"})]})}function x_(){return l.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),l.jsx("path",{d:"M1 13h14"})]})}function od({dir:e,gate:t=!1}){const n=t?12:8;return l.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const DF={works:"works here",expired:"expired here",missing:"not on this deck"},qF={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function FF(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${DF[e.here]}, ${qF[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function BF({row:e,source:t,status:n,accounts:s,now:a,busy:i,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var it,bt,nt,pt;const w=x.useRef(null),N=dn(c,{focusRef:w}),[_,j]=x.useState(null),[k,S]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,I]=x.useState(null),[F,W]=x.useState(!1),[O,B]=x.useState(0),Z=x.useRef(null),Q=x.useRef(!0);x.useEffect(()=>()=>{Q.current=!1},[]);const M=_!=null;x.useEffect(()=>{var fe;M&&((fe=Z.current)==null||fe.select())},[M]),x.useEffect(()=>{if(!E)return;const fe=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(fe)},[E]),x.useEffect(()=>{if(!R)return;const fe=window.setTimeout(()=>I(null),4e3);return()=>window.clearTimeout(fe)},[R]);const K=fe=>{const lt=la(i,fe);return{disabled:lt.disabled,"aria-busy":lt.busy}},G=async fe=>{const lt=await fe();return Q.current&&S(lt),lt==null},{peer:P,stranger:H}=t,L=e.kind==="paired",U=e.self??e.name,$=e.kind!=="dialling",V=e.kind==="dialling"?null:e.fp,he=P?P.addr?`${P.addr}:${P.port}`:"":H?H.port?`${H.addr}:${H.port}`:H.addr:e.addr,Y=(P==null?void 0:P.about)??null,J=((it=n.about)==null?void 0:it.version)??null,z=async fe=>{const lt=fe.trim()===U?"":fe;await G(()=>u(lt))&&j(null)},re=async()=>{if(V)try{if(await navigator.clipboard.writeText(V),!Q.current)return;W(!0),window.setTimeout(()=>{Q.current&&W(!1)},1600)}catch{Q.current&&S("Could not copy it — select the fingerprint and copy it by hand.")}},le=L?P!=null&&P.waiting?P.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":P!=null&&P.offers?"not said — it runs an older version":"not reached yet":"shown once paired",me=v_(n.about),ge=v_(Y),Me=Y!=null&&Y.version&&J?t8(Y.version,J):null,qe=P?LA(P.last,a):null,Ve=(bt=P==null?void 0:P.last)!=null&&bt.error&&qe&&qe.text!==P.last.error?P.last.error:null,Ue=((nt=P==null?void 0:P.last)==null?void 0:nt.done)??[],Se=!!qe&&!!Ve&&!e.quiet&&e.state.startsWith(qe.text),Qe=L||e.kind==="dialling",Ne=P?P.waiting?null:P.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",_e=e.tone==="bad"?"bad":L?e.here?"up":"down":"loose",ue=i===`check:${e.fp}`,je=(P==null?void 0:P.offers)??null,Ce=_e==="up"?(je==null?void 0:je.current)??null:null,Fe=Ce&&"key"in Ce?Ce.key:null,We=!!Ce&&"hidden"in Ce,He=!!Ce&&"other"in Ce,ot=L?r8((je==null?void 0:je.accounts)??null,s,n.shared??[],Fe):[],wt=ot.filter(fe=>fe.in==null&&fe.out==="cut"),ut=ot.some(fe=>fe.in!=null),ee=ot.some(fe=>fe.out!=null),ke=new Map(Ue.map(fe=>[fe.email,fe])),Be=Ue.filter(fe=>!ot.some(lt=>lt.email===fe.email)),et=L?je?je.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:P!=null&&P.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(pt=P==null?void 0:P.last)!=null&&pt.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,ht=je&&(P!=null&&P.last)&&P.last.at-je.at>OF?Vr(je.at,a):null,Je=[];L&&(P!=null&&P.pairedAt)?Je.push({label:"Paired",value:PF(P.pairedAt,a),tone:"meta"}):e.kind==="declined"&&H&&Je.push({label:"Paired",value:`no · you said no ${n0(H.at,a)}`,tone:"meta"}),Je.push({label:"Fingerprint",value:V?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:V}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void re(),"aria-label":F?"Fingerprint copied":"Copy the fingerprint",children:F?"copied":"copy"})]}):"not known — nothing has answered there",tone:V?void 0:"quiet"});const tt=m.length?[{row:e,peer:P??null},...m]:[];return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:fe=>fe.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[l.jsxs("header",{className:"modal-head lan-peer-head",children:[l.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsxs("div",{className:"lan-peer-id",children:[M?l.jsxs("form",{className:"lan-peer-edit",onSubmit:fe=>{fe.preventDefault(),z(_??"")},children:[l.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),l.jsx("input",{ref:Z,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:U,"aria-label":"Name for this deck, shown on this deck only",onChange:fe=>j(fe.target.value)}),l.jsx("button",{type:"submit",className:"ap-manage-btn",...K(`alias:${e.fp}`),children:"save"}),l.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(null),children:"cancel"})]}):l.jsxs("span",{className:"lan-peer-title",children:[l.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),$&&l.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{S(null),j(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:l.jsx(LF,{})})]}),l.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&l.jsxs(l.Fragment,{children:["calls itself ",l.jsx("span",{className:"lan-peer-self",children:e.self}),M&&l.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...K(`alias:${e.fp}`),onClick:()=>void z(""),children:"use this name"}),l.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&l.jsx("span",{"aria-hidden":!0,children:" · "})]}),l.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body lan-peer-body",children:[k&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:k}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>S(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"lan-map","data-link":_e,"data-asking":ue||void 0,"data-bus":ot.length>0||void 0,children:[l.jsxs("div",{className:"lan-ends",children:[l.jsxs("p",{className:"lan-end",children:[l.jsx("span",{className:"lan-end-name",children:"This deck"}),me&&l.jsx("span",{className:"lan-end-runs",children:me}),L&&n.shareActive===!1&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),l.jsxs("p",{className:"lan-end","data-side":"there",children:[l.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&l.jsxs("span",{className:"lan-end-runs",children:[ge??(Y?"not said":le),Me?` · ${Me<0?"older":"newer"}`:null]}),We&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"}),He&&l.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),l.jsxs("div",{className:"lan-link",children:[l.jsx(x_,{}),l.jsxs("span",{className:"lan-span",children:[l.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[l.jsx("i",{className:"lan-glint","data-dir":"out"}),l.jsx("i",{className:"lan-glint","data-dir":"in"})]}),l.jsx("span",{className:"lan-link-label",children:he?l.jsx("code",{className:"ap-lan-code",children:he}):"none here — it calls this deck"})]}),l.jsx(x_,{}),(he&&Ne||Qe)&&l.jsxs("p",{className:"lan-link-sub",children:[he&&Ne,he&&Ne&&Qe&&" · ",Qe&&(qe?Se?l.jsx("code",{className:"ap-lan-code",children:Ve}):l.jsx("span",{className:"lan-round","data-tone":qe.tone,children:qe.text.replace(/ · now$/," · just now")}):"not asked yet"),Qe&&Ve&&!Se&&l.jsx("code",{className:"lan-fact-raw",children:Ve})]}),Be.length>0&&l.jsx("ul",{className:"lan-done",children:Be.map(fe=>l.jsxs("li",{"data-ok":fe.ok,children:[fe.email," ",l.jsx("span",{className:"lan-done-what",children:fe.ok?"arrived":"did not arrive"})]},`${fe.email}:${fe.action}`))}),(P==null?void 0:P.waiting)&&l.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),ot.length>0&&l.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:ot.map((fe,lt)=>{const vt=ke.get(fe.email),Gt=fe.out==="live"||fe.in!=null&&fe.in!=="cut";return l.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":fe.tone,"data-draw":fe.in&&fe.out?"both":fe.in?"in":"out","data-used-there":fe.usedThere||void 0,style:{"--i":lt},children:[l.jsx("i",{className:"lan-pip","data-end":"here","data-state":fe.here,"aria-hidden":!0}),l.jsxs("span",{className:"lan-track",children:[l.jsxs("span",{className:"lan-wire","data-flow":Gt?"live":"cut","aria-hidden":!0,children:[(fe.in==="live"||fe.in==="wait")&&l.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":fe.in}),fe.out==="live"&&l.jsx("i",{className:"lan-glint","data-dir":"out"})]}),fe.in&&fe.in!=="cut"&&l.jsx(od,{dir:"in",gate:fe.in==="blocked"}),fe.out==="live"&&l.jsx(od,{dir:"out"}),l.jsx("span",{className:"lan-lane-email",children:fe.email})]}),l.jsx("i",{className:"lan-pip","data-end":"there","data-state":fe.there,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:FF(fe)}),(fe.caption||vt)&&l.jsxs("span",{className:"lan-lane-note",children:[fe.caption,fe.caption&&vt&&" · ",vt&&l.jsx("span",{className:"lan-lane-done","data-ok":vt.ok,children:vt.ok?"arrived last round":"did not arrive last round"})]})]},fe.key)})},O),L&&l.jsxs(l.Fragment,{children:[wt.length>0&&l.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",wt.length===1?wt[0].email:"the expired ones"," until you sign in again here."]}),et&&l.jsx("p",{className:"lan-empty",children:et}),ht&&l.jsxs("p",{className:"lan-stale",children:["As of ",ht==="now"?"just now":ht,", when it last answered."]}),l.jsxs("div",{className:"lan-legend",children:[ut&&l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:l.jsx(od,{dir:"in"})}),"from ",e.name]}),ee?l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:l.jsx(od,{dir:"out"})}),"from this deck, to every paired deck"]}):l.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),l.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),l.jsx("dl",{className:"lan-facts",children:Je.map(fe=>l.jsxs("div",{className:"lan-fact","data-tone":fe.tone,children:[l.jsx("dt",{children:fe.label}),l.jsx("dd",{children:fe.value})]},fe.label))}),tt.length>1&&l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:[tt.length," decks on this machine"]}),l.jsx("ul",{className:"lan-twins",role:"list",children:tt.map((fe,lt)=>{var Vn,Yn,qt,Kn;const vt=(Vn=fe.peer)!=null&&Vn.addr?`${fe.peer.addr}:${fe.peer.port}`:fe.row.addr,Gt=vt||fe.row.fp,Dt=(Yn=fe.peer)!=null&&Yn.pairedAt?Vr(fe.peer.pairedAt,a):null,Gn=[(Kn=(qt=fe.peer)==null?void 0:qt.about)!=null&&Kn.version?`runs ${fe.peer.about.version}`:null,Dt?`paired ${Dt==="now"?"just now":Dt}`:null,fe.row.state].filter(Boolean).join(" · "),It=fe.row.fp;return l.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":fe.row.tone,children:[l.jsx("i",{className:fe.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),vt?l.jsx("code",{className:"ap-lan-code lan-twin-at",children:vt}):l.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),l.jsx("code",{className:"ap-lan-code lan-twin-fp",children:It}),lt>0&&y&&l.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===It?" armed":""}`,...K(`unpair:${It}`),onKeyDown:te=>{te.repeat&&te.preventDefault()},onClick:()=>{if(R!==It){I(It),T.current=Date.now();return}Date.now()-T.current<gc||(I(null),G(()=>y(It)))},"aria-label":R===It?`Confirm unpairing ${Gt}`:`Unpair ${Gt}`,title:R===It?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:i===`unpair:${It}`?"unpairing…":R===It?"confirm":"unpair"}),l.jsx("span",{className:"lan-twin-meta",children:lt===0?`${Gn} · shown above`:Gn})]},It)})})]})]}),l.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&l.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),L&&!(P!=null&&P.waiting)&&l.jsx("button",{type:"button",className:"btn",...K(`check:${e.fp}`),onClick:()=>void G(f).then(fe=>{fe&&Q.current&&B(lt=>lt+1)}),title:"Ask this deck now instead of waiting for the next round",children:i===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&l.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...K(`unpair:${e.fp}`),onKeyDown:fe=>{fe.repeat&&fe.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<gc||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:i===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&l.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...K(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:i===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...K(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:i===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...K(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:i===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function zF({status:e,accounts:t,onClose:n,onChanged:s}){const a=dn(n),[i,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(!1),w=x.useRef(0);x.useEffect(()=>{if(!m)return;const B=window.setTimeout(()=>y(!1),4e3);return()=>window.clearTimeout(B)},[m]);const[N,_]=x.useState(null),j=x.useRef(null),k=B=>{const Z=la(N,B);return{disabled:Z.disabled,"aria-busy":Z.busy}},S=x.useRef(null),E=x.useRef(!0);x.useEffect(()=>()=>{E.current=!1},[]),x.useEffect(()=>{S.current&&VF(S.current,e.shared??[])&&(S.current=null)},[e.shared]);const C=x.useCallback(async(B,Z,Q="write")=>{j.current=Q,_(Q);try{const K=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:B})})).json().catch(()=>null);return E.current?(K!=null&&K.ok?f(null):f(Xt(Z,K)),s(),(K==null?void 0:K.ok)===!0):!1}catch{return E.current&&f(Xt(Z,null)),!1}finally{j.current=null,E.current&&_(null)}},[s]),T=x.useCallback(async()=>{if(i!=null&&i!==(e.name??"")){if(!await C({name:i},"save the name","name"))return;E.current&&c(null)}n()},[i,e.name,C,n]),R=async()=>{if(!e.fp)return;const B=await Vx(e.fp);if(E.current){if(!B){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{E.current&&h(!1)},1600)}},I=new Set(S.current??e.shared??[]),F=e.autoAsk!==!1,W=e.autoAccept!==!1,O=e.shareActive!==!1;return Kr.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal lan-modal",onClick:B=>B.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[u&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:u}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Name"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"appear as"}),l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:B=>c(B.target.value),onKeyDown:B=>{B.key!=="Enter"||i==null||(C({name:i},"save the name","name"),c(null))}}),i!=null&&i!==(e.name??"")&&l.jsx("button",{type:"button",className:"ap-manage-btn",...k("name"),onClick:()=>{C({name:i},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:e.fp}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void R(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):l.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Share these accounts"}),l.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&l.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(B=>l.jsxs("label",{className:"ap-lan-pick",title:B.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[l.jsx("input",{type:"checkbox",checked:I.has(B.key),onChange:Z=>{const Q=new Set(S.current??e.shared??[]);Z.target.checked?Q.add(B.key):Q.delete(B.key),S.current=[...Q],C({shared:[...Q]},Z.target.checked?"share that account":"stop sharing that account")}}),l.jsx("span",{className:"ap-lan-pick-name",children:B.email}),!B.alive&&l.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},B.key))]}),t.length>0&&l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":O,"aria-label":"Show paired decks which of these this deck is using",...k("current"),onClick:()=>void C({shareActive:!O},O?"stop showing which account this deck is using":"show which account this deck is using","current"),title:O?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Pairing"}),l.jsxs("div",{className:"lan-switches",children:[l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":F,"aria-label":"Ask every deck this one finds",...k("ask"),onClick:()=>void C({autoAsk:!F},F?"stop asking automatically":"ask every deck this one finds","ask"),title:F?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":W,"aria-label":"Say yes to every deck that asks","data-tone":"warn","data-armed":m||void 0,...k("accept"),onKeyDown:B=>{B.repeat&&B.preventDefault()},onClick:()=>{if(!W&&!m){y(!0),w.current=Date.now();return}m&&Date.now()-w.current<gc||(y(!1),C({autoAccept:!W},W?"stop accepting automatically":"accept every deck that asks","accept"))},title:W?"Stop saying yes for you. A deck that asks waits in the panel again.":m?"Press again to turn it on.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsx("p",{className:m||W?"lan-warn":"lan-note","aria-live":"polite",children:m?l.jsx(l.Fragment,{children:"Press the switch again to turn it on. Any deck on this network that asks would then be paired, and offered any login ticked above, without you being asked."}):W?l.jsx(l.Fragment,{children:"Any deck on this network that asks is paired, and offered any login ticked above, without you being asked."}):F?l.jsx(l.Fragment,{children:"This deck asks; somebody on the other machine still has to say yes. A request coming the other way waits in the panel for you."}):l.jsxs(l.Fragment,{children:["Nothing pairs on its own. You press ",l.jsx("strong",{children:"ask"})," on a deck you find, and ",l.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})})]})]}),l.jsxs("footer",{className:"lan-setup-foot",children:[l.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),l.jsx("button",{type:"button",className:"btn primary",...k("name"),onClick:()=>void T(),children:"Done"})]})]})}),document.body)}function Vr(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const s=Math.round(n/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const t0={"waiting for the other deck to accept this one":{text:"waiting for them to say yes",tone:"idle"},"that deck said no":{text:"it said no",tone:"bad"}},UF={ECONNREFUSED:"not listening",EHOSTUNREACH:"no route to it",ENETUNREACH:"no network here",ETIMEDOUT:"no answer",ECONNRESET:"it hung up",EHOSTDOWN:"it is down",ENOTFOUND:"name not found",EACCES:"blocked here",EPIPE:"it hung up"};function WF(e){var s;const t=HF[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&UF[n]||e}const HF={"handshake timed out":"no answer","peer closed the connection":"it hung up","peer went quiet":"it stopped mid-sentence","bad reply":"it answered with nonsense","no manifest":"it would not say what it has","bad challenge":"it answered as somebody else","a different deck is answering at that address":"a different deck is at that address","that deck could not prove its own key":"it could not prove who it is","the other deck refused this one's proof":"it would not take this deck's word","the other deck refused this handshake":"it turned this deck away","that deck has this one pinned under a different key":"it knows this deck by another key"};function LA(e,t){if(!e)return null;if(e.error)return t0[e.error]??{text:WF(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Vr(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Vr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Vr(e.at,t)}`,tone:"bad"}}const fx=5e3,DA=6e4,gc=400;function GF(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const s=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!s||!Number.isInteger(a)||a<1||a>65535||s.includes(":")&&!(s.startsWith("[")&&s.endsWith("]"))?null:{addr:s,port:a}}function Xt(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function VF(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function YF(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function qA(e,t){var n,s;return(n=e.last)!=null&&n.error&&!t0[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Fd||e.lastSeen!=null&&t-e.lastSeen<Fd)}const Fd=95e3;function KF(e,t){const n=[],s=[];for(const a of e??[])(qA(a,t)?n:s).push(a);return{online:n,offline:s}}function XF(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const s=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(w=>w.waiting),i=s.filter(w=>!w.waiting),c=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<Fd}),{online:u,offline:f}=KF(i,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function ZF(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Vr(e,t);return s==="now"?"checked just now":`checked ${s}`}function n0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const s=Math.round(n/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function QF(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Fd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Vr(e,t)}`,here:n}}function b_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Vr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function JF(e,t){var y,w,N,_,j;if(!e)return[];const n=[],s=new Set,a=(k,S)=>k.name.localeCompare(S.name,void 0,{numeric:!0}),i=e.aliases??{},c=(k,S)=>{const E=k?i[k]:void 0;return E&&E!==S?{name:E,self:S}:{name:S}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${n0(k.at,t)}`,tone:"wait",here:!0,hint:`${S.name} at ${k.addr} is waiting for an answer.`})}const u=[],f=[];for(const k of e.peers??[]){const S=k.peerFp??k.fp;if(!S||s.has(S))continue;s.add(S);const E=LA(k.last,t),C=qA(k,t),T=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){f.push({fp:T,name:T||k.name||S,addr:k.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=k.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${k.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=k.waiting?QF(k.lastSeen,t):null,I=R?R.here:C,F=!R&&E?I?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${b_(k,I,t)}`:R?R.text:b_(k,I,t),W=(w=k.last)!=null&&w.error?t0[k.last.error]:null,O=!R&&I&&!((N=k.last)!=null&&N.error)&&!(((_=k.last)==null?void 0:_.done)??[]).length,B=k.manual&&!k.met?{name:T}:c(S,k.name||S);u.push({fp:S,name:B.name,...B.self?{self:B.self}:{},addr:k.addr??"",kind:"paired",state:F,quiet:O,tone:W?W.tone==="bad"?"bad":"wait":E?E.tone:I?"ok":"idle",here:R?R.here:C,hint:R?`${B.name} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${k.lastSeen==null?"It has not called since this deck started.":`It last called ${Vr(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${B.name}${T?` at ${T}`:""}${(j=k.last)!=null&&j.error?` — ${k.last.error}`:""}`})}n.push(...e8(u).sort(a),...f.sort(a));const p=[];for(const k of e.strangers??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${S.name} at ${k.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const S=c(k.fp,k.name||k.fp);h.push({fp:k.fp,name:S.name,...S.self?{self:S.self}:{},addr:k.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${S.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const k of n)m.set(k.name,(m.get(k.name)??0)+1);for(const k of n)(m.get(k.name)??0)<2||!k.addr||(k.state=k.quiet||!k.state?k.addr:`${k.addr} · ${k.state}`,k.quiet=!1);return n}function e8(e){const t=new Map;for(const s of e){const a=t.get(s.name);a?a.push(s):t.set(s.name,[s])}const n=[];for(const s of t.values()){const a=[...new Set(s.filter(i=>i.addr).map(i=>i.addr))];if(a.length>1){for(const i of a)n.push(k_(s.filter(c=>c.addr===i)));n.push(...s.filter(i=>!i.addr))}else n.push(k_(s))}return n}function k_(e){const[t,...n]=[...e].sort((s,a)=>Number(a.here)-Number(s.here)||+!!a.addr-+!!s.addr);return n.length?{...t,twins:n}:t}function __(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function N_(e,t){if(!e)return{};switch(t.kind){case"paired":return{peer:(e.peers??[]).find(n=>(n.peerFp??n.fp)===t.fp)??null};case"dialling":return{peer:(e.peers??[]).find(n=>n.manual&&!n.met&&`${n.addr}:${n.port}`===t.fp)??null};case"nearby":return{stranger:(e.strangers??[]).find(n=>n.fp===t.fp)??null};case"declined":return{stranger:(e.declined??[]).find(n=>n.fp===t.fp)??null};case"asks":return{stranger:(e.pending??[]).find(n=>n.fp===t.fp)??null}}}function t8(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),s=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!s)return null;for(let a=1;a<=3;a++){const i=Number(n[a])-Number(s[a]);if(i)return Math.sign(i)}return 0}function n8(e,t,n){const s=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:s,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:s,note:null,tone:"ok"}:n?{there:"works there",here:s,note:"repairs next round",tone:"wait"}:{there:"works there",here:s,note:"share it to repair",tone:"bad"}:{there:"works there",here:s,note:"arrives next round",tone:"wait"}}function r8(e,t,n,s=null){const a=new Map(t.map(f=>[f.key,f])),i=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=i.has(f.key),m=n8(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:s===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function _i(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function s8(e,t){if(!e)return{text:"checking…",tone:"idle",trouble:0};if(!e.enabled)return{text:"Off",tone:"idle",trouble:0};if(e.stalled)return{text:"could not start",tone:"bad",trouble:0};if(!e.running)return{text:"starting…",tone:"wait",trouble:0};const n=t.filter(i=>i.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",trouble:0};const s=t.filter(i=>i.kind==="paired").length,a=t.filter(i=>i.kind!=="asks"&&i.tone==="bad").length;return s?{text:`${s} paired`,tone:"ok",trouble:a}:{text:"On · none paired yet",tone:"idle",trouble:a}}function a8({accounts:e,onChanged:t,view:n,onOpen:s,onBack:a,closeButton:i}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[N,_]=x.useState(null),j=x.useRef(0),[k,S]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),[I,F]=x.useState(null),W=x.useRef(null),O=x.useCallback(ue=>ah(W.current)?(W.current=ue,m(ue),!0):!1,[]),B=x.useCallback(()=>{W.current=null,K.current&&m(null)},[]),Z=ue=>{const je=la(h,ue);return{disabled:je.disabled,"aria-busy":je.busy}},[Q,M]=x.useState(()=>Date.now()),K=x.useRef(!0),G=x.useRef(fx),P=x.useCallback(async()=>{var ue,je;try{const[Ce,Fe]=await Promise.all([fetch("/api/lan").then(We=>We.json()),fetch("/api/prefs").then(We=>We.json())]);if(!K.current)return;Ce!=null&&Ce.ok&&u(Ce),Fe!=null&&Fe.ok&&p(Array.isArray((je=(ue=Fe.prefs)==null?void 0:ue.lan)==null?void 0:je.manual)?Fe.prefs.lan.manual:[]),G.current=(Ce==null?void 0:Ce.enabled)===!0?fx:DA}catch{}},[]);x.useEffect(()=>{K.current=!0;let ue=0;const je=async()=>{M(Date.now()),await P(),K.current&&(ue=window.setTimeout(je,G.current))};return je(),()=>{K.current=!1,window.clearTimeout(ue)}},[P]);const H=x.useCallback(async()=>{const ue=(c==null?void 0:c.enabled)===!0;if(O("switch"))try{const je=await _i("/api/prefs",{lan:{enabled:!ue}});if(!K.current)return;je!=null&&je.ok?(F(null),ue||w(!0)):F(Xt(ue?"turn this off":"turn this on",je)),await P()}catch{K.current&&F(Xt(ue?"turn this off":"turn this on",null))}finally{B()}},[c==null?void 0:c.enabled,P,O,B]),L=x.useCallback(async(ue,je,Ce)=>{if(!O(`${ue}:${je}`))return null;let Fe=null;try{const We=await _i("/api/lan/peer",{action:ue,fp:je});if(!K.current)return null;We!=null&&We.ok?(u(We),F(null)):(Fe=Xt(Ce,We),F(Fe)),await P()}catch{Fe=Xt(Ce,null),K.current&&F(Fe)}finally{B()}return Fe},[P,O,B]),U=x.useCallback(async ue=>{if(!O(`drop:${ue}`))return null;let je=null;try{const Ce=await _i("/api/prefs",{lan:{manual:f.filter(Fe=>Fe!==ue)}});if(!K.current)return null;Ce!=null&&Ce.ok?(F(null),t()):(je=Xt("stop dialling that address",Ce),F(je)),await P()}catch{je=Xt("stop dialling that address",null),K.current&&F(je)}finally{B()}return je},[f,P,t,O,B]),[$,V]=x.useState(null),he=x.useCallback(async(ue,je)=>{if(!O(`alias:${ue}`))return"Something else is still being saved. Try again in a moment.";try{const Ce=await _i("/api/lan/peer",{action:"alias",fp:ue,name:je});return K.current?Ce!=null&&Ce.ok?(u(Ce),null):Xt("rename that deck",Ce):null}catch{return Xt("rename that deck",null)}finally{B()}},[O,B]),Y=x.useCallback(async ue=>{if(!O(`check:${ue}`))return null;try{const je=await _i("/api/lan/sync",{fp:ue});return K.current?je!=null&&je.ok?(u(je),t(),null):(je==null?void 0:je.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":Xt("check that deck",je):null}catch{return Xt("check that deck",null)}finally{B()}},[O,B,t]),J=x.useCallback(async()=>{if(O("check"))try{const ue=await _i("/api/lan/sync",{});if(!K.current)return;ue!=null&&ue.ok?(u(ue),F(null)):F(Xt("check the other decks",ue)),t()}catch{K.current&&F(Xt("check the other decks",null))}finally{B()}},[O,B,t]),z=(c==null?void 0:c.enabled)===!0,re=JF(c,Q),le=$?re.find(ue=>{var je;return ue.fp===$||((je=ue.twins)==null?void 0:je.some(Ce=>Ce.fp===$))})??null:null;x.useEffect(()=>{$&&c&&!le&&V(null)},[$,c,le]);const me=re.filter(ue=>ue.kind==="asks"),ge=re.filter(ue=>ue.kind!=="asks"),Me=ge.filter(ue=>ue.here),qe=ge.filter(ue=>!ue.here),Ve=qe.filter(ue=>ue.tone==="bad").length,Ue=T||Me.length===0,Se=XF(c,Q),Qe=ge.filter(ue=>ue.kind==="paired").length,Ne=s8(c,re),_e=l.jsxs(l.Fragment,{children:[k&&c&&l.jsx(IF,{status:c,manual:f,onClose:()=>S(!1),onChanged:()=>{P(),t()}}),E&&l.jsx(OA,{title:"How Local network works",steps:TF,finish:z?void 0:{label:"Turn it on",act:()=>{C(!1),H()}},onClose:()=>C(!1)}),y&&c&&l.jsx(zF,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{P(),t()}}),le&&c&&l.jsx(BF,{row:le,source:N_(c,le),status:c,accounts:e,now:Q,busy:h,onClose:()=>V(null),onRename:ue=>he(le.fp,ue),onCheck:()=>Y(le.fp),onVerb:()=>{switch(le.kind){case"paired":return L("unpair",le.fp,"unpair that deck");case"nearby":return L("accept",le.fp,"reach that deck");case"declined":return L("allow",le.fp,"let that deck ask again");case"dialling":return U(le.fp);default:return Promise.resolve(null)}},onSettings:()=>{V(null),w(!0)},twins:(le.twins??[]).map(ue=>({row:ue,peer:N_(c,ue).peer??null})),onUnpair:ue=>L("unpair",ue,"unpair that deck")})]});return n?l.jsxs("div",{className:"ap-lan-view",children:[l.jsxs("div",{className:"ap-header",children:[l.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),l.jsx("h2",{id:"ap-lan-title",children:"Local network"}),l.jsxs("div",{className:"ap-header-right",children:[z&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>S(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),l.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),z&&Qe>0&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...Z("check"),onClick:()=>void J(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),l.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),z&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...Z("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),l.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),l.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i]})]}),l.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:l.jsxs("div",{className:"ap-lan",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":z,"aria-label":"Sync with paired decks",...Z("switch"),onClick:()=>void H(),title:z?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:l.jsx("span",{className:"switch-knob"})})]}),!z&&l.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[l.jsx(AF,{}),l.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),l.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),l.jsx("p",{className:`ap-lan-status ${Se.tone}`,role:"status",children:Se.tone==="ok"?"":Se.text}),I&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:I}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>F(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),z&&l.jsxs(l.Fragment,{children:[me.length>0&&l.jsx("div",{className:"ap-lan-asks",role:"alert",children:me.map(ue=>l.jsxs("div",{className:"ap-lan-ask",children:[l.jsxs("span",{className:"ap-lan-ask-what",children:[l.jsx("strong",{className:"ap-lan-peer-name",children:ue.name})," at ",l.jsx("code",{className:"ap-lan-code",children:ue.addr})," wants to pair"]}),l.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",l.jsx("code",{className:"ap-lan-code",children:ue.fp})]}),l.jsxs("span",{className:"ap-lan-ask-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`accept:${ue.fp}`),onClick:()=>void L("accept",ue.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ue.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`dismiss:${ue.fp}`),onClick:()=>void L("dismiss",ue.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ue.fp))}),(Ue?[...Me,...qe]:Me).length>0&&l.jsx("ul",{className:"ap-lan-here",children:(Ue?[...Me,...qe]:Me).map((ue,je)=>l.jsxs("li",{className:"ap-lan-who","data-tone":ue.tone,children:[l.jsx("i",{className:ue.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ue.name}),l.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${je}`,onClick:()=>V(ue.fp),children:l.jsxs("span",{className:"vis-hidden",children:[ue.name,", details"]})}),l.jsx("span",{id:`lan-who-state-${je}`,className:ue.quiet?"vis-hidden":"ap-lan-who-when",children:ue.state}),ue.kind==="nearby"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`accept:${ue.fp}`),onClick:()=>void L("accept",ue.fp,"reach that deck"),"aria-label":`Ask ${ue.name} to pair`,title:`Send ${ue.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ue.fp}.`,children:"ask"}),ue.kind==="paired"&&l.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${N===ue.fp?" armed":""}`,...Z(`unpair:${ue.fp}`),onClick:()=>{if(N!==ue.fp){_(ue.fp),j.current=Date.now(),window.setTimeout(()=>_(Ce=>Ce===ue.fp?null:Ce),4e3);return}Date.now()-j.current<gc||(_(null),L("unpair",ue.fp,"unpair that deck"))},"aria-label":N===ue.fp?`Confirm unpairing ${ue.name}`:`Unpair ${ue.name}`,title:N===ue.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:N===ue.fp?"confirm":"unpair"}),ue.kind==="dialling"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`drop:${ue.fp}`),onClick:()=>void U(ue.fp),"aria-label":`Stop dialling ${ue.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ue.kind==="declined"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`allow:${ue.fp}`),onClick:()=>void L("allow",ue.fp,"let that deck ask again"),"aria-label":`Let ${ue.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ue.kind}:${ue.fp}`))}),(Me.length>0&&qe.length>0||z&&Qe>0)&&l.jsxs("div",{className:"ap-lan-tail",children:[Me.length>0&&qe.length>0&&l.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":T,onClick:()=>R(ue=>!ue),title:T?"Show only the decks that are on":`Show the ${qe.length} deck${qe.length===1?"":"s"} that are not responding right now`,children:[l.jsx("span",{className:`ap-lan-chev${T?" open":""}`,"aria-hidden":!0,children:"›"}),T?"fewer":`${qe.length} more`,!T&&Ve>0&&l.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",Ve," not responding"]})]}),z&&Qe>0&&l.jsx("span",{className:"ap-lan-checked",children:ZF(c==null?void 0:c.checkedAt,Q,h==="check")})]}),ge.length===0&&me.length===0&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"ap-lan-fine",children:"No other deck yet. Decks on one network usually find each other on their own; when that has not happened, the link at the top of this view reaches one by address or by invite."}),l.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),_e]}):l.jsxs("div",{className:"ap-foot",children:[l.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:s,children:[l.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),l.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),l.jsxs("span",{className:"ap-nav-text",children:[l.jsx("span",{className:"ap-nav-name",children:"Local network"}),l.jsxs("span",{className:"ap-nav-state","data-tone":Ne.tone,children:[Ne.text,Ne.trouble>0&&l.jsxs("span",{className:"ap-nav-bad",children:[" · ",Ne.trouble," not responding"]})]})]}),l.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),l.jsx("p",{className:"vis-hidden",role:"status",children:Se.tone==="ok"?"":Se.text}),_e]})}const S_=15e3,o8=8e3,i8=1800,l8=3e4,pp=[70,80,85,90,95];function mp(e,t){return dA(t-Math.floor(e/1e3))}function c8(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function Jl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u8(e,t){const n="The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating.";if((e==null?void 0:e.state)==="running")return{text:"resuming…",hint:`${n} The deck is re-capturing it from the login you already have. No sign-in, no switch.`};if((e==null?void 0:e.state)==="failed"){const s=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${s}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function d8(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function h8(e){switch(e){case"no_credentials":return{text:"no stored login",hint:"claude-swap holds no credentials for this account, so there is nothing to read its usage with and nothing to switch to. A paired deck that has them sends them on its own; signing in as this account puts them there by hand.",fix:"sign in"};case"relogin_required":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fix:"sign in again"};case"keychain_unavailable":return{text:"keychain unreadable",hint:"This is about the deck, not the account: claude-swap could not open your keychain, so it cannot read any account's stored login. A deck started from a background session cannot reach the keychain at all — start it from a terminal, or let it start at login, and this clears."};case"token_expired":return{text:"token expired",hint:"The access token ran out and the refresh was deferred. The next collection retries."};case"foreign_credential":return{text:"wrong credential",hint:"The live credential belongs to a different account. Switching to this one repairs it."};case null:case void 0:return null;default:return{text:e,hint:`claude-swap reported "${e}" for this account.`}}}function gp(e,t){if(e.staleCopy){const n=u8(e.repair??null,t);return{text:Jl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=h8(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const s=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:Jl(n.text),hint:n.hint,fix:n.fix?Jl(n.fix):null,tone:s||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:s}}if(e.error){const n=d8(e.error);return{text:Jl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function yp(){return l.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),l.jsx("path",{d:"M7 5.6v2.9"}),l.jsx("path",{d:"M7 10.3v.05"})]})}function f8(e){return e>=90?"hi":e>=70?"mid":void 0}function p8(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!pp.includes(t)?[...pp,t]:pp].sort((s,a)=>s-a)}function m8({lane:e,nowSec:t,frozen:n}){const s=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",i=e.resetAt&&!n?hA(e.resetAt,t):null;return l.jsxs("div",{className:"ap-lane",children:[l.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),l.jsx("div",{className:"ap-lane-track",children:l.jsx("div",{className:"ap-lane-fill",style:{width:`${s===0?1.5:s}%`,background:a,opacity:s===0||n?.4:1}})}),l.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[s,"%"]}),l.jsx("span",{className:"ap-lane-reset",title:i?`${e.label} resets in ${i}`:void 0,children:i&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vis-hidden",children:"resets in "}),i]})})]})}async function j_(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function g8({onClose:e,leaving:t}){var Vn,Yn,qt,Kn;const[n,s]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState("accounts"),[j,k]=x.useState(!1),[S,E]=x.useState(null),C=x.useRef(S);C.current=S;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),I=x.useRef(null),[F,W]=x.useState(null),O=(F==null?void 0:F.num)??null,B=x.useRef(F);B.current=F;const[Z,Q]=x.useState(null),[M,K]=x.useState(!1),[G,P]=x.useState(""),[H,L]=x.useState(null),U=x.useRef(0),[$,V]=x.useState(null),[he,Y]=x.useState(!1),[J,z]=x.useState(!1),[re,le]=x.useState(null),[me,ge]=x.useState(null),[Me,qe]=x.useState(null),[Ve,Ue]=x.useState(!1),Se=x.useRef(null),Qe=x.useRef(null),[Ne,_e]=x.useState([]),ue=x.useRef(null),je=x.useCallback(te=>ah(ue.current)?(ue.current=te,u(te),!0):!1,[]),Ce=x.useCallback(()=>{ue.current=null,u(null)},[]),Fe=(te,Ae=!1)=>{const Oe=la(c,te);return{disabled:Oe.disabled,"aria-busy":Oe.busy||Ae}},We=x.useCallback(te=>{window.requestAnimationFrame(()=>{var Ae;if(t_(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Oe of ED(te)){const Re=document.querySelector(Oe);if(Re){Re.focus();return}}})},[]),He=x.useCallback(async(te=!1)=>{te&&p(!0);const Ae=new AbortController,Oe=window.setTimeout(()=>Ae.abort(),l8);try{const[Re,Le]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Re.ok){const Ct=await Re.json();s(Ct),_e(yt=>uF(yt,Ct.accounts))}Le.ok&&i(await Le.json());const ct=mF([await f_(Re),await f_(Le)]);m(Ct=>p_(Ct,ct))}catch{m(Re=>p_(Re,Ae.signal.aborted?pF:fF))}finally{window.clearTimeout(Oe),te&&p(!1)}},[]),ot=x.useCallback(async(te,Ae,Oe="panel")=>{if(!je(Ae))return null;const Re=Oe==="menu"?Q:m;Re(null);try{const ct=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ct!=null&&ct.ok||Re({text:ux(ct,"command failed"),raw:mc(ct)}),ct}catch{return Re({text:"server unreachable"}),null}finally{Ce()}},[je,Ce]),wt=x.useCallback(async(te,Ae)=>{if(!je(Ae))return null;m(null),Q(null);try{const Re=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return Re!=null&&Re.ok||Q({text:Ei(Re,"command failed")}),Re}catch{return Q({text:"server unreachable"}),null}finally{Ce()}},[je,Ce]);x.useEffect(()=>(He(!0),I.current=window.setInterval(()=>He(!1),S_),()=>{I.current!=null&&window.clearInterval(I.current)}),[He]),x.useEffect(()=>{const te=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const ut=((Vn=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:Vn.value)??"90",ee=Me??ut,ke=oF(ee,ut),Be=(Yn=n==null?void 0:n.accounts)==null?void 0:Yn.find(te=>te.active),et=Be?gp(Be,T):null,ht=async(te,Ae)=>{if(je(`switch-${te}`)){m(null),w(null);try{const Re=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Re!=null&&Re.ok?w({num:te,name:Ae}):m({text:ux(Re,"the switch failed"),raw:mc(Re),row:te}),await He(!0)}catch{m({text:"server unreachable",row:te})}finally{Ce(),We(te)}}},Je=x.useCallback(()=>{W(null),Q(null),L(null),V(null),z(!1)},[]),tt=(te,Ae="first")=>{Je(),E(null),ge(null),W({num:te,view:"menu",start:Ae})},it=(te,Ae)=>{Je(),E(Oe=>(Oe==null?void 0:Oe.anchor)===Ae?null:{num:te,anchor:Ae})},bt=x.useCallback((te=!1)=>{var Oe;const Ae=C.current;te&&Ae&&((Oe=document.getElementById(Ae.anchor))==null||Oe.focus()),E(null)},[]),nt=()=>{Je(),E(null),_("lan")},pt=x.useRef(N);x.useEffect(()=>{pt.current!==N&&(pt.current=N,window.requestAnimationFrame(()=>{var te;(te=document.getElementById(N==="lan"?"ap-lan-back":"ap-lan-entry"))==null||te.focus()}))},[N]),x.useEffect(()=>{n!=null&&n.ok&&k(!0)},[n==null?void 0:n.ok]);const fe=x.useCallback(te=>{var Re,Le;const Ae=B.current;if(!Ae||te!=null&&Ae.num!==te)return;const Oe=document.getElementById(`ap-menu-${Ae.num}`);(Oe!=null&&Oe.contains(document.activeElement)||t_(((Re=document.activeElement)==null?void 0:Re.tagName)??null))&&((Le=document.getElementById(`ap-more-${Ae.num}`))==null||Le.focus()),Je()},[Je]);x.useEffect(()=>{t&&(Je(),E(null))},[t,Je]),x.useEffect(()=>{F&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===F.num)&&Je(),S&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===S.num)&&E(null)},[n,F,S,Je]);const lt=async te=>{var Oe;z(!1);const Ae=await wt({action:"share",account:te},`share-${te}`);!(Ae!=null&&Ae.ok)||((Oe=B.current)==null?void 0:Oe.num)!==te||(V({num:te,blob:Ae.blob,expiresAt:Ae.expiresAt}),W({num:te,view:"share"}))},vt=async(te,Ae)=>{const{commit:Oe,alias:Re}=hF(G,Ae);if(Oe){const Le=await wt({action:"alias",account:te,alias:Re},`alias-${te}`);if(await He(!0),!(Le!=null&&Le.ok))return}fe(te)},Gt=async(te,Ae)=>{var Le,ct;const Oe=await wt({action:"move",account:te,slot:Ae},`move-${te}`),Re=rF({menuFor:((Le=B.current)==null?void 0:Le.num)??null,shareFor:($==null?void 0:$.num)??null},te,Oe);if(await He(!0),Re){((ct=B.current)==null?void 0:ct.num)===te&&Je(),L(Re.confirmRemove),Re.shareFor==null&&(V(null),z(!1)),le(Re.swapNote);const Ct=Re.swapNote;Ct&&window.setTimeout(()=>le(yt=>yt===Ct?null:yt),o8),ge(null),We(Re.menuFor)}return Oe},Dt=async(te,Ae,Oe)=>{if(!Oe.sends){fe(te);return}await Gt(te,Ae)},Gn=async(te,Ae)=>{if(Ae.sends){const Oe=await ot({action:"setting",key:"autoswitch.threshold",value:te},"threshold");if(await He(!0),!(Oe!=null&&Oe.ok))return;qe(null)}Ue(!0),window.setTimeout(()=>{var Oe;document.activeElement===Qe.current&&((Oe=Se.current)==null||Oe.focus()),Ue(!1)},i8)},It=l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})});return l.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[N==="accounts"&&l.jsxs("div",{className:"ap-header",children:[l.jsx("h2",{children:"Claude accounts"}),l.jsxs("div",{className:"ap-header-right",children:[l.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>K(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((qt=n==null?void 0:n.accounts)==null?void 0:qt.length)??0)>0&&l.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>Y(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),l.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),l.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>He(!0),...Fe("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),l.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),It]})]}),N==="accounts"&&l.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?l.jsxs("div",{className:"ap-empty",role:"alert",children:[l.jsx("span",{title:h.raw||void 0,children:h.text}),l.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",S_/1e3," seconds."]}),l.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>He(!0),children:f?"trying…":"try again"})]}):l.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?l.jsxs(l.Fragment,{children:[Be&&(et==null?void 0:et.tone)==="warn"&&l.jsxs("div",{className:"ap-notice",children:[l.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)==="ap-notice","aria-controls":(S==null?void 0:S.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>it(Be.num,"ap-notice"),children:[l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),et.fix&&l.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>K(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),l.jsx("ul",{className:"ap-list",children:(Kn=n.accounts)==null?void 0:Kn.map(te=>{const{shown:Ae,fuller:Oe}=iF(te.lanes),Re=gp(te,T),Le=te.active||Ne.includes(Qx(te)),ct=te.alias??te.email??`account ${te.num}`,Ct=te.stale||(Re==null?void 0:Re.blocksSwitch)===!0,yt=Oe?[...Ae,Oe]:Ae,Zr=te.fetchedAt?mp(te.fetchedAt,T):null;return l.jsxs("li",{className:`ap-account${te.active?" active":""}`,"aria-current":te.active?"true":void 0,"data-open":Le?"":void 0,"data-frozen":Ct?"":void 0,children:[!te.active&&l.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${te.num}`,"aria-expanded":Le,"aria-controls":Le?`ap-detail-${te.num}`:void 0,"aria-describedby":!Le&&!(Re!=null&&Re.blocksSwitch)?`ap-quota-${te.num}`:void 0,onClick:()=>_e(kt=>cF(kt,te)),children:l.jsxs("span",{className:"vis-hidden",children:[ct,", ",Le?"hide details":"details"]})}),l.jsxs("div",{className:"ap-account-head",children:[te.active?l.jsx("span",{className:"ap-live",title:`Active account · slot ${te.num}`,children:l.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",te.num,":"]})}):l.jsx("span",{className:"ap-num",children:te.num}),te.alias&&l.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),l.jsx("span",{className:"ap-email",title:te.email??void 0,children:te.email}),te.disabled&&l.jsx("span",{className:"ap-held",children:"held out"}),!te.active&&!te.disabled&&!(Re!=null&&Re.blocksSwitch)&&l.jsx("button",{type:"button",className:"ap-switch",...Fe(`switch-${te.num}`),onClick:()=>ht(te.num,ct),"aria-label":`Switch to ${ct}`,title:`Switch to ${te.alias??te.email}`,children:c===`switch-${te.num}`?"…":"Switch"}),l.jsx("button",{type:"button",id:`ap-more-${te.num}`,className:"ap-more","aria-label":`More actions for ${te.email??te.alias??`account ${te.num}`}`,"aria-haspopup":"menu","aria-expanded":O===te.num,"aria-controls":O===te.num?`ap-menu-${te.num}`:void 0,title:"More actions",onClick:()=>O===te.num?fe():tt(te.num),onKeyDown:kt=>{kt.key!=="ArrowDown"&&kt.key!=="ArrowUp"||(kt.preventDefault(),tt(te.num,kt.key==="ArrowUp"?"last":"first"))},children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[l.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===te.num&&l.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),te.active&&(y==null?void 0:y.num)===te.num&&l.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(re==null?void 0:re.at)===te.num&&(()=>{var rn;const kt=(rn=n.accounts)==null?void 0:rn.find($r=>$r.num===re.displaced),Jt=(kt==null?void 0:kt.alias)??(kt==null?void 0:kt.email)??"the account that was there";return l.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${re.at} was taken, so the two accounts traded places: ${Jt} now holds slot ${re.displaced}.`,children:["swapped with slot ",re.displaced]})})(),Re&&l.jsxs("div",{className:"ap-issue-line",children:[l.jsxs("button",{type:"button",id:`ap-issue-${te.num}`,className:"ap-issue","data-tone":Re.tone,"aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)===`ap-issue-${te.num}`,"aria-controls":(S==null?void 0:S.anchor)===`ap-issue-${te.num}`?"ap-issue-pop":void 0,onClick:()=>it(te.num,`ap-issue-${te.num}`),children:[Re.tone==="warn"&&l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:Re.text})]}),!Le&&l.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Zr??"never collected"})]}),!Le&&!(Re!=null&&Re.blocksSwitch)&&l.jsxs("p",{className:"ap-quota",id:`ap-quota-${te.num}`,children:[yt.length?yt.map(kt=>l.jsxs("span",{className:"ap-q",children:[l.jsx("span",{className:"ap-q-label",children:kt.label})," ",l.jsxs("span",{className:"ap-q-pct","data-level":Ct?void 0:f8(kt.pct),children:[Math.round(kt.pct),"%"]})]},kt.id)):l.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),te.stale&&!Re&&l.jsx("span",{className:"ap-q-age","data-never":Zr?void 0:"",title:"When claude-swap last read this account's usage",children:Zr??"never collected"})]}),Le&&l.jsxs("div",{className:"ap-detail",id:`ap-detail-${te.num}`,children:[l.jsx("div",{className:"ap-lanes",children:te.lanes.length?te.lanes.map(kt=>l.jsx(m8,{lane:kt,nowSec:T,frozen:Ct},kt.id)):l.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),l.jsx("div",{className:"ap-meta",children:te.fetchedAt?l.jsxs("span",{className:`ap-age${te.stale&&!Re?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",mp(te.fetchedAt,T),Re!=null&&Re.blocksSwitch?"":c8(te.nextAt,T)]}):l.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},te.num)})}),F&&(()=>{var Re;const te=(Re=n.accounts)==null?void 0:Re.find(Le=>Le.num===F.num);if(!te)return null;const Ae=`ap-pop-title-${te.num}`,Oe=Z&&l.jsx("p",{className:"ap-pop-error",role:"alert",title:Z.raw||void 0,children:Z.text});return l.jsxs(d_,{anchorId:`ap-more-${te.num}`,boundaryId:"ap-scroll",id:`ap-menu-${te.num}`,className:"ap-pop",role:F.view==="menu"?"menu":"dialog",labelledBy:F.view==="menu"?`ap-more-${te.num}`:Ae,start:F.start,onClose:Je,children:[F.view==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{P(te.alias??""),Q(null),W({num:te.num,view:"rename"})},children:"Rename"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{ge(null),Q(null),W({num:te.num,view:"move"})},children:"Move to slot…"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Fe(`share-${te.num}`),title:`Copy this account to another ${Zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:()=>lt(te.num),children:c===`share-${te.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!te.active||te.disabled)&&l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...Fe(`rot-${te.num}`),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>ot({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`,"menu").then(Le=>{He(!0),Le!=null&&Le.ok&&fe(te.num)}),children:te.disabled?"Put back in rotation":"Hold out of rotation"}),l.jsx("div",{role:"separator",className:"ap-menu-sep"}),l.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${H===te.num?" armed":""}`,...Fe(`rm-${te.num}`),"aria-label":H===te.num?"Confirm remove":void 0,title:H===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(H!==te.num){L(te.num),U.current=Date.now(),window.setTimeout(()=>L(Le=>Le===te.num?null:Le),4e3);return}Date.now()-U.current<gc||(L(null),wt({action:"remove",account:te.num},`rm-${te.num}`).then(Le=>{var ct;He(!0),Le!=null&&Le.ok&&(((ct=B.current)==null?void 0:ct.num)===te.num&&Je(),We(null))}))},children:c===`rm-${te.num}`?"Removing…":H===te.num?"Confirm":"Remove"}),Oe]}),F.view==="rename"&&l.jsxs("form",{className:"ap-pop-form",onSubmit:Le=>{Le.preventDefault(),vt(te.num,te.alias)},children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${te.num}`,children:"Rename account"}),l.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:G,onChange:Le=>P(Le.target.value),maxLength:dF,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:Le=>Le.currentTarget.select()}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn primary",...Fe(`alias-${te.num}`),title:"A short name to show instead of the email",children:c===`alias-${te.num}`?"…":"Save"})]})]}),F.view==="move"&&(()=>{const Le=nF((n.accounts??[]).map(yt=>yt.num),te.num),ct=sF(Le,me,te.num),Ct=aF(Le,ct,te.num);return l.jsxs("div",{className:"ap-pop-form",children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${te.num}`,children:"Move to slot"}),l.jsx("span",{className:"ap-field",children:l.jsx("select",{id:`ap-slot-${te.num}`,value:String(ct),...Fe(`move-${te.num}`),onChange:yt=>ge(Number(yt.target.value)),autoFocus:!0,children:Le.map(yt=>l.jsx("option",{value:yt.slot,children:yt.label},yt.slot))})}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Cancel"}),l.jsx("button",{type:"button",className:"btn primary",...Fe(`move-${te.num}`),title:Ct.title,onClick:()=>Dt(te.num,ct,Ct),children:c===`move-${te.num}`?"…":Jl(Ct.label)})]})]})})(),F.view==="share"&&($==null?void 0:$.num)===te.num&&(()=>{const Le=IA($.expiresAt,T),ct=Le.tone==="gone";return l.jsxs("div",{className:`ap-pop-form ap-share${ct?" expired":""}`,children:[l.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),l.jsx("code",{className:"ap-share-blob",children:$.blob}),l.jsxs("p",{className:"ap-pop-note",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[l.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",l.jsx("span",{className:`ap-share-expiry ${Le.tone}`,children:Le.text})]}),Oe,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>fe(),children:"Done"}),l.jsx("button",{type:"button",className:"btn primary",...Fe(`share-${te.num}`),autoFocus:!0,onClick:async()=>{if(ct){await lt(te.num);return}await j_($.blob)&&(z(!0),window.setTimeout(()=>z(!1),1800))},children:ct?"Make a new share":J?"Copied":"Copy"})]})]})})()]})})(),S&&(()=>{var Oe;const te=(Oe=n.accounts)==null?void 0:Oe.find(Re=>Re.num===S.num),Ae=te?gp(te,T):null;return!te||!Ae?null:l.jsx(d_,{anchorId:S.anchor,boundaryId:"ap-scroll",id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>bt(),children:l.jsxs("div",{className:"ap-pop-form",children:[l.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ae.tone,children:[Ae.tone==="warn"&&l.jsx(yp,{}),Ae.text]}),l.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),l.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[l.jsx("span",{className:"ap-issue-who",children:te.alias??te.email??`account ${te.num}`})," · ",te.fetchedAt?`last collected ${mp(te.fetchedAt,T)}`:"never collected"]}),l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>bt(!0),children:"Done"}),Ae.fix&&l.jsx("button",{type:"button",className:"btn primary",onClick:()=>{bt(!0),K(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ae.fix})]})]})})})()]}):l.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"claude-swap isn't installed."}),l.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&l.jsx("code",{className:"ap-cmd",children:n.hint}),l.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",l.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"No accounts added yet."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",l.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Couldn't read the account store."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),N==="accounts"&&n!=null&&h&&h.row==null&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),N==="accounts"&&(n==null?void 0:n.ok)&&(a==null?void 0:a.ok)&&l.jsxs("div",{className:"ap-foot",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),l.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:l.jsx("select",{ref:Se,"aria-label":"Switch threshold",value:ee,...Fe("threshold"),onChange:te=>qe(te.target.value),children:p8(ut).map(te=>l.jsxs("option",{value:te,children:[te,"%"]},te))})}),(ke.sends||Ve)&&l.jsx("button",{ref:Qe,type:"button",className:"ap-manage-btn",...Fe("threshold"),title:ke.title,onClick:()=>Gn(ee,ke),children:Ve&&!ke.sends?ke.done:ke.label}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...Fe("enable"),onClick:()=>ot({action:"enable",enabled:!a.enabled},"enable").then(()=>He(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:l.jsx("span",{className:"switch-knob"})})]}),a.external&&l.jsxs("p",{className:"ap-auto-note",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",l.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),j&&l.jsx(a8,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({key:`${String(te.email??"").trim().toLowerCase()}@@${te.orgUuid??""}`,email:te.email??"",alive:te.alive===!0})),onChanged:()=>He(!0),view:N==="lan",onOpen:nt,onBack:()=>_("accounts"),closeButton:It}),M&&l.jsx(Xq,{onClose:()=>K(!1),onChanged:()=>He(!0)}),he&&l.jsx(tF,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({num:te.num,email:te.email,alias:te.alias,org:te.org})),onClose:()=>Y(!1),copyText:j_})]})}const y8=3e4;function w8({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function v8({bundle:e,running:t,pending:n,lastTried:s}){return t?w8({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function x8(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function b8({asked:e,reported:t}){return t?t!==e:!1}function FA(e){const t=e.thresholdMs??y8;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function k8(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function _8(e,t){return e?t==null?"auto when idle":`auto in ${k8(t)}`:"auto-restart off"}function E_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function N8(e){return e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function S8(e){const t=FA(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function j8(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function E8(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function C8(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function T8(e,t){const n=C8(e),s=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:s("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:s(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:s(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:s("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const i=t.decks-1;return{goes:s(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function A8({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=dn(n,{focusRef:s,layer:o5}),[i,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(E8(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=T8(e,i);return l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"status-dot err","aria-hidden":!0}),l.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("dl",{className:"cc-plan",children:[l.jsx("dt",{children:"Goes"}),l.jsx("dd",{children:u.map(m=>l.jsx("span",{children:m},m))}),l.jsx("dt",{children:"Stays"}),l.jsx("dd",{children:f.length>0?f.map(m=>l.jsx("span",{children:m},m)):l.jsx("span",{children:"nothing"})})]}),p&&l.jsx("p",{className:"cc-final",children:p}),l.jsxs("div",{className:"cc-actions",children:[l.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),l.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const R8="Press Esc first if a key does nothing.",M8=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function I8({onClose:e,onTour:t}){const n=dn(e);return l.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[t&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),l.jsx("div",{className:"shortcuts",children:M8.map(s=>l.jsxs(x.Fragment,{children:[l.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>l.jsxs("div",{className:"sc",children:[l.jsx("kbd",{children:a.cap}),l.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))}),l.jsx("p",{className:"kh-foot",children:R8})]})]})})}const $8=["done","needs-input"],O8=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],P8=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],r0={done:O8,"needs-input":P8},Fi="two";function px(e,t){const n=r0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Fi)??n[0]}function BA(e,t){return r0[e].some(s=>s.id===t)?t:Fi}px("done",Fi).notes,px("needs-input",Fi).notes;const C_=.04,L8=.24,bd=0,Bd=100,mx=5,yc=50;function wc(e){if(!Number.isFinite(e))return yc;const t=Math.round(e/mx)*mx;return Math.min(Bd,Math.max(bd,t))}function D8(e){if(e==null)return yc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?wc(Number(t)):yc}function q8(e){const t=wc(e),n=C_+(L8-C_)*(t/Bd);return Math.round(n*1e4)/1e4}function F8(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(q8(e)*s*1e4)/1e4}const B8=160,z8="agent-dag.soundLevel.done",U8="agent-dag.soundLevel.needs-input",W8="agent-dag.soundFigure.done",H8="agent-dag.soundFigure.needs-input",zA={done:z8,"needs-input":U8},UA={done:W8,"needs-input":H8},gx={done:{level:yc,figure:Fi},"needs-input":{level:yc,figure:Fi}};function G8(e){const t=n=>({level:D8(e(zA[n])),figure:BA(n,e(UA[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const T_={Stop:"done",Notification:"needs-input"};function V8(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:Object.hasOwn(T_,n)?T_[n]:null}function Y8(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??gx)[f]??gx[f],m=px(f,h.figure),y=F8(h.level,m),w=n.currentTime;for(const _ of m.notes){const j=n.createOscillator(),k=n.createGain();j.type=m.type??"sine",j.frequency.value=_.hz;const S=w+_.at,E=S+_.ms/1e3;k.gain.setValueAtTime(1e-4,S),k.gain.exponentialRampToValueAtTime(y,S+.012),k.gain.exponentialRampToValueAtTime(1e-4,E),j.connect(k).connect(n.destination),j.start(S),j.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const K8="Notify me when a session needs my attention.",X8="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",A_="Get notified when you're away from this tab.";function Z8(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:A_};case"default":return{status:null,ask:!0,ok:!1,note:A_};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const R_={done:"Turn finished","needs-input":"Claude is asking"},Q8={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function J8({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=Z8(m),N=f&&!h,_=dn(e),j=x.useRef(e);return j.current=e,x.useEffect(()=>{const k=S=>{var C,T;const E=S.target;E&&((C=_.current)!=null&&C.contains(E)||(T=u.current)!=null&&T.contains(E)||j.current())};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[_,u]),l.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[l.jsxs("div",{className:"sm-switches",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),l.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"sm-setting",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),l.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"A system notification when a session blocks on you",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsx("p",{className:"sm-note",children:h?X8:K8})]})]}),N&&l.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[l.jsxs("div",{className:"sm-channel-head",children:[l.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?l.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):l.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),l.jsx("p",{className:"sm-note",children:w.note})]}),!t&&l.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),l.jsx("div",{className:"sm-tones",children:$8.map(k=>{const S=s[k],E=`sm-level-${k}`,C=`sm-figure-${k}`;return l.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${k}`,children:[l.jsxs("div",{className:"sm-tone-head",children:[l.jsx("h3",{className:"sm-tone-name",id:`sm-name-${k}`,children:R_[k]}),l.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(k),"aria-label":`Hear the ${R_[k].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[l.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:E,children:"Volume"}),l.jsx("input",{id:E,type:"range",min:bd,max:Bd,step:mx,value:S.level,onChange:T=>a(k,Number(T.target.value)),style:{"--sm-level":`${(S.level-bd)/(Bd-bd)*100}%`}}),l.jsxs("span",{className:"sm-read",children:[S.level,"%"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:C,children:"Tone"}),l.jsx("select",{id:C,className:"sm-select",value:S.figure,onChange:T=>i(k,T.target.value),children:r0[k].map(T=>l.jsx("option",{value:T.id,children:T.label},T.id))})]}),l.jsx("p",{className:"sm-note",children:Q8[k]})]},k)})}),l.jsxs("p",{className:"sm-foot",children:[l.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const eB=15e3;function tB(e){return e.visibilityState==="visible"&&e.hasFocus()}function nB(e,t){return t||e===!0}function rB(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const sB={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":[],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
|
|
89
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(sq(s,e)),children:[t,l.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const hq=3e3;function fq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function pq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${mq(t.lastMs,n)}`:"running at full speed, and never held back"}}function mq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function Kl(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function gq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function yq(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,hq))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}i(),a()};return i(),document.addEventListener("visibilitychange",u),()=>{s=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function a_({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return l.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[l.jsxs("div",{className:"sd-head",children:[l.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&l.jsx("span",{className:"sd-sub",children:n}),l.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function wq({usageOpen:e,leaving:t,onClose:n}){const s=yq();if(!s||s.cpu==null||!s.memory)return l.jsx(a_,{usageOpen:e,leaving:t,onClose:n,children:l.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:i,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m}=s,y=a?a.total-a.available:0,w=h==="win32"?"Commit":"Swap",N=i&&i.total>0?i.used/i.total*100:0;return l.jsxs(a_,{usageOpen:e,leaving:t,sub:`up ${gq(p)} · ${f} cores`,onClose:n,children:[c&&c.length>0&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:l.jsx(vd,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:l.jsx("div",{className:"sd-cores",children:c.map((_,S)=>l.jsx("span",{className:"sd-core",title:`core ${S+1}: ${_}%`,children:l.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},S))})})}),l.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:l.jsxs(vd,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&l.jsx(Ld,{label:"Physical",value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Kl(y)})," of ",Kl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${Kl(a.available)} available`}),i&&i.total>0&&l.jsx(Ld,{label:w,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:Kl(i.used)})," of ",Kl(i.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),u&&l.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:l.jsxs(vd,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[l.jsx("div",{className:"sd-load",children:u.map((_,S)=>l.jsxs("span",{className:`sd-load-item${_>f?" over":""}`,children:[l.jsx("b",{children:_.toFixed(2)}),l.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),l.jsx("div",{className:"sd-note",children:u[0]>f?`${(u[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]})}),l.jsx(vq,{thermal:m}),l.jsx(xq,{sys:s})]})}function vd({group:e,title:t,action:n,label:s,children:a}){const[i,c]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[l.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",l.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&l.jsx(GD,{group:e,title:t,onClose:()=>c(!1)})]})}function vq({thermal:e}){if(!e)return null;const t=e.throttle?pq(e.throttle.speedLimit,e.heldBack):null;return l.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:l.jsxs(vd,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>l.jsx(Ld,{label:n.label,value:l.jsxs(l.Fragment,{children:[l.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:fq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&l.jsx(Ld,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function xq({sys:e}){const[t,n]=x.useState(!1);return l.jsxs("div",{className:"sd-section sd-door-section",children:[l.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:l.jsxs("span",{className:"sd-door-plate",children:[l.jsxs("span",{className:"sd-door-name",children:["Busiest processes",l.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&l.jsx(dq,{sys:e,onClose:()=>n(!1)})]})}function Ld({label:e,value:t,pct:n,tone:s="calm",note:a}){return l.jsxs("div",{className:"sd-row",children:[l.jsxs("div",{className:"sd-row-head",children:[l.jsx("span",{className:"sd-row-label",children:e}),l.jsx("span",{className:"sd-row-val",children:t})]}),l.jsx("span",{className:"sd-track",children:l.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&l.jsx("div",{className:"sd-note",children:a})]})}const o_=18,bq=1100,Ni=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},kq=Array.from({length:o_},(e,t)=>{const n=-72+144*t/(o_-1)+(Ni(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Ni(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Ni(t,3)*260),delay:Math.round(Ni(t,4)*90),dur:760+Math.round(Ni(t,5)*260),scale:.8+Ni(t,6)*.45,hue:t%4,round:t%3===0}});function i_({anchor:e}){var a;const[t,n]=x.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const c=i.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),bq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:$r.createPortal(l.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:kq.map((i,c)=>l.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},c))}),document.body)}const RA=new Set(["awaiting_url","awaiting_code","registering"]);function _q(e){return e!=null&&RA.has(e)}function MA(e){return e!=null&&e!=="done"&&!RA.has(e)}const Nq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Sq="the sign-in did not complete";function jq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Nq:Sq)}}function Eq({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}const Cq="done";function Tq(){let e=!1;return{shouldAnnounce(t){return t!==Cq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Zx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const Aq={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},Rq={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},Mq=`claude-swap could not read the login keychain — start ${Zt} from a Terminal window rather than a background service`;function ux(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(gc(e)))return Mq;const n=Zx(Rq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function gc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Iq={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},$q="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function Oq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const Pq="ccusage could not be started — the deck launched npx and Node could not load the npm script it points at. An older deck asked cmd.exe for a bare npx.cmd, which made the shim look for that script under the deck's working directory instead of beside itself; update the deck and reopen this modal",Lq="ccusage could not be started — the copy npx fetched will not load: Node could not resolve a file inside it. That copy is in npx's own cache, which the deck never rewrites, so clear it with `npm cache clean --force` and reopen this modal",Dq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),qq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,Fq=/[\\/]_npx[\\/]/i,Bq=`the copy of ccusage ${Zt} installed for itself`;function zq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function n9(e,t){const n=Uq(e,t),s=zq(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${Xl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Xl(n)}`;case"managed":return`${Bq} failed to run: ${Xl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Xl(n)}`:`the ccusage this deck found on your PATH failed to run: ${Xl(n)}`;default:return n}}const Xl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function Uq(e,t){const n=gc(e);if(Dq(n)){if(Fq.test(n))return Lq;if(qq.test(n))return Pq}if(Oq(n))return $q;const s=Zx(Iq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ti(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&MA(e.state))return e.error;const n=Zx(Aq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function Wq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function IA(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function Hq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function Gq(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function Vq(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function Yq(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const u=n("present");u&&s.push(`${u} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const Kq=1500,rd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],l_="aa-panel",c_=e=>`aa-tab-${e}`;async function Zl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const dx=fe.forwardRef((e,t)=>l.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[l.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),l.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));dx.displayName="SuccessMark";function Xq({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,i]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[N,_]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),I=x.useRef(null),L=x.useRef(null),H=x.useRef(null),$=x.useRef(null),V=x.useRef([]),Q=x.useRef(!1),J=x.useCallback(()=>{T.current&&Zl({action:"login-cancel"}).catch(()=>{}),e()},[e]),M=dn(J,{focusRef:H}),X=x.useCallback(async()=>{if(!ws(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const U=await Zl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Ti(U,"could not start the sign-in"));return}i(U)},[]);x.useEffect(()=>{if(!_q(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const re=await fetch("/api/claude-accounts/login");re.ok&&i(await re.json())}catch{}},Kq);return()=>window.clearInterval(U)},[a]);const G=x.useRef(t);G.current=t;const P=x.useState(Tq)[0];x.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=I.current)==null||U.focus()),P.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,P]),x.useEffect(()=>{var U;n==="paste"&&!Q.current&&((U=L.current)==null||U.focus()),Q.current=!1},[n]);const B=x.useCallback(U=>{var de;const re=Wq(U,rd.findIndex(pe=>pe.id===n),rd.length);re.kind!=="pass"&&(U.preventDefault(),Q.current=!0,s(rd[re.index].id),(de=V.current[re.index])==null||de.focus())},[n]),W=x.useCallback(async()=>{var re;if(!ws(R.current))return;R.current=!0,m(!0),w(null);const U=await Zl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Ti(U,"the code was not accepted")),U!=null&&U.state&&i(U),(re=I.current)==null||re.select();return}u(""),i(U)},[c,a]),Y=x.useCallback(async()=>{if(!ws(R.current))return;R.current=!0,m(!0),w(null);const U=await Zl({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){w(Ti(U,"the import failed"));return}C.current=f,p(""),E(null),_(U.results??[]),t()},[f,t]),O=x.useCallback(async U=>{const re=`${U.email}|${U.org??""}`;if(!ws(R.current)||!C.current)return;R.current=!0,m(!0),b(re),E(null);const de=await Zl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(R.current=!1,m(!1),b(null),!(de!=null&&de.ok)){E({key:re,text:Ti(de,"that account could not be updated")});return}const pe=(de.results??[])[0];pe&&_(ge=>ge&&ge.map(Te=>`${Te.email}|${Te.org??""}`===re?pe:Te)),t()},[t]),F=(a==null?void 0:a.state)==="done"?a.account:null,oe=Eq({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),z=MA(a==null?void 0:a.state)||!!(y&&T.current&&!h),Z=jq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:J,role:"presentation",children:l.jsxs("div",{ref:M,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:B,children:rd.map((U,re)=>l.jsx("button",{type:"button",role:"tab",id:c_(U.id),ref:de=>{V.current[re]=de},"aria-selected":n===U.id,"aria-controls":l_,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{Q.current=!1,s(U.id)},children:U.label},U.id))})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:J,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body aa-body",id:l_,role:"tabpanel","aria-labelledby":c_(n),children:n==="login"?F?l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:$}),l.jsx(i_,{anchor:$}),l.jsx("h4",{children:F.added?`Account ${F.num} added`:"Credentials refreshed"}),l.jsxs("p",{className:"aa-note",children:[l.jsx("strong",{children:F.email}),F.added?oe?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),oe?l.jsx("p",{className:"aa-note aa-warn",role:"status",children:oe}):null,l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"1 · Approve in the browser"}),l.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),l.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),l.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:I,type:"text",value:c,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!h&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),l.jsx("button",{type:"button",className:"btn primary",...aa(h,!c.trim()||a.state==="registering"),onClick:W,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&l.jsx("p",{className:"aa-err",children:y??a.error}),l.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):z?l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:Z.title}),l.jsx("p",{className:"aa-err",children:Z.message}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,i(null),w(null),X()},children:"Try again"})]}):h||T.current?l.jsx("div",{className:"aa-step",children:l.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):l.jsxs("div",{className:"aa-step aa-primer",children:[l.jsx("h4",{children:"Sign in to Anthropic"}),l.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),l.jsx("div",{className:"aa-actions",children:l.jsx("button",{type:"button",ref:H,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):N?(()=>{const U=N.filter(re=>re.state==="imported").length;return l.jsxs("div",{className:"aa-done",children:[l.jsx(dx,{ref:$}),U>0&&l.jsx(i_,{anchor:$}),l.jsx("h4",{children:Yq(N)}),N.length>0&&l.jsx("ul",{className:"aa-results",children:N.map(re=>{const de=`${re.email}|${re.org??""}`;return l.jsxs("li",{className:`aa-result ${re.state}`,children:[l.jsx("span",{className:"aa-result-who",children:re.email||(re.num?`slot ${re.num}`:"an account")}),l.jsx("span",{className:"aa-result-what",children:Vq(re.state)}),re.state==="present"&&l.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===de,title:`Overwrite the stored login for ${re.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>O(re),children:S===de?"updating…":"update anyway"}),(j==null?void 0:j.key)===de&&l.jsx("span",{className:"aa-result-err",children:j.text})]},de)})}),l.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",l.jsx("strong",{children:" update anyway"}),"."]}),l.jsxs("div",{className:"aa-actions",children:[l.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),l.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():l.jsxs("div",{className:"aa-step",children:[l.jsx("h4",{children:"Paste an account shared from another deck"}),l.jsxs("div",{className:"aa-field",children:[l.jsx("input",{ref:L,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&Y()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),l.jsx("button",{type:"button",className:"btn primary",...aa(h,!f.trim()),onClick:Y,children:h?"importing…":"Import"})]}),y&&l.jsx("p",{className:"aa-err",children:y}),l.jsxs("p",{className:"aa-note",children:["Use ",l.jsx("strong",{children:"share"})," on one account in the other deck, or ",l.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}function Zq(e,t,n){if(n<=0||th(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:s===-1?0:(s+1)%n};case"ArrowUp":return{kind:"focus",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const oa=4,Er=8;function Qq(e,t,n){const s=n.width-Er-(e.right+oa),a=e.left-oa-Er,i=t.width<=s||s>=a?"right":"left",c=i==="right"?e.right+oa:e.left-oa-t.width,u=n.height-Er*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(Er,Math.min(e.top,n.height-Er-p)),left:Math.max(Er,c),side:i,maxHeight:f?null:p}}function Jq(e,t,n){const s=n.height-Er-(e.bottom+oa),a=e.top-oa-Er,i=t.height<=s||s>=a?"below":"above",c=i==="below"?s:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=i==="below"?e.bottom+oa:e.top-oa-f,h=Math.max(Er,Math.min(e.right-t.width,n.width-Er-t.width));return{top:Math.max(Er,p),left:h,side:i,maxHeight:u?null:f}}const $A='[role="menuitem"]';function u_(e){return e?Array.from(e.querySelectorAll($A)).filter(t=>!t.disabled):[]}function d_({anchorId:e,boundaryId:t,id:n,className:s,role:a,labelledBy:i,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=dn(()=>{var _;(_=document.getElementById(e))==null||_.focus(),p.current()}),m=x.useCallback(()=>{var C;const _=h.current;if(!_)return;const S=document.getElementById(e);if(!S){p.current();return}const b=S.getBoundingClientRect(),j=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(j&&(b.bottom<=j.top||b.top>=j.bottom)){_.contains(document.activeElement)&&S.focus({preventScroll:!0}),p.current();return}_.style.maxHeight="";const E=Jq(b,{width:_.offsetWidth,height:_.offsetHeight},{width:window.innerWidth,height:window.innerHeight});_.style.top=`${E.top}px`,_.style.left=`${E.left}px`,_.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,_.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const _=S=>{var b;(b=h.current)!=null&&b.contains(S.target)||m()};return window.addEventListener("scroll",_,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const _=S=>{var j,E;const b=S.target;!b||(j=h.current)!=null&&j.contains(b)||(E=document.getElementById(e))!=null&&E.contains(b)||p.current()};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[e,h]),x.useEffect(()=>{var S;if(a!=="menu")return;const _=u_(h.current);(S=c==="last"?_[_.length-1]:_[0])==null||S.focus()},[]);const y=_=>{var S;if(a==="menu"&&_.key==="Tab"){_.stopPropagation(),(S=document.getElementById(e))==null||S.focus(),_.shiftKey&&_.preventDefault(),p.current();return}if(a==="menu"){const b=u_(h.current),j=Zq(_,b.indexOf(document.activeElement),b.length);j.kind==="focus"&&(_.preventDefault(),b[j.index].focus())}_.key.length===1&&_.stopPropagation()},w=_=>{_.target.closest("button, input, select, textarea, code")||_.preventDefault()},N=_=>{if(a!=="menu"||_.pointerType==="touch")return;const S=_.target.closest($A);S&&!S.disabled&&document.activeElement!==S&&S.focus({preventScroll:!0})};return $r.createPortal(l.jsx("div",{ref:h,id:n,className:`anchored-popover${s?` ${s}`:""}`,role:a,"aria-labelledby":i,onKeyDown:y,onMouseDown:w,onPointerMove:N,children:f}),document.body)}async function eF(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const tF=1800;function nF({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[i,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),S=x.useRef(!1),b=dn(t,{focusRef:_});x.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const $=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval($)},[i]);const j=Hq(e),E=e.filter($=>!s.includes($.num)).map($=>$.num),C=E.length===e.length,T=$=>a(V=>V.includes($)?V.filter(Q=>Q!==$):[...V,$]),R=x.useCallback(async()=>{if(!ws(S.current)||!E.length)return;S.current=!0,f(!0),h(null),y(!1);const $=await eF({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,f(!1),!($!=null&&$.ok)){h(Ti($,"the share could not be made"));return}c({blob:$.blob,expiresAt:$.expiresAt,shared:$.shared??[],failed:$.failed??[]})},[e,E]),I=i?IA(i.expiresAt,w):null,L=(I==null?void 0:I.tone)==="gone",H=(i==null?void 0:i.shared.length)??0;return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:l.jsxs("div",{ref:b,className:"modal sa-modal",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("h3",{children:"Share accounts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsx("section",{className:"modal-body sa-body",children:i?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:L?"This share has expired":H===1?"1 account, ready to paste":`${H} accounts, ready to paste`}),l.jsx("code",{className:`ap-share-blob${L?" sa-dead":""}`,children:i.blob}),l.jsxs("div",{className:"ap-share-foot",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(L){c(null),R();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),tF))},children:L?"make a new share":m?"copied":`copy ${H===1?"the share":"all "+H}`}),l.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[l.jsx("span",{className:"ap-share-warn",children:H===1?"this is the password":`this is ${H} passwords`})," · ",l.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&l.jsxs("div",{className:"sa-failed",role:"alert",children:[l.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),l.jsx("ul",{className:"sa-list",children:i.failed.map($=>{var Q;const V=!!($.email&&((Q=$.detail)!=null&&Q.includes($.email)));return l.jsxs("li",{children:[!V&&l.jsx("span",{className:"sa-who",children:$.email||`account ${$.num}`}),l.jsx("span",{className:"sa-why",children:$.detail||"could not be exported"})]},`${$.num}-${$.email}`)})})]}),l.jsx("p",{className:"sa-note",children:L?l.jsx(l.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):l.jsxs(l.Fragment,{children:["Paste it into the other deck with ",l.jsx("strong",{children:"+"})," → ",l.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),l.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?l.jsxs("div",{className:"sa-step",children:[l.jsx("h4",{children:"Nothing to share"}),l.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",l.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),l.jsx("div",{className:"sa-actions",children:l.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):l.jsxs("div",{className:"sa-step",children:[l.jsxs("h4",{children:["Which accounts go to the other ",Zt,"?"]}),l.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:Gq(E.length)}),l.jsx("ul",{className:"sa-list sa-pick",children:j.map($=>l.jsx("li",{children:l.jsxs("label",{className:"sa-row",children:[l.jsx("input",{type:"checkbox",checked:E.includes($.num),onChange:()=>T($.num)}),l.jsx("span",{className:"sa-who",children:$.label}),$.sub&&l.jsx("span",{className:"sa-sub",children:$.sub})]})},$.num))}),p&&l.jsx("p",{className:"aa-err",children:p}),l.jsxs("div",{className:"sa-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map($=>$.num):[]),children:C?"Clear all":"Select all"}),l.jsx("button",{type:"button",className:"btn primary",ref:_,...aa(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function rF(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function sF(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:a&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:s,displaced:t}:null}}function aF(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function oF(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function iF(e,t){return{label:"save",done:"saved",sends:e!==t,swaps:!1,title:`Switch the active account out once it passes ${e}% of its limit.`}}function h_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function lF(e){const t=e.filter(u=>!h_(u)),n=e.filter(u=>h_(u)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)i&&u.pct<=i.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:s,rest:a,fuller:c,peak:c??i}}const cF="\0";function Qx(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${cF}${n}`}function uF(e,t){const n=Qx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function dF(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Qx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const hF=64;function fF(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const pF=Object.freeze({text:"couldn't reach the deck server",reload:!0}),mF=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function f_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function gF(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=gc(t.body);return{text:ux(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function p_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}function OA({title:e,steps:t,finish:n,aside:s,onClose:a}){const i=x.useRef(null),c=dn(a,{focusRef:i}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=N=>f(Math.max(0,Math.min(t.length-1,N))),y=N=>{N.key!=="ArrowRight"&&N.key!=="ArrowLeft"||(N.preventDefault(),N.stopPropagation(),m(N.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),l.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("div",{className:"guide-stage",children:h.art},u),l.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),l.jsx("p",{className:"guide-tip",children:h.tip??""}),l.jsxs("div",{className:"guide-foot",children:[l.jsx("div",{className:"guide-dots",children:t.map((N,_)=>l.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===u?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&l.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),u>0&&l.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),l.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const hx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function lr({children:e}){return l.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function ir({x:e,y:t=34,w:n=176,h:s=132,label:a}){return l.jsxs(l.Fragment,{children:[a&&l.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),l.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function Rr({x:e,y:t,email:n,state:s,tone:a,bars:i}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:hx[a]}),l.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),l.jsx("text",{x:e+12,y:t+16,className:`ga-s ${hx[a]}`,children:s}),i==null?void 0:i.map((c,u)=>l.jsxs("g",{children:[l.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),l.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function PA({x:e,y:t,on:n}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),l.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function sd({x:e,y:t,name:n,here:s=!0}){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),l.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function m_({x:e,y:t,on:n}){return n?l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),l.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):l.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function g_({x:e,y:t,d:n}){return l.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function Jx({x:e,y:t}){return l.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function e0(){return l.jsxs(l.Fragment,{children:[l.jsx("circle",{r:9,className:"ga-key-bed"}),l.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[l.jsx("circle",{cx:4.6,cy:7,r:2.6}),l.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Ai({x:e,y:t,w:n,title:s,sub:a,tone:i}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),l.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:hx[i]}),l.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),l.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function $i({x:e,y:t,label:n,live:s}){return l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),l.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function Dd({x:e,y:t}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),l.jsx(PA,{x:e+118,y:t-13,on:!0})]})}function yF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),l.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),l.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),l.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),l.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),l.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),l.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),l.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),l.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),l.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),l.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),l.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),l.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),l.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),l.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),l.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),l.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),l.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),l.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),l.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),l.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function wF(){return l.jsxs(lr,{children:[l.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),l.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),l.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),l.jsx(Ai,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),l.jsx(Ai,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),l.jsx(Ai,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),l.jsx(Ai,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),l.jsx($i,{x:326,y:28,label:"Read"}),l.jsx($i,{x:380,y:28,label:"Grep",live:!0}),l.jsx($i,{x:326,y:90,label:"Bash",live:!0})]})}function y_({x:e,y:t,label:n,pct:s,note:a}){return l.jsxs(l.Fragment,{children:[l.jsx("text",{x:e,y:t,className:"ga-s",children:n}),l.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),l.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function vF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),l.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),l.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),l.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),l.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),l.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),l.jsx(y_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),l.jsx(y_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function xF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),l.jsx(Ai,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),l.jsx(Jx,{x:156,y:106}),l.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),l.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:200,y:22,w:226,h:160}),l.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),l.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),l.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),l.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),l.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),l.jsx($i,{x:214,y:122,label:"Read"}),l.jsx($i,{x:266,y:122,label:"Edit"}),l.jsx($i,{x:318,y:122,label:"Bash",live:!0}),l.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),l.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function bF(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:20,w:412,h:160}),l.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),l.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),l.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),l.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>l.jsxs("g",{children:[l.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),l.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),l.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),l.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),l.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),l.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),l.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),l.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),l.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),l.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),l.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),l.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),l.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),l.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function kF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),l.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),l.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),l.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[l.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),l.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),l.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),l.jsx("path",{d:"M210 100H238",className:"ga-arc"}),l.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),l.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Ai,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function _F(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,y:16,w:232,h:170}),l.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),l.jsx(g_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),l.jsx(g_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),l.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),l.jsx(Rr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),l.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),l.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),l.jsx(Rr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),l.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),l.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),l.jsx(Jx,{x:221,y:161}),l.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),l.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),l.jsx(ir,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),l.jsx("g",{className:"ga-pop",children:l.jsx(Rr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function NF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(Dd,{x:28,y:60}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Rr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Rr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Dd,{x:264,y:60}),l.jsx(Rr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),l.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:l.jsx(e0,{})})]})}const SF=[{art:l.jsx(yF,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:l.jsx(wF,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:l.jsx(xF,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:l.jsx(vF,{}),line:"What each session costs, and how much quota is left."},{art:l.jsx(bF,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:l.jsx(_F,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:l.jsx(NF,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:l.jsx(kF,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function jF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(Rr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),l.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),l.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),l.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Rr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function EF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx(Dd,{x:28,y:60}),l.jsx(sd,{x:28,y:92,name:"Ana's MacBook"}),l.jsx(sd,{x:28,y:114,name:"Dorin's PC"}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Dd,{x:264,y:60}),l.jsx(sd,{x:264,y:92,name:"Your MacBook"}),l.jsx(sd,{x:264,y:114,name:"Dorin's PC"}),l.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),l.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),l.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function CF(){return l.jsxs(lr,{children:[l.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),l.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),l.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),l.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),l.jsx(m_,{x:106,y:88,on:!0}),l.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),l.jsx(m_,{x:106,y:112}),l.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),l.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),l.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),l.jsx(PA,{x:304,y:157,on:!0}),l.jsx(Jx,{x:115,y:97})]})}function TF(){return l.jsxs(lr,{children:[l.jsx(ir,{x:14,label:"THIS MACHINE"}),l.jsx("g",{className:"ga-swap-out",children:l.jsx(Rr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),l.jsx("g",{className:"ga-swap-in",children:l.jsx(Rr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),l.jsx(ir,{x:250,label:"ANOTHER MACHINE"}),l.jsx(Rr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),l.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),l.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:l.jsx(e0,{})})]})}const AF=[{art:l.jsx(jF,{}),line:"A login can expire on one machine while it still works on another."},{art:l.jsx(EF,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:l.jsx(CF,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:l.jsx(TF,{}),line:"An expired login is copied from a paired machine within a minute."}];function RF(){return l.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[l.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),l.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),l.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),l.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),l.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),l.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),l.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),l.jsx("g",{transform:"translate(116 13)",children:l.jsx(e0,{})})]})}async function fp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const MF={not_an_invite:"That is not an invite — paste the whole line they sent you.",expired:"That invite has run out. Ask them for a fresh one.",not_running:"This deck is not on the network yet. Turn Local network on, then try again."},IF={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function w_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Xt(n,t)}function $F({status:e,manual:t,onClose:n,onChanged:s}){var W,Y,O;const a=x.useRef(null),i=dn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState(null),[S,b]=x.useState(null),[j,E]=x.useState(()=>Date.now());x.useEffect(()=>{const F=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(F)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback(F=>ah(T.current)?(T.current=F,_(F),!0):!1,[]),I=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),L=F=>{const oe=ua(N,F);return{disabled:oe.disabled,"aria-busy":oe.busy}},H=F=>(h==null?void 0:h.field)===F?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},$=F=>m(oe=>oe&&oe.field===F?null:oe),V=x.useCallback(async()=>{const F=KF(c);if(!F){m({text:OF(c),field:"addr"});return}const oe=`${F.addr}:${F.port}`,z=e.peers.find(Z=>Z.addr===F.addr&&Z.port===F.port&&Z.paired);if(z){m({text:`Already paired with ${z.name} at that address.`,field:"addr"});return}if(t.includes(oe)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const Z=await fp("/api/prefs",{lan:{manual:[...t,oe]}});if(!C.current)return;Z!=null&&Z.ok?(m(null),u(""),s(),n()):m({text:Xt("add that address",Z),field:"addr"})}catch{C.current&&m({text:Xt("add that address",null),field:"addr"})}finally{I()}},[c,t,e.peers,s,n,R,I]),Q=x.useCallback(async F=>{if(!R(`invite:${F}`))return;const oe=F==="make"?"make an invite":"cancel that invite";try{const z=await fp("/api/lan/invite",{action:F});if(!C.current)return;z!=null&&z.ok?(m(null),w(null),s()):m({text:w_(IF,z,oe)})}catch{C.current&&m({text:Xt(oe,null)})}finally{I()}},[s,R,I]),J=x.useCallback(async()=>{const F=f.trim();if(!(!F||!R("join"))){b(null);try{const oe=await fp("/api/lan/invite",{action:"join",token:F});if(!C.current)return;oe!=null&&oe.ok?(p(""),m(null),s(),n()):(oe==null?void 0:oe.reason)==="unreachable"&&Array.isArray(oe.tried)&&oe.tried.length?(b(oe.tried),m(null)):(b(null),m({text:w_(MF,oe,"use that invite"),field:"join"}))}catch{C.current&&m({text:Xt("use that invite",null),field:"join"})}finally{I()}}},[f,s,n,R,I]),M=x.useCallback(async(F,oe)=>{try{await navigator.clipboard.writeText(F),w(oe),window.setTimeout(()=>{C.current&&w(z=>z===oe?null:z)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),X=e.invite&&e.invite.expiresAt>j?e.invite:null,G=((W=e.reach)==null?void 0:W.steps)??[],P=((Y=e.reach)==null?void 0:Y.shell)==="sh",B=e.port!=null?(e.addrs??[]).map(F=>`${F}:${e.port}`):[];return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:i,className:"modal lan-add",onClick:F=>F.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[h&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((O=e.reach)==null?void 0:O.blocked)&&l.jsxs("div",{className:"ap-lan-reach",children:[l.jsx("p",{className:"lan-warn",children:e.reach.text}),l.jsx("p",{className:"lan-note",children:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."}),G.length>0&&l.jsxs("details",{className:"ap-lan-reach-fix",children:[l.jsx("summary",{children:"or let them find this deck on their own"}),l.jsxs("p",{className:"lan-note",children:[P?l.jsx(l.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):l.jsxs(l.Fragment,{children:["Run this in PowerShell ",l.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.reach.category==="Public"&&l.jsx(l.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."}),e.reach.unsure&&l.jsxs(l.Fragment,{children:[" ",e.reach.unsure]})]}),l.jsx("pre",{className:"ap-lan-cmd",children:l.jsx("code",{children:G.join(`
|
|
90
|
+
`)})}),l.jsx("button",{type:"button",className:"ap-manage-btn",...L("copy:fix"),onClick:()=>void M(G.join(`
|
|
91
|
+
`),"fix"),title:P?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"By address"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...H("addr"),onChange:F=>{u(F.target.value),$("addr")},onKeyDown:F=>{F.key==="Enter"&&V()}}),c.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...L("add"),onClick:()=>void V(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),l.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&B.length>0&&l.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",B.map((F,oe)=>l.jsxs("span",{children:[oe>0&&" or ",l.jsx("code",{className:"ap-lan-code",children:F})]},F)),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...L("copy:mine"),onClick:()=>void M(B.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:y==="mine"?"copied":"copy"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:["With an invite",!X&&l.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...L("invite:make"),onClick:()=>void Q("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...H("join"),onChange:F=>{p(F.target.value),b(null),$("join")},onKeyDown:F=>{F.key==="Enter"&&J()}}),f.trim()!==""&&l.jsx("button",{type:"button",className:"ap-manage-btn",...L("join"),onClick:()=>void J(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),l.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&l.jsxs("div",{className:"ap-lan-tried",children:[l.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map(F=>l.jsxs("span",{className:"ap-lan-tried-row",children:[l.jsx("code",{className:"ap-lan-code",children:F.addr}),l.jsx("span",{className:"ap-lan-bad",children:F.why})]},F.addr))]}),X&&l.jsxs("div",{className:"ap-lan-invite",children:[l.jsxs("div",{className:"ap-lan-invite-head",children:[l.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),l.jsxs("span",{className:"ap-lan-invite-left",children:[ZF(X.expiresAt,j)," left"]})]}),l.jsx("code",{className:"ap-lan-token",children:X.token}),l.jsxs("div",{className:"ap-lan-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...L("copy:invite"),onClick:()=>void M(X.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...L("invite:withdraw"),onClick:()=>void Q("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),l.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function OF(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const PF=1e3;function LF(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Kr(e,t);return`${n} · ${s==="now"?"just now":s}`}function v_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function DF(){return l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),l.jsx("path",{d:"M8.4 3.6l2 2"})]})}function x_(){return l.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),l.jsx("path",{d:"M1 13h14"})]})}function ad({dir:e,gate:t=!1}){const n=t?12:8;return l.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const qF={works:"works here",expired:"expired here",missing:"not on this deck"},FF={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function BF(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${qF[e.here]}, ${FF[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function zF({row:e,source:t,status:n,accounts:s,now:a,busy:i,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var bt,st,mt,ze,Dt;const w=x.useRef(null),N=dn(c,{focusRef:w}),[_,S]=x.useState(null),[b,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,I]=x.useState(null),[L,H]=x.useState(!1),[$,V]=x.useState(0),Q=x.useRef(null),J=x.useRef(!0);x.useEffect(()=>()=>{J.current=!1},[]);const M=_!=null;x.useEffect(()=>{var me;M&&((me=Q.current)==null||me.select())},[M]),x.useEffect(()=>{if(!E)return;const me=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(me)},[E]),x.useEffect(()=>{if(!R)return;const me=window.setTimeout(()=>I(null),4e3);return()=>window.clearTimeout(me)},[R]);const X=me=>{const gt=ua(i,me);return{disabled:gt.disabled,"aria-busy":gt.busy}},G=async me=>{const gt=await me();return J.current&&j(gt),gt==null},{peer:P,stranger:B}=t,W=e.kind==="paired",Y=e.self??e.name,O=e.kind!=="dialling",F=e.kind==="dialling"?null:e.fp,oe=P?P.addr?`${P.addr}:${P.port}`:"":B?B.port?`${B.addr}:${B.port}`:B.addr:e.addr,z=(P==null?void 0:P.about)??null,Z=((bt=n.about)==null?void 0:bt.version)??null,U=async me=>{const gt=me.trim()===Y?"":me;await G(()=>u(gt))&&S(null)},re=async()=>{if(F)try{if(await navigator.clipboard.writeText(F),!J.current)return;H(!0),window.setTimeout(()=>{J.current&&H(!1)},1600)}catch{J.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},de=W?P!=null&&P.waiting?P.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":P!=null&&P.offers?"not said — it runs an older version":"not reached yet":"shown once paired",pe=v_(n.about),ge=v_(z),Te=z!=null&&z.version&&Z?i8(z.version,Z):null,Ue=P?LA(P.last,a):null,He=P&&((st=P.last)!=null&&st.error)?YF({error:P.last.error,host:P.addr,port:P.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(me=>!me.manual&&me.addr).map(me=>({fp:me.fp,name:me.name,addr:me.addr,port:me.port,at:me.lastSeen??0}))],a):null,Pe=(mt=P==null?void 0:P.last)!=null&&mt.error&&Ue&&Ue.text!==P.last.error?P.last.error:null,Se=((ze=P==null?void 0:P.last)==null?void 0:ze.done)??[],nt=!!Ue&&!!Pe&&!e.quiet&&e.state.startsWith(Ue.text),je=W||e.kind==="dialling",be=P?P.waiting?null:P.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ke=e.tone==="bad"?"bad":W?e.here?"up":"down":"loose",ct=i===`check:${e.fp}`,Ye=(P==null?void 0:P.offers)??null,ce=Ke==="up"?(Ye==null?void 0:Ye.current)??null:null,ke=ce&&"key"in ce?ce.key:null,Ee=!!ce&&"hidden"in ce,Ze=!!ce&&"other"in ce,Xe=W?c8((Ye==null?void 0:Ye.accounts)??null,s,n.shared??[],ke):[],ut=Xe.filter(me=>me.in==null&&me.out==="cut"),ee=Xe.some(me=>me.in!=null),Ne=Xe.some(me=>me.out!=null),Be=new Map(Se.map(me=>[me.email,me])),et=Se.filter(me=>!Xe.some(gt=>gt.email===me.email)),pt=W?Ye?Ye.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:P!=null&&P.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(Dt=P==null?void 0:P.last)!=null&&Dt.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,tt=Ye&&(P!=null&&P.last)&&P.last.at-Ye.at>PF?Kr(Ye.at,a):null,rt=[];W&&(P!=null&&P.pairedAt)?rt.push({label:"Paired",value:LF(P.pairedAt,a),tone:"meta"}):e.kind==="declined"&&B&&rt.push({label:"Paired",value:`no · you said no ${n0(B.at,a)}`,tone:"meta"}),rt.push({label:"Fingerprint",value:F?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:F}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void re(),"aria-label":L?"Fingerprint copied":"Copy the fingerprint",children:L?"copied":"copy"})]}):"not known — nothing has answered there",tone:F?void 0:"quiet"});const lt=m.length?[{row:e,peer:P??null},...m]:[];return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:me=>me.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[l.jsxs("header",{className:"modal-head lan-peer-head",children:[l.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsxs("div",{className:"lan-peer-id",children:[M?l.jsxs("form",{className:"lan-peer-edit",onSubmit:me=>{me.preventDefault(),U(_??"")},children:[l.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),l.jsx("input",{ref:Q,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:Y,"aria-label":"Name for this deck, shown on this deck only",onChange:me=>S(me.target.value)}),l.jsx("button",{type:"submit",className:"ap-manage-btn",...X(`alias:${e.fp}`),children:"save"}),l.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):l.jsxs("span",{className:"lan-peer-title",children:[l.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),O&&l.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{j(null),S(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:l.jsx(DF,{})})]}),l.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&l.jsxs(l.Fragment,{children:["calls itself ",l.jsx("span",{className:"lan-peer-self",children:e.self}),M&&l.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...X(`alias:${e.fp}`),onClick:()=>void U(""),children:"use this name"}),l.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&l.jsx("span",{"aria-hidden":!0,children:" · "})]}),l.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body lan-peer-body",children:[b&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:b}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"lan-map","data-link":Ke,"data-asking":ct||void 0,"data-bus":Xe.length>0||void 0,children:[l.jsxs("div",{className:"lan-ends",children:[l.jsxs("p",{className:"lan-end",children:[l.jsx("span",{className:"lan-end-name",children:"This deck"}),pe&&l.jsx("span",{className:"lan-end-runs",children:pe}),W&&n.shareActive===!1&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),l.jsxs("p",{className:"lan-end","data-side":"there",children:[l.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&l.jsxs("span",{className:"lan-end-runs",children:[ge??(z?"not said":de),Te?` · ${Te<0?"older":"newer"}`:null]}),Ee&&l.jsx("span",{className:"lan-end-note",children:"current account hidden"}),Ze&&l.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),l.jsxs("div",{className:"lan-link",children:[l.jsx(x_,{}),l.jsxs("span",{className:"lan-span",children:[l.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[l.jsx("i",{className:"lan-glint","data-dir":"out"}),l.jsx("i",{className:"lan-glint","data-dir":"in"})]}),l.jsx("span",{className:"lan-link-label",children:oe?l.jsx("code",{className:"ap-lan-code",children:oe}):"none here — it calls this deck"})]}),l.jsx(x_,{}),(oe&&be||je)&&l.jsxs("p",{className:"lan-link-sub",children:[oe&&be,oe&&be&&je&&" · ",je&&(Ue?nt?l.jsx("code",{className:"ap-lan-code",children:Pe}):l.jsx("span",{className:"lan-round","data-tone":Ue.tone,children:Ue.text.replace(/ · now$/," · just now")}):"not asked yet"),je&&Pe&&!nt&&l.jsx("code",{className:"lan-fact-raw",children:Pe})]}),et.length>0&&l.jsx("ul",{className:"lan-done",children:et.map(me=>l.jsxs("li",{"data-ok":me.ok,children:[me.email," ",l.jsx("span",{className:"lan-done-what",children:me.ok?"arrived":"did not arrive"})]},`${me.email}:${me.action}`))}),He&&l.jsx("p",{className:"lan-note lan-link-note",children:He}),(P==null?void 0:P.waiting)&&l.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),Xe.length>0&&l.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:Xe.map((me,gt)=>{const kt=Be.get(me.email),jn=me.out==="live"||me.in!=null&&me.in!=="cut";return l.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":me.tone,"data-draw":me.in&&me.out?"both":me.in?"in":"out","data-used-there":me.usedThere||void 0,style:{"--i":gt},children:[l.jsx("i",{className:"lan-pip","data-end":"here","data-state":me.here,"aria-hidden":!0}),l.jsxs("span",{className:"lan-track",children:[l.jsxs("span",{className:"lan-wire","data-flow":jn?"live":"cut","aria-hidden":!0,children:[(me.in==="live"||me.in==="wait")&&l.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":me.in}),me.out==="live"&&l.jsx("i",{className:"lan-glint","data-dir":"out"})]}),me.in&&me.in!=="cut"&&l.jsx(ad,{dir:"in",gate:me.in==="blocked"}),me.out==="live"&&l.jsx(ad,{dir:"out"}),l.jsx("span",{className:"lan-lane-email",children:me.email})]}),l.jsx("i",{className:"lan-pip","data-end":"there","data-state":me.there,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:BF(me)}),(me.caption||kt)&&l.jsxs("span",{className:"lan-lane-note",children:[me.caption,me.caption&&kt&&" · ",kt&&l.jsx("span",{className:"lan-lane-done","data-ok":kt.ok,children:kt.ok?"arrived last round":"did not arrive last round"})]})]},me.key)})},$),W&&l.jsxs(l.Fragment,{children:[ut.length>0&&l.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",ut.length===1?ut[0].email:"the expired ones"," until you sign in again here."]}),pt&&l.jsx("p",{className:"lan-empty",children:pt}),tt&&l.jsxs("p",{className:"lan-stale",children:["As of ",tt==="now"?"just now":tt,", when it last answered."]}),l.jsxs("div",{className:"lan-legend",children:[ee&&l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:l.jsx(ad,{dir:"in"})}),"from ",e.name]}),Ne?l.jsxs("span",{className:"lan-key",children:[l.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:l.jsx(ad,{dir:"out"})}),"from this deck, to every paired deck"]}):l.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),l.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),l.jsx("dl",{className:"lan-facts",children:rt.map(me=>l.jsxs("div",{className:"lan-fact","data-tone":me.tone,children:[l.jsx("dt",{children:me.label}),l.jsx("dd",{children:me.value})]},me.label))}),lt.length>1&&l.jsxs("div",{className:"modal-section",children:[l.jsxs("h3",{className:"lan-h",children:[lt.length," decks on this machine"]}),l.jsx("ul",{className:"lan-twins",role:"list",children:lt.map((me,gt)=>{var Ft,Kn,te,Ae;const kt=(Ft=me.peer)!=null&&Ft.addr?`${me.peer.addr}:${me.peer.port}`:me.row.addr,jn=kt||me.row.fp,En=(Kn=me.peer)!=null&&Kn.pairedAt?Kr(me.peer.pairedAt,a):null,Yn=[(Ae=(te=me.peer)==null?void 0:te.about)!=null&&Ae.version?`runs ${me.peer.about.version}`:null,En?`paired ${En==="now"?"just now":En}`:null,me.row.state].filter(Boolean).join(" · "),qt=me.row.fp;return l.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":me.row.tone,children:[l.jsx("i",{className:me.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),kt?l.jsx("code",{className:"ap-lan-code lan-twin-at",children:kt}):l.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),l.jsx("code",{className:"ap-lan-code lan-twin-fp",children:qt}),gt>0&&y&&l.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===qt?" armed":""}`,...X(`unpair:${qt}`),onKeyDown:Ie=>{Ie.repeat&&Ie.preventDefault()},onClick:()=>{if(R!==qt){I(qt),T.current=Date.now();return}Date.now()-T.current<qd||(I(null),G(()=>y(qt)))},"aria-label":R===qt?`Confirm unpairing ${jn}`:`Unpair ${jn}`,title:R===qt?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:i===`unpair:${qt}`?"unpairing…":R===qt?"confirm":"unpair"}),l.jsx("span",{className:"lan-twin-meta",children:gt===0?`${Yn} · shown above`:Yn})]},qt)})})]})]}),l.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&l.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),W&&!(P!=null&&P.waiting)&&l.jsx("button",{type:"button",className:"btn",...X(`check:${e.fp}`),onClick:()=>void G(f).then(me=>{me&&J.current&&V(gt=>gt+1)}),title:"Ask this deck now instead of waiting for the next round",children:i===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&l.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...X(`unpair:${e.fp}`),onKeyDown:me=>{me.repeat&&me.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<qd||(C(!1),G(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:i===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&l.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...X(`accept:${e.fp}`),onClick:()=>void G(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:i===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`drop:${e.fp}`),onClick:()=>void G(p),title:"Stop trying this address. Nothing was ever paired here.",children:i===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&l.jsx("button",{type:"button",className:"btn lan-peer-verb",...X(`allow:${e.fp}`),onClick:()=>void G(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:i===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function UF({status:e,accounts:t,onClose:n,onChanged:s}){const a=dn(n),[i,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null),w=x.useRef(null),N=L=>{const H=ua(m,L);return{disabled:H.disabled,"aria-busy":H.busy}},_=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{_.current&&XF(_.current,e.shared??[])&&(_.current=null)},[e.shared]);const b=x.useCallback(async(L,H,$="write")=>{w.current=$,y($);try{const Q=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:L})})).json().catch(()=>null);return S.current?(Q!=null&&Q.ok?f(null):f(Xt(H,Q)),s(),(Q==null?void 0:Q.ok)===!0):!1}catch{return S.current&&f(Xt(H,null)),!1}finally{w.current=null,S.current&&y(null)}},[s]),j=x.useCallback(async()=>{if(i!=null&&i!==(e.name??"")){if(!await b({name:i},"save the name","name"))return;S.current&&c(null)}n()},[i,e.name,b,n]),E=async()=>{if(!e.fp)return;const L=await Vx(e.fp);if(S.current){if(!L){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{S.current&&h(!1)},1600)}},C=new Set(_.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,I=e.shareActive!==!1;return $r.createPortal(l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal lan-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[u&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:u}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Name"}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"appear as"}),l.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:L=>c(L.target.value),onKeyDown:L=>{L.key!=="Enter"||i==null||(b({name:i},"save the name","name"),c(null))}}),i!=null&&i!==(e.name??"")&&l.jsx("button",{type:"button",className:"ap-manage-btn",...N("name"),onClick:()=>{b({name:i},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),l.jsxs("div",{className:"ap-lan-row",children:[l.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?l.jsxs("span",{className:"lan-fp",children:[l.jsx("code",{className:"ap-lan-code",children:e.fp}),l.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):l.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Share these accounts"}),l.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&l.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(L=>l.jsxs("label",{className:"ap-lan-pick",title:L.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[l.jsx("input",{type:"checkbox",checked:C.has(L.key),onChange:H=>{const $=new Set(_.current??e.shared??[]);H.target.checked?$.add(L.key):$.delete(L.key),_.current=[...$],b({shared:[...$]},H.target.checked?"share that account":"stop sharing that account")}}),l.jsx("span",{className:"ap-lan-pick-name",children:L.email}),!L.alive&&l.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},L.key))]}),t.length>0&&l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":I,"aria-label":"Show paired decks which of these this deck is using",...N("current"),onClick:()=>void b({shareActive:!I},I?"stop showing which account this deck is using":"show which account this deck is using","current"),title:I?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:l.jsx("span",{className:"switch-knob"})})]})]}),l.jsxs("div",{className:"modal-section",children:[l.jsx("h3",{className:"lan-h",children:"Pairing"}),l.jsxs("div",{className:"lan-switches",children:[l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...N("ask"),onClick:()=>void b({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"lan-switch",children:[l.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...N("accept"),onKeyDown:L=>{L.repeat&&L.preventDefault()},onClick:()=>void b({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:R?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:l.jsx("span",{className:"switch-knob"})})]})]})]})]}),l.jsxs("footer",{className:"lan-setup-foot",children:[l.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),l.jsx("button",{type:"button",className:"btn primary",...N("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function Kr(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const s=Math.round(n/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const t0={"waiting for the other deck to accept this one":{text:"waiting for them to say yes",tone:"idle"},"that deck said no":{text:"it said no",tone:"bad"}},WF={ECONNREFUSED:"not listening",EHOSTUNREACH:"no route to it",ENETUNREACH:"no network here",ETIMEDOUT:"no answer",ECONNRESET:"it hung up",EHOSTDOWN:"it is down",ENOTFOUND:"name not found",EACCES:"blocked here",EPIPE:"it hung up"};function HF(e){var s;const t=GF[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&WF[n]||e}const GF={"handshake timed out":"no answer","peer closed the connection":"it hung up","peer went quiet":"it stopped mid-sentence","bad reply":"it answered with nonsense","no manifest":"it would not say what it has","bad challenge":"it answered as somebody else","a different deck is answering at that address":"a different deck is at that address","that deck could not prove its own key":"it could not prove who it is","the other deck refused this one's proof":"it would not take this deck's word","the other deck refused this handshake":"it turned this deck away","that deck has this one pinned under a different key":"it knows this deck by another key"};function LA(e,t){if(!e)return null;if(e.error)return t0[e.error]??{text:HF(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Kr(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Kr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Kr(e.at,t)}`,tone:"bad"}}const VF=9e4;function YF({error:e,host:t,port:n},s,a,i=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=s.filter(p=>p.addr===c&&p.port&&p.at>0&&a-p.at<VF);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${i} and TCP ${n??f[0]}.`}const fx=5e3,DA=6e4,qd=400;function KF(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const s=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!s||!Number.isInteger(a)||a<1||a>65535||s.includes(":")&&!(s.startsWith("[")&&s.endsWith("]"))?null:{addr:s,port:a}}function Xt(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function XF(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function ZF(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function qA(e,t){var n,s;return(n=e.last)!=null&&n.error&&!t0[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Fd||e.lastSeen!=null&&t-e.lastSeen<Fd)}const Fd=95e3,QF=160,JF=6,e8=140;function t8(e,t){const n=[],s=[];for(const a of e??[])(qA(a,t)?n:s).push(a);return{online:n,offline:s}}function n8(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const s=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(w=>w.waiting),i=s.filter(w=>!w.waiting),c=a.filter(w=>{var N;return!((N=w.last)!=null&&N.error)&&w.lastSeen!=null&&t-w.lastSeen<Fd}),{online:u,offline:f}=t8(i,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var N;return((N=w.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function r8(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Kr(e,t);return s==="now"?"checked just now":`checked ${s}`}function n0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const s=Math.round(n/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function s8(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Fd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Kr(e,t)}`,here:n}}function b_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Kr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function a8(e,t){var y,w,N,_,S;if(!e)return[];const n=[],s=new Set,a=(b,j)=>b.name.localeCompare(j.name,void 0,{numeric:!0}),i=e.aliases??{},c=(b,j)=>{const E=b?i[b]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||s.has(b.fp))continue;s.add(b.fp);const j=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${n0(b.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${b.addr} is waiting for an answer.`})}const u=[],f=[];for(const b of e.peers??[]){const j=b.peerFp??b.fp;if(!j||s.has(j))continue;s.add(j);const E=LA(b.last,t),C=qA(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||j,addr:b.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=b.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${b.last.error}.`:`Dialling ${T} until something answers.`});continue}const R=b.waiting?s8(b.lastSeen,t):null,I=R?R.here:C,L=!R&&E?I?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${b_(b,I,t)}`:R?R.text:b_(b,I,t),H=(w=b.last)!=null&&w.error?t0[b.last.error]:null,$=!R&&I&&!((N=b.last)!=null&&N.error)&&!(((_=b.last)==null?void 0:_.done)??[]).length,V=b.manual&&!b.met?{name:T}:c(j,b.name||j);u.push({fp:j,name:V.name,...V.self?{self:V.self}:{},addr:b.addr??"",kind:"paired",state:L,quiet:$,tone:H?H.tone==="bad"?"bad":"wait":E?E.tone:I?"ok":"idle",here:R?R.here:C,hint:R?`${V.name} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${b.lastSeen==null?"It has not called since this deck started.":`It last called ${Kr(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${V.name}${T?` at ${T}`:""}${(S=b.last)!=null&&S.error?` — ${b.last.error}`:""}`})}n.push(...o8(u).sort(a),...f.sort(a));const p=[];for(const b of e.strangers??[]){if(!(b!=null&&b.fp)||s.has(b.fp))continue;s.add(b.fp);const j=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${b.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const b of e.declined??[]){if(!(b!=null&&b.fp)||s.has(b.fp))continue;s.add(b.fp);const j=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:j.name,...j.self?{self:j.self}:{},addr:b.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${j.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const b of n)m.set(b.name,(m.get(b.name)??0)+1);for(const b of n)(m.get(b.name)??0)<2||!b.addr||(b.state=b.quiet||!b.state?b.addr:`${b.addr} · ${b.state}`,b.quiet=!1);return n}function o8(e){const t=new Map;for(const s of e){const a=t.get(s.name);a?a.push(s):t.set(s.name,[s])}const n=[];for(const s of t.values()){const a=[...new Set(s.filter(i=>i.addr).map(i=>i.addr))];if(a.length>1){for(const i of a)n.push(k_(s.filter(c=>c.addr===i)));n.push(...s.filter(i=>!i.addr))}else n.push(k_(s))}return n}function k_(e){const[t,...n]=[...e].sort((s,a)=>Number(a.here)-Number(s.here)||+!!a.addr-+!!s.addr);return n.length?{...t,twins:n}:t}function __(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function N_(e,t){if(!e)return{};switch(t.kind){case"paired":return{peer:(e.peers??[]).find(n=>(n.peerFp??n.fp)===t.fp)??null};case"dialling":return{peer:(e.peers??[]).find(n=>n.manual&&!n.met&&`${n.addr}:${n.port}`===t.fp)??null};case"nearby":return{stranger:(e.strangers??[]).find(n=>n.fp===t.fp)??null};case"declined":return{stranger:(e.declined??[]).find(n=>n.fp===t.fp)??null};case"asks":return{stranger:(e.pending??[]).find(n=>n.fp===t.fp)??null}}}function i8(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),s=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!s)return null;for(let a=1;a<=3;a++){const i=Number(n[a])-Number(s[a]);if(i)return Math.sign(i)}return 0}function l8(e,t,n){const s=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:s,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:s,note:null,tone:"ok"}:n?{there:"works there",here:s,note:"repairs next round",tone:"wait"}:{there:"works there",here:s,note:"share it to repair",tone:"bad"}:{there:"works there",here:s,note:"arrives next round",tone:"wait"}}function c8(e,t,n,s=null){const a=new Map(t.map(f=>[f.key,f])),i=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=i.has(f.key),m=l8(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:s===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function Si(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function u8({anchorId:e,id:t,rows:n,onHold:s,onLet:a}){const i=x.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,JF),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=x.useCallback(()=>{const y=i.current,w=document.getElementById(e);if(!y||!w)return;const N=Qq(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${N.top}px`,y.style.left=`${N.left}px`,y.style.maxHeight=N.maxHeight==null?"":`${N.maxHeight}px`,y.dataset.side=N.side},[e]);return x.useLayoutEffect(()=>{m()}),x.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),$r.createPortal(l.jsxs("div",{ref:i,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:s,onPointerLeave:a,children:[l.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&l.jsx("div",{className:"ap-peek-list",children:f.map(y=>l.jsxs("span",{className:"ap-peek-who",children:[l.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),l.jsx("span",{children:y.name})]},`${y.kind}:${y.fp}`))}),h&&l.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function d8(e,t){if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(i=>i.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};const s=t.filter(i=>i.kind==="paired");if(!s.length)return{text:"On · none paired yet",tone:"idle",live:!1};const a=s.filter(i=>i.here).length;return a?a===s.length?{text:`${a} online`,tone:"ok",live:!0}:{text:`${a} of ${s.length} online`,tone:"ok",live:!0}:{text:`none of ${s.length} online`,tone:"idle",live:!1}}function h8({accounts:e,onChanged:t,view:n,onOpen:s,onBack:a,closeButton:i}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[N,_]=x.useState(null),S=x.useRef(0),[b,j]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),I=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(I.current),[]);const[L,H]=x.useState(!1),[$,V]=x.useState(null),Q=x.useRef(null),J=x.useCallback(ce=>ah(Q.current)?(Q.current=ce,m(ce),!0):!1,[]),M=x.useCallback(()=>{Q.current=null,B.current&&m(null)},[]),X=ce=>{const ke=ua(h,ce);return{disabled:ke.disabled,"aria-busy":ke.busy}},[G,P]=x.useState(()=>Date.now()),B=x.useRef(!0),W=x.useRef(fx),Y=x.useCallback(async()=>{var ce,ke;try{const[Ee,Ze]=await Promise.all([fetch("/api/lan").then(Xe=>Xe.json()),fetch("/api/prefs").then(Xe=>Xe.json())]);if(!B.current)return;Ee!=null&&Ee.ok&&u(Ee),Ze!=null&&Ze.ok&&p(Array.isArray((ke=(ce=Ze.prefs)==null?void 0:ce.lan)==null?void 0:ke.manual)?Ze.prefs.lan.manual:[]),W.current=(Ee==null?void 0:Ee.enabled)===!0?fx:DA}catch{}},[]);x.useEffect(()=>{B.current=!0;let ce=0;const ke=async()=>{P(Date.now()),await Y(),B.current&&(ce=window.setTimeout(ke,W.current))};return ke(),()=>{B.current=!1,window.clearTimeout(ce)}},[Y]);const O=x.useCallback(async()=>{const ce=(c==null?void 0:c.enabled)===!0;if(J("switch"))try{const ke=await Si("/api/prefs",{lan:{enabled:!ce}});if(!B.current)return;ke!=null&&ke.ok?(V(null),ce||w(!0)):V(Xt(ce?"turn this off":"turn this on",ke)),await Y()}catch{B.current&&V(Xt(ce?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,Y,J,M]),F=x.useCallback(async(ce,ke,Ee)=>{if(!J(`${ce}:${ke}`))return null;let Ze=null;try{const Xe=await Si("/api/lan/peer",{action:ce,fp:ke});if(!B.current)return null;Xe!=null&&Xe.ok?(u(Xe),V(null)):(Ze=Xt(Ee,Xe),V(Ze)),await Y()}catch{Ze=Xt(Ee,null),B.current&&V(Ze)}finally{M()}return Ze},[Y,J,M]),oe=x.useCallback(async ce=>{if(!J(`drop:${ce}`))return null;let ke=null;try{const Ee=await Si("/api/prefs",{lan:{manual:f.filter(Ze=>Ze!==ce)}});if(!B.current)return null;Ee!=null&&Ee.ok?(V(null),t()):(ke=Xt("stop dialling that address",Ee),V(ke)),await Y()}catch{ke=Xt("stop dialling that address",null),B.current&&V(ke)}finally{M()}return ke},[f,Y,t,J,M]),[z,Z]=x.useState(null),U=x.useCallback(async(ce,ke)=>{if(!J(`alias:${ce}`))return"Something else is still being saved. Try again in a moment.";try{const Ee=await Si("/api/lan/peer",{action:"alias",fp:ce,name:ke});return B.current?Ee!=null&&Ee.ok?(u(Ee),null):Xt("rename that deck",Ee):null}catch{return Xt("rename that deck",null)}finally{M()}},[J,M]),re=x.useCallback(async ce=>{if(!J(`check:${ce}`))return null;try{const ke=await Si("/api/lan/sync",{fp:ce});return B.current?ke!=null&&ke.ok?(u(ke),t(),null):(ke==null?void 0:ke.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":Xt("check that deck",ke):null}catch{return Xt("check that deck",null)}finally{M()}},[J,M,t]),de=x.useCallback(async()=>{if(J("check"))try{const ce=await Si("/api/lan/sync",{});if(!B.current)return;ce!=null&&ce.ok?(u(ce),V(null)):V(Xt("check the other decks",ce)),t()}catch{B.current&&V(Xt("check the other decks",null))}finally{M()}},[J,M,t]),pe=(c==null?void 0:c.enabled)===!0,ge=a8(c,G),Te=z?ge.find(ce=>{var ke;return ce.fp===z||((ke=ce.twins)==null?void 0:ke.some(Ee=>Ee.fp===z))})??null:null;x.useEffect(()=>{z&&c&&!Te&&Z(null)},[z,c,Te]);const Ue=ge.filter(ce=>ce.kind==="asks"),He=ge.filter(ce=>ce.kind!=="asks"),Pe=He.filter(ce=>ce.here),Se=He.filter(ce=>!ce.here),nt=Se.filter(ce=>ce.tone==="bad").length,je=L||Pe.length===0,be=n8(c,G),Ke=He.filter(ce=>ce.kind==="paired").length,ct=d8(c,ge),Ye=l.jsxs(l.Fragment,{children:[b&&c&&l.jsx($F,{status:c,manual:f,onClose:()=>j(!1),onChanged:()=>{Y(),t()}}),E&&l.jsx(OA,{title:"How Local network works",steps:AF,finish:pe?void 0:{label:"Turn it on",act:()=>{C(!1),O()}},onClose:()=>C(!1)}),y&&c&&l.jsx(UF,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{Y(),t()}}),Te&&c&&l.jsx(zF,{row:Te,source:N_(c,Te),status:c,accounts:e,now:G,busy:h,onClose:()=>Z(null),onRename:ce=>U(Te.fp,ce),onCheck:()=>re(Te.fp),onVerb:()=>{switch(Te.kind){case"paired":return F("unpair",Te.fp,"unpair that deck");case"nearby":return F("accept",Te.fp,"reach that deck");case"declined":return F("allow",Te.fp,"let that deck ask again");case"dialling":return oe(Te.fp);default:return Promise.resolve(null)}},onSettings:()=>{Z(null),w(!0)},twins:(Te.twins??[]).map(ce=>({row:ce,peer:N_(c,ce).peer??null})),onUnpair:ce=>F("unpair",ce,"unpair that deck")})]});if(!n){const ce=Xe=>{window.clearTimeout(I.current),I.current=window.setTimeout(()=>R(!0),Xe)},ke=()=>{window.clearTimeout(I.current),I.current=window.setTimeout(()=>R(!1),e8)},Ee=()=>window.clearTimeout(I.current),Ze=()=>{window.clearTimeout(I.current),R(!1)};return l.jsxs("div",{className:"ap-foot",children:[l.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{Ze(),s()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:Xe=>{Xe.pointerType==="mouse"&&ce(QF)},onPointerLeave:ke,onFocus:Xe=>{Xe.target.matches(":focus-visible")&&ce(0)},onBlur:ke,children:[l.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),l.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),l.jsxs("span",{className:"ap-nav-text",children:[l.jsx("span",{className:"ap-nav-name",children:"Local network"}),l.jsxs("span",{className:"ap-nav-state","data-tone":ct.tone,children:[ct.live&&l.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),ct.text]})]}),l.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),T&&l.jsx(u8,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:ge,onHold:Ee,onLet:ke}),l.jsx("p",{className:"vis-hidden",role:"status",children:be.tone==="ok"?"":be.text}),Ye]})}return l.jsxs("div",{className:"ap-lan-view",children:[l.jsxs("div",{className:"ap-header",children:[l.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),l.jsx("h2",{id:"ap-lan-title",children:"Local network"}),l.jsxs("div",{className:"ap-header-right",children:[pe&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>j(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),l.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),pe&&Ke>0&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...X("check"),onClick:()=>void de(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),l.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),pe&&l.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...X("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),l.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),l.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i]})]}),l.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:l.jsxs("div",{className:"ap-lan",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":pe,"aria-label":"Sync with paired decks",...X("switch"),onClick:()=>void O(),title:pe?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:l.jsx("span",{className:"switch-knob"})})]}),!pe&&l.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[l.jsx(RF,{}),l.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),l.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),l.jsx("p",{className:`ap-lan-status ${be.tone}`,role:"status",children:be.tone==="ok"?"":be.text}),$&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",children:$}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>V(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),pe&&l.jsxs(l.Fragment,{children:[Ue.length>0&&l.jsx("div",{className:"ap-lan-asks",role:"alert",children:Ue.map(ce=>l.jsxs("div",{className:"ap-lan-ask",children:[l.jsxs("span",{className:"ap-lan-ask-what",children:[l.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",l.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),l.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",l.jsx("code",{className:"ap-lan-code",children:ce.fp})]}),l.jsxs("span",{className:"ap-lan-ask-acts",children:[l.jsx("button",{type:"button",className:"ap-manage-btn",...X(`accept:${ce.fp}`),onClick:()=>void F("accept",ce.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ce.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),l.jsx("button",{type:"button",className:"ap-manage-btn",...X(`dismiss:${ce.fp}`),onClick:()=>void F("dismiss",ce.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ce.fp))}),(je?[...Pe,...Se]:Pe).length>0&&l.jsx("ul",{className:"ap-lan-here",children:(je?[...Pe,...Se]:Pe).map((ce,ke)=>l.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,children:[l.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),l.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ce.name}),l.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${ke}`,onClick:()=>Z(ce.fp),children:l.jsxs("span",{className:"vis-hidden",children:[ce.name,", details"]})}),l.jsx("span",{id:`lan-who-state-${ke}`,className:ce.quiet?"vis-hidden":"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`accept:${ce.fp}`),onClick:()=>void F("accept",ce.fp,"reach that deck"),"aria-label":`Ask ${ce.name} to pair`,title:`Send ${ce.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ce.fp}.`,children:"ask"}),ce.kind==="paired"&&l.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${N===ce.fp?" armed":""}`,...X(`unpair:${ce.fp}`),onClick:()=>{if(N!==ce.fp){_(ce.fp),S.current=Date.now(),window.setTimeout(()=>_(Ee=>Ee===ce.fp?null:Ee),4e3);return}Date.now()-S.current<qd||(_(null),F("unpair",ce.fp,"unpair that deck"))},"aria-label":N===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:N===ce.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:N===ce.fp?"confirm":"unpair"}),ce.kind==="dialling"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`drop:${ce.fp}`),onClick:()=>void oe(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&l.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...X(`allow:${ce.fp}`),onClick:()=>void F("allow",ce.fp,"let that deck ask again"),"aria-label":`Let ${ce.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ce.kind}:${ce.fp}`))}),(Pe.length>0&&Se.length>0||pe&&Ke>0)&&l.jsxs("div",{className:"ap-lan-tail",children:[Pe.length>0&&Se.length>0&&l.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":L,onClick:()=>H(ce=>!ce),title:L?"Show only the decks that are on":`Show the ${Se.length} deck${Se.length===1?"":"s"} that are not responding right now`,children:[l.jsx("span",{className:`ap-lan-chev${L?" open":""}`,"aria-hidden":!0,children:"›"}),L?"fewer":`${Se.length} more`,!L&&nt>0&&l.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",nt," not responding"]})]}),pe&&Ke>0&&l.jsx("span",{className:"ap-lan-checked",children:r8(c==null?void 0:c.checkedAt,G,h==="check")})]}),He.length===0&&Ue.length===0&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"ap-lan-fine",children:"No other deck yet. Decks on one network usually find each other on their own; when that has not happened, the link at the top of this view reaches one by address or by invite."}),l.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),Ye]})}const S_=15e3,f8=8e3,p8=1800,m8=3e4,pp=[70,80,85,90,95];function mp(e,t){return dA(t-Math.floor(e/1e3))}function g8(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function ec(e){return e.charAt(0).toUpperCase()+e.slice(1)}function y8(e,t){const n="The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating.";if((e==null?void 0:e.state)==="running")return{text:"resuming…",hint:`${n} The deck is re-capturing it from the login you already have. No sign-in, no switch.`};if((e==null?void 0:e.state)==="failed"){const s=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${s}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function w8(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function v8(e){switch(e){case"no_credentials":return{text:"no stored login",hint:"claude-swap holds no credentials for this account, so there is nothing to read its usage with and nothing to switch to. A paired deck that has them sends them on its own; signing in as this account puts them there by hand.",fix:"sign in"};case"relogin_required":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fix:"sign in again"};case"keychain_unavailable":return{text:"keychain unreadable",hint:"This is about the deck, not the account: claude-swap could not open your keychain, so it cannot read any account's stored login. A deck started from a background session cannot reach the keychain at all — start it from a terminal, or let it start at login, and this clears."};case"token_expired":return{text:"token expired",hint:"The access token ran out and the refresh was deferred. The next collection retries."};case"foreign_credential":return{text:"wrong credential",hint:"The live credential belongs to a different account. Switching to this one repairs it."};case null:case void 0:return null;default:return{text:e,hint:`claude-swap reported "${e}" for this account.`}}}function gp(e,t){if(e.staleCopy){const n=y8(e.repair??null,t);return{text:ec(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=v8(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const s=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:ec(n.text),hint:n.hint,fix:n.fix?ec(n.fix):null,tone:s||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:s}}if(e.error){const n=w8(e.error);return{text:ec(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function yp(){return l.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),l.jsx("path",{d:"M7 5.6v2.9"}),l.jsx("path",{d:"M7 10.3v.05"})]})}function x8(e){return e>=90?"hi":e>=70?"mid":void 0}function b8(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!pp.includes(t)?[...pp,t]:pp].sort((s,a)=>s-a)}function k8({lane:e,nowSec:t,frozen:n}){const s=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",i=e.resetAt&&!n?hA(e.resetAt,t):null;return l.jsxs("div",{className:"ap-lane",children:[l.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),l.jsx("div",{className:"ap-lane-track",children:l.jsx("div",{className:"ap-lane-fill",style:{width:`${s===0?1.5:s}%`,background:a,opacity:s===0||n?.4:1}})}),l.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[s,"%"]}),l.jsx("span",{className:"ap-lane-reset",title:i?`${e.label} resets in ${i}`:void 0,children:i&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"vis-hidden",children:"resets in "}),i]})})]})}async function j_(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function _8({onClose:e,leaving:t}){var Yn,qt,Ft,Kn;const[n,s]=x.useState(null),[a,i]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[N,_]=x.useState("accounts"),[S,b]=x.useState(!1),[j,E]=x.useState(null),C=x.useRef(j);C.current=j;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),I=x.useRef(null),[L,H]=x.useState(null),$=(L==null?void 0:L.num)??null,V=x.useRef(L);V.current=L;const[Q,J]=x.useState(null),[M,X]=x.useState(!1),[G,P]=x.useState(""),[B,W]=x.useState(null),Y=x.useRef(0),[O,F]=x.useState(null),[oe,z]=x.useState(!1),[Z,U]=x.useState(!1),[re,de]=x.useState(null),[pe,ge]=x.useState(null),[Te,Ue]=x.useState(null),[He,Pe]=x.useState(!1),Se=x.useRef(null),nt=x.useRef(null),[je,be]=x.useState([]),Ke=x.useRef(null),ct=x.useCallback(te=>ah(Ke.current)?(Ke.current=te,u(te),!0):!1,[]),Ye=x.useCallback(()=>{Ke.current=null,u(null)},[]),ce=(te,Ae=!1)=>{const Ie=ua(c,te);return{disabled:Ie.disabled,"aria-busy":Ie.busy||Ae}},ke=x.useCallback(te=>{window.requestAnimationFrame(()=>{var Ae;if(t_(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Ie of ED(te)){const Me=document.querySelector(Ie);if(Me){Me.focus();return}}})},[]),Ee=x.useCallback(async(te=!1)=>{te&&p(!0);const Ae=new AbortController,Ie=window.setTimeout(()=>Ae.abort(),m8);try{const[Me,De]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Me.ok){const Tt=await Me.json();s(Tt),be(vt=>dF(vt,Tt.accounts))}De.ok&&i(await De.json());const dt=gF([await f_(Me),await f_(De)]);m(Tt=>p_(Tt,dt))}catch{m(Me=>p_(Me,Ae.signal.aborted?mF:pF))}finally{window.clearTimeout(Ie),te&&p(!1)}},[]),Ze=x.useCallback(async(te,Ae,Ie="panel")=>{if(!ct(Ae))return null;const Me=Ie==="menu"?J:m;Me(null);try{const dt=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return dt!=null&&dt.ok||Me({text:ux(dt,"command failed"),raw:gc(dt)}),dt}catch{return Me({text:"server unreachable"}),null}finally{Ye()}},[ct,Ye]),Xe=x.useCallback(async(te,Ae)=>{if(!ct(Ae))return null;m(null),J(null);try{const Me=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return Me!=null&&Me.ok||J({text:Ti(Me,"command failed")}),Me}catch{return J({text:"server unreachable"}),null}finally{Ye()}},[ct,Ye]);x.useEffect(()=>(Ee(!0),I.current=window.setInterval(()=>Ee(!1),S_),()=>{I.current!=null&&window.clearInterval(I.current)}),[Ee]),x.useEffect(()=>{const te=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const ut=((Yn=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:Yn.value)??"90",ee=Te??ut,Ne=iF(ee,ut),Be=(qt=n==null?void 0:n.accounts)==null?void 0:qt.find(te=>te.active),et=Be?gp(Be,T):null,pt=async(te,Ae)=>{if(ct(`switch-${te}`)){m(null),w(null);try{const Me=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Me!=null&&Me.ok?w({num:te,name:Ae}):m({text:ux(Me,"the switch failed"),raw:gc(Me),row:te}),await Ee(!0)}catch{m({text:"server unreachable",row:te})}finally{Ye(),ke(te)}}},tt=x.useCallback(()=>{H(null),J(null),W(null),F(null),U(!1)},[]),rt=(te,Ae="first")=>{tt(),E(null),ge(null),H({num:te,view:"menu",start:Ae})},lt=(te,Ae)=>{tt(),E(Ie=>(Ie==null?void 0:Ie.anchor)===Ae?null:{num:te,anchor:Ae})},bt=x.useCallback((te=!1)=>{var Ie;const Ae=C.current;te&&Ae&&((Ie=document.getElementById(Ae.anchor))==null||Ie.focus()),E(null)},[]),st=()=>{tt(),E(null),_("lan")},mt=x.useRef(N);x.useEffect(()=>{mt.current!==N&&(mt.current=N,window.requestAnimationFrame(()=>{var te;(te=document.getElementById(N==="lan"?"ap-lan-back":"ap-lan-entry"))==null||te.focus()}))},[N]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const ze=x.useCallback(te=>{var Me,De;const Ae=V.current;if(!Ae||te!=null&&Ae.num!==te)return;const Ie=document.getElementById(`ap-menu-${Ae.num}`);(Ie!=null&&Ie.contains(document.activeElement)||t_(((Me=document.activeElement)==null?void 0:Me.tagName)??null))&&((De=document.getElementById(`ap-more-${Ae.num}`))==null||De.focus()),tt()},[tt]);x.useEffect(()=>{t&&(tt(),E(null))},[t,tt]),x.useEffect(()=>{L&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===L.num)&&tt(),j&&(n!=null&&n.accounts)&&!n.accounts.some(te=>te.num===j.num)&&E(null)},[n,L,j,tt]);const Dt=async te=>{var Ie;U(!1);const Ae=await Xe({action:"share",account:te},`share-${te}`);!(Ae!=null&&Ae.ok)||((Ie=V.current)==null?void 0:Ie.num)!==te||(F({num:te,blob:Ae.blob,expiresAt:Ae.expiresAt}),H({num:te,view:"share"}))},me=async(te,Ae)=>{const{commit:Ie,alias:Me}=fF(G,Ae);if(Ie){const De=await Xe({action:"alias",account:te,alias:Me},`alias-${te}`);if(await Ee(!0),!(De!=null&&De.ok))return}ze(te)},gt=async(te,Ae)=>{var De,dt;const Ie=await Xe({action:"move",account:te,slot:Ae},`move-${te}`),Me=sF({menuFor:((De=V.current)==null?void 0:De.num)??null,shareFor:(O==null?void 0:O.num)??null},te,Ie);if(await Ee(!0),Me){((dt=V.current)==null?void 0:dt.num)===te&&tt(),W(Me.confirmRemove),Me.shareFor==null&&(F(null),U(!1)),de(Me.swapNote);const Tt=Me.swapNote;Tt&&window.setTimeout(()=>de(vt=>vt===Tt?null:vt),f8),ge(null),ke(Me.menuFor)}return Ie},kt=async(te,Ae,Ie)=>{if(!Ie.sends){ze(te);return}await gt(te,Ae)},jn=async(te,Ae)=>{if(Ae.sends){const Ie=await Ze({action:"setting",key:"autoswitch.threshold",value:te},"threshold");if(await Ee(!0),!(Ie!=null&&Ie.ok))return;Ue(null)}Pe(!0),window.setTimeout(()=>{var Ie;document.activeElement===nt.current&&((Ie=Se.current)==null||Ie.focus()),Pe(!1)},p8)},En=l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})});return l.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[N==="accounts"&&l.jsxs("div",{className:"ap-header",children:[l.jsx("h2",{children:"Claude accounts"}),l.jsxs("div",{className:"ap-header-right",children:[l.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>X(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((Ft=n==null?void 0:n.accounts)==null?void 0:Ft.length)??0)>0&&l.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>z(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),l.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),l.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>Ee(!0),...ce("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),l.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),En]})]}),N==="accounts"&&l.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?l.jsxs("div",{className:"ap-empty",role:"alert",children:[l.jsx("span",{title:h.raw||void 0,children:h.text}),l.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",S_/1e3," seconds."]}),l.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>Ee(!0),children:f?"trying…":"try again"})]}):l.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?l.jsxs(l.Fragment,{children:[Be&&(et==null?void 0:et.tone)==="warn"&&l.jsxs("div",{className:"ap-notice",children:[l.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)==="ap-notice","aria-controls":(j==null?void 0:j.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>lt(Be.num,"ap-notice"),children:[l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),et.fix&&l.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>X(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),l.jsx("ul",{className:"ap-list",children:(Kn=n.accounts)==null?void 0:Kn.map(te=>{const{shown:Ae,fuller:Ie}=lF(te.lanes),Me=gp(te,T),De=te.active||je.includes(Qx(te)),dt=te.alias??te.email??`account ${te.num}`,Tt=te.stale||(Me==null?void 0:Me.blocksSwitch)===!0,vt=Ie?[...Ae,Ie]:Ae,Qr=te.fetchedAt?mp(te.fetchedAt,T):null;return l.jsxs("li",{className:`ap-account${te.active?" active":""}`,"aria-current":te.active?"true":void 0,"data-open":De?"":void 0,"data-frozen":Tt?"":void 0,children:[!te.active&&l.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${te.num}`,"aria-expanded":De,"aria-controls":De?`ap-detail-${te.num}`:void 0,"aria-describedby":!De&&!(Me!=null&&Me.blocksSwitch)?`ap-quota-${te.num}`:void 0,onClick:()=>be(_t=>uF(_t,te)),children:l.jsxs("span",{className:"vis-hidden",children:[dt,", ",De?"hide details":"details"]})}),l.jsxs("div",{className:"ap-account-head",children:[te.active?l.jsx("span",{className:"ap-live",title:`Active account · slot ${te.num}`,children:l.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",te.num,":"]})}):l.jsx("span",{className:"ap-num",children:te.num}),te.alias&&l.jsx("span",{className:"ap-alias",title:te.alias,children:te.alias}),l.jsx("span",{className:"ap-email",title:te.email??void 0,children:te.email}),te.disabled&&l.jsx("span",{className:"ap-held",children:"held out"}),!te.active&&!te.disabled&&!(Me!=null&&Me.blocksSwitch)&&l.jsx("button",{type:"button",className:"ap-switch",...ce(`switch-${te.num}`),onClick:()=>pt(te.num,dt),"aria-label":`Switch to ${dt}`,title:`Switch to ${te.alias??te.email}`,children:c===`switch-${te.num}`?"…":"Switch"}),l.jsx("button",{type:"button",id:`ap-more-${te.num}`,className:"ap-more","aria-label":`More actions for ${te.email??te.alias??`account ${te.num}`}`,"aria-haspopup":"menu","aria-expanded":$===te.num,"aria-controls":$===te.num?`ap-menu-${te.num}`:void 0,title:"More actions",onClick:()=>$===te.num?ze():rt(te.num),onKeyDown:_t=>{_t.key!=="ArrowDown"&&_t.key!=="ArrowUp"||(_t.preventDefault(),rt(te.num,_t.key==="ArrowUp"?"last":"first"))},children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[l.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),l.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===te.num&&l.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),te.active&&(y==null?void 0:y.num)===te.num&&l.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(re==null?void 0:re.at)===te.num&&(()=>{var rn;const _t=(rn=n.accounts)==null?void 0:rn.find(Pr=>Pr.num===re.displaced),Jt=(_t==null?void 0:_t.alias)??(_t==null?void 0:_t.email)??"the account that was there";return l.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${re.at} was taken, so the two accounts traded places: ${Jt} now holds slot ${re.displaced}.`,children:["swapped with slot ",re.displaced]})})(),Me&&l.jsxs("div",{className:"ap-issue-line",children:[l.jsxs("button",{type:"button",id:`ap-issue-${te.num}`,className:"ap-issue","data-tone":Me.tone,"aria-haspopup":"dialog","aria-expanded":(j==null?void 0:j.anchor)===`ap-issue-${te.num}`,"aria-controls":(j==null?void 0:j.anchor)===`ap-issue-${te.num}`?"ap-issue-pop":void 0,onClick:()=>lt(te.num,`ap-issue-${te.num}`),children:[Me.tone==="warn"&&l.jsx(yp,{}),l.jsx("span",{className:"ap-issue-text",children:Me.text})]}),!De&&l.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:Qr??"never collected"})]}),!De&&!(Me!=null&&Me.blocksSwitch)&&l.jsxs("p",{className:"ap-quota",id:`ap-quota-${te.num}`,children:[vt.length?vt.map(_t=>l.jsxs("span",{className:"ap-q",children:[l.jsx("span",{className:"ap-q-label",children:_t.label})," ",l.jsxs("span",{className:"ap-q-pct","data-level":Tt?void 0:x8(_t.pct),children:[Math.round(_t.pct),"%"]})]},_t.id)):l.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),te.stale&&!Me&&l.jsx("span",{className:"ap-q-age","data-never":Qr?void 0:"",title:"When claude-swap last read this account's usage",children:Qr??"never collected"})]}),De&&l.jsxs("div",{className:"ap-detail",id:`ap-detail-${te.num}`,children:[l.jsx("div",{className:"ap-lanes",children:te.lanes.length?te.lanes.map(_t=>l.jsx(k8,{lane:_t,nowSec:T,frozen:Tt},_t.id)):l.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),l.jsx("div",{className:"ap-meta",children:te.fetchedAt?l.jsxs("span",{className:`ap-age${te.stale&&!Me?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",mp(te.fetchedAt,T),Me!=null&&Me.blocksSwitch?"":g8(te.nextAt,T)]}):l.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},te.num)})}),L&&(()=>{var Me;const te=(Me=n.accounts)==null?void 0:Me.find(De=>De.num===L.num);if(!te)return null;const Ae=`ap-pop-title-${te.num}`,Ie=Q&&l.jsx("p",{className:"ap-pop-error",role:"alert",title:Q.raw||void 0,children:Q.text});return l.jsxs(d_,{anchorId:`ap-more-${te.num}`,boundaryId:"ap-scroll",id:`ap-menu-${te.num}`,className:"ap-pop",role:L.view==="menu"?"menu":"dialog",labelledBy:L.view==="menu"?`ap-more-${te.num}`:Ae,start:L.start,onClose:tt,children:[L.view==="menu"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{P(te.alias??""),J(null),H({num:te.num,view:"rename"})},children:"Rename"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{ge(null),J(null),H({num:te.num,view:"move"})},children:"Move to slot…"}),l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...ce(`share-${te.num}`),title:`Copy this account to another ${Zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:()=>Dt(te.num),children:c===`share-${te.num}`?"Sharing…":"Share"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!te.active||te.disabled)&&l.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...ce(`rot-${te.num}`),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>Ze({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`,"menu").then(De=>{Ee(!0),De!=null&&De.ok&&ze(te.num)}),children:te.disabled?"Put back in rotation":"Hold out of rotation"}),l.jsx("div",{role:"separator",className:"ap-menu-sep"}),l.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${B===te.num?" armed":""}`,...ce(`rm-${te.num}`),"aria-label":B===te.num?"Confirm remove":void 0,title:B===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(B!==te.num){W(te.num),Y.current=Date.now(),window.setTimeout(()=>W(De=>De===te.num?null:De),4e3);return}Date.now()-Y.current<qd||(W(null),Xe({action:"remove",account:te.num},`rm-${te.num}`).then(De=>{var dt;Ee(!0),De!=null&&De.ok&&(((dt=V.current)==null?void 0:dt.num)===te.num&&tt(),ke(null))}))},children:c===`rm-${te.num}`?"Removing…":B===te.num?"Confirm":"Remove"}),Ie]}),L.view==="rename"&&l.jsxs("form",{className:"ap-pop-form",onSubmit:De=>{De.preventDefault(),me(te.num,te.alias)},children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${te.num}`,children:"Rename account"}),l.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:G,onChange:De=>P(De.target.value),maxLength:hF,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:De=>De.currentTarget.select()}),Ie,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>ze(),children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn primary",...ce(`alias-${te.num}`),title:"A short name to show instead of the email",children:c===`alias-${te.num}`?"…":"Save"})]})]}),L.view==="move"&&(()=>{const De=rF((n.accounts??[]).map(vt=>vt.num),te.num),dt=aF(De,pe,te.num),Tt=oF(De,dt,te.num);return l.jsxs("div",{className:"ap-pop-form",children:[l.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${te.num}`,children:"Move to slot"}),l.jsx("span",{className:"ap-field",children:l.jsx("select",{id:`ap-slot-${te.num}`,value:String(dt),...ce(`move-${te.num}`),onChange:vt=>ge(Number(vt.target.value)),autoFocus:!0,children:De.map(vt=>l.jsx("option",{value:vt.slot,children:vt.label},vt.slot))})}),Ie,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>ze(),children:"Cancel"}),l.jsx("button",{type:"button",className:"btn primary",...ce(`move-${te.num}`),title:Tt.title,onClick:()=>kt(te.num,dt,Tt),children:c===`move-${te.num}`?"…":ec(Tt.label)})]})]})})(),L.view==="share"&&(O==null?void 0:O.num)===te.num&&(()=>{const De=IA(O.expiresAt,T),dt=De.tone==="gone";return l.jsxs("div",{className:`ap-pop-form ap-share${dt?" expired":""}`,children:[l.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),l.jsx("code",{className:"ap-share-blob",children:O.blob}),l.jsxs("p",{className:"ap-pop-note",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[l.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",l.jsx("span",{className:`ap-share-expiry ${De.tone}`,children:De.text})]}),Ie,l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>ze(),children:"Done"}),l.jsx("button",{type:"button",className:"btn primary",...ce(`share-${te.num}`),autoFocus:!0,onClick:async()=>{if(dt){await Dt(te.num);return}await j_(O.blob)&&(U(!0),window.setTimeout(()=>U(!1),1800))},children:dt?"Make a new share":Z?"Copied":"Copy"})]})]})})()]})})(),j&&(()=>{var Ie;const te=(Ie=n.accounts)==null?void 0:Ie.find(Me=>Me.num===j.num),Ae=te?gp(te,T):null;return!te||!Ae?null:l.jsx(d_,{anchorId:j.anchor,boundaryId:"ap-scroll",id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>bt(),children:l.jsxs("div",{className:"ap-pop-form",children:[l.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ae.tone,children:[Ae.tone==="warn"&&l.jsx(yp,{}),Ae.text]}),l.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),l.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[l.jsx("span",{className:"ap-issue-who",children:te.alias??te.email??`account ${te.num}`})," · ",te.fetchedAt?`last collected ${mp(te.fetchedAt,T)}`:"never collected"]}),l.jsxs("div",{className:"ap-pop-actions",children:[l.jsx("button",{type:"button",className:"btn",onClick:()=>bt(!0),children:"Done"}),Ae.fix&&l.jsx("button",{type:"button",className:"btn primary",onClick:()=>{bt(!0),X(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ae.fix})]})]})})})()]}):l.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"claude-swap isn't installed."}),l.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&l.jsx("code",{className:"ap-cmd",children:n.hint}),l.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",l.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"No accounts added yet."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",l.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Couldn't read the account store."}),l.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),N==="accounts"&&n!=null&&h&&h.row==null&&l.jsxs("div",{className:"ap-failure",role:"alert",children:[l.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),l.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),N==="accounts"&&(n==null?void 0:n.ok)&&(a==null?void 0:a.ok)&&l.jsxs("div",{className:"ap-foot",children:[l.jsxs("div",{className:"ap-policy",children:[l.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),l.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:l.jsx("select",{ref:Se,"aria-label":"Switch threshold",value:ee,...ce("threshold"),onChange:te=>Ue(te.target.value),children:b8(ut).map(te=>l.jsxs("option",{value:te,children:[te,"%"]},te))})}),(Ne.sends||He)&&l.jsx("button",{ref:nt,type:"button",className:"ap-manage-btn",...ce("threshold"),title:Ne.title,onClick:()=>jn(ee,Ne),children:He&&!Ne.sends?Ne.done:Ne.label}),l.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...ce("enable"),onClick:()=>Ze({action:"enable",enabled:!a.enabled},"enable").then(()=>Ee(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:l.jsx("span",{className:"switch-knob"})})]}),a.external&&l.jsxs("p",{className:"ap-auto-note",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",l.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),S&&l.jsx(h8,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({key:`${String(te.email??"").trim().toLowerCase()}@@${te.orgUuid??""}`,email:te.email??"",alive:te.alive===!0})),onChanged:()=>Ee(!0),view:N==="lan",onOpen:st,onBack:()=>_("accounts"),closeButton:En}),M&&l.jsx(Xq,{onClose:()=>X(!1),onChanged:()=>Ee(!0)}),oe&&l.jsx(nF,{accounts:((n==null?void 0:n.accounts)??[]).map(te=>({num:te.num,email:te.email,alias:te.alias,org:te.org})),onClose:()=>z(!1),copyText:j_})]})}const N8=3e4;function S8({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function j8({bundle:e,running:t,pending:n,lastTried:s}){return t?S8({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function E8(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function C8({asked:e,reported:t}){return t?t!==e:!1}function FA(e){const t=e.thresholdMs??N8;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function T8(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function A8(e,t){return e?t==null?"auto when idle":`auto in ${T8(t)}`:"auto-restart off"}function E_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function R8(e){return e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function M8(e){const t=FA(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function I8(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function $8(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function O8(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function P8(e,t){const n=O8(e),s=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:s("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:s(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:s(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:s("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const i=t.decks-1;return{goes:s(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function L8({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=dn(n,{focusRef:s,layer:o5}),[i,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c($8(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=P8(e,i);return l.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:l.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{className:"status-dot err","aria-hidden":!0}),l.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("dl",{className:"cc-plan",children:[l.jsx("dt",{children:"Goes"}),l.jsx("dd",{children:u.map(m=>l.jsx("span",{children:m},m))}),l.jsx("dt",{children:"Stays"}),l.jsx("dd",{children:f.length>0?f.map(m=>l.jsx("span",{children:m},m)):l.jsx("span",{children:"nothing"})})]}),p&&l.jsx("p",{className:"cc-final",children:p}),l.jsxs("div",{className:"cc-actions",children:[l.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),l.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const D8="Press Esc first if a key does nothing.",q8=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function F8({onClose:e,onTour:t}){const n=dn(e);return l.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:l.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsx("div",{className:"modal-title",children:l.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[t&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),l.jsx("div",{className:"shortcuts",children:q8.map(s=>l.jsxs(x.Fragment,{children:[l.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>l.jsxs("div",{className:"sc",children:[l.jsx("kbd",{children:a.cap}),l.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))}),l.jsx("p",{className:"kh-foot",children:D8})]})]})})}const B8=["done","needs-input"],z8=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],U8=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],r0={done:z8,"needs-input":U8},zi="two";function px(e,t){const n=r0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===zi)??n[0]}function BA(e,t){return r0[e].some(s=>s.id===t)?t:zi}px("done",zi).notes,px("needs-input",zi).notes;const C_=.04,W8=.24,xd=0,Bd=100,mx=5,yc=50;function wc(e){if(!Number.isFinite(e))return yc;const t=Math.round(e/mx)*mx;return Math.min(Bd,Math.max(xd,t))}function H8(e){if(e==null)return yc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?wc(Number(t)):yc}function G8(e){const t=wc(e),n=C_+(W8-C_)*(t/Bd);return Math.round(n*1e4)/1e4}function V8(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(G8(e)*s*1e4)/1e4}const Y8=160,K8="agent-dag.soundLevel.done",X8="agent-dag.soundLevel.needs-input",Z8="agent-dag.soundFigure.done",Q8="agent-dag.soundFigure.needs-input",zA={done:K8,"needs-input":X8},UA={done:Z8,"needs-input":Q8},gx={done:{level:yc,figure:zi},"needs-input":{level:yc,figure:zi}};function J8(e){const t=n=>({level:H8(e(zA[n])),figure:BA(n,e(UA[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const T_={Stop:"done",Notification:"needs-input"};function eB(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:Object.hasOwn(T_,n)?T_[n]:null}function tB(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??gx)[f]??gx[f],m=px(f,h.figure),y=V8(h.level,m),w=n.currentTime;for(const _ of m.notes){const S=n.createOscillator(),b=n.createGain();S.type=m.type??"sine",S.frequency.value=_.hz;const j=w+_.at,E=j+_.ms/1e3;b.gain.setValueAtTime(1e-4,j),b.gain.exponentialRampToValueAtTime(y,j+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(b).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const nB="Notify me when a session needs my attention.",rB="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",A_="Get notified when you're away from this tab.";function sB(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:A_};case"default":return{status:null,ask:!0,ok:!1,note:A_};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const R_={done:"Turn finished","needs-input":"Claude is asking"},aB={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function oB({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=sB(m),N=f&&!h,_=dn(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const b=j=>{var C,T;const E=j.target;E&&((C=_.current)!=null&&C.contains(E)||(T=u.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[_,u]),l.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[l.jsxs("div",{className:"sm-switches",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),l.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsxs("div",{className:"sm-setting",children:[l.jsxs("label",{className:"sm-switch",children:[l.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),l.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"A system notification when a session blocks on you",children:l.jsx("span",{className:"switch-knob"})})]}),l.jsx("p",{className:"sm-note",children:h?rB:nB})]})]}),N&&l.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[l.jsxs("div",{className:"sm-channel-head",children:[l.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?l.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):l.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),l.jsx("p",{className:"sm-note",children:w.note})]}),!t&&l.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),l.jsx("div",{className:"sm-tones",children:B8.map(b=>{const j=s[b],E=`sm-level-${b}`,C=`sm-figure-${b}`;return l.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${b}`,children:[l.jsxs("div",{className:"sm-tone-head",children:[l.jsx("h3",{className:"sm-tone-name",id:`sm-name-${b}`,children:R_[b]}),l.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(b),"aria-label":`Hear the ${R_[b].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",children:[l.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:E,children:"Volume"}),l.jsx("input",{id:E,type:"range",min:xd,max:Bd,step:mx,value:j.level,onChange:T=>a(b,Number(T.target.value)),style:{"--sm-level":`${(j.level-xd)/(Bd-xd)*100}%`}}),l.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),l.jsxs("div",{className:"sm-row",children:[l.jsx("label",{htmlFor:C,children:"Tone"}),l.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>i(b,T.target.value),children:r0[b].map(T=>l.jsx("option",{value:T.id,children:T.label},T.id))})]}),l.jsx("p",{className:"sm-note",children:aB[b]})]},b)})}),l.jsxs("p",{className:"sm-foot",children:[l.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const iB=15e3;function lB(e){return e.visibilityState==="visible"&&e.hasFocus()}function cB(e,t){return t||e===!0}function uB(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const dB={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2"],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
|
|
92
92
|
|
|
93
|
-
A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many machines are
|
|
93
|
+
A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
|
|
94
94
|
|
|
95
95
|
The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
|
|
96
96
|
|
|
@@ -280,17 +280,17 @@ While it is open it polls this machine once every few seconds, and it stops the
|
|
|
280
280
|
|
|
281
281
|
It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
|
|
282
282
|
|
|
283
|
-
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},s0="agent-dag.releaseNotesSeen";function M_(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Bi(e,t){const n=M_(e),s=M_(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function zi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function aB(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function oB(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!zi(n)||!Array.isArray(s))continue;const a=s.filter(aB);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Bi(s.version,n.version))}const I_=oB(sB);function WA(e,t,n){return e.filter(s=>Bi(s.version,n)<=0&&(t===null||Bi(s.version,t)>0))}function iB(e,t){return e.filter(n=>Bi(n.version,t)===0)}function lB(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function cB({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&zi(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!zi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Bi(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const uB=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function dB(e){const t=uB.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function $_(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function hB(e){if(!e)return null;let t=null;try{t=e.getItem(s0)}catch{return null}return zi(t)?t:null}function fB(e){if(!e)return!1;try{return e.getItem(s0),!0}catch{return!1}}function pB(e,t){if(!e)return!1;try{return e.setItem(s0,t),!0}catch{return!1}}const HA="agent-dag.tourSeen";function mB(e){if(!e)return!1;try{return e.getItem(HA)==="1"}catch{return!1}}function gB(e){if(!e)return!1;try{return e.setItem(HA,"1"),!0}catch{return!1}}function yB({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function wB({stored:e,running:t,notes:n,remembers:s=!0}){if(!zi(t))return{show:[],record:null,reason:"no-version"};if(!zi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=iB(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Bi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=WA(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function vB(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function GA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const c=e.indexOf("`",i+1);if(c>i+1){a(),n.push({kind:"code",text:e.slice(i+1,c)}),i=c+1;continue}}else if(t&&e.startsWith("**",i)){const c=vB(e,i);if(c>0){a(),n.push({kind:"bold",kids:GA(e.slice(i+2,c),!1)}),i=c+2;continue}}s+=e[i],i+=1}return a(),n}function xB({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:i}){const c=dn(a),u=lB(e);return l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),u&&l.jsx("span",{className:"modal-tool-id",children:u})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("p",{className:"modal-note",children:cB({since:t,running:n,firstRun:s,entries:e})}),i&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),e.map(f=>l.jsxs("section",{className:"modal-section",children:[l.jsxs("h3",{className:"rn-version",children:["v",f.version]}),l.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:m,rest:y}=dB(p.title);return l.jsxs("li",{className:"rn-note",children:[l.jsxs("p",{className:"rn-note-title",children:[m&&l.jsx("span",{className:"rn-note-icon",children:m}),y]}),l.jsx("p",{className:"rn-note-body",children:VA(GA(p.body))})]},h)})})]},f.version))]})]})})}function VA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?l.jsx("code",{className:"rn-code",children:t.text},n):l.jsx("strong",{className:"rn-strong",children:VA(t.kids)},n))}function bB(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function kB(e,t,n){var c;if(e.length===0)return null;const s=bB(e),a=t?s.findIndex(u=>u.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[i])==null?void 0:c.id)??null}const _B=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function NB(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:_B.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const SB=new Set(["","BODY","HTML","#DOCUMENT"]);function jB(e){return!e||Wx(e)?!1:!SB.has(String(e.tagName??"").toUpperCase())}function id(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function EB(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const s=new Set;for(const a of e)t.has(a)&&s.add(a);return s}function CB(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(Hx(n.id));return t}function TB(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(Hx(n.id));return t}function AB(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||s.has(c.parentId))break;s.add(c.parentId),a=c.parentId}let i=!0;for(;i;){i=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),i=!0)}return s}function RB(e,t){const n=new Set;for(const s of t){const a=AB(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function kd(e,t,n){return!t.has(e)||n.has(e)}function MB(e,t,n,s){return!t.has(e)&&kd(e,n,s)}function IB(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function O_(e,t,n,s){n.set(e,t),s.delete(e)}const $B=40,OB=120;function PB(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(s<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,m)};return{live(f=$B){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),i();return}u(h,p,f)},replay(f=OB){c(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){c(),i()},cancel(){c()}}}const LB=1e3;function DB(e={}){const t=Math.max(1,Math.floor(e.limit??LB)),n=e.protect;let s=!1,a=[],i=new Set,c=0,u=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[_]=a.splice(N,1);i.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,c=0,h}}}const YA="agent-dag.theme";function qB(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function FB(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function BB(){return qB(yo(YA),FB())}const zB=6,UB="ccdeck-tabs";function WB(e){return e>=zB}function HB(e,t,n){const s=a=>{const i=a.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",s),{ask(a,i=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),i(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",s),(a=e.close)==null||a.call(e)}}}function GB({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Zt}`:Zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const ld={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function cd(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const VB=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(cd(ld.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(cd(ld.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(cd(ld.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(cd(ld.idle,"idle"))}`}),YB="No sessions are waiting for you.";function KB(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function XB(e,t){return t!==""?t:e===""?"":YB}const P_="agent-dag.browserWatch.seenMs";function ZB(e,t){return e.filter(n=>n.startMs>t)}function QB(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function JB({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:c}){const u=x.useRef(null),f=dn(c,{focusRef:u}),p=la(n,"accept"),h=la(n,"dismiss");return l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0}),l.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("p",{className:"lan-ask-who",children:[l.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",l.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",n0(e.at,s)]}),l.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),l.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",l.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&l.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),l.jsxs("div",{className:"lan-ask-acts",children:[l.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),l.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function a0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wp,L_;function ez(){if(L_)return wp;L_=1;function e(){this.__data__=[],this.size=0}return wp=e,wp}var vp,D_;function Wi(){if(D_)return vp;D_=1;function e(t,n){return t===n||t!==t&&n!==n}return vp=e,vp}var xp,q_;function ih(){if(q_)return xp;q_=1;var e=Wi();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return xp=t,xp}var bp,F_;function tz(){if(F_)return bp;F_=1;var e=ih(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,c=e(i,a);if(c<0)return!1;var u=i.length-1;return c==u?i.pop():n.call(i,c,1),--this.size,!0}return bp=s,bp}var kp,B_;function nz(){if(B_)return kp;B_=1;var e=ih();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return kp=t,kp}var _p,z_;function rz(){if(z_)return _p;z_=1;var e=ih();function t(n){return e(this.__data__,n)>-1}return _p=t,_p}var Np,U_;function sz(){if(U_)return Np;U_=1;var e=ih();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Np=t,Np}var Sp,W_;function lh(){if(W_)return Sp;W_=1;var e=ez(),t=tz(),n=nz(),s=rz(),a=sz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Sp=i,Sp}var jp,H_;function az(){if(H_)return jp;H_=1;var e=lh();function t(){this.__data__=new e,this.size=0}return jp=t,jp}var Ep,G_;function oz(){if(G_)return Ep;G_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Ep=e,Ep}var Cp,V_;function iz(){if(V_)return Cp;V_=1;function e(t){return this.__data__.get(t)}return Cp=e,Cp}var Tp,Y_;function lz(){if(Y_)return Tp;Y_=1;function e(t){return this.__data__.has(t)}return Tp=e,Tp}var Ap,K_;function KA(){if(K_)return Ap;K_=1;var e=typeof zu=="object"&&zu&&zu.Object===Object&&zu;return Ap=e,Ap}var Rp,X_;function Ir(){if(X_)return Rp;X_=1;var e=KA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Rp=n,Rp}var Mp,Z_;function Hi(){if(Z_)return Mp;Z_=1;var e=Ir(),t=e.Symbol;return Mp=t,Mp}var Ip,Q_;function cz(){if(Q_)return Ip;Q_=1;var e=Hi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=s.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Ip=i,Ip}var $p,J_;function uz(){if(J_)return $p;J_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return $p=n,$p}var Op,eN;function wo(){if(eN)return Op;eN=1;var e=Hi(),t=cz(),n=uz(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:s:i&&i in Object(u)?t(u):n(u)}return Op=c,Op}var Pp,tN;function cr(){if(tN)return Pp;tN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pp=e,Pp}var Lp,nN;function Ac(){if(nN)return Lp;nN=1;var e=wo(),t=cr(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==s||f==a||f==n||f==i}return Lp=c,Lp}var Dp,rN;function dz(){if(rN)return Dp;rN=1;var e=Ir(),t=e["__core-js_shared__"];return Dp=t,Dp}var qp,sN;function hz(){if(sN)return qp;sN=1;var e=dz(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return qp=n,qp}var Fp,aN;function XA(){if(aN)return Fp;aN=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Fp=n,Fp}var Bp,oN;function fz(){if(oN)return Bp;oN=1;var e=Ac(),t=hz(),n=cr(),s=XA(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Bp=m,Bp}var zp,iN;function pz(){if(iN)return zp;iN=1;function e(t,n){return t==null?void 0:t[n]}return zp=e,zp}var Up,lN;function vo(){if(lN)return Up;lN=1;var e=fz(),t=pz();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Up=n,Up}var Wp,cN;function o0(){if(cN)return Wp;cN=1;var e=vo(),t=Ir(),n=e(t,"Map");return Wp=n,Wp}var Hp,uN;function ch(){if(uN)return Hp;uN=1;var e=vo(),t=e(Object,"create");return Hp=t,Hp}var Gp,dN;function mz(){if(dN)return Gp;dN=1;var e=ch();function t(){this.__data__=e?e(null):{},this.size=0}return Gp=t,Gp}var Vp,hN;function gz(){if(hN)return Vp;hN=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Vp=e,Vp}var Yp,fN;function yz(){if(fN)return Yp;fN=1;var e=ch(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var c=this.__data__;if(e){var u=c[i];return u===t?void 0:u}return s.call(c,i)?c[i]:void 0}return Yp=a,Yp}var Kp,pN;function wz(){if(pN)return Kp;pN=1;var e=ch(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Kp=s,Kp}var Xp,mN;function vz(){if(mN)return Xp;mN=1;var e=ch(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return Xp=n,Xp}var Zp,gN;function xz(){if(gN)return Zp;gN=1;var e=mz(),t=gz(),n=yz(),s=wz(),a=vz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Zp=i,Zp}var Qp,yN;function bz(){if(yN)return Qp;yN=1;var e=xz(),t=lh(),n=o0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Qp=s,Qp}var Jp,wN;function kz(){if(wN)return Jp;wN=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Jp=e,Jp}var em,vN;function uh(){if(vN)return em;vN=1;var e=kz();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return em=t,em}var tm,xN;function _z(){if(xN)return tm;xN=1;var e=uh();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return tm=t,tm}var nm,bN;function Nz(){if(bN)return nm;bN=1;var e=uh();function t(n){return e(this,n).get(n)}return nm=t,nm}var rm,kN;function Sz(){if(kN)return rm;kN=1;var e=uh();function t(n){return e(this,n).has(n)}return rm=t,rm}var sm,_N;function jz(){if(_N)return sm;_N=1;var e=uh();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return sm=t,sm}var am,NN;function i0(){if(NN)return am;NN=1;var e=bz(),t=_z(),n=Nz(),s=Sz(),a=jz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,am=i,am}var om,SN;function Ez(){if(SN)return om;SN=1;var e=lh(),t=o0(),n=i0(),s=200;function a(i,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([i,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(i,c),this.size=u.size,this}return om=a,om}var im,jN;function dh(){if(jN)return im;jN=1;var e=lh(),t=az(),n=oz(),s=iz(),a=lz(),i=Ez();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=i,im=c,im}var lm,EN;function l0(){if(EN)return lm;EN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a&&n(t[s],s,t)!==!1;);return t}return lm=e,lm}var cm,CN;function ZA(){if(CN)return cm;CN=1;var e=vo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return cm=t,cm}var um,TN;function hh(){if(TN)return um;TN=1;var e=ZA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return um=t,um}var dm,AN;function fh(){if(AN)return dm;AN=1;var e=hh(),t=Wi(),n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u){var f=i[c];(!(s.call(i,c)&&t(f,u))||u===void 0&&!(c in i))&&e(i,c,u)}return dm=a,dm}var hm,RN;function Rc(){if(RN)return hm;RN=1;var e=fh(),t=hh();function n(s,a,i,c){var u=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(i[h],s[h],h,i,s):void 0;m===void 0&&(m=s[h]),u?t(i,h,m):e(i,h,m)}return i}return hm=n,hm}var fm,MN;function Cz(){if(MN)return fm;MN=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return fm=e,fm}var pm,IN;function Xr(){if(IN)return pm;IN=1;function e(t){return t!=null&&typeof t=="object"}return pm=e,pm}var mm,$N;function Tz(){if($N)return mm;$N=1;var e=wo(),t=Xr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return mm=s,mm}var gm,ON;function Mc(){if(ON)return gm;ON=1;var e=Tz(),t=Xr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return gm=i,gm}var ym,PN;function Ht(){if(PN)return ym;PN=1;var e=Array.isArray;return ym=e,ym}var ec={exports:{}},wm,LN;function Az(){if(LN)return wm;LN=1;function e(){return!1}return wm=e,wm}ec.exports;var DN;function Gi(){return DN||(DN=1,(function(e,t){var n=Ir(),s=Az(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,c=i&&i.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||s;e.exports=p})(ec,ec.exports)),ec.exports}var vm,qN;function ph(){if(qN)return vm;qN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return vm=n,vm}var xm,FN;function c0(){if(FN)return xm;FN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return xm=t,xm}var bm,BN;function Rz(){if(BN)return bm;BN=1;var e=wo(),t=c0(),n=Xr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",j="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",I="[object Uint8Array]",F="[object Uint8ClampedArray]",W="[object Uint16Array]",O="[object Uint32Array]",B={};B[S]=B[E]=B[C]=B[T]=B[R]=B[I]=B[F]=B[W]=B[O]=!0,B[s]=B[a]=B[j]=B[i]=B[k]=B[c]=B[u]=B[f]=B[p]=B[h]=B[m]=B[y]=B[w]=B[N]=B[_]=!1;function Z(Q){return n(Q)&&t(Q.length)&&!!B[e(Q)]}return bm=Z,bm}var km,zN;function mh(){if(zN)return km;zN=1;function e(t){return function(n){return t(n)}}return km=e,km}var tc={exports:{}};tc.exports;var UN;function u0(){return UN||(UN=1,(function(e,t){var n=KA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(tc,tc.exports)),tc.exports}var _m,WN;function Ic(){if(WN)return _m;WN=1;var e=Rz(),t=mh(),n=u0(),s=n&&n.isTypedArray,a=s?t(s):e;return _m=a,_m}var Nm,HN;function QA(){if(HN)return Nm;HN=1;var e=Cz(),t=Mc(),n=Ht(),s=Gi(),a=ph(),i=Ic(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&s(p),N=!m&&!y&&!w&&i(p),_=m||y||w||N,j=_?e(p.length,String):[],k=j.length;for(var S in p)(h||u.call(p,S))&&!(_&&(S=="length"||w&&(S=="offset"||S=="parent")||N&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,k)))&&j.push(S);return j}return Nm=f,Nm}var Sm,GN;function gh(){if(GN)return Sm;GN=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Sm=t,Sm}var jm,VN;function JA(){if(VN)return jm;VN=1;function e(t,n){return function(s){return t(n(s))}}return jm=e,jm}var Em,YN;function Mz(){if(YN)return Em;YN=1;var e=JA(),t=e(Object.keys,Object);return Em=t,Em}var Cm,KN;function d0(){if(KN)return Cm;KN=1;var e=gh(),t=Mz(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var c=[];for(var u in Object(i))s.call(i,u)&&u!="constructor"&&c.push(u);return c}return Cm=a,Cm}var Tm,XN;function bs(){if(XN)return Tm;XN=1;var e=Ac(),t=c0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Tm=n,Tm}var Am,ZN;function ca(){if(ZN)return Am;ZN=1;var e=QA(),t=d0(),n=bs();function s(a){return n(a)?e(a):t(a)}return Am=s,Am}var Rm,QN;function Iz(){if(QN)return Rm;QN=1;var e=Rc(),t=ca();function n(s,a){return s&&e(a,t(a),s)}return Rm=n,Rm}var Mm,JN;function $z(){if(JN)return Mm;JN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Mm=e,Mm}var Im,eS;function Oz(){if(eS)return Im;eS=1;var e=cr(),t=gh(),n=$z(),s=Object.prototype,a=s.hasOwnProperty;function i(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Im=i,Im}var $m,tS;function xo(){if(tS)return $m;tS=1;var e=QA(),t=Oz(),n=bs();function s(a){return n(a)?e(a,!0):t(a)}return $m=s,$m}var Om,nS;function Pz(){if(nS)return Om;nS=1;var e=Rc(),t=xo();function n(s,a){return s&&e(a,t(a),s)}return Om=n,Om}var nc={exports:{}};nc.exports;var rS;function eR(){return rS||(rS=1,(function(e,t){var n=Ir(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(nc,nc.exports)),nc.exports}var Pm,sS;function tR(){if(sS)return Pm;sS=1;function e(t,n){var s=-1,a=t.length;for(n||(n=Array(a));++s<a;)n[s]=t[s];return n}return Pm=e,Pm}var Lm,aS;function nR(){if(aS)return Lm;aS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,c=[];++s<a;){var u=t[s];n(u,s,t)&&(c[i++]=u)}return c}return Lm=e,Lm}var Dm,oS;function rR(){if(oS)return Dm;oS=1;function e(){return[]}return Dm=e,Dm}var qm,iS;function h0(){if(iS)return qm;iS=1;var e=nR(),t=rR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return s.call(c,u)}))}:t;return qm=i,qm}var Fm,lS;function Lz(){if(lS)return Fm;lS=1;var e=Rc(),t=h0();function n(s,a){return e(s,t(s),a)}return Fm=n,Fm}var Bm,cS;function f0(){if(cS)return Bm;cS=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Bm=e,Bm}var zm,uS;function yh(){if(uS)return zm;uS=1;var e=JA(),t=e(Object.getPrototypeOf,Object);return zm=t,zm}var Um,dS;function sR(){if(dS)return Um;dS=1;var e=f0(),t=yh(),n=h0(),s=rR(),a=Object.getOwnPropertySymbols,i=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:s;return Um=i,Um}var Wm,hS;function Dz(){if(hS)return Wm;hS=1;var e=Rc(),t=sR();function n(s,a){return e(s,t(s),a)}return Wm=n,Wm}var Hm,fS;function aR(){if(fS)return Hm;fS=1;var e=f0(),t=Ht();function n(s,a,i){var c=a(s);return t(s)?c:e(c,i(s))}return Hm=n,Hm}var Gm,pS;function oR(){if(pS)return Gm;pS=1;var e=aR(),t=h0(),n=ca();function s(a){return e(a,n,t)}return Gm=s,Gm}var Vm,mS;function qz(){if(mS)return Vm;mS=1;var e=aR(),t=sR(),n=xo();function s(a){return e(a,n,t)}return Vm=s,Vm}var Ym,gS;function Fz(){if(gS)return Ym;gS=1;var e=vo(),t=Ir(),n=e(t,"DataView");return Ym=n,Ym}var Km,yS;function Bz(){if(yS)return Km;yS=1;var e=vo(),t=Ir(),n=e(t,"Promise");return Km=n,Km}var Xm,wS;function iR(){if(wS)return Xm;wS=1;var e=vo(),t=Ir(),n=e(t,"Set");return Xm=n,Xm}var Zm,vS;function zz(){if(vS)return Zm;vS=1;var e=vo(),t=Ir(),n=e(t,"WeakMap");return Zm=n,Zm}var Qm,xS;function Vi(){if(xS)return Qm;xS=1;var e=Fz(),t=o0(),n=Bz(),s=iR(),a=zz(),i=wo(),c=XA(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),N=c(t),_=c(n),j=c(s),k=c(a),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=u||n&&S(n.resolve())!=p||s&&S(new s)!=h||a&&S(new a)!=m)&&(S=function(E){var C=i(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case N:return u;case _:return p;case j:return h;case k:return m}return C}),Qm=S,Qm}var Jm,bS;function Uz(){if(bS)return Jm;bS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return Jm=n,Jm}var eg,kS;function lR(){if(kS)return eg;kS=1;var e=Ir(),t=e.Uint8Array;return eg=t,eg}var tg,_S;function p0(){if(_S)return tg;_S=1;var e=lR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return tg=t,tg}var ng,NS;function Wz(){if(NS)return ng;NS=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return ng=t,ng}var rg,SS;function Hz(){if(SS)return rg;SS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return rg=t,rg}var sg,jS;function Gz(){if(jS)return sg;jS=1;var e=Hi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return sg=s,sg}var ag,ES;function cR(){if(ES)return ag;ES=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return ag=t,ag}var og,CS;function Vz(){if(CS)return og;CS=1;var e=p0(),t=Wz(),n=Hz(),s=Gz(),a=cR(),i="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",j="[object Float64Array]",k="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]";function F(W,O,B){var Z=W.constructor;switch(O){case w:return e(W);case i:case c:return new Z(+W);case N:return t(W,B);case _:case j:case k:case S:case E:case C:case T:case R:case I:return a(W,B);case u:return new Z;case f:case m:return new Z(W);case p:return n(W);case h:return new Z;case y:return s(W)}}return og=F,og}var ig,TS;function uR(){if(TS)return ig;TS=1;var e=cr(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return ig=n,ig}var lg,AS;function dR(){if(AS)return lg;AS=1;var e=uR(),t=yh(),n=gh();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return lg=s,lg}var cg,RS;function Yz(){if(RS)return cg;RS=1;var e=Vi(),t=Xr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return cg=s,cg}var ug,MS;function Kz(){if(MS)return ug;MS=1;var e=Yz(),t=mh(),n=u0(),s=n&&n.isMap,a=s?t(s):e;return ug=a,ug}var dg,IS;function Xz(){if(IS)return dg;IS=1;var e=Vi(),t=Xr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return dg=s,dg}var hg,$S;function Zz(){if($S)return hg;$S=1;var e=Xz(),t=mh(),n=u0(),s=n&&n.isSet,a=s?t(s):e;return hg=a,hg}var fg,OS;function hR(){if(OS)return fg;OS=1;var e=dh(),t=l0(),n=fh(),s=Iz(),a=Pz(),i=eR(),c=tR(),u=Lz(),f=Dz(),p=oR(),h=qz(),m=Vi(),y=Uz(),w=Vz(),N=dR(),_=Ht(),j=Gi(),k=Kz(),S=cr(),E=Zz(),C=ca(),T=xo(),R=1,I=2,F=4,W="[object Arguments]",O="[object Array]",B="[object Boolean]",Z="[object Date]",Q="[object Error]",M="[object Function]",K="[object GeneratorFunction]",G="[object Map]",P="[object Number]",H="[object Object]",L="[object RegExp]",U="[object Set]",$="[object String]",V="[object Symbol]",he="[object WeakMap]",Y="[object ArrayBuffer]",J="[object DataView]",z="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",me="[object Int16Array]",ge="[object Int32Array]",Me="[object Uint8Array]",qe="[object Uint8ClampedArray]",Ve="[object Uint16Array]",Ue="[object Uint32Array]",Se={};Se[W]=Se[O]=Se[Y]=Se[J]=Se[B]=Se[Z]=Se[z]=Se[re]=Se[le]=Se[me]=Se[ge]=Se[G]=Se[P]=Se[H]=Se[L]=Se[U]=Se[$]=Se[V]=Se[Me]=Se[qe]=Se[Ve]=Se[Ue]=!0,Se[Q]=Se[M]=Se[he]=!1;function Qe(Ne,_e,ue,je,Ce,Fe){var We,He=_e&R,ot=_e&I,wt=_e&F;if(ue&&(We=Ce?ue(Ne,je,Ce,Fe):ue(Ne)),We!==void 0)return We;if(!S(Ne))return Ne;var ut=_(Ne);if(ut){if(We=y(Ne),!He)return c(Ne,We)}else{var ee=m(Ne),ke=ee==M||ee==K;if(j(Ne))return i(Ne,He);if(ee==H||ee==W||ke&&!Ce){if(We=ot||ke?{}:N(Ne),!He)return ot?f(Ne,a(We,Ne)):u(Ne,s(We,Ne))}else{if(!Se[ee])return Ce?Ne:{};We=w(Ne,ee,He)}}Fe||(Fe=new e);var Be=Fe.get(Ne);if(Be)return Be;Fe.set(Ne,We),E(Ne)?Ne.forEach(function(Je){We.add(Qe(Je,_e,ue,Je,Ne,Fe))}):k(Ne)&&Ne.forEach(function(Je,tt){We.set(tt,Qe(Je,_e,ue,tt,Ne,Fe))});var et=wt?ot?h:p:ot?T:C,ht=ut?void 0:et(Ne);return t(ht||Ne,function(Je,tt){ht&&(tt=Je,Je=Ne[tt]),n(We,tt,Qe(Je,_e,ue,tt,Ne,Fe))}),We}return fg=Qe,fg}var pg,PS;function Qz(){if(PS)return pg;PS=1;var e=hR(),t=4;function n(s){return e(s,t)}return pg=n,pg}var mg,LS;function m0(){if(LS)return mg;LS=1;function e(t){return function(){return t}}return mg=e,mg}var gg,DS;function Jz(){if(DS)return gg;DS=1;function e(t){return function(n,s,a){for(var i=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++i];if(s(c[p],p,c)===!1)break}return n}}return gg=e,gg}var yg,qS;function g0(){if(qS)return yg;qS=1;var e=Jz(),t=e();return yg=t,yg}var wg,FS;function y0(){if(FS)return wg;FS=1;var e=g0(),t=ca();function n(s,a){return s&&e(s,a,t)}return wg=n,wg}var vg,BS;function eU(){if(BS)return vg;BS=1;var e=bs();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var c=a.length,u=s?c:-1,f=Object(a);(s?u--:++u<c)&&i(f[u],u,f)!==!1;);return a}}return vg=t,vg}var xg,zS;function wh(){if(zS)return xg;zS=1;var e=y0(),t=eU(),n=t(e);return xg=n,xg}var bg,US;function bo(){if(US)return bg;US=1;function e(t){return t}return bg=e,bg}var kg,WS;function fR(){if(WS)return kg;WS=1;var e=bo();function t(n){return typeof n=="function"?n:e}return kg=t,kg}var _g,HS;function pR(){if(HS)return _g;HS=1;var e=l0(),t=wh(),n=fR(),s=Ht();function a(i,c){var u=s(i)?e:t;return u(i,n(c))}return _g=a,_g}var Ng,GS;function mR(){return GS||(GS=1,Ng=pR()),Ng}var Sg,VS;function tU(){if(VS)return Sg;VS=1;var e=wh();function t(n,s){var a=[];return e(n,function(i,c,u){s(i,c,u)&&a.push(i)}),a}return Sg=t,Sg}var jg,YS;function nU(){if(YS)return jg;YS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return jg=t,jg}var Eg,KS;function rU(){if(KS)return Eg;KS=1;function e(t){return this.__data__.has(t)}return Eg=e,Eg}var Cg,XS;function gR(){if(XS)return Cg;XS=1;var e=i0(),t=nU(),n=rU();function s(a){var i=-1,c=a==null?0:a.length;for(this.__data__=new e;++i<c;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Cg=s,Cg}var Tg,ZS;function sU(){if(ZS)return Tg;ZS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return Tg=e,Tg}var Ag,QS;function yR(){if(QS)return Ag;QS=1;function e(t,n){return t.has(n)}return Ag=e,Ag}var Rg,JS;function wR(){if(JS)return Rg;JS=1;var e=gR(),t=sU(),n=yR(),s=1,a=2;function i(c,u,f,p,h,m){var y=f&s,w=c.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(c),j=m.get(u);if(_&&j)return _==u&&j==c;var k=-1,S=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++k<w;){var C=c[k],T=u[k];if(p)var R=y?p(T,C,k,u,c,m):p(C,T,k,c,u,m);if(R!==void 0){if(R)continue;S=!1;break}if(E){if(!t(u,function(I,F){if(!n(E,F)&&(C===I||h(C,I,f,p,m)))return E.push(F)})){S=!1;break}}else if(!(C===T||h(C,T,f,p,m))){S=!1;break}}return m.delete(c),m.delete(u),S}return Rg=i,Rg}var Mg,ej;function aU(){if(ej)return Mg;ej=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return Mg=e,Mg}var Ig,tj;function w0(){if(tj)return Ig;tj=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Ig=e,Ig}var $g,nj;function oU(){if(nj)return $g;nj=1;var e=Hi(),t=lR(),n=Wi(),s=wR(),a=aU(),i=w0(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",j="[object Symbol]",k="[object ArrayBuffer]",S="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,I,F,W,O,B,Z){switch(F){case S:if(R.byteLength!=I.byteLength||R.byteOffset!=I.byteOffset)return!1;R=R.buffer,I=I.buffer;case k:return!(R.byteLength!=I.byteLength||!B(new t(R),new t(I)));case f:case p:case y:return n(+R,+I);case h:return R.name==I.name&&R.message==I.message;case w:case _:return R==I+"";case m:var Q=a;case N:var M=W&c;if(Q||(Q=i),R.size!=I.size&&!M)return!1;var K=Z.get(R);if(K)return K==I;W|=u,Z.set(R,I);var G=s(Q(R),Q(I),W,O,B,Z);return Z.delete(R),G;case j:if(C)return C.call(R)==C.call(I)}return!1}return $g=T,$g}var Og,rj;function iU(){if(rj)return Og;rj=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u,f,p,h){var m=u&t,y=e(i),w=y.length,N=e(c),_=N.length;if(w!=_&&!m)return!1;for(var j=w;j--;){var k=y[j];if(!(m?k in c:s.call(c,k)))return!1}var S=h.get(i),E=h.get(c);if(S&&E)return S==c&&E==i;var C=!0;h.set(i,c),h.set(c,i);for(var T=m;++j<w;){k=y[j];var R=i[k],I=c[k];if(f)var F=m?f(I,R,k,c,i,h):f(R,I,k,i,c,h);if(!(F===void 0?R===I||p(R,I,u,f,h):F)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var W=i.constructor,O=c.constructor;W!=O&&"constructor"in i&&"constructor"in c&&!(typeof W=="function"&&W instanceof W&&typeof O=="function"&&O instanceof O)&&(C=!1)}return h.delete(i),h.delete(c),C}return Og=a,Og}var Pg,sj;function lU(){if(sj)return Pg;sj=1;var e=dh(),t=wR(),n=oU(),s=iU(),a=Vi(),i=Ht(),c=Gi(),u=Ic(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,j,k,S,E,C){var T=i(_),R=i(j),I=T?h:a(_),F=R?h:a(j);I=I==p?m:I,F=F==p?m:F;var W=I==m,O=F==m,B=I==F;if(B&&c(_)){if(!c(j))return!1;T=!0,W=!1}if(B&&!W)return C||(C=new e),T||u(_)?t(_,j,k,S,E,C):n(_,j,I,k,S,E,C);if(!(k&f)){var Z=W&&w.call(_,"__wrapped__"),Q=O&&w.call(j,"__wrapped__");if(Z||Q){var M=Z?_.value():_,K=Q?j.value():j;return C||(C=new e),E(M,K,k,S,C)}}return B?(C||(C=new e),s(_,j,k,S,E,C)):!1}return Pg=N,Pg}var Lg,aj;function vR(){if(aj)return Lg;aj=1;var e=lU(),t=Xr();function n(s,a,i,c,u){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,c,n,u)}return Lg=n,Lg}var Dg,oj;function cU(){if(oj)return Dg;oj=1;var e=dh(),t=vR(),n=1,s=2;function a(i,c,u,f){var p=u.length,h=p,m=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=u[p];if(m&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=u[p];var w=y[0],N=i[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in i))return!1}else{var j=new e;if(f)var k=f(N,_,w,i,c,j);if(!(k===void 0?t(_,N,n|s,f,j):k))return!1}}return!0}return Dg=a,Dg}var qg,ij;function xR(){if(ij)return qg;ij=1;var e=cr();function t(n){return n===n&&!e(n)}return qg=t,qg}var Fg,lj;function uU(){if(lj)return Fg;lj=1;var e=xR(),t=ca();function n(s){for(var a=t(s),i=a.length;i--;){var c=a[i],u=s[c];a[i]=[c,u,e(u)]}return a}return Fg=n,Fg}var Bg,cj;function bR(){if(cj)return Bg;cj=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Bg=e,Bg}var zg,uj;function dU(){if(uj)return zg;uj=1;var e=cU(),t=uU(),n=bR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(c){return c===a||e(c,a,i)}}return zg=s,zg}var Ug,dj;function Yi(){if(dj)return Ug;dj=1;var e=wo(),t=Xr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Ug=s,Ug}var Wg,hj;function v0(){if(hj)return Wg;hj=1;var e=Ht(),t=Yi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,c){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||c!=null&&i in Object(c)}return Wg=a,Wg}var Hg,fj;function hU(){if(fj)return Hg;fj=1;var e=i0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=i.cache;if(f.has(u))return f.get(u);var p=s.apply(this,c);return i.cache=f.set(u,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Hg=n,Hg}var Gg,pj;function fU(){if(pj)return Gg;pj=1;var e=hU(),t=500;function n(s){var a=e(s,function(c){return i.size===t&&i.clear(),c}),i=a.cache;return a}return Gg=n,Gg}var Vg,mj;function pU(){if(mj)return Vg;mj=1;var e=fU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(c,u,f,p){i.push(f?p.replace(n,"$1"):u||c)}),i});return Vg=s,Vg}var Yg,gj;function vh(){if(gj)return Yg;gj=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return Yg=e,Yg}var Kg,yj;function mU(){if(yj)return Kg;yj=1;var e=Hi(),t=vh(),n=Ht(),s=Yi(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(s(u))return i?i.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Kg=c,Kg}var Xg,wj;function kR(){if(wj)return Xg;wj=1;var e=mU();function t(n){return n==null?"":e(n)}return Xg=t,Xg}var Zg,vj;function xh(){if(vj)return Zg;vj=1;var e=Ht(),t=v0(),n=pU(),s=kR();function a(i,c){return e(i)?i:t(i,c)?[i]:n(s(i))}return Zg=a,Zg}var Qg,xj;function $c(){if(xj)return Qg;xj=1;var e=Yi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Qg=t,Qg}var Jg,bj;function bh(){if(bj)return Jg;bj=1;var e=xh(),t=$c();function n(s,a){a=e(a,s);for(var i=0,c=a.length;s!=null&&i<c;)s=s[t(a[i++])];return i&&i==c?s:void 0}return Jg=n,Jg}var ey,kj;function gU(){if(kj)return ey;kj=1;var e=bh();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return ey=t,ey}var ty,_j;function yU(){if(_j)return ty;_j=1;function e(t,n){return t!=null&&n in Object(t)}return ty=e,ty}var ny,Nj;function _R(){if(Nj)return ny;Nj=1;var e=xh(),t=Mc(),n=Ht(),s=ph(),a=c0(),i=$c();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=i(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&s(w,m)&&(n(u)||t(u)))}return ny=c,ny}var ry,Sj;function NR(){if(Sj)return ry;Sj=1;var e=yU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return ry=n,ry}var sy,jj;function wU(){if(jj)return sy;jj=1;var e=vR(),t=gU(),n=NR(),s=v0(),a=xR(),i=bR(),c=$c(),u=1,f=2;function p(h,m){return s(h)&&a(m)?i(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return sy=p,sy}var ay,Ej;function SR(){if(Ej)return ay;Ej=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ay=e,ay}var oy,Cj;function vU(){if(Cj)return oy;Cj=1;var e=bh();function t(n){return function(s){return e(s,n)}}return oy=t,oy}var iy,Tj;function xU(){if(Tj)return iy;Tj=1;var e=SR(),t=vU(),n=v0(),s=$c();function a(i){return n(i)?e(s(i)):t(i)}return iy=a,iy}var ly,Aj;function ks(){if(Aj)return ly;Aj=1;var e=dU(),t=wU(),n=bo(),s=Ht(),a=xU();function i(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return ly=i,ly}var cy,Rj;function jR(){if(Rj)return cy;Rj=1;var e=nR(),t=tU(),n=ks(),s=Ht();function a(i,c){var u=s(i)?e:t;return u(i,n(c,3))}return cy=a,cy}var uy,Mj;function bU(){if(Mj)return uy;Mj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return uy=n,uy}var dy,Ij;function ER(){if(Ij)return dy;Ij=1;var e=bU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return dy=n,dy}var hy,$j;function kU(){if($j)return hy;$j=1;var e=d0(),t=Vi(),n=Mc(),s=Ht(),a=bs(),i=Gi(),c=gh(),u=Ic(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(c(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return hy=y,hy}var fy,Oj;function CR(){if(Oj)return fy;Oj=1;function e(t){return t===void 0}return fy=e,fy}var py,Pj;function TR(){if(Pj)return py;Pj=1;var e=wh(),t=bs();function n(s,a){var i=-1,c=t(s)?Array(s.length):[];return e(s,function(u,f,p){c[++i]=a(u,f,p)}),c}return py=n,py}var my,Lj;function AR(){if(Lj)return my;Lj=1;var e=vh(),t=ks(),n=TR(),s=Ht();function a(i,c){var u=s(i)?e:n;return u(i,t(c,3))}return my=a,my}var gy,Dj;function _U(){if(Dj)return gy;Dj=1;function e(t,n,s,a){var i=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++i]);++i<c;)s=n(s,t[i],i,t);return s}return gy=e,gy}var yy,qj;function NU(){if(qj)return yy;qj=1;function e(t,n,s,a,i){return i(t,function(c,u,f){s=a?(a=!1,c):n(s,c,u,f)}),s}return yy=e,yy}var wy,Fj;function RR(){if(Fj)return wy;Fj=1;var e=_U(),t=wh(),n=ks(),s=NU(),a=Ht();function i(c,u,f){var p=a(c)?e:s,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return wy=i,wy}var vy,Bj;function SU(){if(Bj)return vy;Bj=1;var e=wo(),t=Ht(),n=Xr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return vy=a,vy}var xy,zj;function jU(){if(zj)return xy;zj=1;var e=SR(),t=e("length");return xy=t,xy}var by,Uj;function EU(){if(Uj)return by;Uj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+i+"]");function f(p){return u.test(p)}return by=f,by}var ky,Wj;function CU(){if(Wj)return ky;Wj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+i+"]?",j="(?:"+w+"(?:"+[h,m,y].join("|")+")"+_+N+")*",k=_+N+j,S="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+S+k,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return ky=C,ky}var _y,Hj;function TU(){if(Hj)return _y;Hj=1;var e=jU(),t=EU(),n=CU();function s(a){return t(a)?n(a):e(a)}return _y=s,_y}var Ny,Gj;function AU(){if(Gj)return Ny;Gj=1;var e=d0(),t=Vi(),n=bs(),s=SU(),a=TU(),i="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==c?f.size:e(f).length}return Ny=u,Ny}var Sy,Vj;function RU(){if(Vj)return Sy;Vj=1;var e=l0(),t=uR(),n=y0(),s=ks(),a=yh(),i=Ht(),c=Gi(),u=Ac(),f=cr(),p=Ic();function h(m,y,w){var N=i(m),_=N||c(m)||p(m);if(y=s(y,4),w==null){var j=m&&m.constructor;_?w=N?new j:[]:f(m)?w=u(j)?t(a(m)):{}:w={}}return(_?e:n)(m,function(k,S,E){return y(w,k,S,E)}),w}return Sy=h,Sy}var jy,Yj;function MU(){if(Yj)return jy;Yj=1;var e=Hi(),t=Mc(),n=Ht(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return jy=a,jy}var Ey,Kj;function x0(){if(Kj)return Ey;Kj=1;var e=f0(),t=MU();function n(s,a,i,c,u){var f=-1,p=s.length;for(i||(i=t),u||(u=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,c,u):e(u,h):c||(u[u.length]=h)}return u}return Ey=n,Ey}var Cy,Xj;function IU(){if(Xj)return Cy;Xj=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return Cy=e,Cy}var Ty,Zj;function MR(){if(Zj)return Ty;Zj=1;var e=IU(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=i(p),e(s,this,h)}}return Ty=n,Ty}var Ay,Qj;function $U(){if(Qj)return Ay;Qj=1;var e=m0(),t=ZA(),n=bo(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Ay=s,Ay}var Ry,Jj;function OU(){if(Jj)return Ry;Jj=1;var e=800,t=16,n=Date.now;function s(a){var i=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Ry=s,Ry}var My,eE;function IR(){if(eE)return My;eE=1;var e=$U(),t=OU(),n=t(e);return My=n,My}var Iy,tE;function kh(){if(tE)return Iy;tE=1;var e=bo(),t=MR(),n=IR();function s(a,i){return n(t(a,i,e),a+"")}return Iy=s,Iy}var $y,nE;function $R(){if(nE)return $y;nE=1;function e(t,n,s,a){for(var i=t.length,c=s+(a?1:-1);a?c--:++c<i;)if(n(t[c],c,t))return c;return-1}return $y=e,$y}var Oy,rE;function PU(){if(rE)return Oy;rE=1;function e(t){return t!==t}return Oy=e,Oy}var Py,sE;function LU(){if(sE)return Py;sE=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Py=e,Py}var Ly,aE;function DU(){if(aE)return Ly;aE=1;var e=$R(),t=PU(),n=LU();function s(a,i,c){return i===i?n(a,i,c):e(a,t,c)}return Ly=s,Ly}var Dy,oE;function qU(){if(oE)return Dy;oE=1;var e=DU();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Dy=t,Dy}var qy,iE;function FU(){if(iE)return qy;iE=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return qy=e,qy}var Fy,lE;function BU(){if(lE)return Fy;lE=1;function e(){}return Fy=e,Fy}var By,cE;function zU(){if(cE)return By;cE=1;var e=iR(),t=BU(),n=w0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return By=a,By}var zy,uE;function UU(){if(uE)return zy;uE=1;var e=gR(),t=qU(),n=FU(),s=yR(),a=zU(),i=w0(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,N=!0,_=[],j=_;if(h)N=!1,y=n;else if(w>=c){var k=p?null:a(f);if(k)return i(k);N=!1,y=s,j=new e}else j=p?[]:_;e:for(;++m<w;){var S=f[m],E=p?p(S):S;if(S=h||S!==0?S:0,N&&E===E){for(var C=j.length;C--;)if(j[C]===E)continue e;p&&j.push(E),_.push(S)}else y(j,E,h)||(j!==_&&j.push(E),_.push(S))}return _}return zy=u,zy}var Uy,dE;function OR(){if(dE)return Uy;dE=1;var e=bs(),t=Xr();function n(s){return t(s)&&e(s)}return Uy=n,Uy}var Wy,hE;function WU(){if(hE)return Wy;hE=1;var e=x0(),t=kh(),n=UU(),s=OR(),a=t(function(i){return n(e(i,1,s,!0))});return Wy=a,Wy}var Hy,fE;function HU(){if(fE)return Hy;fE=1;var e=vh();function t(n,s){return e(s,function(a){return n[a]})}return Hy=t,Hy}var Gy,pE;function PR(){if(pE)return Gy;pE=1;var e=HU(),t=ca();function n(s){return s==null?[]:e(s,t(s))}return Gy=n,Gy}var Vy,mE;function ur(){if(mE)return Vy;mE=1;var e;if(typeof a0=="function")try{e={clone:Qz(),constant:m0(),each:mR(),filter:jR(),has:ER(),isArray:Ht(),isEmpty:kU(),isFunction:Ac(),isUndefined:CR(),keys:ca(),map:AR(),reduce:RR(),size:AU(),transform:RU(),union:WU(),values:PR()}}catch{}return e||(e=window._),Vy=e,Vy}var Yy,gE;function b0(){if(gE)return Yy;gE=1;var e=ur();Yy=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,j){h(j)&&m.setNode(j,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var j=y.parent(_);return j===void 0||m.hasNode(j)?(w[_]=j,j):j in w?w[j]:N(j)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var h,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(h=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var j=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,j))return N&&(this._edgeLabels[j]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[j]=N?w:this._defaultEdgeLabelFn(h,m,y);var k=f(this._isDirected,h,m,y);return h=k.v,m=k.w,Object.freeze(k),this._edgeObjs[j]=k,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][j]=k,this._out[h][j]=k,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),N=this._edgeObjs[w];return N&&(h=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var j=N;N=_,_=j}return N+s+_+s+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var j=N;N=_,_=j}var k={v:N,w:_};return w&&(k.name=w),k}function p(h,m){return u(h,m.v,m.w,m.name)}return Yy}var Ky,yE;function GU(){return yE||(yE=1,Ky="2.1.8"),Ky}var Xy,wE;function VU(){return wE||(wE=1,Xy={Graph:b0(),version:GU()}),Xy}var Zy,vE;function YU(){if(vE)return Zy;vE=1;var e=ur(),t=b0();Zy={write:n,read:i};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function s(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function i(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return Zy}var Qy,xE;function KU(){if(xE)return Qy;xE=1;var e=ur();Qy=t;function t(n){var s={},a=[],i;function c(u){e.has(s,u)||(s[u]=!0,i.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){i=[],c(u),i.length&&a.push(i)}),a}return Qy}var Jy,bE;function LR(){if(bE)return Jy;bE=1;var e=ur();Jy=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,c=i.length;return a[n]=c,i.push({key:n,priority:s}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,i<s.length&&(c=s[i].priority<s[c].priority?i:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,c=a[n],u=a[s];a[n]=u,a[s]=c,i[u.key]=n,i[c.key]=s},Jy}var ew,kE;function DR(){if(kE)return ew;kE=1;var e=ur(),t=LR();ew=s;var n=e.constant(1);function s(i,c,u,f){return a(i,String(c),u||n,f||function(p){return i.outEdges(p)})}function a(i,c,u,f){var p={},h=new t,m,y,w=function(N){var _=N.v!==m?N.v:N.w,j=p[_],k=u(N),S=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);S<j.distance&&(j.distance=S,j.predecessor=m,h.decrease(_,S))};for(i.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},h.add(N,_)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return ew}var tw,_E;function XU(){if(_E)return tw;_E=1;var e=DR(),t=ur();tw=n;function n(s,a,i){return t.transform(s.nodes(),function(c,u){c[u]=e(s,u,a,i)},{})}return tw}var nw,NE;function qR(){if(NE)return nw;NE=1;var e=ur();nw=t;function t(n){var s=0,a=[],i={},c=[];function u(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),i[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||u(f)}),c}return nw}var rw,SE;function ZU(){if(SE)return rw;SE=1;var e=ur(),t=qR();rw=n;function n(s){return e.filter(t(s),function(a){return a.length>1||a.length===1&&s.hasEdge(a[0],a[0])})}return rw}var sw,jE;function QU(){if(jE)return sw;jE=1;var e=ur();sw=n;var t=e.constant(1);function n(a,i,c){return s(a,i||t,c||function(u){return a.outEdges(u)})}function s(a,i,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=i(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var N=y[p],_=h[w],j=y[w],k=N.distance+_.distance;k<j.distance&&(j.distance=k,j.predecessor=_.predecessor)})})}),u}return sw}var aw,EE;function FR(){if(EE)return aw;EE=1;var e=ur();aw=t,t.CycleException=n;function t(s){var a={},i={},c=[];function u(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),u),delete i[f],c.push(f))}if(e.each(s.sinks(),u),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,aw}var ow,CE;function JU(){if(CE)return ow;CE=1;var e=FR();ow=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return ow}var iw,TE;function BR(){if(TE)return iw;TE=1;var e=ur();iw=t;function t(s,a,i){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,c,u)}),u}function n(s,a,i,c,u,f){e.has(c,a)||(c[a]=!0,i||f.push(a),e.each(u(a),function(p){n(s,p,i,c,u,f)}),i&&f.push(a))}return iw}var lw,AE;function eW(){if(AE)return lw;AE=1;var e=BR();lw=t;function t(n,s){return e(n,s,"post")}return lw}var cw,RE;function tW(){if(RE)return cw;RE=1;var e=BR();cw=t;function t(n,s){return e(n,s,"pre")}return cw}var uw,ME;function nW(){if(ME)return uw;ME=1;var e=ur(),t=b0(),n=LR();uw=s;function s(a,i){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var _=i(y);_<N&&(u[w]=p,f.decrease(w,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return uw}var dw,IE;function rW(){return IE||(IE=1,dw={components:KU(),dijkstra:DR(),dijkstraAll:XU(),findCycles:ZU(),floydWarshall:QU(),isAcyclic:JU(),postorder:eW(),preorder:tW(),prim:nW(),tarjan:qR(),topsort:FR()}),dw}var hw,$E;function sW(){if($E)return hw;$E=1;var e=VU();return hw={Graph:e.Graph,json:YU(),alg:rW(),version:e.version},hw}var fw,OE;function Rr(){if(OE)return fw;OE=1;var e;if(typeof a0=="function")try{e=sW()}catch{}return e||(e=window.graphlib),fw=e,fw}var pw,PE;function aW(){if(PE)return pw;PE=1;var e=hR(),t=1,n=4;function s(a){return e(a,t|n)}return pw=s,pw}var mw,LE;function _h(){if(LE)return mw;LE=1;var e=Wi(),t=bs(),n=ph(),s=cr();function a(i,c,u){if(!s(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],i):!1}return mw=a,mw}var gw,DE;function oW(){if(DE)return gw;DE=1;var e=kh(),t=Wi(),n=_h(),s=xo(),a=Object.prototype,i=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=s(y),N=-1,_=w.length;++N<_;){var j=w[N],k=u[j];(k===void 0||t(k,a[j])&&!i.call(u,j))&&(u[j]=y[j])}return u});return gw=c,gw}var yw,qE;function iW(){if(qE)return yw;qE=1;var e=ks(),t=bs(),n=ca();function s(a){return function(i,c,u){var f=Object(i);if(!t(i)){var p=e(c,3);i=n(i),c=function(m){return p(f[m],m,f)}}var h=a(i,c,u);return h>-1?f[p?i[h]:h]:void 0}}return yw=s,yw}var ww,FE;function lW(){if(FE)return ww;FE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ww=t,ww}var vw,BE;function cW(){if(BE)return vw;BE=1;var e=lW(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return vw=n,vw}var xw,zE;function uW(){if(zE)return xw;zE=1;var e=cW(),t=cr(),n=Yi(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=i.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?s:+p}return xw=f,xw}var bw,UE;function zR(){if(UE)return bw;UE=1;var e=uW(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return bw=s,bw}var kw,WE;function dW(){if(WE)return kw;WE=1;var e=zR();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return kw=t,kw}var _w,HE;function hW(){if(HE)return _w;HE=1;var e=$R(),t=ks(),n=dW(),s=Math.max;function a(i,c,u){var f=i==null?0:i.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=s(f+p,0)),e(i,t(c,3),p)}return _w=a,_w}var Nw,GE;function fW(){if(GE)return Nw;GE=1;var e=iW(),t=hW(),n=e(t);return Nw=n,Nw}var Sw,VE;function UR(){if(VE)return Sw;VE=1;var e=x0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Sw=t,Sw}var jw,YE;function pW(){if(YE)return jw;YE=1;var e=g0(),t=fR(),n=xo();function s(a,i){return a==null?a:e(a,t(i),n)}return jw=s,jw}var Ew,KE;function mW(){if(KE)return Ew;KE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ew=e,Ew}var Cw,XE;function gW(){if(XE)return Cw;XE=1;var e=hh(),t=y0(),n=ks();function s(a,i){var c={};return i=n(i,3),t(a,function(u,f,p){e(c,f,i(u,f,p))}),c}return Cw=s,Cw}var Tw,ZE;function k0(){if(ZE)return Tw;ZE=1;var e=Yi();function t(n,s,a){for(var i=-1,c=n.length;++i<c;){var u=n[i],f=s(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Tw=t,Tw}var Aw,QE;function yW(){if(QE)return Aw;QE=1;function e(t,n){return t>n}return Aw=e,Aw}var Rw,JE;function wW(){if(JE)return Rw;JE=1;var e=k0(),t=yW(),n=bo();function s(a){return a&&a.length?e(a,n,t):void 0}return Rw=s,Rw}var Mw,eC;function WR(){if(eC)return Mw;eC=1;var e=hh(),t=Wi();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return Mw=n,Mw}var Iw,tC;function vW(){if(tC)return Iw;tC=1;var e=wo(),t=yh(),n=Xr(),s="[object Object]",a=Function.prototype,i=Object.prototype,c=a.toString,u=i.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Iw=p,Iw}var $w,nC;function HR(){if(nC)return $w;nC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return $w=e,$w}var Ow,rC;function xW(){if(rC)return Ow;rC=1;var e=Rc(),t=xo();function n(s){return e(s,t(s))}return Ow=n,Ow}var Pw,sC;function bW(){if(sC)return Pw;sC=1;var e=WR(),t=eR(),n=cR(),s=tR(),a=dR(),i=Mc(),c=Ht(),u=OR(),f=Gi(),p=Ac(),h=cr(),m=vW(),y=Ic(),w=HR(),N=xW();function _(j,k,S,E,C,T,R){var I=w(j,S),F=w(k,S),W=R.get(F);if(W){e(j,S,W);return}var O=T?T(I,F,S+"",j,k,R):void 0,B=O===void 0;if(B){var Z=c(F),Q=!Z&&f(F),M=!Z&&!Q&&y(F);O=F,Z||Q||M?c(I)?O=I:u(I)?O=s(I):Q?(B=!1,O=t(F,!0)):M?(B=!1,O=n(F,!0)):O=[]:m(F)||i(F)?(O=I,i(I)?O=N(I):(!h(I)||p(I))&&(O=a(F))):B=!1}B&&(R.set(F,O),C(O,F,E,T,R),R.delete(F)),e(j,S,O)}return Pw=_,Pw}var Lw,aC;function kW(){if(aC)return Lw;aC=1;var e=dh(),t=WR(),n=g0(),s=bW(),a=cr(),i=xo(),c=HR();function u(f,p,h,m,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))s(f,p,N,h,u,m,y);else{var _=m?m(c(f,N),w,N+"",f,p,y):void 0;_===void 0&&(_=w),t(f,N,_)}},i)}return Lw=u,Lw}var Dw,oC;function _W(){if(oC)return Dw;oC=1;var e=kh(),t=_h();function n(s){return e(function(a,i){var c=-1,u=i.length,f=u>1?i[u-1]:void 0,p=u>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(i[0],i[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=i[c];h&&s(a,h,c,f)}return a})}return Dw=n,Dw}var qw,iC;function NW(){if(iC)return qw;iC=1;var e=kW(),t=_W(),n=t(function(s,a,i){e(s,a,i)});return qw=n,qw}var Fw,lC;function GR(){if(lC)return Fw;lC=1;function e(t,n){return t<n}return Fw=e,Fw}var Bw,cC;function SW(){if(cC)return Bw;cC=1;var e=k0(),t=GR(),n=bo();function s(a){return a&&a.length?e(a,n,t):void 0}return Bw=s,Bw}var zw,uC;function jW(){if(uC)return zw;uC=1;var e=k0(),t=ks(),n=GR();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return zw=s,zw}var Uw,dC;function EW(){if(dC)return Uw;dC=1;var e=Ir(),t=function(){return e.Date.now()};return Uw=t,Uw}var Ww,hC;function CW(){if(hC)return Ww;hC=1;var e=fh(),t=xh(),n=ph(),s=cr(),a=$c();function i(c,u,f,p){if(!s(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var N=a(u[h]),_=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(h!=y){var j=w[N];_=p?p(j,N,w):void 0,_===void 0&&(_=s(j)?j:n(u[h+1])?[]:{})}e(w,N,_),w=w[N]}return c}return Ww=i,Ww}var Hw,fC;function TW(){if(fC)return Hw;fC=1;var e=bh(),t=CW(),n=xh();function s(a,i,c){for(var u=-1,f=i.length,p={};++u<f;){var h=i[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return Hw=s,Hw}var Gw,pC;function AW(){if(pC)return Gw;pC=1;var e=TW(),t=NR();function n(s,a){return e(s,a,function(i,c){return t(s,c)})}return Gw=n,Gw}var Vw,mC;function RW(){if(mC)return Vw;mC=1;var e=UR(),t=MR(),n=IR();function s(a){return n(t(a,void 0,e),a+"")}return Vw=s,Vw}var Yw,gC;function MW(){if(gC)return Yw;gC=1;var e=AW(),t=RW(),n=t(function(s,a){return s==null?{}:e(s,a)});return Yw=n,Yw}var Kw,yC;function IW(){if(yC)return Kw;yC=1;var e=Math.ceil,t=Math.max;function n(s,a,i,c){for(var u=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[c?f:++u]=s,s+=i;return p}return Kw=n,Kw}var Xw,wC;function $W(){if(wC)return Xw;wC=1;var e=IW(),t=_h(),n=zR();function s(a){return function(i,c,u){return u&&typeof u!="number"&&t(i,c,u)&&(c=u=void 0),i=n(i),c===void 0?(c=i,i=0):c=n(c),u=u===void 0?i<c?1:-1:n(u),e(i,c,u,a)}}return Xw=s,Xw}var Zw,vC;function OW(){if(vC)return Zw;vC=1;var e=$W(),t=e();return Zw=t,Zw}var Qw,xC;function PW(){if(xC)return Qw;xC=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Qw=e,Qw}var Jw,bC;function LW(){if(bC)return Jw;bC=1;var e=Yi();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,c=n===n,u=e(n),f=s!==void 0,p=s===null,h=s===s,m=e(s);if(!p&&!m&&!u&&n>s||u&&f&&h&&!p&&!m||i&&f&&h||!a&&h||!c)return 1;if(!i&&!u&&!m&&n<s||m&&a&&c&&!i&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return Jw=t,Jw}var ev,kC;function DW(){if(kC)return ev;kC=1;var e=LW();function t(n,s,a){for(var i=-1,c=n.criteria,u=s.criteria,f=c.length,p=a.length;++i<f;){var h=e(c[i],u[i]);if(h){if(i>=p)return h;var m=a[i];return h*(m=="desc"?-1:1)}}return n.index-s.index}return ev=t,ev}var tv,_C;function qW(){if(_C)return tv;_C=1;var e=vh(),t=bh(),n=ks(),s=TR(),a=PW(),i=mh(),c=DW(),u=bo(),f=Ht();function p(h,m,y){m.length?m=e(m,function(_){return f(_)?function(j){return t(j,_.length===1?_[0]:_)}:_}):m=[u];var w=-1;m=e(m,i(n));var N=s(h,function(_,j,k){var S=e(m,function(E){return E(_)});return{criteria:S,index:++w,value:_}});return a(N,function(_,j){return c(_,j,y)})}return tv=p,tv}var nv,NC;function FW(){if(NC)return nv;NC=1;var e=x0(),t=qW(),n=kh(),s=_h(),a=n(function(i,c){if(i==null)return[];var u=c.length;return u>1&&s(i,c[0],c[1])?c=[]:u>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(i,e(c,1),[])});return nv=a,nv}var rv,SC;function BW(){if(SC)return rv;SC=1;var e=kR(),t=0;function n(s){var a=++t;return e(s)+a}return rv=n,rv}var sv,jC;function zW(){if(jC)return sv;jC=1;function e(t,n,s){for(var a=-1,i=t.length,c=n.length,u={};++a<i;){var f=a<c?n[a]:void 0;s(u,t[a],f)}return u}return sv=e,sv}var av,EC;function UW(){if(EC)return av;EC=1;var e=fh(),t=zW();function n(s,a){return t(s||[],a||[],e)}return av=n,av}var ov,CC;function At(){if(CC)return ov;CC=1;var e;if(typeof a0=="function")try{e={cloneDeep:aW(),constant:m0(),defaults:oW(),each:mR(),filter:jR(),find:fW(),flatten:UR(),forEach:pR(),forIn:pW(),has:ER(),isUndefined:CR(),last:mW(),map:AR(),mapValues:gW(),max:wW(),merge:NW(),min:SW(),minBy:jW(),now:EW(),pick:MW(),range:OW(),reduce:RR(),sortBy:FW(),uniqueId:BW(),values:PR(),zipObject:UW()}}catch{}return e||(e=window._),ov=e,ov}var iv,TC;function WW(){if(TC)return iv;TC=1,iv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return iv}var lv,AC;function HW(){if(AC)return lv;AC=1;var e=At(),t=Rr().Graph,n=WW();lv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||s),y=i(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,m){for(var y=[],w=h[h.length-1],N=h[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,h,m,_);for(;_=w.dequeue();)c(p,h,m,_);if(p.nodeCount()){for(var j=h.length-2;j>0;--j)if(_=h[j].dequeue(),_){y=y.concat(c(p,h,m,_,!0));break}}}return y}function c(p,h,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var j=p.edge(_),k=p.node(_.v);w&&N.push({v:_.v,w:_.w}),k.out-=j,f(h,m,k)}),e.forEach(p.outEdges(y.v),function(_){var j=p.edge(_),k=_.w,S=p.node(k);S.in-=j,f(h,m,S)}),p.removeNode(y.v),N}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(j){m.setNode(j,{v:j,in:0,out:0})}),e.forEach(p.edges(),function(j){var k=m.edge(j.v,j.w)||0,S=h(j),E=k+S;m.setEdge(j.v,j.w,E),w=Math.max(w,m.node(j.v).out+=S),y=Math.max(y,m.node(j.w).in+=S)});var N=e.range(w+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(j){f(N,_,m.node(j))}),{graph:m,buckets:N,zeroIdx:_}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return lv}var cv,RC;function GW(){if(RC)return cv;RC=1;var e=At(),t=HW();cv={run:n,undo:a};function n(i){var c=i.graph().acyclicer==="greedy"?t(i,u(i)):s(i);e.forEach(c,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function s(i){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(i.nodes(),p),c}function a(i){e.forEach(i.edges(),function(c){var u=i.edge(c);if(u.reversed){i.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(c.w,c.v,u,f)}})}return cv}var uv,MC;function On(){if(MC)return uv;MC=1;var e=At(),t=Rr().Graph;uv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function n(j,k,S,E){var C;do C=e.uniqueId(E);while(j.hasNode(C));return S.dummy=k,j.setNode(C,S),C}function s(j){var k=new t().setGraph(j.graph());return e.forEach(j.nodes(),function(S){k.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){var E=k.edge(S.v,S.w)||{weight:0,minlen:1},C=j.edge(S);k.setEdge(S.v,S.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function a(j){var k=new t({multigraph:j.isMultigraph()}).setGraph(j.graph());return e.forEach(j.nodes(),function(S){j.children(S).length||k.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){k.setEdge(S,j.edge(S))}),k}function i(j){var k=e.map(j.nodes(),function(S){var E={};return e.forEach(j.outEdges(S),function(C){E[C.w]=(E[C.w]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),k)}function c(j){var k=e.map(j.nodes(),function(S){var E={};return e.forEach(j.inEdges(S),function(C){E[C.v]=(E[C.v]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),k)}function u(j,k){var S=j.x,E=j.y,C=k.x-S,T=k.y-E,R=j.width/2,I=j.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var F,W;return Math.abs(T)*R>Math.abs(C)*I?(T<0&&(I=-I),F=I*C/T,W=I):(C<0&&(R=-R),F=R,W=R*T/C),{x:S+F,y:E+W}}function f(j){var k=e.map(e.range(y(j)+1),function(){return[]});return e.forEach(j.nodes(),function(S){var E=j.node(S),C=E.rank;e.isUndefined(C)||(k[C][E.order]=S)}),k}function p(j){var k=e.min(e.map(j.nodes(),function(S){return j.node(S).rank}));e.forEach(j.nodes(),function(S){var E=j.node(S);e.has(E,"rank")&&(E.rank-=k)})}function h(j){var k=e.min(e.map(j.nodes(),function(T){return j.node(T).rank})),S=[];e.forEach(j.nodes(),function(T){var R=j.node(T).rank-k;S[R]||(S[R]=[]),S[R].push(T)});var E=0,C=j.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(I){j.node(I).rank+=E})})}function m(j,k,S,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=E),n(j,"border",C,k)}function y(j){return e.max(e.map(j.nodes(),function(k){var S=j.node(k).rank;if(!e.isUndefined(S))return S}))}function w(j,k){var S={lhs:[],rhs:[]};return e.forEach(j,function(E){k(E)?S.lhs.push(E):S.rhs.push(E)}),S}function N(j,k){var S=e.now();try{return k()}finally{console.log(j+" time: "+(e.now()-S)+"ms")}}function _(j,k){return k()}return uv}var dv,IC;function VW(){if(IC)return dv;IC=1;var e=At(),t=On();dv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(c){s(i,c)})}function s(i,c){var u=c.v,f=i.node(u).rank,p=c.w,h=i.node(p).rank,m=c.name,y=i.edge(c),w=y.labelRank;if(h!==f+1){i.removeEdge(c);var N,_,j;for(j=0,++f;f<h;++j,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},N=t.addDummyNode(i,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),i.setEdge(u,N,{weight:y.weight},m),j===0&&i.graph().dummyChains.push(N),u=N;i.setEdge(u,p,{weight:y.weight},m)}}function a(i){e.forEach(i.graph().dummyChains,function(c){var u=i.node(c),f=u.edgeLabel,p;for(i.setEdge(u.edgeObj,f);u.dummy;)p=i.successors(c)[0],i.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=i.node(c)})}return dv}var hv,$C;function zd(){if($C)return hv;$C=1;var e=At();hv={longestPath:t,slack:n};function t(s){var a={};function i(c){var u=s.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(s.outEdges(c),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return hv}var fv,OC;function VR(){if(OC)return fv;OC=1;var e=At(),t=Rr().Graph,n=zd().slack;fv=s;function s(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=i(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function i(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return fv}var pv,PC;function YW(){if(PC)return pv;PC=1;var e=At(),t=VR(),n=zd().slack,s=zd().longestPath,a=Rr().alg.preorder,i=Rr().alg.postorder,c=On().simplify;pv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=_;function u(E){E=c(E),s(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=N(C,E,T),_(C,E,T,R)}function f(E,C){var T=i(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),I=R.parent;E.edge(T,I).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),I=R.parent,F=!0,W=C.edge(T,I),O=0;return W||(F=!1,W=C.edge(I,T)),O=W.weight,e.forEach(C.nodeEdges(T),function(B){var Z=B.v===T,Q=Z?B.w:B.v;if(Q!==I){var M=Z===F,K=C.edge(B).weight;if(O+=M?K:-K,k(E,T,Q)){var G=E.edge(T,Q).cutvalue;O+=M?-G:G}}}),O}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,I){var F=T,W=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(O){e.has(C,O)||(T=y(E,C,T,O,R))}),W.low=F,W.lim=T++,I?W.parent=I:delete W.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,I=T.w;C.hasEdge(R,I)||(R=T.w,I=T.v);var F=E.node(R),W=E.node(I),O=F,B=!1;F.lim>W.lim&&(O=W,B=!0);var Z=e.filter(C.edges(),function(Q){return B===S(E,E.node(Q.v),O)&&B!==S(E,E.node(Q.w),O)});return e.minBy(Z,function(Q){return n(C,Q)})}function _(E,C,T,R){var I=T.v,F=T.w;E.removeEdge(I,F),E.setEdge(R.v,R.w,{}),m(E),f(E,C),j(E,C)}function j(E,C){var T=e.find(E.nodes(),function(I){return!C.node(I).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(I){var F=E.node(I).parent,W=C.edge(I,F),O=!1;W||(W=C.edge(F,I),O=!0),C.node(I).rank=C.node(F).rank+(O?W.minlen:-W.minlen)})}function k(E,C,T){return E.hasEdge(C,T)}function S(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return pv}var mv,LC;function KW(){if(LC)return mv;LC=1;var e=zd(),t=e.longestPath,n=VR(),s=YW();mv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":i(f);break;default:u(f)}}var i=t;function c(f){t(f),n(f)}function u(f){s(f)}return mv}var gv,DC;function XW(){if(DC)return gv;DC=1;var e=At();gv=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,i,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],N=!0;c!==f.w;){if(u=a.node(c),N){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,i,c,u){var f=[],p=[],h=Math.min(i[c].low,i[u].low),m=Math.max(i[c].lim,i[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||m>i[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),i[f]={low:p,lim:c++}}return e.forEach(a.children(),u),i}return gv}var yv,qC;function ZW(){if(qC)return yv;qC=1;var e=At(),t=On();yv={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=i(u)+1;e.forEach(u.children(),function(w){s(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function s(u,f,p,h,m,y,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(u,"_bt"),j=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(_,w),k.borderTop=_,u.setParent(j,w),k.borderBottom=j,e.forEach(N,function(S){s(u,f,p,h,m,y,S);var E=u.node(S),C=E.borderTop?E.borderTop:S,T=E.borderBottom?E.borderBottom:S,R=E.borderTop?h:2*h,I=C!==T?1:m-y[w]+1;u.setEdge(_,C,{weight:R,minlen:I,nestingEdge:!0}),u.setEdge(T,j,{weight:R,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,_,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function i(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return yv}var wv,FC;function QW(){if(FC)return wv;FC=1;var e=At(),t=On();wv=n;function n(a){function i(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",c,f,p),s(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),i)}function s(a,i,c,u,f,p){var h={width:0,height:0,rank:p,borderType:i},m=f[i][p-1],y=t.addDummyNode(a,"border",h,c);f[i][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return wv}var vv,BC;function JW(){if(BC)return vv;BC=1;var e=At();vv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return vv}var xv,zC;function eH(){if(zC)return xv;zC=1;var e=At();xv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(i+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return xv}var bv,UC;function tH(){if(UC)return bv;UC=1;var e=At();bv=t;function t(s,a){for(var i=0,c=1;c<a.length;++c)i+=n(s,a[c-1],a[c]);return i}function n(s,a,i){for(var c=e.zipObject(i,e.map(i,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:c[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*N})),m}return bv}var kv,WC;function nH(){if(WC)return kv;WC=1;var e=At();kv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var c=e.reduce(i,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return kv}var _v,HC;function rH(){if(HC)return _v;HC=1;var e=At();_v=t;function t(a,i){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var i=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),i.weight&&(c+=i.barycenter*i.weight,u+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(i.i,a.i),i.merged=!0}return _v}var Nv,GC;function sH(){if(GC)return Nv;GC=1;var e=At(),t=On();Nv=n;function n(i,c){var u=t.partition(i,function(_){return e.has(_,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(_){return-_.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=s(h,p,w),e.forEach(f,function(_){w+=_.vs.length,h.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(i,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),i.push(f.vs),u++;return u}function a(i){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:i?u.i-c.i:c.i-u.i}}return Nv}var Sv,VC;function aH(){if(VC)return Sv;VC=1;var e=At(),t=nH(),n=rH(),s=sH();Sv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(T){return T!==w&&T!==N}));var j=t(u,m);e.forEach(j,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var k=n(j,p);i(k,_);var S=s(k,h);if(w&&(S.vs=e.flatten([w,S.vs,N],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+E.order+C.order)/(S.weight+2),S.weight+=2}return S}function i(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return Sv}var jv,YC;function oH(){if(YC)return jv;YC=1;var e=At(),t=Rr().Graph;jv=n;function n(a,i,c){var u=s(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),_=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+_})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return jv}var Ev,KC;function iH(){if(KC)return Ev;KC=1;var e=At();Ev=t;function t(n,s,a){var i={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=c,c=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return Ev}var Cv,XC;function lH(){if(XC)return Cv;XC=1;var e=At(),t=eH(),n=tH(),s=aH(),a=oH(),i=iH(),c=Rr().Graph,u=On();Cv=f;function f(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),j=t(y);m(y,j);for(var k=Number.POSITIVE_INFINITY,S,E=0,C=0;C<4;++E,++C){h(E%2?N:_,E%4>=2),j=u.buildLayerMatrix(y);var T=n(y,j);T<k&&(C=0,S=e.cloneDeep(j),k=T)}m(y,S)}function p(y,w,N){return e.map(w,function(_){return a(y,_,N)})}function h(y,w){var N=new c;e.forEach(y,function(_){var j=_.graph().root,k=s(_,j,N,w);e.forEach(k.vs,function(S,E){_.node(S).order=E}),i(_,N,k.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,j){y.node(_).order=j})})}return Cv}var Tv,ZC;function cH(){if(ZC)return Tv;ZC=1;var e=At(),t=Rr().Graph,n=On();Tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function s(k,S){var E={};function C(T,R){var I=0,F=0,W=T.length,O=e.last(R);return e.forEach(R,function(B,Z){var Q=i(k,B),M=Q?k.node(Q).order:W;(Q||B===O)&&(e.forEach(R.slice(F,Z+1),function(K){e.forEach(k.predecessors(K),function(G){var P=k.node(G),H=P.order;(H<I||M<H)&&!(P.dummy&&k.node(K).dummy)&&c(E,G,K)})}),F=Z+1,I=M)}),R}return e.reduce(S,C),E}function a(k,S){var E={};function C(R,I,F,W,O){var B;e.forEach(e.range(I,F),function(Z){B=R[Z],k.node(B).dummy&&e.forEach(k.predecessors(B),function(Q){var M=k.node(Q);M.dummy&&(M.order<W||M.order>O)&&c(E,Q,B)})})}function T(R,I){var F=-1,W,O=0;return e.forEach(I,function(B,Z){if(k.node(B).dummy==="border"){var Q=k.predecessors(B);Q.length&&(W=k.node(Q[0]).order,C(I,O,Z,F,W),O=Z,F=W)}C(I,O,I.length,W,R.length)}),I}return e.reduce(S,T),E}function i(k,S){if(k.node(S).dummy)return e.find(k.predecessors(S),function(E){return k.node(E).dummy})}function c(k,S,E){if(S>E){var C=S;S=E,E=C}var T=k[S];T||(k[S]=T={}),T[E]=!0}function u(k,S,E){if(S>E){var C=S;S=E,E=C}return e.has(k[S],E)}function f(k,S,E,C){var T={},R={},I={};return e.forEach(S,function(F){e.forEach(F,function(W,O){T[W]=W,R[W]=W,I[W]=O})}),e.forEach(S,function(F){var W=-1;e.forEach(F,function(O){var B=C(O);if(B.length){B=e.sortBy(B,function(G){return I[G]});for(var Z=(B.length-1)/2,Q=Math.floor(Z),M=Math.ceil(Z);Q<=M;++Q){var K=B[Q];R[O]===O&&W<I[K]&&!u(E,O,K)&&(R[K]=O,R[O]=T[O]=T[K],W=I[K])}}})}),{root:T,align:R}}function p(k,S,E,C,T){var R={},I=h(k,S,E,T),F=T?"borderLeft":"borderRight";function W(Z,Q){for(var M=I.nodes(),K=M.pop(),G={};K;)G[K]?Z(K):(G[K]=!0,M.push(K),M=M.concat(Q(K))),K=M.pop()}function O(Z){R[Z]=I.inEdges(Z).reduce(function(Q,M){return Math.max(Q,R[M.v]+I.edge(M))},0)}function B(Z){var Q=I.outEdges(Z).reduce(function(K,G){return Math.min(K,R[G.w]-I.edge(G))},Number.POSITIVE_INFINITY),M=k.node(Z);Q!==Number.POSITIVE_INFINITY&&M.borderType!==F&&(R[Z]=Math.max(R[Z],Q))}return W(O,I.predecessors.bind(I)),W(B,I.successors.bind(I)),e.forEach(C,function(Z){R[Z]=R[E[Z]]}),R}function h(k,S,E,C){var T=new t,R=k.graph(),I=_(R.nodesep,R.edgesep,C);return e.forEach(S,function(F){var W;e.forEach(F,function(O){var B=E[O];if(T.setNode(B),W){var Z=E[W],Q=T.edge(Z,B);T.setEdge(Z,B,Math.max(I(k,O,W),Q||0))}W=O})}),T}function m(k,S){return e.minBy(e.values(S),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,I){var F=j(k,I)/2;C=Math.max(R+F,C),T=Math.min(R-F,T)}),C-T})}function y(k,S){var E=e.values(S),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(I){var F=R+I,W=k[F],O;if(W!==S){var B=e.values(W);O=I==="l"?C-e.min(B):T-e.max(B),O&&(k[F]=e.mapValues(W,function(Z){return Z+O}))}})})}function w(k,S){return e.mapValues(k.ul,function(E,C){if(S)return k[S.toLowerCase()][C];var T=e.sortBy(e.map(k,C));return(T[1]+T[2])/2})}function N(k){var S=n.buildLayerMatrix(k),E=e.merge(s(k,S),a(k,S)),C={},T;e.forEach(["u","d"],function(I){T=I==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(T=e.map(T,function(Z){return e.values(Z).reverse()}));var W=(I==="u"?k.predecessors:k.successors).bind(k),O=f(k,T,E,W),B=p(k,T,O.root,O.align,F==="r");F==="r"&&(B=e.mapValues(B,function(Z){return-Z})),C[I+F]=B})});var R=m(k,C);return y(C,R),w(C,k.graph().align)}function _(k,S,E){return function(C,T,R){var I=C.node(T),F=C.node(R),W=0,O;if(W+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":O=-I.width/2;break;case"r":O=I.width/2;break}if(O&&(W+=E?O:-O),O=0,W+=(I.dummy?S:k)/2,W+=(F.dummy?S:k)/2,W+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":O=F.width/2;break;case"r":O=-F.width/2;break}return O&&(W+=E?O:-O),O=0,W}}function j(k,S){return k.node(S).width}return Tv}var Av,QC;function uH(){if(QC)return Av;QC=1;var e=At(),t=On(),n=cH().positionX;Av=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(c,u){i.node(u).x=c})}function a(i){var c=t.buildLayerMatrix(i),u=i.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return i.node(m).height}));e.forEach(p,function(m){i.node(m).y=f+h/2}),f+=h+u})}return Av}var Rv,JC;function dH(){if(JC)return Rv;JC=1;var e=At(),t=GW(),n=VW(),s=KW(),a=On().normalizeRanks,i=XW(),c=On().removeEmptyRanks,u=ZW(),f=QW(),p=JW(),h=lH(),m=uH(),y=On(),w=Rr().Graph;Rv=N;function N(Y,J){var z=J&&J.debugTiming?y.time:y.notime;z("layout",function(){var re=z(" buildLayoutGraph",function(){return W(Y)});z(" runLayout",function(){_(re,z)}),z(" updateInputGraph",function(){j(Y,re)})})}function _(Y,J){J(" makeSpaceForEdgeLabels",function(){O(Y)}),J(" removeSelfEdges",function(){L(Y)}),J(" acyclic",function(){t.run(Y)}),J(" nestingGraph.run",function(){u.run(Y)}),J(" rank",function(){s(y.asNonCompoundGraph(Y))}),J(" injectEdgeLabelProxies",function(){B(Y)}),J(" removeEmptyRanks",function(){c(Y)}),J(" nestingGraph.cleanup",function(){u.cleanup(Y)}),J(" normalizeRanks",function(){a(Y)}),J(" assignRankMinMax",function(){Z(Y)}),J(" removeEdgeLabelProxies",function(){Q(Y)}),J(" normalize.run",function(){n.run(Y)}),J(" parentDummyChains",function(){i(Y)}),J(" addBorderSegments",function(){f(Y)}),J(" order",function(){h(Y)}),J(" insertSelfEdges",function(){U(Y)}),J(" adjustCoordinateSystem",function(){p.adjust(Y)}),J(" position",function(){m(Y)}),J(" positionSelfEdges",function(){$(Y)}),J(" removeBorderNodes",function(){H(Y)}),J(" normalize.undo",function(){n.undo(Y)}),J(" fixupEdgeLabelCoords",function(){G(Y)}),J(" undoCoordinateSystem",function(){p.undo(Y)}),J(" translateGraph",function(){M(Y)}),J(" assignNodeIntersects",function(){K(Y)}),J(" reversePoints",function(){P(Y)}),J(" acyclic.undo",function(){t.undo(Y)})}function j(Y,J){e.forEach(Y.nodes(),function(z){var re=Y.node(z),le=J.node(z);re&&(re.x=le.x,re.y=le.y,J.children(z).length&&(re.width=le.width,re.height=le.height))}),e.forEach(Y.edges(),function(z){var re=Y.edge(z),le=J.edge(z);re.points=le.points,e.has(le,"x")&&(re.x=le.x,re.y=le.y)}),Y.graph().width=J.graph().width,Y.graph().height=J.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function W(Y){var J=new w({multigraph:!0,compound:!0}),z=he(Y.graph());return J.setGraph(e.merge({},S,V(z,k),e.pick(z,E))),e.forEach(Y.nodes(),function(re){var le=he(Y.node(re));J.setNode(re,e.defaults(V(le,C),T)),J.setParent(re,Y.parent(re))}),e.forEach(Y.edges(),function(re){var le=he(Y.edge(re));J.setEdge(re,e.merge({},I,V(le,R),e.pick(le,F)))}),J}function O(Y){var J=Y.graph();J.ranksep/=2,e.forEach(Y.edges(),function(z){var re=Y.edge(z);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function B(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);if(z.width&&z.height){var re=Y.node(J.v),le=Y.node(J.w),me={rank:(le.rank-re.rank)/2+re.rank,e:J};y.addDummyNode(Y,"edge-proxy",me,"_ep")}})}function Z(Y){var J=0;e.forEach(Y.nodes(),function(z){var re=Y.node(z);re.borderTop&&(re.minRank=Y.node(re.borderTop).rank,re.maxRank=Y.node(re.borderBottom).rank,J=e.max(J,re.maxRank))}),Y.graph().maxRank=J}function Q(Y){e.forEach(Y.nodes(),function(J){var z=Y.node(J);z.dummy==="edge-proxy"&&(Y.edge(z.e).labelRank=z.rank,Y.removeNode(J))})}function M(Y){var J=Number.POSITIVE_INFINITY,z=0,re=Number.POSITIVE_INFINITY,le=0,me=Y.graph(),ge=me.marginx||0,Me=me.marginy||0;function qe(Ve){var Ue=Ve.x,Se=Ve.y,Qe=Ve.width,Ne=Ve.height;J=Math.min(J,Ue-Qe/2),z=Math.max(z,Ue+Qe/2),re=Math.min(re,Se-Ne/2),le=Math.max(le,Se+Ne/2)}e.forEach(Y.nodes(),function(Ve){qe(Y.node(Ve))}),e.forEach(Y.edges(),function(Ve){var Ue=Y.edge(Ve);e.has(Ue,"x")&&qe(Ue)}),J-=ge,re-=Me,e.forEach(Y.nodes(),function(Ve){var Ue=Y.node(Ve);Ue.x-=J,Ue.y-=re}),e.forEach(Y.edges(),function(Ve){var Ue=Y.edge(Ve);e.forEach(Ue.points,function(Se){Se.x-=J,Se.y-=re}),e.has(Ue,"x")&&(Ue.x-=J),e.has(Ue,"y")&&(Ue.y-=re)}),me.width=z-J+ge,me.height=le-re+Me}function K(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J),re=Y.node(J.v),le=Y.node(J.w),me,ge;z.points?(me=z.points[0],ge=z.points[z.points.length-1]):(z.points=[],me=le,ge=re),z.points.unshift(y.intersectRect(re,me)),z.points.push(y.intersectRect(le,ge))})}function G(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);if(e.has(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function P(Y){e.forEach(Y.edges(),function(J){var z=Y.edge(J);z.reversed&&z.points.reverse()})}function H(Y){e.forEach(Y.nodes(),function(J){if(Y.children(J).length){var z=Y.node(J),re=Y.node(z.borderTop),le=Y.node(z.borderBottom),me=Y.node(e.last(z.borderLeft)),ge=Y.node(e.last(z.borderRight));z.width=Math.abs(ge.x-me.x),z.height=Math.abs(le.y-re.y),z.x=me.x+z.width/2,z.y=re.y+z.height/2}}),e.forEach(Y.nodes(),function(J){Y.node(J).dummy==="border"&&Y.removeNode(J)})}function L(Y){e.forEach(Y.edges(),function(J){if(J.v===J.w){var z=Y.node(J.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:J,label:Y.edge(J)}),Y.removeEdge(J)}})}function U(Y){var J=y.buildLayerMatrix(Y);e.forEach(J,function(z){var re=0;e.forEach(z,function(le,me){var ge=Y.node(le);ge.order=me+re,e.forEach(ge.selfEdges,function(Me){y.addDummyNode(Y,"selfedge",{width:Me.label.width,height:Me.label.height,rank:ge.rank,order:me+ ++re,e:Me.e,label:Me.label},"_se")}),delete ge.selfEdges})})}function $(Y){e.forEach(Y.nodes(),function(J){var z=Y.node(J);if(z.dummy==="selfedge"){var re=Y.node(z.e.v),le=re.x+re.width/2,me=re.y,ge=z.x-le,Me=re.height/2;Y.setEdge(z.e,z.label),Y.removeNode(J),z.label.points=[{x:le+2*ge/3,y:me-Me},{x:le+5*ge/6,y:me-Me},{x:le+ge,y:me},{x:le+5*ge/6,y:me+Me},{x:le+2*ge/3,y:me+Me}],z.label.x=z.x,z.label.y=z.y}})}function V(Y,J){return e.mapValues(e.pick(Y,J),Number)}function he(Y){var J={};return e.forEach(Y,function(z,re){J[re.toLowerCase()]=z}),J}return Rv}var Mv,eT;function hH(){if(eT)return Mv;eT=1;var e=At(),t=On(),n=Rr().Graph;Mv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return Mv}var Iv,tT;function fH(){return tT||(tT=1,Iv="0.8.5"),Iv}var $v,nT;function pH(){return nT||(nT=1,$v={graphlib:Rr(),layout:dH(),debug:hH(),util:{time:On().time,notime:On().notime},version:fH()}),$v}var mH=pH();const rT=xx(mH),po=240,vc=130,Ii=74,Nh=72,ac=Ii+Nh;function YR(e,t){var s;let n=po;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??po);return n}const Ud=420,KR=1;function gH(e,t,n,s){return Math.min(KR,n/Math.max(1,e),s/Math.max(1,t))}function mo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function yH(e,t){return((t==null?void 0:t.get(e))??0)>0?Ud:0}function wH(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function xc(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??po)+yH(e,n),h:Math.max((s==null?void 0:s.height)??vc,wH(e,n))}}function vH(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function xH(e,t,n,s,a,i){const c=new rT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!a.has(k)),f=new Set(u);for(const k of u){const{w:S,h:E}=xc(k,s,i);c.setNode(k,{width:S,height:E})}for(const k of t)f.has(k.source)&&f.has(k.target)&&c.setEdge(k.source,k.target);rT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const k of u){const S=c.node(k);if(!S)continue;const E=s.get(k),C=(E==null?void 0:E.width)??po,T=(E==null?void 0:E.height)??vc,R=xc(k,s,i),I=S.x-R.w/2,F=S.y-R.h/2;p.set(k,{x:I,y:F}),I<h&&(h=I),F<m&&(m=F),I+C>y&&(y=I+C),F+T>w&&(w=F+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[k,S]of p)p.set(k,{x:S.x-h,y:S.y-m});const N=Number.isFinite(y)?y-h:0,_=Number.isFinite(w)?w-m:0;let j=null;for(const k of e){const S=a.get(k);if(!S)continue;const E=s.get(k),C=(E==null?void 0:E.width)??po,T=(E==null?void 0:E.height)??vc;j=j===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+T}:{minX:Math.min(j.minX,S.x),minY:Math.min(j.minY,S.y),maxX:Math.max(j.maxX,S.x+C),maxY:Math.max(j.maxY,S.y+T)}}return{positions:p,width:N,height:_,pinnedBox:j}}function XR(e,t,n){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=mo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...xH(u.get(h),t,s,i,a,c)})),gap:YR(e,i)}}const ZR=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+Ud,bH=e=>e.reduce((t,n)=>t+n.height,0)+ac*Math.max(0,e.length-1);function yx(e,t,n,s){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+ac;return p},i=[];for(let f=0;f<e.length;f++){let p=-ac;for(let h=f;h<e.length;h++)i.push(p+=e[h].height+ac)}i.sort((f,p)=>f-p);const c=f=>{let p=0,h=i.length-1;for(;p<h;){const m=p+h>>1;a(i[m]).length<=f?h=m:p=m+1}return a(i[p])};let u=[e];if(n>0&&s>0){const f=h=>gH(h.reduce((m,y)=>m+ZR(y),0)+t*(h.length-1),Math.max(...h.map(bH)),n,s);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function kH(e,t,n,s,a){if(!(s.width>0&&s.height>0&&a.width>0&&a.height>0))return!1;const{laid:i,gap:c}=XR(e,t,n);return i.length<2?!1:yx(i,c,s.width,s.height).length!==yx(i,c,a.width,a.height).length}function _H(e,t,n={}){const s=n.pinned??new Map,{laid:a,gap:i}=XR(e,t,n),c=yx(a,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=ZR(p);let m=0;for(const{positions:y,height:w,pinnedBox:N}of p){for(const[j,k]of y)u.set(j,{x:k.x+f,y:k.y+m});let _=m+w;N&&N.maxY>_&&N.minX<f+h&&f<N.maxX&&(_=N.maxY),m=_+ac}f+=h+i}return e.map(p=>{const h=s.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function NH(e,t,n,s,a){const c=Ii+Nh,u=60,f=w=>xc(w,s,a),p=new Map(e.map(w=>[w.id,mo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:j}=f(w),k=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:_,h:j,sid:k});continue}let S=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===k?24:u,I=T.sid===k?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&S<T.y+T.h+I&&T.y<S+j+I});if(!C)break;S=C.y+C.h+(C.sid===k?24:c)}S!==N.y&&(t.set(w,{x:N.x,y:S}),y.push(w)),h.push({x:N.x,y:S,w:_,h:j,sid:k})}return y}function SH(e,t,n,s,a,i,c){const u=E=>xc(E,s,i),f=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??po,ch:(C==null?void 0:C.height)??vc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=mo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,N=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),I=mo(E);y.has(I)?(w.get(I)??w.set(I,[]).get(I)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&N.length===0)return[];const _=Ii+Nh,j=(E,C,T,R)=>N.some(I=>E<I.x+I.w+Ii&&I.x<E+T+Ii&&C<I.y+I.h+_&&I.y<C+R+_),k=YR(e,s),S=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,I=-1/0,F=-1/0,W=-1/0,O=-1/0;for(const P of C){const H=f(P.id),{w:L,h:U}=u(P.id),{cw:$,ch:V}=p(P.id);T=Math.min(T,H.x),R=Math.min(R,H.y),I=Math.max(I,H.x+L),F=Math.max(F,H.y+U),W=Math.max(W,H.x+$),O=Math.max(O,H.y+V)}const B=I-T,Z=F-R,Q=[...new Set(N.map(P=>Math.round(P.x)))].sort((P,H)=>P-H),M=Q.length?Q:[T],K=[0,...N.map(P=>P.y+P.h+_)].sort((P,H)=>P-H);let G=null;if(h){let P=1/0,H=1/0,L=-1/0,U=-1/0;for(const z of N)P=Math.min(P,z.x),H=Math.min(H,z.y),L=Math.max(L,z.x+z.cw),U=Math.max(U,z.y+z.ch);const $=(z,re)=>{const le=c.width/(Math.max(L,z+W-T)-Math.min(P,z)+Ud),me=c.height/(Math.max(U,re+O-R)-Math.min(H,re));return[Math.min(KR,le,me),Math.min(le,me),Math.max(le,me)]},V=(z,re)=>{for(let le=0;le<z.length;le++){if(z[le]>re[le]+1e-9)return!0;if(z[le]<re[le]-1e-9)return!1}return!1},he=Math.round(L+Ud+k),Y=[...new Set([...K,H])].sort((z,re)=>z-re);let J=null;for(const z of[...M,he])for(const re of Y){if(j(z,re,B,Z))continue;const le=$(z,re);(J===null||V(le,J))&&(J=le,G={x:z,y:re})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const P of M)for(const H of K){if(H>=R)break;if(!j(P,H,B,Z)){G={x:P,y:H};break e}}if(G){const P=G.x-T,H=G.y-R;for(const L of C){const U=f(L.id);t.set(L.id,{x:U.x+P,y:U.y+H})}S.push(E)}for(const P of C){const H=f(P.id),{w:L,h:U}=u(P.id);N.push({x:H.x,y:H.y,w:L,h:U,...p(P.id)})}}return S}function jH(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const i=mo(a);(s.get(i)??s.set(i,[]).get(i)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((i,c)=>i.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const i=s.get(mo(a));if(!i)return a;const c=(p=a.data)==null?void 0:p.parentId,u=i.find(h=>h.id===c)??i[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function EH(e,t,n,s,a,i=!1,c){const p=Ii+Nh+1,h=8,m=1.75,y=200,w=.7,N=.01,_=O=>xc(O,s,c),j=O=>n.get(O)??t.get(O),k=new Map;for(const O of e){if(!j(O.id))continue;const B=mo(O),Z=k.get(B);Z?Z.push(O):k.set(B,[O])}const S=[],E=new Set,C=new Set,T=a.size===0;for(const O of[...k.keys()].sort()){const B=k.get(O);let Z=1/0,Q=1/0,M=-1/0,K=-1/0,G=!1;for(const U of B){const $=j(U.id),{w:V,h:he}=_(U.id);Z=Math.min(Z,$.x),Q=Math.min(Q,$.y),M=Math.max(M,$.x+V),K=Math.max(K,$.y+he),n.has(U.id)&&(G=!0)}const P=M-Z,H=K-Q;C.add(O);const L=a.get(O);L&&(P>L.w+h||H>L.h+h)&&E.add(O),a.set(O,{w:P,h:H}),S.push({sid:O,members:B.map(U=>U.id),x:Z,y:Q,w:P,h:H,anchored:G,mass:1})}for(const O of[...a.keys()])C.has(O)||a.delete(O);if(i||T)return[];let R=!1;for(let O=0;O<S.length&&!R;O++)for(let B=O+1;B<S.length;B++){const Z=S[O],Q=S[B];if(!(Z.anchored&&Q.anchored)&&Math.abs(Z.x+Z.w/2-(Q.x+Q.w/2))<(Z.w+Q.w)/2+61&&Math.abs(Z.y+Z.h/2-(Q.y+Q.h/2))<(Z.h+Q.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const O of S)E.has(O.sid)&&(O.mass=8);else for(const O of S)O.mass=Math.max(1,O.w*O.h/(po*vc));const I=new Map(S.map(O=>[O.sid,O.x])),F=new Map(S.map(O=>[O.sid,O.y]));for(let O=0;O<y;O++){const B=new Map,Z=new Map;let Q=0;for(let M=0;M<S.length;M++)for(let K=M+1;K<S.length;K++){const G=S[M],P=S[K];if(G.anchored&&P.anchored)continue;const H=G.x+G.w/2,L=G.y+G.h/2,U=P.x+P.w/2,$=P.y+P.h/2,V=(G.w+P.w)/2+61-Math.abs(H-U),he=(G.h+P.h)/2+p-Math.abs(L-$);if(V<=0||he<=0)continue;const Y=(We,He)=>!We.anchored&&!(He<0&&We.x<=0),J=(We,He)=>!We.anchored&&!(He<0&&We.y<=0),z=(We,He,ot)=>{const wt=We===He,ut=wt?G.sid<P.sid?-1:1:Math.sign(We-He);return ot(G,ut)||ot(P,-ut)?ut:wt&&(ot(G,-ut)||ot(P,ut))?-ut:0},re=z(H,U,Y),le=z(L,$,J),me=re!==0,ge=le!==0;if(!me&&!ge)continue;const Me=me&&(!ge||V*m<he),[qe,Ve,Ue,Se]=Me?[re,V,B,Y]:[le,he,Z,J],Qe=Se(G,qe),Ne=Se(P,-qe),_e=G.mass,ue=P.mass,je=Qe?Ne?ue/(_e+ue):1:0,Ce=Ne?Qe?_e/(_e+ue):1:0,Fe=Ve*w;Ue.set(G.sid,(Ue.get(G.sid)??0)+qe*Fe*je),Ue.set(P.sid,(Ue.get(P.sid)??0)-qe*Fe*Ce),Q+=Fe}for(const M of S)M.anchored||(M.x=Math.max(0,M.x+(B.get(M.sid)??0)),M.y=Math.max(0,M.y+(Z.get(M.sid)??0)));if(Q<N)break}const W=[];for(const O of S){const B=O.x-I.get(O.sid),Z=O.y-F.get(O.sid);if(!(Math.abs(B)<1&&Math.abs(Z)<1)){for(const Q of O.members){if(n.has(Q))continue;const M=t.get(Q);M&&t.set(Q,{x:M.x+B,y:M.y+Z})}W.push(O.sid)}}return W}const CH=600;function wx(e,t){return!(e.exitAt!=null&&t-e.exitAt>CH||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function TH(e,t){const n=new Set;for(const s of e.agents.values())wx(s,t)&&n.add(s.id);return n}function AH(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function RH(e,t,n=0){if(!e)return!1;for(const s of t)if(AH(e,s,n))return!0;return!1}const QR="sessionGroup";function MH(e,t){var s,a;if(e.type===QR)return"transparent";if(go((s=e.data)==null?void 0:s.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const JR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function sT(e){const t={};for(const n of JR)t[n]=e(n);return t}function IH(e){return t=>e[t]??""}function $H(e,t){return JR.every(n=>e[n]===t[n])}function OH(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const eM=.2,tM=1.6;function PH(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:s,zoom:a}=t;return typeof n!="number"||typeof s!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(a)||a<eM||a>tM?null:{x:n,y:s,zoom:a}}const LH=1200,DH=1e3;function aT(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<LH?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<DH}function _d({durationMs:e,documentHidden:t,reducedMotion:n=qH()}){return t||n?!1:Number.isFinite(e)&&e>0}function qH(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ov(e){const t=typeof document<"u"&&document.hidden;return _d({durationMs:e,documentHidden:t})?e:0}function FH(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&c>0&&a<n.height}function BH({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const a of n)if(s=!0,FH(a,t,e))return!1;return s}const zH="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Pv="click for what's new";function UH(e){if(e.checkDisabled)return`${zH} · ${Pv}`;if(e.checking)return`Asking npm for the newest release… · ${Pv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${Pv}, and to check npm now`}function WH(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function HH(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function GH(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const vx={kind:"assumed",claude:!0,codex:!0};function VH(e){if(!e||typeof e!="object")return vx;const t=e.providers;if(!t||typeof t!="object")return vx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function YH(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const oT={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function KH(e){const t=e.toLowerCase();return Object.hasOwn(oT,t)?oT[t]:t?t[0].toUpperCase()+t.slice(1):""}function XH(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function X7(e,t=[]){const n=t.length?XH(t.map(KH)):YH(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function ZH(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},n=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,n]}function QH(e,t){const n=t.prefs??gx,s=wc(n.done.level),a=wc(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
283
|
+
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},s0="agent-dag.releaseNotesSeen";function M_(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Ui(e,t){const n=M_(e),s=M_(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function Wi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function hB(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function fB(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Wi(n)||!Array.isArray(s))continue;const a=s.filter(hB);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Ui(s.version,n.version))}const I_=fB(dB);function WA(e,t,n){return e.filter(s=>Ui(s.version,n)<=0&&(t===null||Ui(s.version,t)>0))}function pB(e,t){return e.filter(n=>Ui(n.version,t)===0)}function mB(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function gB({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Wi(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!Wi(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Ui(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const yB=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function wB(e){const t=yB.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function $_(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function vB(e){if(!e)return null;let t=null;try{t=e.getItem(s0)}catch{return null}return Wi(t)?t:null}function xB(e){if(!e)return!1;try{return e.getItem(s0),!0}catch{return!1}}function bB(e,t){if(!e)return!1;try{return e.setItem(s0,t),!0}catch{return!1}}const HA="agent-dag.tourSeen";function kB(e){if(!e)return!1;try{return e.getItem(HA)==="1"}catch{return!1}}function _B(e){if(!e)return!1;try{return e.setItem(HA,"1"),!0}catch{return!1}}function NB({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function SB({stored:e,running:t,notes:n,remembers:s=!0}){if(!Wi(t))return{show:[],record:null,reason:"no-version"};if(!Wi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=pB(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Ui(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=WA(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function jB(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function GA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const c=e.indexOf("`",i+1);if(c>i+1){a(),n.push({kind:"code",text:e.slice(i+1,c)}),i=c+1;continue}}else if(t&&e.startsWith("**",i)){const c=jB(e,i);if(c>0){a(),n.push({kind:"bold",kids:GA(e.slice(i+2,c),!1)}),i=c+2;continue}}s+=e[i],i+=1}return a(),n}function EB({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:i}){const c=dn(a),u=mB(e);return l.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:l.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),u&&l.jsx("span",{className:"modal-tool-id",children:u})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsx("p",{className:"modal-note",children:gB({since:t,running:n,firstRun:s,entries:e})}),i&&l.jsxs("div",{className:"guide-door",children:[l.jsx("span",{children:"Eight pictures of what the deck shows."}),l.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),e.map(f=>l.jsxs("section",{className:"modal-section",children:[l.jsxs("h3",{className:"rn-version",children:["v",f.version]}),l.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:m,rest:y}=wB(p.title);return l.jsxs("li",{className:"rn-note",children:[l.jsxs("p",{className:"rn-note-title",children:[m&&l.jsx("span",{className:"rn-note-icon",children:m}),y]}),l.jsx("p",{className:"rn-note-body",children:VA(GA(p.body))})]},h)})})]},f.version))]})]})})}function VA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?l.jsx("code",{className:"rn-code",children:t.text},n):l.jsx("strong",{className:"rn-strong",children:VA(t.kids)},n))}function CB(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function TB(e,t,n){var c;if(e.length===0)return null;const s=CB(e),a=t?s.findIndex(u=>u.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[i])==null?void 0:c.id)??null}const AB=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function RB(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:AB.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const MB=new Set(["","BODY","HTML","#DOCUMENT"]);function IB(e){return!e||Wx(e)?!1:!MB.has(String(e.tagName??"").toUpperCase())}function od(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function $B(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const s=new Set;for(const a of e)t.has(a)&&s.add(a);return s}function OB(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(Hx(n.id));return t}function PB(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(Hx(n.id));return t}function LB(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||s.has(c.parentId))break;s.add(c.parentId),a=c.parentId}let i=!0;for(;i;){i=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),i=!0)}return s}function DB(e,t){const n=new Set;for(const s of t){const a=LB(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function bd(e,t,n){return!t.has(e)||n.has(e)}function qB(e,t,n,s){return!t.has(e)&&bd(e,n,s)}function FB(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function O_(e,t,n,s){n.set(e,t),s.delete(e)}const BB=40,zB=120;function UB(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(s<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,m)};return{live(f=BB){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),i();return}u(h,p,f)},replay(f=zB){c(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){c(),i()},cancel(){c()}}}const WB=1e3;function HB(e={}){const t=Math.max(1,Math.floor(e.limit??WB)),n=e.protect;let s=!1,a=[],i=new Set,c=0,u=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[_]=a.splice(N,1);i.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,c=0,h}}}const YA="agent-dag.theme";function GB(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function VB(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function YB(){return GB(vo(YA),VB())}const KB=6,XB="ccdeck-tabs";function ZB(e){return e>=KB}function QB(e,t,n){const s=a=>{const i=a.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",s),{ask(a,i=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),i(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",s),(a=e.close)==null||a.call(e)}}}function JB({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Zt}`:Zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const id={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function ld(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const ez=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(ld(id.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(ld(id.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(ld(id.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(ld(id.idle,"idle"))}`}),tz="No sessions are waiting for you.";function nz(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function rz(e,t){return t!==""?t:e===""?"":tz}const P_="agent-dag.browserWatch.seenMs";function sz(e,t){return e.filter(n=>n.startMs>t)}function az(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function oz({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:c}){const u=x.useRef(null),f=dn(c,{focusRef:u}),p=ua(n,"accept"),h=ua(n,"dismiss");return l.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:l.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[l.jsxs("header",{className:"modal-head",children:[l.jsxs("div",{className:"modal-title",children:[l.jsx("i",{className:"ap-pulse","aria-hidden":!0}),l.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),l.jsx("div",{className:"modal-actions",children:l.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),l.jsxs("section",{className:"modal-body",children:[l.jsxs("p",{className:"lan-ask-who",children:[l.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",l.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",n0(e.at,s)]}),l.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),l.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",l.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&l.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),l.jsxs("div",{className:"lan-ask-acts",children:[l.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),l.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function a0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wp,L_;function iz(){if(L_)return wp;L_=1;function e(){this.__data__=[],this.size=0}return wp=e,wp}var vp,D_;function Gi(){if(D_)return vp;D_=1;function e(t,n){return t===n||t!==t&&n!==n}return vp=e,vp}var xp,q_;function ih(){if(q_)return xp;q_=1;var e=Gi();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return xp=t,xp}var bp,F_;function lz(){if(F_)return bp;F_=1;var e=ih(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,c=e(i,a);if(c<0)return!1;var u=i.length-1;return c==u?i.pop():n.call(i,c,1),--this.size,!0}return bp=s,bp}var kp,B_;function cz(){if(B_)return kp;B_=1;var e=ih();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return kp=t,kp}var _p,z_;function uz(){if(z_)return _p;z_=1;var e=ih();function t(n){return e(this.__data__,n)>-1}return _p=t,_p}var Np,U_;function dz(){if(U_)return Np;U_=1;var e=ih();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Np=t,Np}var Sp,W_;function lh(){if(W_)return Sp;W_=1;var e=iz(),t=lz(),n=cz(),s=uz(),a=dz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Sp=i,Sp}var jp,H_;function hz(){if(H_)return jp;H_=1;var e=lh();function t(){this.__data__=new e,this.size=0}return jp=t,jp}var Ep,G_;function fz(){if(G_)return Ep;G_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Ep=e,Ep}var Cp,V_;function pz(){if(V_)return Cp;V_=1;function e(t){return this.__data__.get(t)}return Cp=e,Cp}var Tp,Y_;function mz(){if(Y_)return Tp;Y_=1;function e(t){return this.__data__.has(t)}return Tp=e,Tp}var Ap,K_;function KA(){if(K_)return Ap;K_=1;var e=typeof zu=="object"&&zu&&zu.Object===Object&&zu;return Ap=e,Ap}var Rp,X_;function Or(){if(X_)return Rp;X_=1;var e=KA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Rp=n,Rp}var Mp,Z_;function Vi(){if(Z_)return Mp;Z_=1;var e=Or(),t=e.Symbol;return Mp=t,Mp}var Ip,Q_;function gz(){if(Q_)return Ip;Q_=1;var e=Vi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=s.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Ip=i,Ip}var $p,J_;function yz(){if(J_)return $p;J_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return $p=n,$p}var Op,eN;function xo(){if(eN)return Op;eN=1;var e=Vi(),t=gz(),n=yz(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:s:i&&i in Object(u)?t(u):n(u)}return Op=c,Op}var Pp,tN;function cr(){if(tN)return Pp;tN=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pp=e,Pp}var Lp,nN;function Ac(){if(nN)return Lp;nN=1;var e=xo(),t=cr(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==s||f==a||f==n||f==i}return Lp=c,Lp}var Dp,rN;function wz(){if(rN)return Dp;rN=1;var e=Or(),t=e["__core-js_shared__"];return Dp=t,Dp}var qp,sN;function vz(){if(sN)return qp;sN=1;var e=wz(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return qp=n,qp}var Fp,aN;function XA(){if(aN)return Fp;aN=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Fp=n,Fp}var Bp,oN;function xz(){if(oN)return Bp;oN=1;var e=Ac(),t=vz(),n=cr(),s=XA(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Bp=m,Bp}var zp,iN;function bz(){if(iN)return zp;iN=1;function e(t,n){return t==null?void 0:t[n]}return zp=e,zp}var Up,lN;function bo(){if(lN)return Up;lN=1;var e=xz(),t=bz();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Up=n,Up}var Wp,cN;function o0(){if(cN)return Wp;cN=1;var e=bo(),t=Or(),n=e(t,"Map");return Wp=n,Wp}var Hp,uN;function ch(){if(uN)return Hp;uN=1;var e=bo(),t=e(Object,"create");return Hp=t,Hp}var Gp,dN;function kz(){if(dN)return Gp;dN=1;var e=ch();function t(){this.__data__=e?e(null):{},this.size=0}return Gp=t,Gp}var Vp,hN;function _z(){if(hN)return Vp;hN=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Vp=e,Vp}var Yp,fN;function Nz(){if(fN)return Yp;fN=1;var e=ch(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var c=this.__data__;if(e){var u=c[i];return u===t?void 0:u}return s.call(c,i)?c[i]:void 0}return Yp=a,Yp}var Kp,pN;function Sz(){if(pN)return Kp;pN=1;var e=ch(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Kp=s,Kp}var Xp,mN;function jz(){if(mN)return Xp;mN=1;var e=ch(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return Xp=n,Xp}var Zp,gN;function Ez(){if(gN)return Zp;gN=1;var e=kz(),t=_z(),n=Nz(),s=Sz(),a=jz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Zp=i,Zp}var Qp,yN;function Cz(){if(yN)return Qp;yN=1;var e=Ez(),t=lh(),n=o0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Qp=s,Qp}var Jp,wN;function Tz(){if(wN)return Jp;wN=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Jp=e,Jp}var em,vN;function uh(){if(vN)return em;vN=1;var e=Tz();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return em=t,em}var tm,xN;function Az(){if(xN)return tm;xN=1;var e=uh();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return tm=t,tm}var nm,bN;function Rz(){if(bN)return nm;bN=1;var e=uh();function t(n){return e(this,n).get(n)}return nm=t,nm}var rm,kN;function Mz(){if(kN)return rm;kN=1;var e=uh();function t(n){return e(this,n).has(n)}return rm=t,rm}var sm,_N;function Iz(){if(_N)return sm;_N=1;var e=uh();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return sm=t,sm}var am,NN;function i0(){if(NN)return am;NN=1;var e=Cz(),t=Az(),n=Rz(),s=Mz(),a=Iz();function i(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,am=i,am}var om,SN;function $z(){if(SN)return om;SN=1;var e=lh(),t=o0(),n=i0(),s=200;function a(i,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([i,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(i,c),this.size=u.size,this}return om=a,om}var im,jN;function dh(){if(jN)return im;jN=1;var e=lh(),t=hz(),n=fz(),s=pz(),a=mz(),i=$z();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=i,im=c,im}var lm,EN;function l0(){if(EN)return lm;EN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a&&n(t[s],s,t)!==!1;);return t}return lm=e,lm}var cm,CN;function ZA(){if(CN)return cm;CN=1;var e=bo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return cm=t,cm}var um,TN;function hh(){if(TN)return um;TN=1;var e=ZA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return um=t,um}var dm,AN;function fh(){if(AN)return dm;AN=1;var e=hh(),t=Gi(),n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u){var f=i[c];(!(s.call(i,c)&&t(f,u))||u===void 0&&!(c in i))&&e(i,c,u)}return dm=a,dm}var hm,RN;function Rc(){if(RN)return hm;RN=1;var e=fh(),t=hh();function n(s,a,i,c){var u=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(i[h],s[h],h,i,s):void 0;m===void 0&&(m=s[h]),u?t(i,h,m):e(i,h,m)}return i}return hm=n,hm}var fm,MN;function Oz(){if(MN)return fm;MN=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return fm=e,fm}var pm,IN;function Zr(){if(IN)return pm;IN=1;function e(t){return t!=null&&typeof t=="object"}return pm=e,pm}var mm,$N;function Pz(){if($N)return mm;$N=1;var e=xo(),t=Zr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return mm=s,mm}var gm,ON;function Mc(){if(ON)return gm;ON=1;var e=Pz(),t=Zr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return gm=i,gm}var ym,PN;function Gt(){if(PN)return ym;PN=1;var e=Array.isArray;return ym=e,ym}var tc={exports:{}},wm,LN;function Lz(){if(LN)return wm;LN=1;function e(){return!1}return wm=e,wm}tc.exports;var DN;function Yi(){return DN||(DN=1,(function(e,t){var n=Or(),s=Lz(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,c=i&&i.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||s;e.exports=p})(tc,tc.exports)),tc.exports}var vm,qN;function ph(){if(qN)return vm;qN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return vm=n,vm}var xm,FN;function c0(){if(FN)return xm;FN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return xm=t,xm}var bm,BN;function Dz(){if(BN)return bm;BN=1;var e=xo(),t=c0(),n=Zr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",I="[object Uint8Array]",L="[object Uint8ClampedArray]",H="[object Uint16Array]",$="[object Uint32Array]",V={};V[j]=V[E]=V[C]=V[T]=V[R]=V[I]=V[L]=V[H]=V[$]=!0,V[s]=V[a]=V[S]=V[i]=V[b]=V[c]=V[u]=V[f]=V[p]=V[h]=V[m]=V[y]=V[w]=V[N]=V[_]=!1;function Q(J){return n(J)&&t(J.length)&&!!V[e(J)]}return bm=Q,bm}var km,zN;function mh(){if(zN)return km;zN=1;function e(t){return function(n){return t(n)}}return km=e,km}var nc={exports:{}};nc.exports;var UN;function u0(){return UN||(UN=1,(function(e,t){var n=KA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(nc,nc.exports)),nc.exports}var _m,WN;function Ic(){if(WN)return _m;WN=1;var e=Dz(),t=mh(),n=u0(),s=n&&n.isTypedArray,a=s?t(s):e;return _m=a,_m}var Nm,HN;function QA(){if(HN)return Nm;HN=1;var e=Oz(),t=Mc(),n=Gt(),s=Yi(),a=ph(),i=Ic(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&s(p),N=!m&&!y&&!w&&i(p),_=m||y||w||N,S=_?e(p.length,String):[],b=S.length;for(var j in p)(h||u.call(p,j))&&!(_&&(j=="length"||w&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,b)))&&S.push(j);return S}return Nm=f,Nm}var Sm,GN;function gh(){if(GN)return Sm;GN=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Sm=t,Sm}var jm,VN;function JA(){if(VN)return jm;VN=1;function e(t,n){return function(s){return t(n(s))}}return jm=e,jm}var Em,YN;function qz(){if(YN)return Em;YN=1;var e=JA(),t=e(Object.keys,Object);return Em=t,Em}var Cm,KN;function d0(){if(KN)return Cm;KN=1;var e=gh(),t=qz(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var c=[];for(var u in Object(i))s.call(i,u)&&u!="constructor"&&c.push(u);return c}return Cm=a,Cm}var Tm,XN;function ks(){if(XN)return Tm;XN=1;var e=Ac(),t=c0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Tm=n,Tm}var Am,ZN;function da(){if(ZN)return Am;ZN=1;var e=QA(),t=d0(),n=ks();function s(a){return n(a)?e(a):t(a)}return Am=s,Am}var Rm,QN;function Fz(){if(QN)return Rm;QN=1;var e=Rc(),t=da();function n(s,a){return s&&e(a,t(a),s)}return Rm=n,Rm}var Mm,JN;function Bz(){if(JN)return Mm;JN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Mm=e,Mm}var Im,eS;function zz(){if(eS)return Im;eS=1;var e=cr(),t=gh(),n=Bz(),s=Object.prototype,a=s.hasOwnProperty;function i(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Im=i,Im}var $m,tS;function ko(){if(tS)return $m;tS=1;var e=QA(),t=zz(),n=ks();function s(a){return n(a)?e(a,!0):t(a)}return $m=s,$m}var Om,nS;function Uz(){if(nS)return Om;nS=1;var e=Rc(),t=ko();function n(s,a){return s&&e(a,t(a),s)}return Om=n,Om}var rc={exports:{}};rc.exports;var rS;function eR(){return rS||(rS=1,(function(e,t){var n=Or(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,c=i?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(rc,rc.exports)),rc.exports}var Pm,sS;function tR(){if(sS)return Pm;sS=1;function e(t,n){var s=-1,a=t.length;for(n||(n=Array(a));++s<a;)n[s]=t[s];return n}return Pm=e,Pm}var Lm,aS;function nR(){if(aS)return Lm;aS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,c=[];++s<a;){var u=t[s];n(u,s,t)&&(c[i++]=u)}return c}return Lm=e,Lm}var Dm,oS;function rR(){if(oS)return Dm;oS=1;function e(){return[]}return Dm=e,Dm}var qm,iS;function h0(){if(iS)return qm;iS=1;var e=nR(),t=rR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return s.call(c,u)}))}:t;return qm=i,qm}var Fm,lS;function Wz(){if(lS)return Fm;lS=1;var e=Rc(),t=h0();function n(s,a){return e(s,t(s),a)}return Fm=n,Fm}var Bm,cS;function f0(){if(cS)return Bm;cS=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Bm=e,Bm}var zm,uS;function yh(){if(uS)return zm;uS=1;var e=JA(),t=e(Object.getPrototypeOf,Object);return zm=t,zm}var Um,dS;function sR(){if(dS)return Um;dS=1;var e=f0(),t=yh(),n=h0(),s=rR(),a=Object.getOwnPropertySymbols,i=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:s;return Um=i,Um}var Wm,hS;function Hz(){if(hS)return Wm;hS=1;var e=Rc(),t=sR();function n(s,a){return e(s,t(s),a)}return Wm=n,Wm}var Hm,fS;function aR(){if(fS)return Hm;fS=1;var e=f0(),t=Gt();function n(s,a,i){var c=a(s);return t(s)?c:e(c,i(s))}return Hm=n,Hm}var Gm,pS;function oR(){if(pS)return Gm;pS=1;var e=aR(),t=h0(),n=da();function s(a){return e(a,n,t)}return Gm=s,Gm}var Vm,mS;function Gz(){if(mS)return Vm;mS=1;var e=aR(),t=sR(),n=ko();function s(a){return e(a,n,t)}return Vm=s,Vm}var Ym,gS;function Vz(){if(gS)return Ym;gS=1;var e=bo(),t=Or(),n=e(t,"DataView");return Ym=n,Ym}var Km,yS;function Yz(){if(yS)return Km;yS=1;var e=bo(),t=Or(),n=e(t,"Promise");return Km=n,Km}var Xm,wS;function iR(){if(wS)return Xm;wS=1;var e=bo(),t=Or(),n=e(t,"Set");return Xm=n,Xm}var Zm,vS;function Kz(){if(vS)return Zm;vS=1;var e=bo(),t=Or(),n=e(t,"WeakMap");return Zm=n,Zm}var Qm,xS;function Ki(){if(xS)return Qm;xS=1;var e=Vz(),t=o0(),n=Yz(),s=iR(),a=Kz(),i=xo(),c=XA(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),N=c(t),_=c(n),S=c(s),b=c(a),j=i;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=u||n&&j(n.resolve())!=p||s&&j(new s)!=h||a&&j(new a)!=m)&&(j=function(E){var C=i(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case N:return u;case _:return p;case S:return h;case b:return m}return C}),Qm=j,Qm}var Jm,bS;function Xz(){if(bS)return Jm;bS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return Jm=n,Jm}var eg,kS;function lR(){if(kS)return eg;kS=1;var e=Or(),t=e.Uint8Array;return eg=t,eg}var tg,_S;function p0(){if(_S)return tg;_S=1;var e=lR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return tg=t,tg}var ng,NS;function Zz(){if(NS)return ng;NS=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return ng=t,ng}var rg,SS;function Qz(){if(SS)return rg;SS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return rg=t,rg}var sg,jS;function Jz(){if(jS)return sg;jS=1;var e=Vi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return sg=s,sg}var ag,ES;function cR(){if(ES)return ag;ES=1;var e=p0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return ag=t,ag}var og,CS;function eU(){if(CS)return og;CS=1;var e=p0(),t=Zz(),n=Qz(),s=Jz(),a=cR(),i="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]";function L(H,$,V){var Q=H.constructor;switch($){case w:return e(H);case i:case c:return new Q(+H);case N:return t(H,V);case _:case S:case b:case j:case E:case C:case T:case R:case I:return a(H,V);case u:return new Q;case f:case m:return new Q(H);case p:return n(H);case h:return new Q;case y:return s(H)}}return og=L,og}var ig,TS;function uR(){if(TS)return ig;TS=1;var e=cr(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return ig=n,ig}var lg,AS;function dR(){if(AS)return lg;AS=1;var e=uR(),t=yh(),n=gh();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return lg=s,lg}var cg,RS;function tU(){if(RS)return cg;RS=1;var e=Ki(),t=Zr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return cg=s,cg}var ug,MS;function nU(){if(MS)return ug;MS=1;var e=tU(),t=mh(),n=u0(),s=n&&n.isMap,a=s?t(s):e;return ug=a,ug}var dg,IS;function rU(){if(IS)return dg;IS=1;var e=Ki(),t=Zr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return dg=s,dg}var hg,$S;function sU(){if($S)return hg;$S=1;var e=rU(),t=mh(),n=u0(),s=n&&n.isSet,a=s?t(s):e;return hg=a,hg}var fg,OS;function hR(){if(OS)return fg;OS=1;var e=dh(),t=l0(),n=fh(),s=Fz(),a=Uz(),i=eR(),c=tR(),u=Wz(),f=Hz(),p=oR(),h=Gz(),m=Ki(),y=Xz(),w=eU(),N=dR(),_=Gt(),S=Yi(),b=nU(),j=cr(),E=sU(),C=da(),T=ko(),R=1,I=2,L=4,H="[object Arguments]",$="[object Array]",V="[object Boolean]",Q="[object Date]",J="[object Error]",M="[object Function]",X="[object GeneratorFunction]",G="[object Map]",P="[object Number]",B="[object Object]",W="[object RegExp]",Y="[object Set]",O="[object String]",F="[object Symbol]",oe="[object WeakMap]",z="[object ArrayBuffer]",Z="[object DataView]",U="[object Float32Array]",re="[object Float64Array]",de="[object Int8Array]",pe="[object Int16Array]",ge="[object Int32Array]",Te="[object Uint8Array]",Ue="[object Uint8ClampedArray]",He="[object Uint16Array]",Pe="[object Uint32Array]",Se={};Se[H]=Se[$]=Se[z]=Se[Z]=Se[V]=Se[Q]=Se[U]=Se[re]=Se[de]=Se[pe]=Se[ge]=Se[G]=Se[P]=Se[B]=Se[W]=Se[Y]=Se[O]=Se[F]=Se[Te]=Se[Ue]=Se[He]=Se[Pe]=!0,Se[J]=Se[M]=Se[oe]=!1;function nt(je,be,Ke,ct,Ye,ce){var ke,Ee=be&R,Ze=be&I,Xe=be&L;if(Ke&&(ke=Ye?Ke(je,ct,Ye,ce):Ke(je)),ke!==void 0)return ke;if(!j(je))return je;var ut=_(je);if(ut){if(ke=y(je),!Ee)return c(je,ke)}else{var ee=m(je),Ne=ee==M||ee==X;if(S(je))return i(je,Ee);if(ee==B||ee==H||Ne&&!Ye){if(ke=Ze||Ne?{}:N(je),!Ee)return Ze?f(je,a(ke,je)):u(je,s(ke,je))}else{if(!Se[ee])return Ye?je:{};ke=w(je,ee,Ee)}}ce||(ce=new e);var Be=ce.get(je);if(Be)return Be;ce.set(je,ke),E(je)?je.forEach(function(tt){ke.add(nt(tt,be,Ke,tt,je,ce))}):b(je)&&je.forEach(function(tt,rt){ke.set(rt,nt(tt,be,Ke,rt,je,ce))});var et=Xe?Ze?h:p:Ze?T:C,pt=ut?void 0:et(je);return t(pt||je,function(tt,rt){pt&&(rt=tt,tt=je[rt]),n(ke,rt,nt(tt,be,Ke,rt,je,ce))}),ke}return fg=nt,fg}var pg,PS;function aU(){if(PS)return pg;PS=1;var e=hR(),t=4;function n(s){return e(s,t)}return pg=n,pg}var mg,LS;function m0(){if(LS)return mg;LS=1;function e(t){return function(){return t}}return mg=e,mg}var gg,DS;function oU(){if(DS)return gg;DS=1;function e(t){return function(n,s,a){for(var i=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++i];if(s(c[p],p,c)===!1)break}return n}}return gg=e,gg}var yg,qS;function g0(){if(qS)return yg;qS=1;var e=oU(),t=e();return yg=t,yg}var wg,FS;function y0(){if(FS)return wg;FS=1;var e=g0(),t=da();function n(s,a){return s&&e(s,a,t)}return wg=n,wg}var vg,BS;function iU(){if(BS)return vg;BS=1;var e=ks();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var c=a.length,u=s?c:-1,f=Object(a);(s?u--:++u<c)&&i(f[u],u,f)!==!1;);return a}}return vg=t,vg}var xg,zS;function wh(){if(zS)return xg;zS=1;var e=y0(),t=iU(),n=t(e);return xg=n,xg}var bg,US;function _o(){if(US)return bg;US=1;function e(t){return t}return bg=e,bg}var kg,WS;function fR(){if(WS)return kg;WS=1;var e=_o();function t(n){return typeof n=="function"?n:e}return kg=t,kg}var _g,HS;function pR(){if(HS)return _g;HS=1;var e=l0(),t=wh(),n=fR(),s=Gt();function a(i,c){var u=s(i)?e:t;return u(i,n(c))}return _g=a,_g}var Ng,GS;function mR(){return GS||(GS=1,Ng=pR()),Ng}var Sg,VS;function lU(){if(VS)return Sg;VS=1;var e=wh();function t(n,s){var a=[];return e(n,function(i,c,u){s(i,c,u)&&a.push(i)}),a}return Sg=t,Sg}var jg,YS;function cU(){if(YS)return jg;YS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return jg=t,jg}var Eg,KS;function uU(){if(KS)return Eg;KS=1;function e(t){return this.__data__.has(t)}return Eg=e,Eg}var Cg,XS;function gR(){if(XS)return Cg;XS=1;var e=i0(),t=cU(),n=uU();function s(a){var i=-1,c=a==null?0:a.length;for(this.__data__=new e;++i<c;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,Cg=s,Cg}var Tg,ZS;function dU(){if(ZS)return Tg;ZS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return Tg=e,Tg}var Ag,QS;function yR(){if(QS)return Ag;QS=1;function e(t,n){return t.has(n)}return Ag=e,Ag}var Rg,JS;function wR(){if(JS)return Rg;JS=1;var e=gR(),t=dU(),n=yR(),s=1,a=2;function i(c,u,f,p,h,m){var y=f&s,w=c.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(c),S=m.get(u);if(_&&S)return _==u&&S==c;var b=-1,j=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++b<w;){var C=c[b],T=u[b];if(p)var R=y?p(T,C,b,u,c,m):p(C,T,b,c,u,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(u,function(I,L){if(!n(E,L)&&(C===I||h(C,I,f,p,m)))return E.push(L)})){j=!1;break}}else if(!(C===T||h(C,T,f,p,m))){j=!1;break}}return m.delete(c),m.delete(u),j}return Rg=i,Rg}var Mg,ej;function hU(){if(ej)return Mg;ej=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return Mg=e,Mg}var Ig,tj;function w0(){if(tj)return Ig;tj=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Ig=e,Ig}var $g,nj;function fU(){if(nj)return $g;nj=1;var e=Vi(),t=lR(),n=Gi(),s=wR(),a=hU(),i=w0(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,I,L,H,$,V,Q){switch(L){case j:if(R.byteLength!=I.byteLength||R.byteOffset!=I.byteOffset)return!1;R=R.buffer,I=I.buffer;case b:return!(R.byteLength!=I.byteLength||!V(new t(R),new t(I)));case f:case p:case y:return n(+R,+I);case h:return R.name==I.name&&R.message==I.message;case w:case _:return R==I+"";case m:var J=a;case N:var M=H&c;if(J||(J=i),R.size!=I.size&&!M)return!1;var X=Q.get(R);if(X)return X==I;H|=u,Q.set(R,I);var G=s(J(R),J(I),H,$,V,Q);return Q.delete(R),G;case S:if(C)return C.call(R)==C.call(I)}return!1}return $g=T,$g}var Og,rj;function pU(){if(rj)return Og;rj=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,c,u,f,p,h){var m=u&t,y=e(i),w=y.length,N=e(c),_=N.length;if(w!=_&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in c:s.call(c,b)))return!1}var j=h.get(i),E=h.get(c);if(j&&E)return j==c&&E==i;var C=!0;h.set(i,c),h.set(c,i);for(var T=m;++S<w;){b=y[S];var R=i[b],I=c[b];if(f)var L=m?f(I,R,b,c,i,h):f(R,I,b,i,c,h);if(!(L===void 0?R===I||p(R,I,u,f,h):L)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var H=i.constructor,$=c.constructor;H!=$&&"constructor"in i&&"constructor"in c&&!(typeof H=="function"&&H instanceof H&&typeof $=="function"&&$ instanceof $)&&(C=!1)}return h.delete(i),h.delete(c),C}return Og=a,Og}var Pg,sj;function mU(){if(sj)return Pg;sj=1;var e=dh(),t=wR(),n=fU(),s=pU(),a=Ki(),i=Gt(),c=Yi(),u=Ic(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,S,b,j,E,C){var T=i(_),R=i(S),I=T?h:a(_),L=R?h:a(S);I=I==p?m:I,L=L==p?m:L;var H=I==m,$=L==m,V=I==L;if(V&&c(_)){if(!c(S))return!1;T=!0,H=!1}if(V&&!H)return C||(C=new e),T||u(_)?t(_,S,b,j,E,C):n(_,S,I,b,j,E,C);if(!(b&f)){var Q=H&&w.call(_,"__wrapped__"),J=$&&w.call(S,"__wrapped__");if(Q||J){var M=Q?_.value():_,X=J?S.value():S;return C||(C=new e),E(M,X,b,j,C)}}return V?(C||(C=new e),s(_,S,b,j,E,C)):!1}return Pg=N,Pg}var Lg,aj;function vR(){if(aj)return Lg;aj=1;var e=mU(),t=Zr();function n(s,a,i,c,u){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,c,n,u)}return Lg=n,Lg}var Dg,oj;function gU(){if(oj)return Dg;oj=1;var e=dh(),t=vR(),n=1,s=2;function a(i,c,u,f){var p=u.length,h=p,m=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=u[p];if(m&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=u[p];var w=y[0],N=i[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in i))return!1}else{var S=new e;if(f)var b=f(N,_,w,i,c,S);if(!(b===void 0?t(_,N,n|s,f,S):b))return!1}}return!0}return Dg=a,Dg}var qg,ij;function xR(){if(ij)return qg;ij=1;var e=cr();function t(n){return n===n&&!e(n)}return qg=t,qg}var Fg,lj;function yU(){if(lj)return Fg;lj=1;var e=xR(),t=da();function n(s){for(var a=t(s),i=a.length;i--;){var c=a[i],u=s[c];a[i]=[c,u,e(u)]}return a}return Fg=n,Fg}var Bg,cj;function bR(){if(cj)return Bg;cj=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Bg=e,Bg}var zg,uj;function wU(){if(uj)return zg;uj=1;var e=gU(),t=yU(),n=bR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(c){return c===a||e(c,a,i)}}return zg=s,zg}var Ug,dj;function Xi(){if(dj)return Ug;dj=1;var e=xo(),t=Zr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Ug=s,Ug}var Wg,hj;function v0(){if(hj)return Wg;hj=1;var e=Gt(),t=Xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,c){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||c!=null&&i in Object(c)}return Wg=a,Wg}var Hg,fj;function vU(){if(fj)return Hg;fj=1;var e=i0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=i.cache;if(f.has(u))return f.get(u);var p=s.apply(this,c);return i.cache=f.set(u,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Hg=n,Hg}var Gg,pj;function xU(){if(pj)return Gg;pj=1;var e=vU(),t=500;function n(s){var a=e(s,function(c){return i.size===t&&i.clear(),c}),i=a.cache;return a}return Gg=n,Gg}var Vg,mj;function bU(){if(mj)return Vg;mj=1;var e=xU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(c,u,f,p){i.push(f?p.replace(n,"$1"):u||c)}),i});return Vg=s,Vg}var Yg,gj;function vh(){if(gj)return Yg;gj=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return Yg=e,Yg}var Kg,yj;function kU(){if(yj)return Kg;yj=1;var e=Vi(),t=vh(),n=Gt(),s=Xi(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(s(u))return i?i.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Kg=c,Kg}var Xg,wj;function kR(){if(wj)return Xg;wj=1;var e=kU();function t(n){return n==null?"":e(n)}return Xg=t,Xg}var Zg,vj;function xh(){if(vj)return Zg;vj=1;var e=Gt(),t=v0(),n=bU(),s=kR();function a(i,c){return e(i)?i:t(i,c)?[i]:n(s(i))}return Zg=a,Zg}var Qg,xj;function $c(){if(xj)return Qg;xj=1;var e=Xi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Qg=t,Qg}var Jg,bj;function bh(){if(bj)return Jg;bj=1;var e=xh(),t=$c();function n(s,a){a=e(a,s);for(var i=0,c=a.length;s!=null&&i<c;)s=s[t(a[i++])];return i&&i==c?s:void 0}return Jg=n,Jg}var ey,kj;function _U(){if(kj)return ey;kj=1;var e=bh();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return ey=t,ey}var ty,_j;function NU(){if(_j)return ty;_j=1;function e(t,n){return t!=null&&n in Object(t)}return ty=e,ty}var ny,Nj;function _R(){if(Nj)return ny;Nj=1;var e=xh(),t=Mc(),n=Gt(),s=ph(),a=c0(),i=$c();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=i(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&s(w,m)&&(n(u)||t(u)))}return ny=c,ny}var ry,Sj;function NR(){if(Sj)return ry;Sj=1;var e=NU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return ry=n,ry}var sy,jj;function SU(){if(jj)return sy;jj=1;var e=vR(),t=_U(),n=NR(),s=v0(),a=xR(),i=bR(),c=$c(),u=1,f=2;function p(h,m){return s(h)&&a(m)?i(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return sy=p,sy}var ay,Ej;function SR(){if(Ej)return ay;Ej=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ay=e,ay}var oy,Cj;function jU(){if(Cj)return oy;Cj=1;var e=bh();function t(n){return function(s){return e(s,n)}}return oy=t,oy}var iy,Tj;function EU(){if(Tj)return iy;Tj=1;var e=SR(),t=jU(),n=v0(),s=$c();function a(i){return n(i)?e(s(i)):t(i)}return iy=a,iy}var ly,Aj;function _s(){if(Aj)return ly;Aj=1;var e=wU(),t=SU(),n=_o(),s=Gt(),a=EU();function i(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return ly=i,ly}var cy,Rj;function jR(){if(Rj)return cy;Rj=1;var e=nR(),t=lU(),n=_s(),s=Gt();function a(i,c){var u=s(i)?e:t;return u(i,n(c,3))}return cy=a,cy}var uy,Mj;function CU(){if(Mj)return uy;Mj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return uy=n,uy}var dy,Ij;function ER(){if(Ij)return dy;Ij=1;var e=CU(),t=_R();function n(s,a){return s!=null&&t(s,a,e)}return dy=n,dy}var hy,$j;function TU(){if($j)return hy;$j=1;var e=d0(),t=Ki(),n=Mc(),s=Gt(),a=ks(),i=Yi(),c=gh(),u=Ic(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(c(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return hy=y,hy}var fy,Oj;function CR(){if(Oj)return fy;Oj=1;function e(t){return t===void 0}return fy=e,fy}var py,Pj;function TR(){if(Pj)return py;Pj=1;var e=wh(),t=ks();function n(s,a){var i=-1,c=t(s)?Array(s.length):[];return e(s,function(u,f,p){c[++i]=a(u,f,p)}),c}return py=n,py}var my,Lj;function AR(){if(Lj)return my;Lj=1;var e=vh(),t=_s(),n=TR(),s=Gt();function a(i,c){var u=s(i)?e:n;return u(i,t(c,3))}return my=a,my}var gy,Dj;function AU(){if(Dj)return gy;Dj=1;function e(t,n,s,a){var i=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++i]);++i<c;)s=n(s,t[i],i,t);return s}return gy=e,gy}var yy,qj;function RU(){if(qj)return yy;qj=1;function e(t,n,s,a,i){return i(t,function(c,u,f){s=a?(a=!1,c):n(s,c,u,f)}),s}return yy=e,yy}var wy,Fj;function RR(){if(Fj)return wy;Fj=1;var e=AU(),t=wh(),n=_s(),s=RU(),a=Gt();function i(c,u,f){var p=a(c)?e:s,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return wy=i,wy}var vy,Bj;function MU(){if(Bj)return vy;Bj=1;var e=xo(),t=Gt(),n=Zr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return vy=a,vy}var xy,zj;function IU(){if(zj)return xy;zj=1;var e=SR(),t=e("length");return xy=t,xy}var by,Uj;function $U(){if(Uj)return by;Uj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+i+"]");function f(p){return u.test(p)}return by=f,by}var ky,Wj;function OU(){if(Wj)return ky;Wj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+i+"]?",S="(?:"+w+"(?:"+[h,m,y].join("|")+")"+_+N+")*",b=_+N+S,j="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+j+b,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return ky=C,ky}var _y,Hj;function PU(){if(Hj)return _y;Hj=1;var e=IU(),t=$U(),n=OU();function s(a){return t(a)?n(a):e(a)}return _y=s,_y}var Ny,Gj;function LU(){if(Gj)return Ny;Gj=1;var e=d0(),t=Ki(),n=ks(),s=MU(),a=PU(),i="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==c?f.size:e(f).length}return Ny=u,Ny}var Sy,Vj;function DU(){if(Vj)return Sy;Vj=1;var e=l0(),t=uR(),n=y0(),s=_s(),a=yh(),i=Gt(),c=Yi(),u=Ac(),f=cr(),p=Ic();function h(m,y,w){var N=i(m),_=N||c(m)||p(m);if(y=s(y,4),w==null){var S=m&&m.constructor;_?w=N?new S:[]:f(m)?w=u(S)?t(a(m)):{}:w={}}return(_?e:n)(m,function(b,j,E){return y(w,b,j,E)}),w}return Sy=h,Sy}var jy,Yj;function qU(){if(Yj)return jy;Yj=1;var e=Vi(),t=Mc(),n=Gt(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return jy=a,jy}var Ey,Kj;function x0(){if(Kj)return Ey;Kj=1;var e=f0(),t=qU();function n(s,a,i,c,u){var f=-1,p=s.length;for(i||(i=t),u||(u=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,c,u):e(u,h):c||(u[u.length]=h)}return u}return Ey=n,Ey}var Cy,Xj;function FU(){if(Xj)return Cy;Xj=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return Cy=e,Cy}var Ty,Zj;function MR(){if(Zj)return Ty;Zj=1;var e=FU(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=i(p),e(s,this,h)}}return Ty=n,Ty}var Ay,Qj;function BU(){if(Qj)return Ay;Qj=1;var e=m0(),t=ZA(),n=_o(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Ay=s,Ay}var Ry,Jj;function zU(){if(Jj)return Ry;Jj=1;var e=800,t=16,n=Date.now;function s(a){var i=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Ry=s,Ry}var My,eE;function IR(){if(eE)return My;eE=1;var e=BU(),t=zU(),n=t(e);return My=n,My}var Iy,tE;function kh(){if(tE)return Iy;tE=1;var e=_o(),t=MR(),n=IR();function s(a,i){return n(t(a,i,e),a+"")}return Iy=s,Iy}var $y,nE;function $R(){if(nE)return $y;nE=1;function e(t,n,s,a){for(var i=t.length,c=s+(a?1:-1);a?c--:++c<i;)if(n(t[c],c,t))return c;return-1}return $y=e,$y}var Oy,rE;function UU(){if(rE)return Oy;rE=1;function e(t){return t!==t}return Oy=e,Oy}var Py,sE;function WU(){if(sE)return Py;sE=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Py=e,Py}var Ly,aE;function HU(){if(aE)return Ly;aE=1;var e=$R(),t=UU(),n=WU();function s(a,i,c){return i===i?n(a,i,c):e(a,t,c)}return Ly=s,Ly}var Dy,oE;function GU(){if(oE)return Dy;oE=1;var e=HU();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Dy=t,Dy}var qy,iE;function VU(){if(iE)return qy;iE=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return qy=e,qy}var Fy,lE;function YU(){if(lE)return Fy;lE=1;function e(){}return Fy=e,Fy}var By,cE;function KU(){if(cE)return By;cE=1;var e=iR(),t=YU(),n=w0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return By=a,By}var zy,uE;function XU(){if(uE)return zy;uE=1;var e=gR(),t=GU(),n=VU(),s=yR(),a=KU(),i=w0(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,N=!0,_=[],S=_;if(h)N=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return i(b);N=!1,y=s,S=new e}else S=p?[]:_;e:for(;++m<w;){var j=f[m],E=p?p(j):j;if(j=h||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(j)}else y(S,E,h)||(S!==_&&S.push(E),_.push(j))}return _}return zy=u,zy}var Uy,dE;function OR(){if(dE)return Uy;dE=1;var e=ks(),t=Zr();function n(s){return t(s)&&e(s)}return Uy=n,Uy}var Wy,hE;function ZU(){if(hE)return Wy;hE=1;var e=x0(),t=kh(),n=XU(),s=OR(),a=t(function(i){return n(e(i,1,s,!0))});return Wy=a,Wy}var Hy,fE;function QU(){if(fE)return Hy;fE=1;var e=vh();function t(n,s){return e(s,function(a){return n[a]})}return Hy=t,Hy}var Gy,pE;function PR(){if(pE)return Gy;pE=1;var e=QU(),t=da();function n(s){return s==null?[]:e(s,t(s))}return Gy=n,Gy}var Vy,mE;function ur(){if(mE)return Vy;mE=1;var e;if(typeof a0=="function")try{e={clone:aU(),constant:m0(),each:mR(),filter:jR(),has:ER(),isArray:Gt(),isEmpty:TU(),isFunction:Ac(),isUndefined:CR(),keys:da(),map:AR(),reduce:RR(),size:LU(),transform:DU(),union:ZU(),values:PR()}}catch{}return e||(e=window._),Vy=e,Vy}var Yy,gE;function b0(){if(gE)return Yy;gE=1;var e=ur();Yy=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,S){h(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(w[_]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var h,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(h=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var S=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(h,m,y);var b=f(this._isDirected,h,m,y);return h=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][S]=b,this._out[h][S]=b,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),N=this._edgeObjs[w];return N&&(h=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var S=N;N=_,_=S}return N+s+_+s+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var N=""+m,_=""+y;if(!h&&N>_){var S=N;N=_,_=S}var b={v:N,w:_};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return Yy}var Ky,yE;function JU(){return yE||(yE=1,Ky="2.1.8"),Ky}var Xy,wE;function eW(){return wE||(wE=1,Xy={Graph:b0(),version:JU()}),Xy}var Zy,vE;function tW(){if(vE)return Zy;vE=1;var e=ur(),t=b0();Zy={write:n,read:i};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function s(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function i(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return Zy}var Qy,xE;function nW(){if(xE)return Qy;xE=1;var e=ur();Qy=t;function t(n){var s={},a=[],i;function c(u){e.has(s,u)||(s[u]=!0,i.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){i=[],c(u),i.length&&a.push(i)}),a}return Qy}var Jy,bE;function LR(){if(bE)return Jy;bE=1;var e=ur();Jy=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,c=i.length;return a[n]=c,i.push({key:n,priority:s}),this._decrease(c),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,i<s.length&&(c=s[i].priority<s[c].priority?i:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,c=a[n],u=a[s];a[n]=u,a[s]=c,i[u.key]=n,i[c.key]=s},Jy}var ew,kE;function DR(){if(kE)return ew;kE=1;var e=ur(),t=LR();ew=s;var n=e.constant(1);function s(i,c,u,f){return a(i,String(c),u||n,f||function(p){return i.outEdges(p)})}function a(i,c,u,f){var p={},h=new t,m,y,w=function(N){var _=N.v!==m?N.v:N.w,S=p[_],b=u(N),j=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);j<S.distance&&(S.distance=j,S.predecessor=m,h.decrease(_,j))};for(i.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},h.add(N,_)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return ew}var tw,_E;function rW(){if(_E)return tw;_E=1;var e=DR(),t=ur();tw=n;function n(s,a,i){return t.transform(s.nodes(),function(c,u){c[u]=e(s,u,a,i)},{})}return tw}var nw,NE;function qR(){if(NE)return nw;NE=1;var e=ur();nw=t;function t(n){var s=0,a=[],i={},c=[];function u(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,i[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),i[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||u(f)}),c}return nw}var rw,SE;function sW(){if(SE)return rw;SE=1;var e=ur(),t=qR();rw=n;function n(s){return e.filter(t(s),function(a){return a.length>1||a.length===1&&s.hasEdge(a[0],a[0])})}return rw}var sw,jE;function aW(){if(jE)return sw;jE=1;var e=ur();sw=n;var t=e.constant(1);function n(a,i,c){return s(a,i||t,c||function(u){return a.outEdges(u)})}function s(a,i,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=i(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var N=y[p],_=h[w],S=y[w],b=N.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),u}return sw}var aw,EE;function FR(){if(EE)return aw;EE=1;var e=ur();aw=t,t.CycleException=n;function t(s){var a={},i={},c=[];function u(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),u),delete i[f],c.push(f))}if(e.each(s.sinks(),u),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,aw}var ow,CE;function oW(){if(CE)return ow;CE=1;var e=FR();ow=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return ow}var iw,TE;function BR(){if(TE)return iw;TE=1;var e=ur();iw=t;function t(s,a,i){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,c,u)}),u}function n(s,a,i,c,u,f){e.has(c,a)||(c[a]=!0,i||f.push(a),e.each(u(a),function(p){n(s,p,i,c,u,f)}),i&&f.push(a))}return iw}var lw,AE;function iW(){if(AE)return lw;AE=1;var e=BR();lw=t;function t(n,s){return e(n,s,"post")}return lw}var cw,RE;function lW(){if(RE)return cw;RE=1;var e=BR();cw=t;function t(n,s){return e(n,s,"pre")}return cw}var uw,ME;function cW(){if(ME)return uw;ME=1;var e=ur(),t=b0(),n=LR();uw=s;function s(a,i){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,N=f.priority(w);if(N!==void 0){var _=i(y);_<N&&(u[w]=p,f.decrease(w,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return uw}var dw,IE;function uW(){return IE||(IE=1,dw={components:nW(),dijkstra:DR(),dijkstraAll:rW(),findCycles:sW(),floydWarshall:aW(),isAcyclic:oW(),postorder:iW(),preorder:lW(),prim:cW(),tarjan:qR(),topsort:FR()}),dw}var hw,$E;function dW(){if($E)return hw;$E=1;var e=eW();return hw={Graph:e.Graph,json:tW(),alg:uW(),version:e.version},hw}var fw,OE;function Mr(){if(OE)return fw;OE=1;var e;if(typeof a0=="function")try{e=dW()}catch{}return e||(e=window.graphlib),fw=e,fw}var pw,PE;function hW(){if(PE)return pw;PE=1;var e=hR(),t=1,n=4;function s(a){return e(a,t|n)}return pw=s,pw}var mw,LE;function _h(){if(LE)return mw;LE=1;var e=Gi(),t=ks(),n=ph(),s=cr();function a(i,c,u){if(!s(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],i):!1}return mw=a,mw}var gw,DE;function fW(){if(DE)return gw;DE=1;var e=kh(),t=Gi(),n=_h(),s=ko(),a=Object.prototype,i=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=s(y),N=-1,_=w.length;++N<_;){var S=w[N],b=u[S];(b===void 0||t(b,a[S])&&!i.call(u,S))&&(u[S]=y[S])}return u});return gw=c,gw}var yw,qE;function pW(){if(qE)return yw;qE=1;var e=_s(),t=ks(),n=da();function s(a){return function(i,c,u){var f=Object(i);if(!t(i)){var p=e(c,3);i=n(i),c=function(m){return p(f[m],m,f)}}var h=a(i,c,u);return h>-1?f[p?i[h]:h]:void 0}}return yw=s,yw}var ww,FE;function mW(){if(FE)return ww;FE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ww=t,ww}var vw,BE;function gW(){if(BE)return vw;BE=1;var e=mW(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return vw=n,vw}var xw,zE;function yW(){if(zE)return xw;zE=1;var e=gW(),t=cr(),n=Xi(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=i.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?s:+p}return xw=f,xw}var bw,UE;function zR(){if(UE)return bw;UE=1;var e=yW(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return bw=s,bw}var kw,WE;function wW(){if(WE)return kw;WE=1;var e=zR();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return kw=t,kw}var _w,HE;function vW(){if(HE)return _w;HE=1;var e=$R(),t=_s(),n=wW(),s=Math.max;function a(i,c,u){var f=i==null?0:i.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=s(f+p,0)),e(i,t(c,3),p)}return _w=a,_w}var Nw,GE;function xW(){if(GE)return Nw;GE=1;var e=pW(),t=vW(),n=e(t);return Nw=n,Nw}var Sw,VE;function UR(){if(VE)return Sw;VE=1;var e=x0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Sw=t,Sw}var jw,YE;function bW(){if(YE)return jw;YE=1;var e=g0(),t=fR(),n=ko();function s(a,i){return a==null?a:e(a,t(i),n)}return jw=s,jw}var Ew,KE;function kW(){if(KE)return Ew;KE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ew=e,Ew}var Cw,XE;function _W(){if(XE)return Cw;XE=1;var e=hh(),t=y0(),n=_s();function s(a,i){var c={};return i=n(i,3),t(a,function(u,f,p){e(c,f,i(u,f,p))}),c}return Cw=s,Cw}var Tw,ZE;function k0(){if(ZE)return Tw;ZE=1;var e=Xi();function t(n,s,a){for(var i=-1,c=n.length;++i<c;){var u=n[i],f=s(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Tw=t,Tw}var Aw,QE;function NW(){if(QE)return Aw;QE=1;function e(t,n){return t>n}return Aw=e,Aw}var Rw,JE;function SW(){if(JE)return Rw;JE=1;var e=k0(),t=NW(),n=_o();function s(a){return a&&a.length?e(a,n,t):void 0}return Rw=s,Rw}var Mw,eC;function WR(){if(eC)return Mw;eC=1;var e=hh(),t=Gi();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return Mw=n,Mw}var Iw,tC;function jW(){if(tC)return Iw;tC=1;var e=xo(),t=yh(),n=Zr(),s="[object Object]",a=Function.prototype,i=Object.prototype,c=a.toString,u=i.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Iw=p,Iw}var $w,nC;function HR(){if(nC)return $w;nC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return $w=e,$w}var Ow,rC;function EW(){if(rC)return Ow;rC=1;var e=Rc(),t=ko();function n(s){return e(s,t(s))}return Ow=n,Ow}var Pw,sC;function CW(){if(sC)return Pw;sC=1;var e=WR(),t=eR(),n=cR(),s=tR(),a=dR(),i=Mc(),c=Gt(),u=OR(),f=Yi(),p=Ac(),h=cr(),m=jW(),y=Ic(),w=HR(),N=EW();function _(S,b,j,E,C,T,R){var I=w(S,j),L=w(b,j),H=R.get(L);if(H){e(S,j,H);return}var $=T?T(I,L,j+"",S,b,R):void 0,V=$===void 0;if(V){var Q=c(L),J=!Q&&f(L),M=!Q&&!J&&y(L);$=L,Q||J||M?c(I)?$=I:u(I)?$=s(I):J?(V=!1,$=t(L,!0)):M?(V=!1,$=n(L,!0)):$=[]:m(L)||i(L)?($=I,i(I)?$=N(I):(!h(I)||p(I))&&($=a(L))):V=!1}V&&(R.set(L,$),C($,L,E,T,R),R.delete(L)),e(S,j,$)}return Pw=_,Pw}var Lw,aC;function TW(){if(aC)return Lw;aC=1;var e=dh(),t=WR(),n=g0(),s=CW(),a=cr(),i=ko(),c=HR();function u(f,p,h,m,y){f!==p&&n(p,function(w,N){if(y||(y=new e),a(w))s(f,p,N,h,u,m,y);else{var _=m?m(c(f,N),w,N+"",f,p,y):void 0;_===void 0&&(_=w),t(f,N,_)}},i)}return Lw=u,Lw}var Dw,oC;function AW(){if(oC)return Dw;oC=1;var e=kh(),t=_h();function n(s){return e(function(a,i){var c=-1,u=i.length,f=u>1?i[u-1]:void 0,p=u>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(i[0],i[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=i[c];h&&s(a,h,c,f)}return a})}return Dw=n,Dw}var qw,iC;function RW(){if(iC)return qw;iC=1;var e=TW(),t=AW(),n=t(function(s,a,i){e(s,a,i)});return qw=n,qw}var Fw,lC;function GR(){if(lC)return Fw;lC=1;function e(t,n){return t<n}return Fw=e,Fw}var Bw,cC;function MW(){if(cC)return Bw;cC=1;var e=k0(),t=GR(),n=_o();function s(a){return a&&a.length?e(a,n,t):void 0}return Bw=s,Bw}var zw,uC;function IW(){if(uC)return zw;uC=1;var e=k0(),t=_s(),n=GR();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return zw=s,zw}var Uw,dC;function $W(){if(dC)return Uw;dC=1;var e=Or(),t=function(){return e.Date.now()};return Uw=t,Uw}var Ww,hC;function OW(){if(hC)return Ww;hC=1;var e=fh(),t=xh(),n=ph(),s=cr(),a=$c();function i(c,u,f,p){if(!s(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var N=a(u[h]),_=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(h!=y){var S=w[N];_=p?p(S,N,w):void 0,_===void 0&&(_=s(S)?S:n(u[h+1])?[]:{})}e(w,N,_),w=w[N]}return c}return Ww=i,Ww}var Hw,fC;function PW(){if(fC)return Hw;fC=1;var e=bh(),t=OW(),n=xh();function s(a,i,c){for(var u=-1,f=i.length,p={};++u<f;){var h=i[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return Hw=s,Hw}var Gw,pC;function LW(){if(pC)return Gw;pC=1;var e=PW(),t=NR();function n(s,a){return e(s,a,function(i,c){return t(s,c)})}return Gw=n,Gw}var Vw,mC;function DW(){if(mC)return Vw;mC=1;var e=UR(),t=MR(),n=IR();function s(a){return n(t(a,void 0,e),a+"")}return Vw=s,Vw}var Yw,gC;function qW(){if(gC)return Yw;gC=1;var e=LW(),t=DW(),n=t(function(s,a){return s==null?{}:e(s,a)});return Yw=n,Yw}var Kw,yC;function FW(){if(yC)return Kw;yC=1;var e=Math.ceil,t=Math.max;function n(s,a,i,c){for(var u=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[c?f:++u]=s,s+=i;return p}return Kw=n,Kw}var Xw,wC;function BW(){if(wC)return Xw;wC=1;var e=FW(),t=_h(),n=zR();function s(a){return function(i,c,u){return u&&typeof u!="number"&&t(i,c,u)&&(c=u=void 0),i=n(i),c===void 0?(c=i,i=0):c=n(c),u=u===void 0?i<c?1:-1:n(u),e(i,c,u,a)}}return Xw=s,Xw}var Zw,vC;function zW(){if(vC)return Zw;vC=1;var e=BW(),t=e();return Zw=t,Zw}var Qw,xC;function UW(){if(xC)return Qw;xC=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Qw=e,Qw}var Jw,bC;function WW(){if(bC)return Jw;bC=1;var e=Xi();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,c=n===n,u=e(n),f=s!==void 0,p=s===null,h=s===s,m=e(s);if(!p&&!m&&!u&&n>s||u&&f&&h&&!p&&!m||i&&f&&h||!a&&h||!c)return 1;if(!i&&!u&&!m&&n<s||m&&a&&c&&!i&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return Jw=t,Jw}var ev,kC;function HW(){if(kC)return ev;kC=1;var e=WW();function t(n,s,a){for(var i=-1,c=n.criteria,u=s.criteria,f=c.length,p=a.length;++i<f;){var h=e(c[i],u[i]);if(h){if(i>=p)return h;var m=a[i];return h*(m=="desc"?-1:1)}}return n.index-s.index}return ev=t,ev}var tv,_C;function GW(){if(_C)return tv;_C=1;var e=vh(),t=bh(),n=_s(),s=TR(),a=UW(),i=mh(),c=HW(),u=_o(),f=Gt();function p(h,m,y){m.length?m=e(m,function(_){return f(_)?function(S){return t(S,_.length===1?_[0]:_)}:_}):m=[u];var w=-1;m=e(m,i(n));var N=s(h,function(_,S,b){var j=e(m,function(E){return E(_)});return{criteria:j,index:++w,value:_}});return a(N,function(_,S){return c(_,S,y)})}return tv=p,tv}var nv,NC;function VW(){if(NC)return nv;NC=1;var e=x0(),t=GW(),n=kh(),s=_h(),a=n(function(i,c){if(i==null)return[];var u=c.length;return u>1&&s(i,c[0],c[1])?c=[]:u>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(i,e(c,1),[])});return nv=a,nv}var rv,SC;function YW(){if(SC)return rv;SC=1;var e=kR(),t=0;function n(s){var a=++t;return e(s)+a}return rv=n,rv}var sv,jC;function KW(){if(jC)return sv;jC=1;function e(t,n,s){for(var a=-1,i=t.length,c=n.length,u={};++a<i;){var f=a<c?n[a]:void 0;s(u,t[a],f)}return u}return sv=e,sv}var av,EC;function XW(){if(EC)return av;EC=1;var e=fh(),t=KW();function n(s,a){return t(s||[],a||[],e)}return av=n,av}var ov,CC;function Rt(){if(CC)return ov;CC=1;var e;if(typeof a0=="function")try{e={cloneDeep:hW(),constant:m0(),defaults:fW(),each:mR(),filter:jR(),find:xW(),flatten:UR(),forEach:pR(),forIn:bW(),has:ER(),isUndefined:CR(),last:kW(),map:AR(),mapValues:_W(),max:SW(),merge:RW(),min:MW(),minBy:IW(),now:$W(),pick:qW(),range:zW(),reduce:RR(),sortBy:VW(),uniqueId:YW(),values:PR(),zipObject:XW()}}catch{}return e||(e=window._),ov=e,ov}var iv,TC;function ZW(){if(TC)return iv;TC=1,iv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return iv}var lv,AC;function QW(){if(AC)return lv;AC=1;var e=Rt(),t=Mr().Graph,n=ZW();lv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||s),y=i(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,m){for(var y=[],w=h[h.length-1],N=h[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,h,m,_);for(;_=w.dequeue();)c(p,h,m,_);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(_=h[S].dequeue(),_){y=y.concat(c(p,h,m,_,!0));break}}}return y}function c(p,h,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),b=p.node(_.v);w&&N.push({v:_.v,w:_.w}),b.out-=S,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),b=_.w,j=p.node(b);j.in-=S,f(h,m,j)}),p.removeNode(y.v),N}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,j=h(S),E=b+j;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(w+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(S){f(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return lv}var cv,RC;function JW(){if(RC)return cv;RC=1;var e=Rt(),t=QW();cv={run:n,undo:a};function n(i){var c=i.graph().acyclicer==="greedy"?t(i,u(i)):s(i);e.forEach(c,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function s(i){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(i.nodes(),p),c}function a(i){e.forEach(i.edges(),function(c){var u=i.edge(c);if(u.reversed){i.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(c.w,c.v,u,f)}})}return cv}var uv,MC;function Ln(){if(MC)return uv;MC=1;var e=Rt(),t=Mr().Graph;uv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function n(S,b,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=b,S.setNode(C,j),C}function s(S){var b=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=b.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);b.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(S){var b=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||b.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){b.setEdge(j,S.edge(j))}),b}function i(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S){var b=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S,b){var j=S.x,E=S.y,C=b.x-j,T=b.y-E,R=S.width/2,I=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var L,H;return Math.abs(T)*R>Math.abs(C)*I?(T<0&&(I=-I),L=I*C/T,H=I):(C<0&&(R=-R),L=R,H=R*T/C),{x:j+L,y:E+H}}function f(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(b[C][E.order]=j)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=b)})}function h(S){var b=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),j=[];e.forEach(S.nodes(),function(T){var R=S.node(T).rank-b;j[R]||(j[R]=[]),j[R].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(I){S.node(I).rank+=E})})}function m(S,b,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var j=S.node(b).rank;if(!e.isUndefined(j))return j}))}function w(S,b){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,b){var j=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function _(S,b){return b()}return uv}var dv,IC;function eH(){if(IC)return dv;IC=1;var e=Rt(),t=Ln();dv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(c){s(i,c)})}function s(i,c){var u=c.v,f=i.node(u).rank,p=c.w,h=i.node(p).rank,m=c.name,y=i.edge(c),w=y.labelRank;if(h!==f+1){i.removeEdge(c);var N,_,S;for(S=0,++f;f<h;++S,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},N=t.addDummyNode(i,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),i.setEdge(u,N,{weight:y.weight},m),S===0&&i.graph().dummyChains.push(N),u=N;i.setEdge(u,p,{weight:y.weight},m)}}function a(i){e.forEach(i.graph().dummyChains,function(c){var u=i.node(c),f=u.edgeLabel,p;for(i.setEdge(u.edgeObj,f);u.dummy;)p=i.successors(c)[0],i.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=i.node(c)})}return dv}var hv,$C;function zd(){if($C)return hv;$C=1;var e=Rt();hv={longestPath:t,slack:n};function t(s){var a={};function i(c){var u=s.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(s.outEdges(c),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return hv}var fv,OC;function VR(){if(OC)return fv;OC=1;var e=Rt(),t=Mr().Graph,n=zd().slack;fv=s;function s(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=i(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function i(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return fv}var pv,PC;function tH(){if(PC)return pv;PC=1;var e=Rt(),t=VR(),n=zd().slack,s=zd().longestPath,a=Mr().alg.preorder,i=Mr().alg.postorder,c=Ln().simplify;pv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=_;function u(E){E=c(E),s(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=N(C,E,T),_(C,E,T,R)}function f(E,C){var T=i(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),I=R.parent;E.edge(T,I).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),I=R.parent,L=!0,H=C.edge(T,I),$=0;return H||(L=!1,H=C.edge(I,T)),$=H.weight,e.forEach(C.nodeEdges(T),function(V){var Q=V.v===T,J=Q?V.w:V.v;if(J!==I){var M=Q===L,X=C.edge(V).weight;if($+=M?X:-X,b(E,T,J)){var G=E.edge(T,J).cutvalue;$+=M?-G:G}}}),$}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,I){var L=T,H=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function($){e.has(C,$)||(T=y(E,C,T,$,R))}),H.low=L,H.lim=T++,I?H.parent=I:delete H.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,I=T.w;C.hasEdge(R,I)||(R=T.w,I=T.v);var L=E.node(R),H=E.node(I),$=L,V=!1;L.lim>H.lim&&($=H,V=!0);var Q=e.filter(C.edges(),function(J){return V===j(E,E.node(J.v),$)&&V!==j(E,E.node(J.w),$)});return e.minBy(Q,function(J){return n(C,J)})}function _(E,C,T,R){var I=T.v,L=T.w;E.removeEdge(I,L),E.setEdge(R.v,R.w,{}),m(E),f(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function(I){return!C.node(I).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(I){var L=E.node(I).parent,H=C.edge(I,L),$=!1;H||(H=C.edge(L,I),$=!0),C.node(I).rank=C.node(L).rank+($?H.minlen:-H.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return pv}var mv,LC;function nH(){if(LC)return mv;LC=1;var e=zd(),t=e.longestPath,n=VR(),s=tH();mv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":i(f);break;default:u(f)}}var i=t;function c(f){t(f),n(f)}function u(f){s(f)}return mv}var gv,DC;function rH(){if(DC)return gv;DC=1;var e=Rt();gv=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,i,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],N=!0;c!==f.w;){if(u=a.node(c),N){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,i,c,u){var f=[],p=[],h=Math.min(i[c].low,i[u].low),m=Math.max(i[c].lim,i[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||m>i[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),i[f]={low:p,lim:c++}}return e.forEach(a.children(),u),i}return gv}var yv,qC;function sH(){if(qC)return yv;qC=1;var e=Rt(),t=Ln();yv={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=i(u)+1;e.forEach(u.children(),function(w){s(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function s(u,f,p,h,m,y,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(_,w),b.borderTop=_,u.setParent(S,w),b.borderBottom=S,e.forEach(N,function(j){s(u,f,p,h,m,y,j);var E=u.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?h:2*h,I=C!==T?1:m-y[w]+1;u.setEdge(_,C,{weight:R,minlen:I,nestingEdge:!0}),u.setEdge(T,S,{weight:R,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,_,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function i(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return yv}var wv,FC;function aH(){if(FC)return wv;FC=1;var e=Rt(),t=Ln();wv=n;function n(a){function i(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",c,f,p),s(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),i)}function s(a,i,c,u,f,p){var h={width:0,height:0,rank:p,borderType:i},m=f[i][p-1],y=t.addDummyNode(a,"border",h,c);f[i][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return wv}var vv,BC;function oH(){if(BC)return vv;BC=1;var e=Rt();vv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return vv}var xv,zC;function iH(){if(zC)return xv;zC=1;var e=Rt();xv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(i+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return xv}var bv,UC;function lH(){if(UC)return bv;UC=1;var e=Rt();bv=t;function t(s,a){for(var i=0,c=1;c<a.length;++c)i+=n(s,a[c-1],a[c]);return i}function n(s,a,i){for(var c=e.zipObject(i,e.map(i,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:c[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*N})),m}return bv}var kv,WC;function cH(){if(WC)return kv;WC=1;var e=Rt();kv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var c=e.reduce(i,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return kv}var _v,HC;function uH(){if(HC)return _v;HC=1;var e=Rt();_v=t;function t(a,i){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var i=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),i.weight&&(c+=i.barycenter*i.weight,u+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(i.i,a.i),i.merged=!0}return _v}var Nv,GC;function dH(){if(GC)return Nv;GC=1;var e=Rt(),t=Ln();Nv=n;function n(i,c){var u=t.partition(i,function(_){return e.has(_,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(_){return-_.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=s(h,p,w),e.forEach(f,function(_){w+=_.vs.length,h.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(i,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),i.push(f.vs),u++;return u}function a(i){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:i?u.i-c.i:c.i-u.i}}return Nv}var Sv,VC;function hH(){if(VC)return Sv;VC=1;var e=Rt(),t=cH(),n=uH(),s=dH();Sv=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(T){return T!==w&&T!==N}));var S=t(u,m);e.forEach(S,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var b=n(S,p);i(b,_);var j=s(b,h);if(w&&(j.vs=e.flatten([w,j.vs,N],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function i(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return Sv}var jv,YC;function fH(){if(YC)return jv;YC=1;var e=Rt(),t=Mr().Graph;jv=n;function n(a,i,c){var u=s(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,N=f.edge(w,p),_=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(y).weight+_})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return jv}var Ev,KC;function pH(){if(KC)return Ev;KC=1;var e=Rt();Ev=t;function t(n,s,a){var i={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=c,c=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return Ev}var Cv,XC;function mH(){if(XC)return Cv;XC=1;var e=Rt(),t=iH(),n=lH(),s=hH(),a=fH(),i=pH(),c=Mr().Graph,u=Ln();Cv=f;function f(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){h(E%2?N:_,E%4>=2),S=u.buildLayerMatrix(y);var T=n(y,S);T<b&&(C=0,j=e.cloneDeep(S),b=T)}m(y,j)}function p(y,w,N){return e.map(w,function(_){return a(y,_,N)})}function h(y,w){var N=new c;e.forEach(y,function(_){var S=_.graph().root,b=s(_,S,N,w);e.forEach(b.vs,function(j,E){_.node(j).order=E}),i(_,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return Cv}var Tv,ZC;function gH(){if(ZC)return Tv;ZC=1;var e=Rt(),t=Mr().Graph,n=Ln();Tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function s(b,j){var E={};function C(T,R){var I=0,L=0,H=T.length,$=e.last(R);return e.forEach(R,function(V,Q){var J=i(b,V),M=J?b.node(J).order:H;(J||V===$)&&(e.forEach(R.slice(L,Q+1),function(X){e.forEach(b.predecessors(X),function(G){var P=b.node(G),B=P.order;(B<I||M<B)&&!(P.dummy&&b.node(X).dummy)&&c(E,G,X)})}),L=Q+1,I=M)}),R}return e.reduce(j,C),E}function a(b,j){var E={};function C(R,I,L,H,$){var V;e.forEach(e.range(I,L),function(Q){V=R[Q],b.node(V).dummy&&e.forEach(b.predecessors(V),function(J){var M=b.node(J);M.dummy&&(M.order<H||M.order>$)&&c(E,J,V)})})}function T(R,I){var L=-1,H,$=0;return e.forEach(I,function(V,Q){if(b.node(V).dummy==="border"){var J=b.predecessors(V);J.length&&(H=b.node(J[0]).order,C(I,$,Q,L,H),$=Q,L=H)}C(I,$,I.length,H,R.length)}),I}return e.reduce(j,T),E}function i(b,j){if(b.node(j).dummy)return e.find(b.predecessors(j),function(E){return b.node(E).dummy})}function c(b,j,E){if(j>E){var C=j;j=E,E=C}var T=b[j];T||(b[j]=T={}),T[E]=!0}function u(b,j,E){if(j>E){var C=j;j=E,E=C}return e.has(b[j],E)}function f(b,j,E,C){var T={},R={},I={};return e.forEach(j,function(L){e.forEach(L,function(H,$){T[H]=H,R[H]=H,I[H]=$})}),e.forEach(j,function(L){var H=-1;e.forEach(L,function($){var V=C($);if(V.length){V=e.sortBy(V,function(G){return I[G]});for(var Q=(V.length-1)/2,J=Math.floor(Q),M=Math.ceil(Q);J<=M;++J){var X=V[J];R[$]===$&&H<I[X]&&!u(E,$,X)&&(R[X]=$,R[$]=T[$]=T[X],H=I[X])}}})}),{root:T,align:R}}function p(b,j,E,C,T){var R={},I=h(b,j,E,T),L=T?"borderLeft":"borderRight";function H(Q,J){for(var M=I.nodes(),X=M.pop(),G={};X;)G[X]?Q(X):(G[X]=!0,M.push(X),M=M.concat(J(X))),X=M.pop()}function $(Q){R[Q]=I.inEdges(Q).reduce(function(J,M){return Math.max(J,R[M.v]+I.edge(M))},0)}function V(Q){var J=I.outEdges(Q).reduce(function(X,G){return Math.min(X,R[G.w]-I.edge(G))},Number.POSITIVE_INFINITY),M=b.node(Q);J!==Number.POSITIVE_INFINITY&&M.borderType!==L&&(R[Q]=Math.max(R[Q],J))}return H($,I.predecessors.bind(I)),H(V,I.successors.bind(I)),e.forEach(C,function(Q){R[Q]=R[E[Q]]}),R}function h(b,j,E,C){var T=new t,R=b.graph(),I=_(R.nodesep,R.edgesep,C);return e.forEach(j,function(L){var H;e.forEach(L,function($){var V=E[$];if(T.setNode(V),H){var Q=E[H],J=T.edge(Q,V);T.setEdge(Q,V,Math.max(I(b,$,H),J||0))}H=$})}),T}function m(b,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,I){var L=S(b,I)/2;C=Math.max(R+L,C),T=Math.min(R-L,T)}),C-T})}function y(b,j){var E=e.values(j),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(I){var L=R+I,H=b[L],$;if(H!==j){var V=e.values(H);$=I==="l"?C-e.min(V):T-e.max(V),$&&(b[L]=e.mapValues(H,function(Q){return Q+$}))}})})}function w(b,j){return e.mapValues(b.ul,function(E,C){if(j)return b[j.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function N(b){var j=n.buildLayerMatrix(b),E=e.merge(s(b,j),a(b,j)),C={},T;e.forEach(["u","d"],function(I){T=I==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(L){L==="r"&&(T=e.map(T,function(Q){return e.values(Q).reverse()}));var H=(I==="u"?b.predecessors:b.successors).bind(b),$=f(b,T,E,H),V=p(b,T,$.root,$.align,L==="r");L==="r"&&(V=e.mapValues(V,function(Q){return-Q})),C[I+L]=V})});var R=m(b,C);return y(C,R),w(C,b.graph().align)}function _(b,j,E){return function(C,T,R){var I=C.node(T),L=C.node(R),H=0,$;if(H+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":$=-I.width/2;break;case"r":$=I.width/2;break}if($&&(H+=E?$:-$),$=0,H+=(I.dummy?j:b)/2,H+=(L.dummy?j:b)/2,H+=L.width/2,e.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":$=L.width/2;break;case"r":$=-L.width/2;break}return $&&(H+=E?$:-$),$=0,H}}function S(b,j){return b.node(j).width}return Tv}var Av,QC;function yH(){if(QC)return Av;QC=1;var e=Rt(),t=Ln(),n=gH().positionX;Av=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(c,u){i.node(u).x=c})}function a(i){var c=t.buildLayerMatrix(i),u=i.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return i.node(m).height}));e.forEach(p,function(m){i.node(m).y=f+h/2}),f+=h+u})}return Av}var Rv,JC;function wH(){if(JC)return Rv;JC=1;var e=Rt(),t=JW(),n=eH(),s=nH(),a=Ln().normalizeRanks,i=rH(),c=Ln().removeEmptyRanks,u=sH(),f=aH(),p=oH(),h=mH(),m=yH(),y=Ln(),w=Mr().Graph;Rv=N;function N(z,Z){var U=Z&&Z.debugTiming?y.time:y.notime;U("layout",function(){var re=U(" buildLayoutGraph",function(){return H(z)});U(" runLayout",function(){_(re,U)}),U(" updateInputGraph",function(){S(z,re)})})}function _(z,Z){Z(" makeSpaceForEdgeLabels",function(){$(z)}),Z(" removeSelfEdges",function(){W(z)}),Z(" acyclic",function(){t.run(z)}),Z(" nestingGraph.run",function(){u.run(z)}),Z(" rank",function(){s(y.asNonCompoundGraph(z))}),Z(" injectEdgeLabelProxies",function(){V(z)}),Z(" removeEmptyRanks",function(){c(z)}),Z(" nestingGraph.cleanup",function(){u.cleanup(z)}),Z(" normalizeRanks",function(){a(z)}),Z(" assignRankMinMax",function(){Q(z)}),Z(" removeEdgeLabelProxies",function(){J(z)}),Z(" normalize.run",function(){n.run(z)}),Z(" parentDummyChains",function(){i(z)}),Z(" addBorderSegments",function(){f(z)}),Z(" order",function(){h(z)}),Z(" insertSelfEdges",function(){Y(z)}),Z(" adjustCoordinateSystem",function(){p.adjust(z)}),Z(" position",function(){m(z)}),Z(" positionSelfEdges",function(){O(z)}),Z(" removeBorderNodes",function(){B(z)}),Z(" normalize.undo",function(){n.undo(z)}),Z(" fixupEdgeLabelCoords",function(){G(z)}),Z(" undoCoordinateSystem",function(){p.undo(z)}),Z(" translateGraph",function(){M(z)}),Z(" assignNodeIntersects",function(){X(z)}),Z(" reversePoints",function(){P(z)}),Z(" acyclic.undo",function(){t.undo(z)})}function S(z,Z){e.forEach(z.nodes(),function(U){var re=z.node(U),de=Z.node(U);re&&(re.x=de.x,re.y=de.y,Z.children(U).length&&(re.width=de.width,re.height=de.height))}),e.forEach(z.edges(),function(U){var re=z.edge(U),de=Z.edge(U);re.points=de.points,e.has(de,"x")&&(re.x=de.x,re.y=de.y)}),z.graph().width=Z.graph().width,z.graph().height=Z.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function H(z){var Z=new w({multigraph:!0,compound:!0}),U=oe(z.graph());return Z.setGraph(e.merge({},j,F(U,b),e.pick(U,E))),e.forEach(z.nodes(),function(re){var de=oe(z.node(re));Z.setNode(re,e.defaults(F(de,C),T)),Z.setParent(re,z.parent(re))}),e.forEach(z.edges(),function(re){var de=oe(z.edge(re));Z.setEdge(re,e.merge({},I,F(de,R),e.pick(de,L)))}),Z}function $(z){var Z=z.graph();Z.ranksep/=2,e.forEach(z.edges(),function(U){var re=z.edge(U);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(Z.rankdir==="TB"||Z.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function V(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(U.width&&U.height){var re=z.node(Z.v),de=z.node(Z.w),pe={rank:(de.rank-re.rank)/2+re.rank,e:Z};y.addDummyNode(z,"edge-proxy",pe,"_ep")}})}function Q(z){var Z=0;e.forEach(z.nodes(),function(U){var re=z.node(U);re.borderTop&&(re.minRank=z.node(re.borderTop).rank,re.maxRank=z.node(re.borderBottom).rank,Z=e.max(Z,re.maxRank))}),z.graph().maxRank=Z}function J(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);U.dummy==="edge-proxy"&&(z.edge(U.e).labelRank=U.rank,z.removeNode(Z))})}function M(z){var Z=Number.POSITIVE_INFINITY,U=0,re=Number.POSITIVE_INFINITY,de=0,pe=z.graph(),ge=pe.marginx||0,Te=pe.marginy||0;function Ue(He){var Pe=He.x,Se=He.y,nt=He.width,je=He.height;Z=Math.min(Z,Pe-nt/2),U=Math.max(U,Pe+nt/2),re=Math.min(re,Se-je/2),de=Math.max(de,Se+je/2)}e.forEach(z.nodes(),function(He){Ue(z.node(He))}),e.forEach(z.edges(),function(He){var Pe=z.edge(He);e.has(Pe,"x")&&Ue(Pe)}),Z-=ge,re-=Te,e.forEach(z.nodes(),function(He){var Pe=z.node(He);Pe.x-=Z,Pe.y-=re}),e.forEach(z.edges(),function(He){var Pe=z.edge(He);e.forEach(Pe.points,function(Se){Se.x-=Z,Se.y-=re}),e.has(Pe,"x")&&(Pe.x-=Z),e.has(Pe,"y")&&(Pe.y-=re)}),pe.width=U-Z+ge,pe.height=de-re+Te}function X(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z),re=z.node(Z.v),de=z.node(Z.w),pe,ge;U.points?(pe=U.points[0],ge=U.points[U.points.length-1]):(U.points=[],pe=de,ge=re),U.points.unshift(y.intersectRect(re,pe)),U.points.push(y.intersectRect(de,ge))})}function G(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);if(e.has(U,"x"))switch((U.labelpos==="l"||U.labelpos==="r")&&(U.width-=U.labeloffset),U.labelpos){case"l":U.x-=U.width/2+U.labeloffset;break;case"r":U.x+=U.width/2+U.labeloffset;break}})}function P(z){e.forEach(z.edges(),function(Z){var U=z.edge(Z);U.reversed&&U.points.reverse()})}function B(z){e.forEach(z.nodes(),function(Z){if(z.children(Z).length){var U=z.node(Z),re=z.node(U.borderTop),de=z.node(U.borderBottom),pe=z.node(e.last(U.borderLeft)),ge=z.node(e.last(U.borderRight));U.width=Math.abs(ge.x-pe.x),U.height=Math.abs(de.y-re.y),U.x=pe.x+U.width/2,U.y=re.y+U.height/2}}),e.forEach(z.nodes(),function(Z){z.node(Z).dummy==="border"&&z.removeNode(Z)})}function W(z){e.forEach(z.edges(),function(Z){if(Z.v===Z.w){var U=z.node(Z.v);U.selfEdges||(U.selfEdges=[]),U.selfEdges.push({e:Z,label:z.edge(Z)}),z.removeEdge(Z)}})}function Y(z){var Z=y.buildLayerMatrix(z);e.forEach(Z,function(U){var re=0;e.forEach(U,function(de,pe){var ge=z.node(de);ge.order=pe+re,e.forEach(ge.selfEdges,function(Te){y.addDummyNode(z,"selfedge",{width:Te.label.width,height:Te.label.height,rank:ge.rank,order:pe+ ++re,e:Te.e,label:Te.label},"_se")}),delete ge.selfEdges})})}function O(z){e.forEach(z.nodes(),function(Z){var U=z.node(Z);if(U.dummy==="selfedge"){var re=z.node(U.e.v),de=re.x+re.width/2,pe=re.y,ge=U.x-de,Te=re.height/2;z.setEdge(U.e,U.label),z.removeNode(Z),U.label.points=[{x:de+2*ge/3,y:pe-Te},{x:de+5*ge/6,y:pe-Te},{x:de+ge,y:pe},{x:de+5*ge/6,y:pe+Te},{x:de+2*ge/3,y:pe+Te}],U.label.x=U.x,U.label.y=U.y}})}function F(z,Z){return e.mapValues(e.pick(z,Z),Number)}function oe(z){var Z={};return e.forEach(z,function(U,re){Z[re.toLowerCase()]=U}),Z}return Rv}var Mv,eT;function vH(){if(eT)return Mv;eT=1;var e=Rt(),t=Ln(),n=Mr().Graph;Mv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return Mv}var Iv,tT;function xH(){return tT||(tT=1,Iv="0.8.5"),Iv}var $v,nT;function bH(){return nT||(nT=1,$v={graphlib:Mr(),layout:wH(),debug:vH(),util:{time:Ln().time,notime:Ln().notime},version:xH()}),$v}var kH=bH();const rT=xx(kH),go=240,vc=130,Oi=74,Nh=72,oc=Oi+Nh;function YR(e,t){var s;let n=go;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??go);return n}const Ud=420,KR=1;function _H(e,t,n,s){return Math.min(KR,n/Math.max(1,e),s/Math.max(1,t))}function yo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function NH(e,t){return((t==null?void 0:t.get(e))??0)>0?Ud:0}function SH(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function xc(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??go)+NH(e,n),h:Math.max((s==null?void 0:s.height)??vc,SH(e,n))}}function jH(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function EH(e,t,n,s,a,i){const c=new rT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(b=>!a.has(b)),f=new Set(u);for(const b of u){const{w:j,h:E}=xc(b,s,i);c.setNode(b,{width:j,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);rT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of u){const j=c.node(b);if(!j)continue;const E=s.get(b),C=(E==null?void 0:E.width)??go,T=(E==null?void 0:E.height)??vc,R=xc(b,s,i),I=j.x-R.w/2,L=j.y-R.h/2;p.set(b,{x:I,y:L}),I<h&&(h=I),L<m&&(m=L),I+C>y&&(y=I+C),L+T>w&&(w=L+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,j]of p)p.set(b,{x:j.x-h,y:j.y-m});const N=Number.isFinite(y)?y-h:0,_=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const j=a.get(b);if(!j)continue;const E=s.get(b),C=(E==null?void 0:E.width)??go,T=(E==null?void 0:E.height)??vc;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+T}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+T)}}return{positions:p,width:N,height:_,pinnedBox:S}}function XR(e,t,n){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=yo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...EH(u.get(h),t,s,i,a,c)})),gap:YR(e,i)}}const ZR=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+Ud,CH=e=>e.reduce((t,n)=>t+n.height,0)+oc*Math.max(0,e.length-1);function yx(e,t,n,s){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+oc;return p},i=[];for(let f=0;f<e.length;f++){let p=-oc;for(let h=f;h<e.length;h++)i.push(p+=e[h].height+oc)}i.sort((f,p)=>f-p);const c=f=>{let p=0,h=i.length-1;for(;p<h;){const m=p+h>>1;a(i[m]).length<=f?h=m:p=m+1}return a(i[p])};let u=[e];if(n>0&&s>0){const f=h=>_H(h.reduce((m,y)=>m+ZR(y),0)+t*(h.length-1),Math.max(...h.map(CH)),n,s);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function TH(e,t,n,s,a){if(!(s.width>0&&s.height>0&&a.width>0&&a.height>0))return!1;const{laid:i,gap:c}=XR(e,t,n);return i.length<2?!1:yx(i,c,s.width,s.height).length!==yx(i,c,a.width,a.height).length}function AH(e,t,n={}){const s=n.pinned??new Map,{laid:a,gap:i}=XR(e,t,n),c=yx(a,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=ZR(p);let m=0;for(const{positions:y,height:w,pinnedBox:N}of p){for(const[S,b]of y)u.set(S,{x:b.x+f,y:b.y+m});let _=m+w;N&&N.maxY>_&&N.minX<f+h&&f<N.maxX&&(_=N.maxY),m=_+oc}f+=h+i}return e.map(p=>{const h=s.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function RH(e,t,n,s,a){const c=Oi+Nh,u=60,f=w=>xc(w,s,a),p=new Map(e.map(w=>[w.id,yo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:S}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:_,h:S,sid:b});continue}let j=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===b?24:u,I=T.sid===b?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&j<T.y+T.h+I&&T.y<j+S+I});if(!C)break;j=C.y+C.h+(C.sid===b?24:c)}j!==N.y&&(t.set(w,{x:N.x,y:j}),y.push(w)),h.push({x:N.x,y:j,w:_,h:S,sid:b})}return y}function MH(e,t,n,s,a,i,c){const u=E=>xc(E,s,i),f=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??go,ch:(C==null?void 0:C.height)??vc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=yo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,N=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),I=yo(E);y.has(I)?(w.get(I)??w.set(I,[]).get(I)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&N.length===0)return[];const _=Oi+Nh,S=(E,C,T,R)=>N.some(I=>E<I.x+I.w+Oi&&I.x<E+T+Oi&&C<I.y+I.h+_&&I.y<C+R+_),b=YR(e,s),j=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,I=-1/0,L=-1/0,H=-1/0,$=-1/0;for(const P of C){const B=f(P.id),{w:W,h:Y}=u(P.id),{cw:O,ch:F}=p(P.id);T=Math.min(T,B.x),R=Math.min(R,B.y),I=Math.max(I,B.x+W),L=Math.max(L,B.y+Y),H=Math.max(H,B.x+O),$=Math.max($,B.y+F)}const V=I-T,Q=L-R,J=[...new Set(N.map(P=>Math.round(P.x)))].sort((P,B)=>P-B),M=J.length?J:[T],X=[0,...N.map(P=>P.y+P.h+_)].sort((P,B)=>P-B);let G=null;if(h){let P=1/0,B=1/0,W=-1/0,Y=-1/0;for(const U of N)P=Math.min(P,U.x),B=Math.min(B,U.y),W=Math.max(W,U.x+U.cw),Y=Math.max(Y,U.y+U.ch);const O=(U,re)=>{const de=c.width/(Math.max(W,U+H-T)-Math.min(P,U)+Ud),pe=c.height/(Math.max(Y,re+$-R)-Math.min(B,re));return[Math.min(KR,de,pe),Math.min(de,pe),Math.max(de,pe)]},F=(U,re)=>{for(let de=0;de<U.length;de++){if(U[de]>re[de]+1e-9)return!0;if(U[de]<re[de]-1e-9)return!1}return!1},oe=Math.round(W+Ud+b),z=[...new Set([...X,B])].sort((U,re)=>U-re);let Z=null;for(const U of[...M,oe])for(const re of z){if(S(U,re,V,Q))continue;const de=O(U,re);(Z===null||F(de,Z))&&(Z=de,G={x:U,y:re})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const P of M)for(const B of X){if(B>=R)break;if(!S(P,B,V,Q)){G={x:P,y:B};break e}}if(G){const P=G.x-T,B=G.y-R;for(const W of C){const Y=f(W.id);t.set(W.id,{x:Y.x+P,y:Y.y+B})}j.push(E)}for(const P of C){const B=f(P.id),{w:W,h:Y}=u(P.id);N.push({x:B.x,y:B.y,w:W,h:Y,...p(P.id)})}}return j}function IH(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const i=yo(a);(s.get(i)??s.set(i,[]).get(i)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((i,c)=>i.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const i=s.get(yo(a));if(!i)return a;const c=(p=a.data)==null?void 0:p.parentId,u=i.find(h=>h.id===c)??i[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function $H(e,t,n,s,a,i=!1,c){const p=Oi+Nh+1,h=8,m=1.75,y=200,w=.7,N=.01,_=$=>xc($,s,c),S=$=>n.get($)??t.get($),b=new Map;for(const $ of e){if(!S($.id))continue;const V=yo($),Q=b.get(V);Q?Q.push($):b.set(V,[$])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const $ of[...b.keys()].sort()){const V=b.get($);let Q=1/0,J=1/0,M=-1/0,X=-1/0,G=!1;for(const Y of V){const O=S(Y.id),{w:F,h:oe}=_(Y.id);Q=Math.min(Q,O.x),J=Math.min(J,O.y),M=Math.max(M,O.x+F),X=Math.max(X,O.y+oe),n.has(Y.id)&&(G=!0)}const P=M-Q,B=X-J;C.add($);const W=a.get($);W&&(P>W.w+h||B>W.h+h)&&E.add($),a.set($,{w:P,h:B}),j.push({sid:$,members:V.map(Y=>Y.id),x:Q,y:J,w:P,h:B,anchored:G,mass:1})}for(const $ of[...a.keys()])C.has($)||a.delete($);if(i||T)return[];let R=!1;for(let $=0;$<j.length&&!R;$++)for(let V=$+1;V<j.length;V++){const Q=j[$],J=j[V];if(!(Q.anchored&&J.anchored)&&Math.abs(Q.x+Q.w/2-(J.x+J.w/2))<(Q.w+J.w)/2+61&&Math.abs(Q.y+Q.h/2-(J.y+J.h/2))<(Q.h+J.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const $ of j)E.has($.sid)&&($.mass=8);else for(const $ of j)$.mass=Math.max(1,$.w*$.h/(go*vc));const I=new Map(j.map($=>[$.sid,$.x])),L=new Map(j.map($=>[$.sid,$.y]));for(let $=0;$<y;$++){const V=new Map,Q=new Map;let J=0;for(let M=0;M<j.length;M++)for(let X=M+1;X<j.length;X++){const G=j[M],P=j[X];if(G.anchored&&P.anchored)continue;const B=G.x+G.w/2,W=G.y+G.h/2,Y=P.x+P.w/2,O=P.y+P.h/2,F=(G.w+P.w)/2+61-Math.abs(B-Y),oe=(G.h+P.h)/2+p-Math.abs(W-O);if(F<=0||oe<=0)continue;const z=(ke,Ee)=>!ke.anchored&&!(Ee<0&&ke.x<=0),Z=(ke,Ee)=>!ke.anchored&&!(Ee<0&&ke.y<=0),U=(ke,Ee,Ze)=>{const Xe=ke===Ee,ut=Xe?G.sid<P.sid?-1:1:Math.sign(ke-Ee);return Ze(G,ut)||Ze(P,-ut)?ut:Xe&&(Ze(G,-ut)||Ze(P,ut))?-ut:0},re=U(B,Y,z),de=U(W,O,Z),pe=re!==0,ge=de!==0;if(!pe&&!ge)continue;const Te=pe&&(!ge||F*m<oe),[Ue,He,Pe,Se]=Te?[re,F,V,z]:[de,oe,Q,Z],nt=Se(G,Ue),je=Se(P,-Ue),be=G.mass,Ke=P.mass,ct=nt?je?Ke/(be+Ke):1:0,Ye=je?nt?be/(be+Ke):1:0,ce=He*w;Pe.set(G.sid,(Pe.get(G.sid)??0)+Ue*ce*ct),Pe.set(P.sid,(Pe.get(P.sid)??0)-Ue*ce*Ye),J+=ce}for(const M of j)M.anchored||(M.x=Math.max(0,M.x+(V.get(M.sid)??0)),M.y=Math.max(0,M.y+(Q.get(M.sid)??0)));if(J<N)break}const H=[];for(const $ of j){const V=$.x-I.get($.sid),Q=$.y-L.get($.sid);if(!(Math.abs(V)<1&&Math.abs(Q)<1)){for(const J of $.members){if(n.has(J))continue;const M=t.get(J);M&&t.set(J,{x:M.x+V,y:M.y+Q})}H.push($.sid)}}return H}const OH=600;function wx(e,t){return!(e.exitAt!=null&&t-e.exitAt>OH||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function PH(e,t){const n=new Set;for(const s of e.agents.values())wx(s,t)&&n.add(s.id);return n}function LH(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function DH(e,t,n=0){if(!e)return!1;for(const s of t)if(LH(e,s,n))return!0;return!1}const QR="sessionGroup";function qH(e,t){var s,a;if(e.type===QR)return"transparent";if(wo((s=e.data)==null?void 0:s.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const JR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function sT(e){const t={};for(const n of JR)t[n]=e(n);return t}function FH(e){return t=>e[t]??""}function BH(e,t){return JR.every(n=>e[n]===t[n])}function zH(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const eM=.2,tM=1.6;function UH(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:s,zoom:a}=t;return typeof n!="number"||typeof s!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(a)||a<eM||a>tM?null:{x:n,y:s,zoom:a}}const WH=1200,HH=1e3;function aT(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<WH?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<HH}function kd({durationMs:e,documentHidden:t,reducedMotion:n=GH()}){return t||n?!1:Number.isFinite(e)&&e>0}function GH(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ov(e){const t=typeof document<"u"&&document.hidden;return kd({durationMs:e,documentHidden:t})?e:0}function VH(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&c>0&&a<n.height}function YH({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const a of n)if(s=!0,VH(a,t,e))return!1;return s}const KH="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Pv="click for what's new";function XH(e){if(e.checkDisabled)return`${KH} · ${Pv}`;if(e.checking)return`Asking npm for the newest release… · ${Pv}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${Pv}, and to check npm now`}function ZH(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function QH(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function JH(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const vx={kind:"assumed",claude:!0,codex:!0};function e7(e){if(!e||typeof e!="object")return vx;const t=e.providers;if(!t||typeof t!="object")return vx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function t7(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const oT={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function n7(e){const t=e.toLowerCase();return Object.hasOwn(oT,t)?oT[t]:t?t[0].toUpperCase()+t.slice(1):""}function r7(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function r9(e,t=[]){const n=t.length?r7(t.map(n7)):t7(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function s7(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},n=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,n]}function a7(e,t){const n=t.prefs??gx,s=wc(n.done.level),a=wc(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
284
284
|
|
|
285
285
|
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
|
|
286
286
|
|
|
287
287
|
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
|
|
288
288
|
|
|
289
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function Wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const iT=99;function JH(e){const t=Math.max(0,Math.floor(e));return t>iT?`${iT}+`:String(t)}const e7="Pause the canvas";function t7(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${Wd(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${Wd(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function n7(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const nM="paused · full",r7=(e,t)=>t>0?nM:e>0?`paused · ${JH(e)}`:"paused";function s7(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:r7(e.held,t),widest:nM,title:t>0?`Connected — the pause is full at ${Wd(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Wd(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}const a7=x.lazy(()=>vT(()=>import("./UsageHistoryModal-zExZpRWU.js"),[])),o7=x.lazy(()=>vT(()=>import("./BrowserWatchModal-DD6srgsk.js"),[]));function lT(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const i7={agent:q5,sessionGroup:y6,recapNote:v6},l7={recapTie:x6},c7=300,cT=130,u7=160,rM="react-flow__node";function uT(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,rM))===!0}const Lv=80,Dv=.86;function dT(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const s of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=s.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function d7(e){try{const t=document.querySelector(`.${rM}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const h7=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),f7=420;function p7(e){return e<.35?"far":e<.55?"mid":"full"}const ud=18,m7=200,g7=5*6e4,y7=6,w7=2*6e4,hT=400,_0="agent-dag.layout",N0="agent-dag.layoutFrame",S0="agent-dag.viewport",sM="agent-dag.sessionListOpen",aM="agent-dag.detailOpen",oM="agent-dag.usagePanelOpen",iM="agent-dag.systemPanelOpen",fT="agent-dag.accountsPanelOpen",qv="agent-dag.versionNoticeDismissed",pT="agent-dag.oldNameNoticeDismissed",v7=15*6e4,Fv={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"},dd="agent-dag.autoRestart",mT="agent-dag.bundleReloadedFor";function x7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sM)==="1"}catch{return!1}}function b7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sM,e?"1":"0")}catch{}}function k7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(aM)==="1"}catch{return!1}}function _7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(aM,e?"1":"0")}catch{}}function N7(){const e=yo(oM);return e===null?!0:e==="1"}function S7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oM,e?"1":"0")}catch{}}function j7(){const e=yo(iM);return e===null?!0:e==="1"}function E7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iM,e?"1":"0")}catch{}}function C7(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(_0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function hd(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(_0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function T7(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(N0);if(!e)return null;const t=JSON.parse(e);return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}catch{return null}}function A7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N0,JSON.stringify(e))}catch{}}function R7(){if(typeof window>"u")return null;try{return PH(window.localStorage.getItem(S0))}catch{return null}}function M7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(S0,JSON.stringify(e))}catch{}}function gT(){if(!(typeof window>"u")){try{window.localStorage.removeItem(_0)}catch{}try{window.localStorage.removeItem(S0)}catch{}try{window.localStorage.removeItem(N0)}catch{}}}function I7(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},i=JSON.stringify(a,null,2),c=new Blob([i],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const lM={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},$7={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function O7({cat:e}){return l.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:$7[e]})})}const Hd={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},cM=fA,yT=new WeakMap;function P7(e,t){let n=yT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map},yT.set(e,n));const{byId:s}=n;return a=>{let i=s.get(a.id);return i||(i={...a,onOpenContext:t},s.set(a.id,i)),i}}function uM(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function L7(e,t,n,s,a,i,c,u,f,p,h,m,y,w,N,_,j,k){var Q,M,K,G;const S=[],E=[],C=P7(e,k);for(const P of e.agents.values()){if(!j.has(P.id))continue;const H=P.exitAt!=null,L=_!=null&&!_.has(P.id),U=[H?"rf-exiting":"",L?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,$=i.get(P.id);if(S.push({id:P.id,type:"agent",position:{x:0,y:0},data:C(P),className:U,ariaLabel:z5(P,t),...$?{width:$.width,height:$.height}:null}),P.parentId&&j.has(P.parentId)){const Y=$d(P.sessionId),J=H,z=N.size>0&&(N.has(P.id)||N.has(P.parentId)),re=_!=null&&!_.has(P.id)&&!_.has(P.parentId),le=P.state==="active"?2:1.5,me=z?le+1.5:le,ge=J?.2:re?.12:1,Me=["sess-edge",P.state==="active"?"sess-live":"sess-idle",J?"rf-edge-exiting":"",z?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${P.parentId}->${P.id}`,source:P.parentId,target:P.id,animated:(P.state==="active"||z)&&!J,type:"smoothstep",style:{"--session-hue":Y,strokeWidth:me,opacity:ge,transition:"var(--edge-transition)"},className:Me})}const V=P.kind==="root"?rh(P):null,he=V?cA(P.sessionId,V.at):null;if(V&&he&&!M5(he)){const Y=Hx(P.id),J=$d(P.sessionId),z=i.get(Y);S.push({id:Y,type:"recapNote",position:{x:0,y:0},data:{sessionId:P.sessionId,parentId:P.id,recap:V,noteKey:he,hue:J},className:L?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${P.label}`,...z?{width:z.width,height:z.height}:null}),E.push({id:`e:recap:${P.id}`,source:Y,target:P.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":J}})}}const T=uM(e),R=`${y}#lanes:${vH(T)}`,I=new Set(S.filter(P=>P.type==="recapNote").map(P=>P.id));for(const P of Array.from(h.keys()))P5(P)&&!I.has(P)&&!a.has(P)&&(h.delete(P),m.delete(P));const F=S.filter(P=>MB(P.id,a,h,m));if(F.length>0||R!==w.current){if(F.length>0){const P=jH(_H(S,E,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:T}),a,H=>kd(H,h,m)?void 0:h.get(H));for(const H of P)kd(H.id,h,m)&&O_(H.id,H.position,h,m);SH(S,h,a,i,new Set(F.filter(H=>H.type!=="recapNote").map(H=>H.id)),T,{width:n,height:s});for(const H of F){if(H.type!=="recapNote")continue;const L=(Q=H.data)==null?void 0:Q.parentId;if(!L)continue;const U=a.get(L)??(kd(L,h,m)?void 0:h.get(L));if(!U)continue;const $=((M=i.get(H.id))==null?void 0:M.width)??c7,V=((K=i.get(H.id))==null?void 0:K.height)??cT,he=((G=i.get(L))==null?void 0:G.height)??cT;O_(H.id,{x:U.x-u7-$,y:U.y+(he-V)/2},h,m)}}NH(S,h,a,i,T),w.current=R}const W=EH(S,h,a,i,c,!f||p,T);W.length>0&&u(W);const O=TB(e.agents.values());id(h,O),id(m,O),id(a,O),id(i,CB(e.agents.values()));const B=[];let Z=!1;for(const P of S){let H=a.get(P.id)??h.get(P.id);H||(H=IB(P.id,h,m),Z=!0),B.push({...P,position:H})}return Z&&(w.current=""),{nodes:B,edges:E}}function D7(){return l.jsx(Dx,{children:l.jsx(B7,{})})}const q7=e=>e.transform[2]>=e.maxZoom,F7=e=>e.transform[2]<=e.minZoom;function B7(){var bl,xt,Xo,Ba;const e=Sc(),t=gt(q7),n=gt(F7),s=Wt(),a=x.useState(rx)[0],i=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(D=>D+1),[]),[f,p]=x.useState(k7);x.useEffect(()=>{_7(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[N,_]=x.useState(null),j=x.useCallback((D,q)=>{m(ae=>{if(!q)return new Set([D]);const oe=new Set(ae);return oe.has(D)?oe.delete(D):oe.add(D),oe}),w(ae=>q&&ae===D?ae:D),q||p(!0)},[]),k=x.useCallback(()=>{m(new Set),w(null)},[]),[S,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(D=>T(D),[]),[I,F]=x.useState(!1),[W,O]=x.useState(!1),[B,Z]=x.useState(!1),Q=x.useRef(null),[M,K]=x.useState(x7);x.useEffect(()=>{b7(M)},[M]);const[G,P]=x.useState(N7);x.useEffect(()=>{S7(G)},[G]);const[H,L]=x.useState(j7);x.useEffect(()=>{E7(H)},[H]);const U=x.useRef(!1),[$,V]=x.useState(()=>{const D=(()=>{try{const q=window.localStorage.getItem(fT);return q===null?!0:q==="1"}catch{return!0}})();return D&&M?(U.current=!0,!1):D});x.useEffect(()=>{if(!(!$&&U.current))try{window.localStorage.setItem(fT,$?"1":"0")}catch{}},[$]),x.useEffect(()=>{!M&&U.current&&(U.current=!1,V(!0))},[M]);const he=up($,200),Y=up(G,130),J=up(H,130),[z,re]=x.useState(null);x.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}re(D===null?!0:D==="on")},[]);const le=x.useCallback(()=>{re(D=>{var ae;const q=D!==!0;try{localStorage.setItem("agent-dag.sound",q?"on":"off")}catch{}return q&&((ae=Ce.current)==null||ae.unlock()),q})},[]),me=x.useCallback(D=>{le()},[le]),ge=x.useRef(me);ge.current=me;const Me=x.useRef(z);Me.current=z;const[qe,Ve]=x.useState(()=>G8(yo)),Ue=x.useRef(qe);Ue.current=qe;const Se=x.useRef(null),Qe=x.useCallback((D,q=!1)=>{var ae,oe;if((ae=Ce.current)==null||ae.unlock(),Se.current!==null&&clearTimeout(Se.current),Se.current=null,!q){(oe=Ce.current)==null||oe.play(D,!0);return}Se.current=setTimeout(()=>{var Ee;Se.current=null,(Ee=Ce.current)==null||Ee.play(D,!0)},B8)},[]),Ne=x.useCallback((D,q)=>{Ve(ae=>{const oe={level:wc(q.level??ae[D].level),figure:BA(D,q.figure??ae[D].figure)};try{localStorage.setItem(zA[D],String(oe.level)),localStorage.setItem(UA[D],oe.figure)}catch{}return{...ae,[D]:oe}}),Qe(D,!0)},[Qe]);x.useEffect(()=>()=>{Se.current!==null&&clearTimeout(Se.current)},[]);const[_e,ue]=x.useState(!1),je=x.useRef(null),Ce=x.useRef(null),[Fe,We]=x.useState("locked");x.useEffect(()=>{const D=Y8({enabled:()=>Me.current===!0,prefs:()=>Ue.current,onState:We});Ce.current=D,We(D.state());const q=()=>D.unlock();return window.addEventListener("pointerdown",q,{once:!0,capture:!0}),window.addEventListener("keydown",q,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",q,{capture:!0}),window.removeEventListener("keydown",q,{capture:!0})}},[]);const[He,ot]=x.useState(!1),[wt,ut]=x.useState(!1),[ee,ke]=x.useState(null),[Be,et]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(qv)??""}catch{return""}}),[ht,Je]=x.useState(!1),tt=x.useRef(0),[it,bt]=x.useState(!1),nt=x.useCallback((D=!1)=>(D&&(tt.current=Date.now(),bt(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(q=>q.ok?q.json():null).then(q=>{q&&ke(q)}).catch(()=>{}).finally(()=>{D&&bt(!1)})),[]),pt=x.useCallback(()=>{nt(Date.now()-tt.current>=v7)},[nt]);x.useEffect(()=>{nt();const D=window.setInterval(pt,5*6e4),q=()=>{document.visibilityState==="visible"&&pt()};return document.addEventListener("visibilitychange",q),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",q)}},[nt,pt]),x.useEffect(()=>{He&&nt()},[He,nt]),x.useEffect(()=>{const D=rB();let q=null;const ae=Ge=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:D,looking:Ge}),keepalive:!0}).catch(()=>{})},oe=()=>{const Ge=tB(document);nB(q,Ge)&&ae(Ge),q=Ge},Ee=()=>{q&&ae(!1),q=!1};oe();const ve=window.setInterval(oe,eB);return window.addEventListener("focus",oe),window.addEventListener("blur",oe),document.addEventListener("visibilitychange",oe),window.addEventListener("pagehide",Ee),()=>{window.clearInterval(ve),window.removeEventListener("focus",oe),window.removeEventListener("blur",oe),document.removeEventListener("visibilitychange",oe),window.removeEventListener("pagehide",Ee),Ee()}},[]);const fe=(ee==null?void 0:ee.notice)??null,[lt,vt]=x.useState(null),Gt=x.useRef(!1);x.useEffect(()=>{if(Gt.current)return;const D=$_(),q=hB(D),ae=wB({stored:q,running:(ee==null?void 0:ee.running)??null,notes:I_,remembers:fB(D)});if(ae.reason==="no-version")return;Gt.current=!0,ae.record&&pB(D,ae.record);const oe=yB({tourSeen:mB(D),decision:ae}),Ee=ae.show.length?{entries:ae.show,since:q,firstRun:!1}:null;oe.tour&&Z(!0),oe.notes==="now"?vt(Ee):oe.notes==="after"&&(Q.current=Ee)},[ee==null?void 0:ee.running]);const Dt=(ee==null?void 0:ee.running)??"3.23.0",Gn=x.useMemo(()=>WA(I_,null,Dt),[Dt]),It=x.useCallback(()=>{vt({entries:Gn,since:null,firstRun:!1})},[Gn]),[Vn,Yn]=x.useState(null),[qt,Kn]=x.useState(vx);x.useEffect(()=>{let D=!1;return fetch("/api/health").then(q=>q.ok?q.json():null).then(q=>{D||(Kn(VH(q)),!(!q||typeof q.workspace!="string")&&Yn(q.workspace))}).catch(()=>{}),()=>{D=!0}},[He]);const te=x.useRef(qt);te.current=qt;const Ae=fe?`${fe.kind}:${fe.to}`:"",Oe=fe!=null&&Be!==Ae,Re=x.useCallback(()=>{et("");try{window.localStorage.setItem(qv,"")}catch{}},[]),Le=x.useCallback(()=>{if(fe){et(Ae);try{window.localStorage.setItem(qv,Ae)}catch{}}},[fe,Ae]),[ct,Ct]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(pT)??""}catch{return""}}),yt=ee!=null&&ee.invokedAs&&ee.invokedAs!==Zt?ee.invokedAs:null,Zr=yt!=null&&ct!==yt,kt=x.useCallback(()=>{if(yt){Ct(yt);try{window.localStorage.setItem(pT,yt)}catch{}}},[yt]),Jt=((bl=ee==null?void 0:ee.upgrade)==null?void 0:bl.state)??"idle",rn=x8(ee==null?void 0:ee.upgrade),$r=x.useRef(!1),ko=x.useCallback(async()=>{if(ys($r.current||Jt==="running")){$r.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await nt(),$r.current=!1}},[Jt,nt]);x.useEffect(()=>{if(Jt!=="running")return;const D=window.setInterval(nt,3e3);return()=>window.clearInterval(D)},[Jt,nt]);const Ki=x.useCallback(async()=>{const D=ee==null?void 0:ee.command;!D||!await Vx(D)||(Je(!0),window.setTimeout(()=>Je(!1),1600))},[ee==null?void 0:ee.command]),ua=x.useCallback(()=>{K(D=>(D||V(q=>(q&&(U.current=!0),!1)),!D))},[]),da=x.useCallback(()=>{U.current=!1,V(D=>(D||K(!1),!D))},[]),[ha,_s]=x.useState(!1),[fa,pa]=x.useState(!1),[St,Xi]=x.useState(()=>{try{return Number(localStorage.getItem(P_))||0}catch{return 0}}),[Ns,_o]=x.useState([]),[Or,ma]=x.useState(!1);x.useEffect(()=>{let D=!0;const q=()=>{fetch("/api/browser-watch?live=0").then(oe=>oe.ok?oe.json():null).then(oe=>{var Ee;!D||!(oe!=null&&oe.ok)||(_o(oe.episodes??[]),ma(((Ee=oe.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};q();const ae=setInterval(q,5*6e4);return()=>{D=!1,clearInterval(ae)}},[]);const[No,dr]=x.useState([]),vn=x.useRef(new Set),[Pr,jn]=x.useState(null);x.useEffect(()=>{let D=!0,q=0;const ae=()=>{fetch("/api/lan").then(oe=>oe.ok?oe.json():null).then(oe=>D?(oe!=null&&oe.ok&&dr(__(Array.isArray(oe.pending)?oe.pending:[],oe.aliases)),oe):null).catch(()=>null).then(oe=>{D&&(q=window.setTimeout(ae,(oe==null?void 0:oe.enabled)===!0?fx:DA))})};return ae(),()=>{D=!1,window.clearTimeout(q)}},[]);const Oc=x.useCallback(async(D,q)=>{if(!Pr){jn(D);try{const oe=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:q})})).json().catch(()=>null);oe&&Array.isArray(oe.pending)?dr(__(oe.pending,oe.aliases)):dr(Ee=>Ee.filter(ve=>ve.fp!==q))}catch{}finally{jn(null)}}},[Pr]),ga=x.useMemo(()=>ZB(Ns,St).length,[Ns,St]),[Sh,ya]=x.useState(0),wa=x.useRef(null),[va,xa]=x.useState(!1),ba=x.useRef(null),[jh,So]=x.useState(0),En=x.useState(()=>DB({protect:D=>CL(i.current,D)}))[0],[Ss,ka]=x.useState(!1),Zi=x.useCallback(()=>{const D=En.paused&&En.dropped>0,q=En.setPaused(!En.paused);D&&TL(i.current);for(const ae of q)i.current=g1(i.current,ae);ka(En.paused)},[En]),[Ft,mt]=x.useState(Date.now()),[hr,_a]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(dd)!=="0"}catch{return!0}}),jo=x.useRef(!1),Pc=x.useCallback(()=>{const D=!hr;jo.current=!0;try{window.localStorage.removeItem(dd)}catch{}_a(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&_a(((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1)}).catch(()=>{})},[hr]),[fr,Na]=x.useState(!1),[Qi,Eo]=x.useState("restart"),[pr,mr]=x.useState(null),xn=x.useRef(!1),js=x.useRef(null),Es=x.useRef(0),Pn=x.useCallback(async D=>{if(!ys(xn.current))return;const q=(D==null?void 0:D.upgrade)===!0;xn.current=!0,js.current=rn;const ae=++Es.current;Eo(q?"npx":"restart"),Na(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(fe==null?void 0:fe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:q})})}catch{}window.setTimeout(()=>{if(Es.current===ae&&xn.current){xn.current=!1,Na(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},q?18e4:3e4)},[fe==null?void 0:fe.to,rn]),Ji=x.useRef(null);x.useEffect(()=>{const D=E_(i.current.agents.values())>0,q=S8({enabled:hr,kind:fe==null?void 0:fe.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Oe,visible:document.visibilityState==="visible",busy:D,idleSince:Ji.current,now:Ft});Ji.current=q.idleSince,q.restart&&Pn()},[hr,fe==null?void 0:fe.kind,ee==null?void 0:ee.canRestart,Oe,Ft,Pn]);const el=E_(i.current.agents.values()),Cs=N8(el),Lc=FA({enabled:hr,kind:fe==null?void 0:fe.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Oe,visible:document.visibilityState==="visible",busy:el>0,idleSince:Ji.current,now:Ft});x.useEffect(()=>{const D=ee==null?void 0:ee.running;let q=null,ae=null;try{q=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(mT)}catch{return}const oe=v8({bundle:"3.23.0",running:D,pending:q,lastTried:ae});if(oe==="reload"){try{window.sessionStorage.setItem(mT,D??"")}catch{return}window.location.reload();return}if(oe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,Na(!1),mr(D??null);const Ee=window.setTimeout(()=>mr(null),6e3);return()=>window.clearTimeout(Ee)},[ee==null?void 0:ee.running]),x.useEffect(()=>{if(fr&&b8({asked:js.current,reported:rn})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,Na(!1)}},[fr,rn]);const tl=x.useState(()=>OH(C7()))[0],Bt=x.useRef(tl.pinned),Sa=x.useRef(null),Co=x.useState(()=>R7())[0],[Qr,ja]=x.useState(()=>new Set),[Ln,Ea]=x.useState(BB),[Ts,Eh]=x.useState(()=>sT(lT)),To=x.useMemo(()=>IH(Ts),[Ts]),Ao=x.useCallback(D=>MH(D,To),[To]),[Ro,Dc]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Ln;try{window.localStorage.setItem(YA,Ln)}catch{}Eh(D=>{const q=sT(lT);return $H(D,q)?D:q})},[Ln]);const hn=x.useCallback((D,q)=>{if(_d({durationMs:q,documentHidden:document.hidden})){e.setViewport(D,{duration:q});return}const{d3Zoom:ae,d3Selection:oe}=s.getState(),Ee=oe==null?void 0:oe.property("__zoom");if(ae&&oe&&Ee&&Ee.k>0&&D.zoom>0){ae.transform(oe,Ee.scale(D.zoom/Ee.k).translate((D.x-Ee.x)/D.zoom,(D.y-Ee.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,s]),Jr=x.useRef(null);x.useEffect(()=>{if(!Co)return;const D=window.setTimeout(()=>{try{hn(Co,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(D)},[hn,Co]);const Ca=x.useRef(!0),[As,Ta]=x.useState(null);x.useEffect(()=>{const D=new EventSource("/events"),q=PB(u,{now:()=>Date.now(),setTimeout:(ve,Ge)=>window.setTimeout(ve,Ge),clearTimeout:ve=>window.clearTimeout(ve)});let ae=!1;const oe=typeof BroadcastChannel=="function"?HB(new BroadcastChannel(UB),Math.random().toString(36).slice(2),()=>ae):null,Ee=window.setInterval(()=>{ae||!oe||oe.ask(600).then(ve=>{ae||ut(WB(ve))})},3e3);return D.addEventListener("open",()=>{ot(!0),Dc(!0)}),D.addEventListener("error",()=>{ot(!1),Ta(null)}),D.addEventListener("open",()=>{ae=!0,ut(!1)}),D.addEventListener("error",()=>{ae=!1}),D.addEventListener("replay-end",()=>{Ca.current=!1,q.flush(),Ta(Date.now())}),D.addEventListener("hook",ve=>{var Ge;try{const rt=JSON.parse(ve.data);if(!En.accept(rt))return;i.current=g1(i.current,rt);const _t=rt.replay===!0||Ca.current||Date.now()-rt.receivedAt>3e4;_t?q.replay():q.live();const Ze=V8(rt,_t);Ze&&((Ge=Ce.current)==null||Ge.play(Ze))}catch{}}),()=>{D.close(),q.cancel(),window.clearInterval(Ee),oe==null||oe.leave()}},[u]),x.useEffect(()=>{const D=setInterval(()=>{const q=Date.now();mt(q);let ae=AL(i.current,q,m1);RL(i.current,q,m1)&&(ae=!0);const oe=[],Ee=ve=>{oe.push(ve)};jL(i.current,q,m7,g7,Ee)&&(ae=!0),EL(i.current,q,y7,w7,Ee)&&(ae=!0),oe.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})}).catch(()=>{}),m(ve=>EB(ve,i.current.agents)),w(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),T(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),E(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),ae&&u()},250);return()=>clearInterval(D)},[u]);const Rs=x.useRef(null),Xn=x.useRef(0),bn=420,Vt=x.useCallback((D=500)=>{const q=Lv,ae=1,oe=.2,Ee=Dv;try{const ve=document.querySelector(".canvas-wrap"),Ge=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ot=>Ot.offsetWidth>0);if(!ve||Ge.length===0)return;const rt=ve.getBoundingClientRect(),_t=e.getViewport();if(!Number.isFinite(_t.zoom)||_t.zoom<=0)return;const Ze=Ot=>(Ot-rt.left-_t.x)/_t.zoom,an=Ot=>(Ot-rt.top-_t.y)/_t.zoom,os=Ge.map(Ot=>Ot.getBoundingClientRect()),Zo=Math.min(...os.map(Ot=>Ze(Ot.left))),kl=Math.max(...os.map(Ot=>Ze(Ot.right))),Qo=Math.min(...os.map(Ot=>an(Ot.top))),_l=Math.max(...os.map(Ot=>an(Ot.bottom))),nu=kl-Zo,Jo=_l-Qo;if(!(nu>0&&Jo>0))return;const za=Math.max(oe,Math.min(ae,(rt.width-dT(ve)-q*2)/(nu+bn)*Ee,(rt.height-q*2)/Jo*Ee)),Ua={x:q-Zo*za,y:Math.max(q,(rt.height-Jo*za)/2)-Qo*za,zoom:za};hn(Ua,D),Xn.current=Date.now(),Jr.current=_d({durationMs:D,documentHidden:document.hidden})?{target:Ua,until:Date.now()+D+60}:null,window.setTimeout(()=>{var Ot;try{((Ot=Jr.current)==null?void 0:Ot.target)===Ua&&(Jr.current=null);const vr=e.getViewport();(Math.abs(vr.zoom-za)>.01||Math.abs(vr.x-Ua.x)>2)&&hn(Ua,0)}catch{}},D+60)}catch{}},[e,hn]);x.useEffect(()=>{const D=()=>{if(!document.hidden)return;const q=Jr.current;if(Jr.current=null,!(!q||Date.now()>q.until)){try{hn(q.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[hn]);const Aa=x.useRef(""),es=x.useRef(null),qc=x.useRef(0),Ms=x.useCallback(()=>{qc.current=Date.now()},[]),Ra=x.useRef(null),Is=x.useRef(0),$s=x.useCallback(()=>{Is.current=Date.now()},[]),nl=x.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:Is.current}),[]),Ch="agent-dag.autoFitDisabled",ts=x.useRef(!1),[rl,Mo]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Ch)}catch{}},[]);const sl=x.useCallback(()=>{ts.current||(ts.current=!0,Mo(!0))},[]),Fc=x.useCallback(()=>{ts.current=!1,Mo(!1),Vt(400)},[e,Vt]);x.useEffect(()=>{const D=setInterval(()=>{if(ts.current||Date.now()-qc.current<800)return;const q=i.current,ae=Date.now(),oe=[];for(const ve of q.agents.values())wx(ve,ae)&&oe.push({id:ve.id});if(oe.length===0)return;const Ee=[];for(const{id:ve}of oe){const Ge=ns.current.get(ve),rt=Bt.current.get(ve)??sn.current.get(ve);!Ge||!rt||Ee.push({x:rt.x,y:rt.y,width:Ge.width,height:Ge.height})}BH({pane:Ra.current,viewport:e.getViewport(),boxes:Ee})&&Vt(600)},1500);return()=>clearInterval(D)},[e]);const al=x.useRef(!1),ns=x.useRef(new Map),Bc=x.useRef(0),zc=x.useCallback(D=>{const q=ns.current;let ae=!1;for(const oe of D.nodeInternals.values()){const Ee=oe.width,ve=oe.height;if(Ee==null||ve==null)continue;const Ge=q.get(oe.id);Ge?(Math.abs(Ge.height-ve)>4||Math.abs(Ge.width-Ee)>4)&&(q.set(oe.id,{width:Ee,height:ve}),ae=!0):(q.set(oe.id,{width:Ee,height:ve}),ae=!0)}return ae&&(Bc.current+=1),Bc.current},[]),Uc=gt(zc),[Wc,Th]=x.useState(0);x.useEffect(()=>{let D=0;const q=()=>{const oe=ns.current;let Ee=!1;for(const ve of document.querySelectorAll(".react-flow__node[data-id]")){const Ge=ve.getAttribute("data-id");if(!Ge)continue;const rt=ve.offsetWidth,_t=ve.offsetHeight;if(!rt||!_t)continue;const Ze=oe.get(Ge);(!Ze||Math.abs(Ze.width-rt)>4||Math.abs(Ze.height-_t)>4)&&(oe.set(Ge,{width:rt,height:_t}),Ee=!0)}Ee&&Th(ve=>ve+1)};if(al.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(q,32):D=requestAnimationFrame(q),()=>{cancelAnimationFrame(D),window.clearTimeout(ae)}});const sn=x.useRef(tl.positions),Io=x.useRef(new Set),$o=x.useRef(""),Os=x.useMemo(()=>{const D=[];for(const q of i.current.agents.values())wx(q,Ft)&&D.push(q.id+(q.parentId?`>${q.parentId}`:""));return D.sort(),`${D.join("|")}#sv${Uc}.${Wc}`},[i.current,i.current.revision,Ft,Uc,Wc]),Ma=x.useRef(null);x.useEffect(()=>(Ma.current!=null&&window.clearTimeout(Ma.current),Ma.current=window.setTimeout(()=>{hd(sn.current,Bt.current)},1500),()=>{Ma.current!=null&&window.clearTimeout(Ma.current)}),[Os]),x.useEffect(()=>{if(Aa.current===Os)return;const D=Aa.current;if(Aa.current=Os,!D||ts.current)return;Date.now()-Xn.current>1200&&Vt(400),Rs.current&&window.clearTimeout(Rs.current),Rs.current=window.setTimeout(()=>{ts.current||Vt(500)},280)},[Os,e,Vt]);const Oo=x.useMemo(()=>RB(i.current,h),[i.current,i.current.revision,h]),ol=x.useMemo(()=>TH(i.current,Ft),[i.current,i.current.revision,Ft]),Po=x.useRef(null),[Ia,Hc]=x.useState({w:0,h:0});x.useEffect(()=>{const D=Po.current;if(!D||typeof ResizeObserver>"u")return;const q=new ResizeObserver(ae=>{var Ee;const oe=(Ee=ae[0])==null?void 0:Ee.contentRect;oe&&(Ra.current={width:oe.width,height:oe.height},Hc(ve=>Math.abs(ve.w-oe.width)>40||Math.abs(ve.h-oe.height)>40?{w:oe.width,h:oe.height}:ve))});return q.observe(D),Ra.current={width:D.clientWidth,height:D.clientHeight},Hc({w:D.clientWidth,h:D.clientHeight}),()=>q.disconnect()},[]);const Ah=x.useCallback(D=>{var ae,oe;const q=D.target;!(q!=null&&q.closest)||q.closest(h7)!==D.currentTarget||(D.preventDefault(),(oe=(ae=document.activeElement)==null?void 0:ae.blur)==null||oe.call(ae))},[]),Rh=x.useRef(new Map),[Lo,il]=x.useState(!1);x.useEffect(()=>{const D=window.setTimeout(()=>il(!0),2500);return()=>window.clearTimeout(D)},[]);const[$a,ll]=x.useState(!1),gr=x.useRef(null),[Ps,cl]=x.useState(!1),[Gc,Vc]=x.useState("full"),rs=x.useRef("full"),Mh=x.useCallback(()=>{gr.current&&(window.clearTimeout(gr.current),gr.current=null),ll(!1)},[]),Ih=x.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{ll(!0),gr.current&&window.clearTimeout(gr.current),gr.current=window.setTimeout(()=>ll(!1),f7+80)})},[]);x.useEffect(()=>()=>{gr.current&&window.clearTimeout(gr.current)},[]);const fn=y?i.current.agents.get(y):null,Yc=f&&fn!=null,[Kc,Oa]=x.useState(0);x.useEffect(()=>{const D=dT(Po.current);Oa(q=>Math.abs(q-D)>40?D:q)},[J,Y,G,Yc,Ia.w]);const Lr=Ia.w>0?Math.max(0,(Ia.w-Kc-Lv*2)*Dv):0,Do=Ia.h>0?Math.max(0,(Ia.h-Lv*2)*Dv):0,qo=L5(),{nodes:yr,edges:ul}=x.useMemo(()=>L7(i.current,Ft,Lr,Do,Bt.current,ns.current,Rh.current,Ih,Lo,Ps,sn.current,Io.current,Os,$o,h,Oo,ol,R),[i.current,i.current.revision,Ft,Lr,Do,Lo,Ps,Os,h,Oo,ol,R,Sh,qo]),dl=x.useState(T7)[0],Fo=x.useRef(dl);x.useEffect(()=>{if(!Lo||Ps)return;const D={width:Lr,height:Do};if(!(D.width>0&&D.height>0))return;const q=Fo.current;if(Fo.current=D,A7(D),!q||q.width===D.width&&q.height===D.height)return;const ae={direction:"LR",pinned:Bt.current,measured:ns.current,lanes:uM(i.current)};if(kH(yr,ul,ae,q,D)){for(const oe of Array.from(sn.current.keys()))Bt.current.has(oe)||sn.current.delete(oe);Io.current.clear(),$o.current="",u(),window.setTimeout(()=>{hd(sn.current,Bt.current),!ts.current&&Vt(500)},80)}},[Lr,Do,Lo,Ps,u,Vt]);const hl=x.useMemo(()=>{const D=new Map;for(const ae of yr){const oe=ae.data;if(!(oe!=null&&oe.sessionId)||oe.exitAt!=null)continue;const Ee=ae.width,ve=ae.height;if(Ee==null||ve==null)continue;const Ge=ae.position.x,rt=ae.position.y,_t=Ge+Ee,Ze=rt+ve,an=D.get(oe.sessionId);an?(an.minX=Math.min(an.minX,Ge),an.minY=Math.min(an.minY,rt),an.maxX=Math.max(an.maxX,_t),an.maxY=Math.max(an.maxY,Ze)):D.set(oe.sessionId,{minX:Ge,minY:rt,maxX:_t,maxY:Ze})}const q=[];for(const[ae,oe]of D){const Ee=oe.maxX-oe.minX+ud*2,ve=oe.maxY-oe.minY+ud*2;q.push({id:`group:${ae}`,type:QR,position:{x:oe.minX-ud,y:oe.minY-ud},data:{sessionId:ae,w:Ee,h:ve},width:Ee,height:ve,style:{width:Ee,height:ve},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return q},[yr]),Xc=x.useMemo(()=>{const D=[...hl,...yr],q=ba.current;return!q||q.size===0?D:D.map(ae=>{const oe=q.get(ae.id);return oe?{...ae,position:oe}:ae})},[hl,yr,jh]),Pa=x.useMemo(()=>{const D=new Set;for(const q of i.current.agents.values())for(const ae of q.tools)D.add(cM(ae.name));return Object.keys(lM).filter(q=>D.has(q))},[i.current,i.current.revision]);x.useEffect(()=>{if(Pa.length<=1){xa(!1);return}let D=0;const q=()=>{const ae=wa.current;if(ae&&!document.hidden){const oe=ae.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ge=>Ge.getBoundingClientRect()),ve=RH(oe,Ee,8);xa(Ge=>Ge===ve?Ge:ve)}D=window.setTimeout(q,300)};return q(),()=>window.clearTimeout(D)},[Pa.length]);const $h=x.useCallback(D=>{ja(q=>{const ae=new Set(q);return ae.has(D)?ae.delete(D):ae.add(D),ae})},[]),fl=N?xL(i.current.agents,N):null,Zc=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}i.current=rx(),Bt.current.clear(),ns.current.clear(),sn.current.clear(),$o.current="",gT(),k(),u()},[u,k]),Qc=x.useRef(I);Qc.current=I;const Jc=x.useRef(W);Jc.current=W;const kn=x.useRef(!1);kn.current=fl!=null||ha||C!=null||B||S!=null||fa||W||lt!=null;const Dr=x.useCallback(D=>{const q=j8(D,{confirmOpen:Qc.current,modalOpen:kn.current});q==="confirm"?F(!0):q==="clear"&&(F(!1),Zc())},[Zc]),Bo=x.useCallback(()=>{Bt.current.clear(),sn.current.clear(),$o.current="",gT(),u(),window.setTimeout(()=>Vt(500),80)},[u,e,Vt]),pl=x.useCallback(()=>Vt(500),[Vt]),La=x.useRef(yr);La.current=yr;const zo=x.useRef(y);zo.current=y;const Ls=x.useCallback(D=>{const q=La.current.filter(ve=>ve.type==="agent"),ae=kB(q.map(ve=>({id:ve.id,x:ve.position.x,y:ve.position.y})),zo.current,D),oe=ae?q.find(ve=>ve.id===ae):void 0;if(!oe)return;const Ee=uT(document.activeElement);j(oe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:Ov(350),nodes:[oe]})}catch{}Xn.current=Date.now(),Ee&&d7(oe.id)},30)},[j,e]),ml=x.useRef(null),Ds=x.useCallback(D=>{j(D,!1),window.setTimeout(()=>{try{const q=La.current.find(ae=>ae.id===D);q&&e.fitView({padding:.3,duration:Ov(500),nodes:[q]}),Xn.current=Date.now()}catch{}},60)},[j,e]),ss=x.useRef(null);x.useEffect(()=>{let D=-1/0;const q=()=>{D=performance.now()},ae=oe=>{ss.current=performance.now()-D<250?oe.target:null};return window.addEventListener("pointerdown",q,!0),window.addEventListener("focusin",ae,!0),()=>{window.removeEventListener("pointerdown",q,!0),window.removeEventListener("focusin",ae,!0)}},[]),x.useEffect(()=>{const D=q=>{var rt,_t;const ae=q.target,oe={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(rt=ae==null?void 0:ae.getAttribute)==null?void 0:rt.call(ae,"role"),type:ae==null?void 0:ae.type,pointerFocused:ae!=null&&ae===ss.current};if(q.key==="Escape"){const Ze=l5({overlayOpen:Ld.depth()>0,typing:Wx(oe)});Ze==="dismiss"?Ld.dismissTop():Ze==="blur"?ae==null||ae.blur():(jB(oe)&&(ae==null||ae.blur()),k());return}if(th(q))return;const Ee=uT(ae)?(_t=ae==null?void 0:ae.getAttribute)==null?void 0:_t.call(ae,"data-id"):null,ve=Ee&&La.current.some(Ze=>Ze.id===Ee)?Ee:null,Ge=NB(q,ve);if(Ge.kind==="activate"){q.preventDefault(),j(Ge.nodeId,Ge.additive);return}if(Ge.kind!=="node"&&!(Ge.nodeId==null&&y5(oe,q.key))&&!w5({key:q.key,modalOpen:kn.current,sheetOpen:Jc.current})){if(q.key===" "&&(q.preventDefault(),Zi()),(q.key==="c"||q.key==="C")&&Dr("shortcut"),(q.key==="r"||q.key==="R")&&Bo(),(q.key==="f"||q.key==="F")&&pl(),(q.key==="l"||q.key==="L")&&ua(),q.key==="d"||q.key==="D")if(zo.current)p(Ze=>!Ze);else{const Ze=ip(i.current.agents.values());Ze.length>0?Ds(Ze[0].id):Ls(1)}if((q.key==="h"||q.key==="H")&&_s(Ze=>!Ze),(q.key==="u"||q.key==="U")&&P(Ze=>!Ze),(q.key==="a"||q.key==="A")&&te.current.claude&&da(),(q.key==="j"||q.key==="J")&&Ls(1),(q.key==="k"||q.key==="K")&&Ls(-1),q.key==="w"||q.key==="W"){const Ze=QL(ip(i.current.agents.values()),ml.current);Ze&&(ml.current=Ze.id,Ds(Ze.id))}(q.key==="t"||q.key==="T")&&Ea(Ze=>Ze==="dark"?"light":"dark"),(q.key==="m"||q.key==="M")&&te.current.claude&&Me.current!==null&&ge.current(q.shiftKey),(q.key==="s"||q.key==="S")&&L(Ze=>!Ze),(q.key==="b"||q.key==="B")&&pa(Ze=>!Ze),(q.key==="v"||q.key==="V")&&te.current.claude&&Me.current!==null&&ue(Ze=>!Ze),q.key==="?"&&O(Ze=>!Ze)}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[Dr,Bo,pl,k,j,Ls,Ds,Zi]);const Uo=i.current.agents.size,$t=x.useMemo(()=>ip(i.current.agents.values()),[i.current,i.current.revision]),Wo=x.useMemo(()=>JL(i.current.agents.values()),[i.current,i.current.revision]),gl=x.useRef(null);x.useEffect(()=>{const D=GB({waiting:$t.length,running:Wo,connected:He}),q=gl.current;if(gl.current=D,(q==null?void 0:q.title)!==D.title&&(document.title=D.title),(q==null?void 0:q.icon)!==D.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=VB[D.icon])}},[$t.length,Wo,He]);const[Ho,qs]=x.useState(""),Go=KB($t);x.useEffect(()=>{qs(D=>XB(D,Go))},[Go]);const[Da,Vo]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[qr,Yo]=x.useState(null),[qa,Ko]=x.useState(!1),[eu,yl]=x.useState(!1);x.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(q=>q.ok?q.json():null).then(q=>{var ae,oe,Ee;if(!(!D||!(q!=null&&q.ok))){if(!jo.current){let ve=!1;try{ve=window.localStorage.getItem(dd)==="0",window.localStorage.removeItem(dd)}catch{}ve&&((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1?(_a(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):_a(((oe=q.prefs)==null?void 0:oe.autoUpdate)!==!1)}Ko(((Ee=q.prefs)==null?void 0:Ee.notifications)===!0),yl(q.notificationsVetoed===!0)}}).catch(()=>{}),()=>{D=!1}},[]);const wr=x.useRef(()=>{}),wl=x.useCallback(()=>{const D=!qa;Ko(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&wr.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&(Ko(((ae=q.prefs)==null?void 0:ae.notifications)===!0),yl(q.notificationsVetoed===!0))}).catch(()=>{})},[qa]),vl=typeof Notification<"u";x.useEffect(()=>{if(!qr)return;const q=setTimeout(()=>Yo(null),qr==="blocked"?8e3:4e3);return()=>clearTimeout(q)},[qr]);const tu=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const q=D;Vo(q),q==="granted"?Yo("on"):q==="denied"&&Yo("blocked")})},[]);wr.current=tu;const Fa=x.useRef(new Set),as=x.useRef(null),Oh=$t.map(D=>eh(D.id,D.waiting)).join("|");x.useEffect(()=>{r5(as.current,Da)&&(as.current=Da,Fa.current=lp($t))},[Da]);const xl=x.useRef(!1);return x.useEffect(()=>{s5(xl.current,As)&&(xl.current=!0,Fa.current=lp($t))},[As]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!a5(as.current,As))return;const D=typeof document>"u"||!document.hidden,q=t5($t,Fa.current,D,qa);for(const ae of q)try{const oe=new Notification(ae.title,{body:ae.body,tag:ae.key});oe.onclick=()=>{window.focus(),Ds(ae.sessionId),oe.close()}}catch{}Fa.current=D?lp($t):n5($t,q,Fa.current)},[Oh,As]),l.jsxs("div",{className:"app",children:[l.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),l.jsxs("header",{className:"topbar",children:[l.jsxs("div",{className:"readout",children:[l.jsxs("div",{className:"brand",children:[l.jsx("span",{className:"logo"}),l.jsx("h1",{children:Zt}),fe?l.jsxs("button",{type:"button",className:"v stale",onClick:()=>{It(),Re()},"aria-haspopup":"dialog","aria-label":HH({...fe,open:Oe}),title:fe.kind==="restart"?`Running v${fe.from}; v${fe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${fe.from}; v${fe.to} is on npm · click for what's new`,children:["v",fe.from,l.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:Dt,latest:ee==null?void 0:ee.latest,latestPending:ee==null?void 0:ee.latestPending,checkedAgo:ee!=null&&ee.checkedAt?yd(Ft-ee.checkedAt):null,checkFailedAgo:ee!=null&&ee.checkFailedAt&&ee.checkFailedAt>(ee.checkedAt??0)?yd(Ft-ee.checkFailedAt):null,checkDisabled:ee==null?void 0:ee.checkDisabled,checking:it};return l.jsxs("button",{type:"button",className:it?"v checking":"v",onClick:()=>{It(),nt(!0)},"aria-busy":it||void 0,"aria-haspopup":"dialog","aria-label":WH(D),title:UH(D),children:["v",D.running]})})()]}),l.jsx("span",{className:"status",children:(()=>{const D=s7({connected:He,paused:Ss,held:En.size,dropped:En.dropped});return D.resting?null:l.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:l.jsxs("span",{className:"pill-box",children:[l.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),l.jsx("span",{className:"pill-label",children:D.label})]})})})()}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ho}),$t.length>0&&l.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{ml.current=$t[0].id,Ds($t[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
290
|
-
${$t.map(D=>` ${D.label}: ${
|
|
291
|
-
`)}`,"aria-label":`${$t.length} session${$t.length===1?"":"s"} waiting for you`,children:[l.jsx("span",{className:"ap-pulse","aria-hidden":!0}),l.jsx("b",{children:$t.length})," ",l.jsx("span",{className:"ws-word",children:"waiting"})]}),
|
|
289
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function Wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const iT=99;function o7(e){const t=Math.max(0,Math.floor(e));return t>iT?`${iT}+`:String(t)}const i7="Pause the canvas";function l7(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${Wd(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${Wd(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function c7(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const nM="paused · full",u7=(e,t)=>t>0?nM:e>0?`paused · ${o7(e)}`:"paused";function d7(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:u7(e.held,t),widest:nM,title:t>0?`Connected — the pause is full at ${Wd(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Wd(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}const h7=x.lazy(()=>vT(()=>import("./UsageHistoryModal-DEZjEWrd.js"),[])),f7=x.lazy(()=>vT(()=>import("./BrowserWatchModal-plr3Bmmv.js"),[]));function lT(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const p7={agent:q5,sessionGroup:y6,recapNote:v6},m7={recapTie:x6},g7=300,cT=130,y7=160,rM="react-flow__node";function uT(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,rM))===!0}const Lv=80,Dv=.86;function dT(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const s of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=s.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function w7(e){try{const t=document.querySelector(`.${rM}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const v7=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),x7=420;function b7(e){return e<.35?"far":e<.55?"mid":"full"}const cd=18,k7=200,_7=5*6e4,N7=6,S7=2*6e4,hT=400,_0="agent-dag.layout",N0="agent-dag.layoutFrame",S0="agent-dag.viewport",sM="agent-dag.sessionListOpen",aM="agent-dag.detailOpen",oM="agent-dag.usagePanelOpen",iM="agent-dag.systemPanelOpen",fT="agent-dag.accountsPanelOpen",qv="agent-dag.versionNoticeDismissed",pT="agent-dag.oldNameNoticeDismissed",j7=15*6e4,Fv={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"},ud="agent-dag.autoRestart",mT="agent-dag.bundleReloadedFor";function E7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sM)==="1"}catch{return!1}}function C7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(sM,e?"1":"0")}catch{}}function T7(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(aM)==="1"}catch{return!1}}function A7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(aM,e?"1":"0")}catch{}}function R7(){const e=vo(oM);return e===null?!0:e==="1"}function M7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oM,e?"1":"0")}catch{}}function I7(){const e=vo(iM);return e===null?!0:e==="1"}function $7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(iM,e?"1":"0")}catch{}}function O7(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(_0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function dd(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(_0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function P7(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(N0);if(!e)return null;const t=JSON.parse(e);return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}catch{return null}}function L7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N0,JSON.stringify(e))}catch{}}function D7(){if(typeof window>"u")return null;try{return UH(window.localStorage.getItem(S0))}catch{return null}}function q7(e){if(!(typeof window>"u"))try{window.localStorage.setItem(S0,JSON.stringify(e))}catch{}}function gT(){if(!(typeof window>"u")){try{window.localStorage.removeItem(_0)}catch{}try{window.localStorage.removeItem(S0)}catch{}try{window.localStorage.removeItem(N0)}catch{}}}function F7(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},i=JSON.stringify(a,null,2),c=new Blob([i],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const lM={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},B7={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function z7({cat:e}){return l.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:B7[e]})})}const Hd={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},cM=fA,yT=new WeakMap;function U7(e,t){let n=yT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map},yT.set(e,n));const{byId:s}=n;return a=>{let i=s.get(a.id);return i||(i={...a,onOpenContext:t},s.set(a.id,i)),i}}function uM(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function W7(e,t,n,s,a,i,c,u,f,p,h,m,y,w,N,_,S,b){var J,M,X,G;const j=[],E=[],C=U7(e,b);for(const P of e.agents.values()){if(!S.has(P.id))continue;const B=P.exitAt!=null,W=_!=null&&!_.has(P.id),Y=[B?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,O=i.get(P.id);if(j.push({id:P.id,type:"agent",position:{x:0,y:0},data:C(P),className:Y,ariaLabel:z5(P,t),...O?{width:O.width,height:O.height}:null}),P.parentId&&S.has(P.parentId)){const z=Id(P.sessionId),Z=B,U=N.size>0&&(N.has(P.id)||N.has(P.parentId)),re=_!=null&&!_.has(P.id)&&!_.has(P.parentId),de=P.state==="active"?2:1.5,pe=U?de+1.5:de,ge=Z?.2:re?.12:1,Te=["sess-edge",P.state==="active"?"sess-live":"sess-idle",Z?"rf-edge-exiting":"",U?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${P.parentId}->${P.id}`,source:P.parentId,target:P.id,animated:(P.state==="active"||U)&&!Z,type:"smoothstep",style:{"--session-hue":z,strokeWidth:pe,opacity:ge,transition:"var(--edge-transition)"},className:Te})}const F=P.kind==="root"?rh(P):null,oe=F?cA(P.sessionId,F.at):null;if(F&&oe&&!M5(oe)){const z=Hx(P.id),Z=Id(P.sessionId),U=i.get(z);j.push({id:z,type:"recapNote",position:{x:0,y:0},data:{sessionId:P.sessionId,parentId:P.id,recap:F,noteKey:oe,hue:Z},className:W?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${P.label}`,...U?{width:U.width,height:U.height}:null}),E.push({id:`e:recap:${P.id}`,source:z,target:P.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":Z}})}}const T=uM(e),R=`${y}#lanes:${jH(T)}`,I=new Set(j.filter(P=>P.type==="recapNote").map(P=>P.id));for(const P of Array.from(h.keys()))P5(P)&&!I.has(P)&&!a.has(P)&&(h.delete(P),m.delete(P));const L=j.filter(P=>qB(P.id,a,h,m));if(L.length>0||R!==w.current){if(L.length>0){const P=IH(AH(j,E,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:T}),a,B=>bd(B,h,m)?void 0:h.get(B));for(const B of P)bd(B.id,h,m)&&O_(B.id,B.position,h,m);MH(j,h,a,i,new Set(L.filter(B=>B.type!=="recapNote").map(B=>B.id)),T,{width:n,height:s});for(const B of L){if(B.type!=="recapNote")continue;const W=(J=B.data)==null?void 0:J.parentId;if(!W)continue;const Y=a.get(W)??(bd(W,h,m)?void 0:h.get(W));if(!Y)continue;const O=((M=i.get(B.id))==null?void 0:M.width)??g7,F=((X=i.get(B.id))==null?void 0:X.height)??cT,oe=((G=i.get(W))==null?void 0:G.height)??cT;O_(B.id,{x:Y.x-y7-O,y:Y.y+(oe-F)/2},h,m)}}RH(j,h,a,i,T),w.current=R}const H=$H(j,h,a,i,c,!f||p,T);H.length>0&&u(H);const $=PB(e.agents.values());od(h,$),od(m,$),od(a,$),od(i,OB(e.agents.values()));const V=[];let Q=!1;for(const P of j){let B=a.get(P.id)??h.get(P.id);B||(B=FB(P.id,h,m),Q=!0),V.push({...P,position:B})}return Q&&(w.current=""),{nodes:V,edges:E}}function H7(){return l.jsx(Dx,{children:l.jsx(Y7,{})})}const G7=e=>e.transform[2]>=e.maxZoom,V7=e=>e.transform[2]<=e.minZoom;function Y7(){var _l,xt,Qo,Ua;const e=Sc(),t=wt(G7),n=wt(V7),s=Ht(),a=x.useState(rx)[0],i=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(D=>D+1),[]),[f,p]=x.useState(T7);x.useEffect(()=>{A7(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[N,_]=x.useState(null),S=x.useCallback((D,q)=>{m(ae=>{if(!q)return new Set([D]);const ie=new Set(ae);return ie.has(D)?ie.delete(D):ie.add(D),ie}),w(ae=>q&&ae===D?ae:D),q||p(!0)},[]),b=x.useCallback(()=>{m(new Set),w(null)},[]),[j,E]=x.useState(null),[C,T]=x.useState(null),R=x.useCallback(D=>T(D),[]),[I,L]=x.useState(!1),[H,$]=x.useState(!1),[V,Q]=x.useState(!1),J=x.useRef(null),[M,X]=x.useState(E7);x.useEffect(()=>{C7(M)},[M]);const[G,P]=x.useState(R7);x.useEffect(()=>{M7(G)},[G]);const[B,W]=x.useState(I7);x.useEffect(()=>{$7(B)},[B]);const Y=x.useRef(!1),[O,F]=x.useState(()=>{const D=(()=>{try{const q=window.localStorage.getItem(fT);return q===null?!0:q==="1"}catch{return!0}})();return D&&M?(Y.current=!0,!1):D});x.useEffect(()=>{if(!(!O&&Y.current))try{window.localStorage.setItem(fT,O?"1":"0")}catch{}},[O]),x.useEffect(()=>{!M&&Y.current&&(Y.current=!1,F(!0))},[M]);const oe=up(O,200),z=up(G,130),Z=up(B,130),[U,re]=x.useState(null);x.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}re(D===null?!0:D==="on")},[]);const de=x.useCallback(()=>{re(D=>{var ae;const q=D!==!0;try{localStorage.setItem("agent-dag.sound",q?"on":"off")}catch{}return q&&((ae=Ye.current)==null||ae.unlock()),q})},[]),pe=x.useCallback(D=>{de()},[de]),ge=x.useRef(pe);ge.current=pe;const Te=x.useRef(U);Te.current=U;const[Ue,He]=x.useState(()=>J8(vo)),Pe=x.useRef(Ue);Pe.current=Ue;const Se=x.useRef(null),nt=x.useCallback((D,q=!1)=>{var ae,ie;if((ae=Ye.current)==null||ae.unlock(),Se.current!==null&&clearTimeout(Se.current),Se.current=null,!q){(ie=Ye.current)==null||ie.play(D,!0);return}Se.current=setTimeout(()=>{var Ce;Se.current=null,(Ce=Ye.current)==null||Ce.play(D,!0)},Y8)},[]),je=x.useCallback((D,q)=>{He(ae=>{const ie={level:wc(q.level??ae[D].level),figure:BA(D,q.figure??ae[D].figure)};try{localStorage.setItem(zA[D],String(ie.level)),localStorage.setItem(UA[D],ie.figure)}catch{}return{...ae,[D]:ie}}),nt(D,!0)},[nt]);x.useEffect(()=>()=>{Se.current!==null&&clearTimeout(Se.current)},[]);const[be,Ke]=x.useState(!1),ct=x.useRef(null),Ye=x.useRef(null),[ce,ke]=x.useState("locked");x.useEffect(()=>{const D=tB({enabled:()=>Te.current===!0,prefs:()=>Pe.current,onState:ke});Ye.current=D,ke(D.state());const q=()=>D.unlock();return window.addEventListener("pointerdown",q,{once:!0,capture:!0}),window.addEventListener("keydown",q,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",q,{capture:!0}),window.removeEventListener("keydown",q,{capture:!0})}},[]);const[Ee,Ze]=x.useState(!1),[Xe,ut]=x.useState(!1),[ee,Ne]=x.useState(null),[Be,et]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(qv)??""}catch{return""}}),[pt,tt]=x.useState(!1),rt=x.useRef(0),[lt,bt]=x.useState(!1),st=x.useCallback((D=!1)=>(D&&(rt.current=Date.now(),bt(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(q=>q.ok?q.json():null).then(q=>{q&&Ne(q)}).catch(()=>{}).finally(()=>{D&&bt(!1)})),[]),mt=x.useCallback(()=>{st(Date.now()-rt.current>=j7)},[st]);x.useEffect(()=>{st();const D=window.setInterval(mt,5*6e4),q=()=>{document.visibilityState==="visible"&&mt()};return document.addEventListener("visibilitychange",q),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",q)}},[st,mt]),x.useEffect(()=>{Ee&&st()},[Ee,st]),x.useEffect(()=>{const D=uB();let q=null;const ae=We=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:D,looking:We}),keepalive:!0}).catch(()=>{})},ie=()=>{const We=lB(document);cB(q,We)&&ae(We),q=We},Ce=()=>{q&&ae(!1),q=!1};ie();const ve=window.setInterval(ie,iB);return window.addEventListener("focus",ie),window.addEventListener("blur",ie),document.addEventListener("visibilitychange",ie),window.addEventListener("pagehide",Ce),()=>{window.clearInterval(ve),window.removeEventListener("focus",ie),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",ie),window.removeEventListener("pagehide",Ce),Ce()}},[]);const ze=(ee==null?void 0:ee.notice)??null,[Dt,me]=x.useState(null),gt=x.useRef(!1);x.useEffect(()=>{if(gt.current)return;const D=$_(),q=vB(D),ae=SB({stored:q,running:(ee==null?void 0:ee.running)??null,notes:I_,remembers:xB(D)});if(ae.reason==="no-version")return;gt.current=!0,ae.record&&bB(D,ae.record);const ie=NB({tourSeen:kB(D),decision:ae}),Ce=ae.show.length?{entries:ae.show,since:q,firstRun:!1}:null;ie.tour&&Q(!0),ie.notes==="now"?me(Ce):ie.notes==="after"&&(J.current=Ce)},[ee==null?void 0:ee.running]);const kt=(ee==null?void 0:ee.running)??"3.23.2",jn=x.useMemo(()=>WA(I_,null,kt),[kt]),En=x.useCallback(()=>{me({entries:jn,since:null,firstRun:!1})},[jn]),[Yn,qt]=x.useState(null),[Ft,Kn]=x.useState(vx);x.useEffect(()=>{let D=!1;return fetch("/api/health").then(q=>q.ok?q.json():null).then(q=>{D||(Kn(e7(q)),!(!q||typeof q.workspace!="string")&&qt(q.workspace))}).catch(()=>{}),()=>{D=!0}},[Ee]);const te=x.useRef(Ft);te.current=Ft;const Ae=ze?`${ze.kind}:${ze.to}`:"",Ie=ze!=null&&Be!==Ae,Me=x.useCallback(()=>{et("");try{window.localStorage.setItem(qv,"")}catch{}},[]),De=x.useCallback(()=>{if(ze){et(Ae);try{window.localStorage.setItem(qv,Ae)}catch{}}},[ze,Ae]),[dt,Tt]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(pT)??""}catch{return""}}),vt=ee!=null&&ee.invokedAs&&ee.invokedAs!==Zt?ee.invokedAs:null,Qr=vt!=null&&dt!==vt,_t=x.useCallback(()=>{if(vt){Tt(vt);try{window.localStorage.setItem(pT,vt)}catch{}}},[vt]),Jt=((_l=ee==null?void 0:ee.upgrade)==null?void 0:_l.state)??"idle",rn=E8(ee==null?void 0:ee.upgrade),Pr=x.useRef(!1),No=x.useCallback(async()=>{if(ws(Pr.current||Jt==="running")){Pr.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await st(),Pr.current=!1}},[Jt,st]);x.useEffect(()=>{if(Jt!=="running")return;const D=window.setInterval(st,3e3);return()=>window.clearInterval(D)},[Jt,st]);const Zi=x.useCallback(async()=>{const D=ee==null?void 0:ee.command;!D||!await Vx(D)||(tt(!0),window.setTimeout(()=>tt(!1),1600))},[ee==null?void 0:ee.command]),ha=x.useCallback(()=>{X(D=>(D||F(q=>(q&&(Y.current=!0),!1)),!D))},[]),fa=x.useCallback(()=>{Y.current=!1,F(D=>(D||X(!1),!D))},[]),[pa,Ns]=x.useState(!1),[ma,ga]=x.useState(!1),[jt,Qi]=x.useState(()=>{try{return Number(localStorage.getItem(P_))||0}catch{return 0}}),[Ss,So]=x.useState([]),[Lr,ya]=x.useState(!1);x.useEffect(()=>{let D=!0;const q=()=>{fetch("/api/browser-watch?live=0").then(ie=>ie.ok?ie.json():null).then(ie=>{var Ce;!D||!(ie!=null&&ie.ok)||(So(ie.episodes??[]),ya(((Ce=ie.settings)==null?void 0:Ce.enabled)===!0))}).catch(()=>{})};q();const ae=setInterval(q,5*6e4);return()=>{D=!1,clearInterval(ae)}},[]);const[jo,dr]=x.useState([]),vn=x.useRef(new Set),[Dr,Cn]=x.useState(null);x.useEffect(()=>{let D=!0,q=0;const ae=()=>{fetch("/api/lan").then(ie=>ie.ok?ie.json():null).then(ie=>D?(ie!=null&&ie.ok&&dr(__(Array.isArray(ie.pending)?ie.pending:[],ie.aliases)),ie):null).catch(()=>null).then(ie=>{D&&(q=window.setTimeout(ae,(ie==null?void 0:ie.enabled)===!0?fx:DA))})};return ae(),()=>{D=!1,window.clearTimeout(q)}},[]);const Oc=x.useCallback(async(D,q)=>{if(!Dr){Cn(D);try{const ie=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:q})})).json().catch(()=>null);ie&&Array.isArray(ie.pending)?dr(__(ie.pending,ie.aliases)):dr(Ce=>Ce.filter(ve=>ve.fp!==q))}catch{}finally{Cn(null)}}},[Dr]),wa=x.useMemo(()=>sz(Ss,jt).length,[Ss,jt]),[Sh,va]=x.useState(0),xa=x.useRef(null),[ba,ka]=x.useState(!1),_a=x.useRef(null),[jh,Eo]=x.useState(0),Tn=x.useState(()=>HB({protect:D=>CL(i.current,D)}))[0],[js,Na]=x.useState(!1),Ji=x.useCallback(()=>{const D=Tn.paused&&Tn.dropped>0,q=Tn.setPaused(!Tn.paused);D&&TL(i.current);for(const ae of q)i.current=g1(i.current,ae);Na(Tn.paused)},[Tn]),[Bt,yt]=x.useState(Date.now()),[hr,Sa]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(ud)!=="0"}catch{return!0}}),Co=x.useRef(!1),Pc=x.useCallback(()=>{const D=!hr;Co.current=!0;try{window.localStorage.removeItem(ud)}catch{}Sa(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&Sa(((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1)}).catch(()=>{})},[hr]),[fr,ja]=x.useState(!1),[el,To]=x.useState("restart"),[pr,mr]=x.useState(null),xn=x.useRef(!1),Es=x.useRef(null),Cs=x.useRef(0),Dn=x.useCallback(async D=>{if(!ws(xn.current))return;const q=(D==null?void 0:D.upgrade)===!0;xn.current=!0,Es.current=rn;const ae=++Cs.current;To(q?"npx":"restart"),ja(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ze==null?void 0:ze.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:q})})}catch{}window.setTimeout(()=>{if(Cs.current===ae&&xn.current){xn.current=!1,ja(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},q?18e4:3e4)},[ze==null?void 0:ze.to,rn]),tl=x.useRef(null);x.useEffect(()=>{const D=E_(i.current.agents.values())>0,q=M8({enabled:hr,kind:ze==null?void 0:ze.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Ie,visible:document.visibilityState==="visible",busy:D,idleSince:tl.current,now:Bt});tl.current=q.idleSince,q.restart&&Dn()},[hr,ze==null?void 0:ze.kind,ee==null?void 0:ee.canRestart,Ie,Bt,Dn]);const nl=E_(i.current.agents.values()),Ts=R8(nl),Lc=FA({enabled:hr,kind:ze==null?void 0:ze.kind,canRestart:(ee==null?void 0:ee.canRestart)===!0,noticeOpen:Ie,visible:document.visibilityState==="visible",busy:nl>0,idleSince:tl.current,now:Bt});x.useEffect(()=>{const D=ee==null?void 0:ee.running;let q=null,ae=null;try{q=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(mT)}catch{return}const ie=j8({bundle:"3.23.2",running:D,pending:q,lastTried:ae});if(ie==="reload"){try{window.sessionStorage.setItem(mT,D??"")}catch{return}window.location.reload();return}if(ie!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,ja(!1),mr(D??null);const Ce=window.setTimeout(()=>mr(null),6e3);return()=>window.clearTimeout(Ce)},[ee==null?void 0:ee.running]),x.useEffect(()=>{if(fr&&C8({asked:Es.current,reported:rn})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}xn.current=!1,ja(!1)}},[fr,rn]);const rl=x.useState(()=>zH(O7()))[0],zt=x.useRef(rl.pinned),Ea=x.useRef(null),Ao=x.useState(()=>D7())[0],[Jr,Ca]=x.useState(()=>new Set),[qn,Ta]=x.useState(YB),[As,Eh]=x.useState(()=>sT(lT)),Ro=x.useMemo(()=>FH(As),[As]),Mo=x.useCallback(D=>qH(D,Ro),[Ro]),[Io,Dc]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=qn;try{window.localStorage.setItem(YA,qn)}catch{}Eh(D=>{const q=sT(lT);return BH(D,q)?D:q})},[qn]);const hn=x.useCallback((D,q)=>{if(kd({durationMs:q,documentHidden:document.hidden})){e.setViewport(D,{duration:q});return}const{d3Zoom:ae,d3Selection:ie}=s.getState(),Ce=ie==null?void 0:ie.property("__zoom");if(ae&&ie&&Ce&&Ce.k>0&&D.zoom>0){ae.transform(ie,Ce.scale(D.zoom/Ce.k).translate((D.x-Ce.x)/D.zoom,(D.y-Ce.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,s]),es=x.useRef(null);x.useEffect(()=>{if(!Ao)return;const D=window.setTimeout(()=>{try{hn(Ao,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(D)},[hn,Ao]);const Aa=x.useRef(!0),[Rs,Ra]=x.useState(null);x.useEffect(()=>{const D=new EventSource("/events"),q=UB(u,{now:()=>Date.now(),setTimeout:(ve,We)=>window.setTimeout(ve,We),clearTimeout:ve=>window.clearTimeout(ve)});let ae=!1;const ie=typeof BroadcastChannel=="function"?QB(new BroadcastChannel(XB),Math.random().toString(36).slice(2),()=>ae):null,Ce=window.setInterval(()=>{ae||!ie||ie.ask(600).then(ve=>{ae||ut(ZB(ve))})},3e3);return D.addEventListener("open",()=>{Ze(!0),Dc(!0)}),D.addEventListener("error",()=>{Ze(!1),Ra(null)}),D.addEventListener("open",()=>{ae=!0,ut(!1)}),D.addEventListener("error",()=>{ae=!1}),D.addEventListener("replay-end",()=>{Aa.current=!1,q.flush(),Ra(Date.now())}),D.addEventListener("hook",ve=>{var We;try{const at=JSON.parse(ve.data);if(!Tn.accept(at))return;i.current=g1(i.current,at);const Nt=at.replay===!0||Aa.current||Date.now()-at.receivedAt>3e4;Nt?q.replay():q.live();const Je=eB(at,Nt);Je&&((We=Ye.current)==null||We.play(Je))}catch{}}),()=>{D.close(),q.cancel(),window.clearInterval(Ce),ie==null||ie.leave()}},[u]),x.useEffect(()=>{const D=setInterval(()=>{const q=Date.now();yt(q);let ae=AL(i.current,q,m1);RL(i.current,q,m1)&&(ae=!0);const ie=[],Ce=ve=>{ie.push(ve)};jL(i.current,q,k7,_7,Ce)&&(ae=!0),EL(i.current,q,N7,S7,Ce)&&(ae=!0),ie.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:ie})}).catch(()=>{}),m(ve=>$B(ve,i.current.agents)),w(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),T(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),E(ve=>ve!=null&&!i.current.agents.has(ve)?null:ve),ae&&u()},250);return()=>clearInterval(D)},[u]);const Ms=x.useRef(null),Xn=x.useRef(0),bn=420,Vt=x.useCallback((D=500)=>{const q=Lv,ae=1,ie=.2,Ce=Dv;try{const ve=document.querySelector(".canvas-wrap"),We=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ot=>Ot.offsetWidth>0);if(!ve||We.length===0)return;const at=ve.getBoundingClientRect(),Nt=e.getViewport();if(!Number.isFinite(Nt.zoom)||Nt.zoom<=0)return;const Je=Ot=>(Ot-at.left-Nt.x)/Nt.zoom,an=Ot=>(Ot-at.top-Nt.y)/Nt.zoom,is=We.map(Ot=>Ot.getBoundingClientRect()),Jo=Math.min(...is.map(Ot=>Je(Ot.left))),Nl=Math.max(...is.map(Ot=>Je(Ot.right))),ei=Math.min(...is.map(Ot=>an(Ot.top))),Sl=Math.max(...is.map(Ot=>an(Ot.bottom))),nu=Nl-Jo,ti=Sl-ei;if(!(nu>0&&ti>0))return;const Wa=Math.max(ie,Math.min(ae,(at.width-dT(ve)-q*2)/(nu+bn)*Ce,(at.height-q*2)/ti*Ce)),Ha={x:q-Jo*Wa,y:Math.max(q,(at.height-ti*Wa)/2)-ei*Wa,zoom:Wa};hn(Ha,D),Xn.current=Date.now(),es.current=kd({durationMs:D,documentHidden:document.hidden})?{target:Ha,until:Date.now()+D+60}:null,window.setTimeout(()=>{var Ot;try{((Ot=es.current)==null?void 0:Ot.target)===Ha&&(es.current=null);const vr=e.getViewport();(Math.abs(vr.zoom-Wa)>.01||Math.abs(vr.x-Ha.x)>2)&&hn(Ha,0)}catch{}},D+60)}catch{}},[e,hn]);x.useEffect(()=>{const D=()=>{if(!document.hidden)return;const q=es.current;if(es.current=null,!(!q||Date.now()>q.until)){try{hn(q.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[hn]);const Ma=x.useRef(""),ts=x.useRef(null),qc=x.useRef(0),Is=x.useCallback(()=>{qc.current=Date.now()},[]),Ia=x.useRef(null),$s=x.useRef(0),Os=x.useCallback(()=>{$s.current=Date.now()},[]),sl=x.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:$s.current}),[]),Ch="agent-dag.autoFitDisabled",ns=x.useRef(!1),[al,$o]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Ch)}catch{}},[]);const ol=x.useCallback(()=>{ns.current||(ns.current=!0,$o(!0))},[]),Fc=x.useCallback(()=>{ns.current=!1,$o(!1),Vt(400)},[e,Vt]);x.useEffect(()=>{const D=setInterval(()=>{if(ns.current||Date.now()-qc.current<800)return;const q=i.current,ae=Date.now(),ie=[];for(const ve of q.agents.values())wx(ve,ae)&&ie.push({id:ve.id});if(ie.length===0)return;const Ce=[];for(const{id:ve}of ie){const We=rs.current.get(ve),at=zt.current.get(ve)??sn.current.get(ve);!We||!at||Ce.push({x:at.x,y:at.y,width:We.width,height:We.height})}YH({pane:Ia.current,viewport:e.getViewport(),boxes:Ce})&&Vt(600)},1500);return()=>clearInterval(D)},[e]);const il=x.useRef(!1),rs=x.useRef(new Map),Bc=x.useRef(0),zc=x.useCallback(D=>{const q=rs.current;let ae=!1;for(const ie of D.nodeInternals.values()){const Ce=ie.width,ve=ie.height;if(Ce==null||ve==null)continue;const We=q.get(ie.id);We?(Math.abs(We.height-ve)>4||Math.abs(We.width-Ce)>4)&&(q.set(ie.id,{width:Ce,height:ve}),ae=!0):(q.set(ie.id,{width:Ce,height:ve}),ae=!0)}return ae&&(Bc.current+=1),Bc.current},[]),Uc=wt(zc),[Wc,Th]=x.useState(0);x.useEffect(()=>{let D=0;const q=()=>{const ie=rs.current;let Ce=!1;for(const ve of document.querySelectorAll(".react-flow__node[data-id]")){const We=ve.getAttribute("data-id");if(!We)continue;const at=ve.offsetWidth,Nt=ve.offsetHeight;if(!at||!Nt)continue;const Je=ie.get(We);(!Je||Math.abs(Je.width-at)>4||Math.abs(Je.height-Nt)>4)&&(ie.set(We,{width:at,height:Nt}),Ce=!0)}Ce&&Th(ve=>ve+1)};if(il.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(q,32):D=requestAnimationFrame(q),()=>{cancelAnimationFrame(D),window.clearTimeout(ae)}});const sn=x.useRef(rl.positions),Oo=x.useRef(new Set),Po=x.useRef(""),Ps=x.useMemo(()=>{const D=[];for(const q of i.current.agents.values())wx(q,Bt)&&D.push(q.id+(q.parentId?`>${q.parentId}`:""));return D.sort(),`${D.join("|")}#sv${Uc}.${Wc}`},[i.current,i.current.revision,Bt,Uc,Wc]),$a=x.useRef(null);x.useEffect(()=>($a.current!=null&&window.clearTimeout($a.current),$a.current=window.setTimeout(()=>{dd(sn.current,zt.current)},1500),()=>{$a.current!=null&&window.clearTimeout($a.current)}),[Ps]),x.useEffect(()=>{if(Ma.current===Ps)return;const D=Ma.current;if(Ma.current=Ps,!D||ns.current)return;Date.now()-Xn.current>1200&&Vt(400),Ms.current&&window.clearTimeout(Ms.current),Ms.current=window.setTimeout(()=>{ns.current||Vt(500)},280)},[Ps,e,Vt]);const Lo=x.useMemo(()=>DB(i.current,h),[i.current,i.current.revision,h]),ll=x.useMemo(()=>PH(i.current,Bt),[i.current,i.current.revision,Bt]),Do=x.useRef(null),[Oa,Hc]=x.useState({w:0,h:0});x.useEffect(()=>{const D=Do.current;if(!D||typeof ResizeObserver>"u")return;const q=new ResizeObserver(ae=>{var Ce;const ie=(Ce=ae[0])==null?void 0:Ce.contentRect;ie&&(Ia.current={width:ie.width,height:ie.height},Hc(ve=>Math.abs(ve.w-ie.width)>40||Math.abs(ve.h-ie.height)>40?{w:ie.width,h:ie.height}:ve))});return q.observe(D),Ia.current={width:D.clientWidth,height:D.clientHeight},Hc({w:D.clientWidth,h:D.clientHeight}),()=>q.disconnect()},[]);const Ah=x.useCallback(D=>{var ae,ie;const q=D.target;!(q!=null&&q.closest)||q.closest(v7)!==D.currentTarget||(D.preventDefault(),(ie=(ae=document.activeElement)==null?void 0:ae.blur)==null||ie.call(ae))},[]),Rh=x.useRef(new Map),[qo,cl]=x.useState(!1);x.useEffect(()=>{const D=window.setTimeout(()=>cl(!0),2500);return()=>window.clearTimeout(D)},[]);const[Pa,ul]=x.useState(!1),gr=x.useRef(null),[Ls,dl]=x.useState(!1),[Gc,Vc]=x.useState("full"),ss=x.useRef("full"),Mh=x.useCallback(()=>{gr.current&&(window.clearTimeout(gr.current),gr.current=null),ul(!1)},[]),Ih=x.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{ul(!0),gr.current&&window.clearTimeout(gr.current),gr.current=window.setTimeout(()=>ul(!1),x7+80)})},[]);x.useEffect(()=>()=>{gr.current&&window.clearTimeout(gr.current)},[]);const fn=y?i.current.agents.get(y):null,Yc=f&&fn!=null,[Kc,La]=x.useState(0);x.useEffect(()=>{const D=dT(Do.current);La(q=>Math.abs(q-D)>40?D:q)},[Z,z,G,Yc,Oa.w]);const qr=Oa.w>0?Math.max(0,(Oa.w-Kc-Lv*2)*Dv):0,Fo=Oa.h>0?Math.max(0,(Oa.h-Lv*2)*Dv):0,Bo=L5(),{nodes:yr,edges:hl}=x.useMemo(()=>W7(i.current,Bt,qr,Fo,zt.current,rs.current,Rh.current,Ih,qo,Ls,sn.current,Oo.current,Ps,Po,h,Lo,ll,R),[i.current,i.current.revision,Bt,qr,Fo,qo,Ls,Ps,h,Lo,ll,R,Sh,Bo]),fl=x.useState(P7)[0],zo=x.useRef(fl);x.useEffect(()=>{if(!qo||Ls)return;const D={width:qr,height:Fo};if(!(D.width>0&&D.height>0))return;const q=zo.current;if(zo.current=D,L7(D),!q||q.width===D.width&&q.height===D.height)return;const ae={direction:"LR",pinned:zt.current,measured:rs.current,lanes:uM(i.current)};if(TH(yr,hl,ae,q,D)){for(const ie of Array.from(sn.current.keys()))zt.current.has(ie)||sn.current.delete(ie);Oo.current.clear(),Po.current="",u(),window.setTimeout(()=>{dd(sn.current,zt.current),!ns.current&&Vt(500)},80)}},[qr,Fo,qo,Ls,u,Vt]);const pl=x.useMemo(()=>{const D=new Map;for(const ae of yr){const ie=ae.data;if(!(ie!=null&&ie.sessionId)||ie.exitAt!=null)continue;const Ce=ae.width,ve=ae.height;if(Ce==null||ve==null)continue;const We=ae.position.x,at=ae.position.y,Nt=We+Ce,Je=at+ve,an=D.get(ie.sessionId);an?(an.minX=Math.min(an.minX,We),an.minY=Math.min(an.minY,at),an.maxX=Math.max(an.maxX,Nt),an.maxY=Math.max(an.maxY,Je)):D.set(ie.sessionId,{minX:We,minY:at,maxX:Nt,maxY:Je})}const q=[];for(const[ae,ie]of D){const Ce=ie.maxX-ie.minX+cd*2,ve=ie.maxY-ie.minY+cd*2;q.push({id:`group:${ae}`,type:QR,position:{x:ie.minX-cd,y:ie.minY-cd},data:{sessionId:ae,w:Ce,h:ve},width:Ce,height:ve,style:{width:Ce,height:ve},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return q},[yr]),Xc=x.useMemo(()=>{const D=[...pl,...yr],q=_a.current;return!q||q.size===0?D:D.map(ae=>{const ie=q.get(ae.id);return ie?{...ae,position:ie}:ae})},[pl,yr,jh]),Da=x.useMemo(()=>{const D=new Set;for(const q of i.current.agents.values())for(const ae of q.tools)D.add(cM(ae.name));return Object.keys(lM).filter(q=>D.has(q))},[i.current,i.current.revision]);x.useEffect(()=>{if(Da.length<=1){ka(!1);return}let D=0;const q=()=>{const ae=xa.current;if(ae&&!document.hidden){const ie=ae.getBoundingClientRect(),Ce=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(We=>We.getBoundingClientRect()),ve=DH(ie,Ce,8);ka(We=>We===ve?We:ve)}D=window.setTimeout(q,300)};return q(),()=>window.clearTimeout(D)},[Da.length]);const $h=x.useCallback(D=>{Ca(q=>{const ae=new Set(q);return ae.has(D)?ae.delete(D):ae.add(D),ae})},[]),ml=N?xL(i.current.agents,N):null,Zc=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}i.current=rx(),zt.current.clear(),rs.current.clear(),sn.current.clear(),Po.current="",gT(),b(),u()},[u,b]),Qc=x.useRef(I);Qc.current=I;const Jc=x.useRef(H);Jc.current=H;const kn=x.useRef(!1);kn.current=ml!=null||pa||C!=null||V||j!=null||ma||H||Dt!=null;const Fr=x.useCallback(D=>{const q=I8(D,{confirmOpen:Qc.current,modalOpen:kn.current});q==="confirm"?L(!0):q==="clear"&&(L(!1),Zc())},[Zc]),Uo=x.useCallback(()=>{zt.current.clear(),sn.current.clear(),Po.current="",gT(),u(),window.setTimeout(()=>Vt(500),80)},[u,e,Vt]),gl=x.useCallback(()=>Vt(500),[Vt]),qa=x.useRef(yr);qa.current=yr;const Wo=x.useRef(y);Wo.current=y;const Ds=x.useCallback(D=>{const q=qa.current.filter(ve=>ve.type==="agent"),ae=TB(q.map(ve=>({id:ve.id,x:ve.position.x,y:ve.position.y})),Wo.current,D),ie=ae?q.find(ve=>ve.id===ae):void 0;if(!ie)return;const Ce=uT(document.activeElement);S(ie.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:Ov(350),nodes:[ie]})}catch{}Xn.current=Date.now(),Ce&&w7(ie.id)},30)},[S,e]),yl=x.useRef(null),qs=x.useCallback(D=>{S(D,!1),window.setTimeout(()=>{try{const q=qa.current.find(ae=>ae.id===D);q&&e.fitView({padding:.3,duration:Ov(500),nodes:[q]}),Xn.current=Date.now()}catch{}},60)},[S,e]),as=x.useRef(null);x.useEffect(()=>{let D=-1/0;const q=()=>{D=performance.now()},ae=ie=>{as.current=performance.now()-D<250?ie.target:null};return window.addEventListener("pointerdown",q,!0),window.addEventListener("focusin",ae,!0),()=>{window.removeEventListener("pointerdown",q,!0),window.removeEventListener("focusin",ae,!0)}},[]),x.useEffect(()=>{const D=q=>{var at,Nt;const ae=q.target,ie={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(at=ae==null?void 0:ae.getAttribute)==null?void 0:at.call(ae,"role"),type:ae==null?void 0:ae.type,pointerFocused:ae!=null&&ae===as.current};if(q.key==="Escape"){const Je=l5({overlayOpen:Pd.depth()>0,typing:Wx(ie)});Je==="dismiss"?Pd.dismissTop():Je==="blur"?ae==null||ae.blur():(IB(ie)&&(ae==null||ae.blur()),b());return}if(th(q))return;const Ce=uT(ae)?(Nt=ae==null?void 0:ae.getAttribute)==null?void 0:Nt.call(ae,"data-id"):null,ve=Ce&&qa.current.some(Je=>Je.id===Ce)?Ce:null,We=RB(q,ve);if(We.kind==="activate"){q.preventDefault(),S(We.nodeId,We.additive);return}if(We.kind!=="node"&&!(We.nodeId==null&&y5(ie,q.key))&&!w5({key:q.key,modalOpen:kn.current,sheetOpen:Jc.current})){if(q.key===" "&&(q.preventDefault(),Ji()),(q.key==="c"||q.key==="C")&&Fr("shortcut"),(q.key==="r"||q.key==="R")&&Uo(),(q.key==="f"||q.key==="F")&&gl(),(q.key==="l"||q.key==="L")&&ha(),q.key==="d"||q.key==="D")if(Wo.current)p(Je=>!Je);else{const Je=ip(i.current.agents.values());Je.length>0?qs(Je[0].id):Ds(1)}if((q.key==="h"||q.key==="H")&&Ns(Je=>!Je),(q.key==="u"||q.key==="U")&&P(Je=>!Je),(q.key==="a"||q.key==="A")&&te.current.claude&&fa(),(q.key==="j"||q.key==="J")&&Ds(1),(q.key==="k"||q.key==="K")&&Ds(-1),q.key==="w"||q.key==="W"){const Je=QL(ip(i.current.agents.values()),yl.current);Je&&(yl.current=Je.id,qs(Je.id))}(q.key==="t"||q.key==="T")&&Ta(Je=>Je==="dark"?"light":"dark"),(q.key==="m"||q.key==="M")&&te.current.claude&&Te.current!==null&&ge.current(q.shiftKey),(q.key==="s"||q.key==="S")&&W(Je=>!Je),(q.key==="b"||q.key==="B")&&ga(Je=>!Je),(q.key==="v"||q.key==="V")&&te.current.claude&&Te.current!==null&&Ke(Je=>!Je),q.key==="?"&&$(Je=>!Je)}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[Fr,Uo,gl,b,S,Ds,qs,Ji]);const Ho=i.current.agents.size,$t=x.useMemo(()=>ip(i.current.agents.values()),[i.current,i.current.revision]),Go=x.useMemo(()=>JL(i.current.agents.values()),[i.current,i.current.revision]),wl=x.useRef(null);x.useEffect(()=>{const D=JB({waiting:$t.length,running:Go,connected:Ee}),q=wl.current;if(wl.current=D,(q==null?void 0:q.title)!==D.title&&(document.title=D.title),(q==null?void 0:q.icon)!==D.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=ez[D.icon])}},[$t.length,Go,Ee]);const[Vo,Fs]=x.useState(""),Yo=nz($t);x.useEffect(()=>{Fs(D=>rz(D,Yo))},[Yo]);const[Fa,Ko]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Br,Xo]=x.useState(null),[Ba,Zo]=x.useState(!1),[eu,vl]=x.useState(!1);x.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(q=>q.ok?q.json():null).then(q=>{var ae,ie,Ce;if(!(!D||!(q!=null&&q.ok))){if(!Co.current){let ve=!1;try{ve=window.localStorage.getItem(ud)==="0",window.localStorage.removeItem(ud)}catch{}ve&&((ae=q.prefs)==null?void 0:ae.autoUpdate)!==!1?(Sa(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):Sa(((ie=q.prefs)==null?void 0:ie.autoUpdate)!==!1)}Zo(((Ce=q.prefs)==null?void 0:Ce.notifications)===!0),vl(q.notificationsVetoed===!0)}}).catch(()=>{}),()=>{D=!1}},[]);const wr=x.useRef(()=>{}),xl=x.useCallback(()=>{const D=!Ba;Zo(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&wr.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(q=>q.ok?q.json():null).then(q=>{var ae;q!=null&&q.ok&&(Zo(((ae=q.prefs)==null?void 0:ae.notifications)===!0),vl(q.notificationsVetoed===!0))}).catch(()=>{})},[Ba]),bl=typeof Notification<"u";x.useEffect(()=>{if(!Br)return;const q=setTimeout(()=>Xo(null),Br==="blocked"?8e3:4e3);return()=>clearTimeout(q)},[Br]);const tu=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const q=D;Ko(q),q==="granted"?Xo("on"):q==="denied"&&Xo("blocked")})},[]);wr.current=tu;const za=x.useRef(new Set),os=x.useRef(null),Oh=$t.map(D=>eh(D.id,D.waiting)).join("|");x.useEffect(()=>{r5(os.current,Fa)&&(os.current=Fa,za.current=lp($t))},[Fa]);const kl=x.useRef(!1);return x.useEffect(()=>{s5(kl.current,Rs)&&(kl.current=!0,za.current=lp($t))},[Rs]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!a5(os.current,Rs))return;const D=typeof document>"u"||!document.hidden,q=t5($t,za.current,D,Ba);for(const ae of q)try{const ie=new Notification(ae.title,{body:ae.body,tag:ae.key});ie.onclick=()=>{window.focus(),qs(ae.sessionId),ie.close()}}catch{}za.current=D?lp($t):n5($t,q,za.current)},[Oh,Rs]),l.jsxs("div",{className:"app",children:[l.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),l.jsxs("header",{className:"topbar",children:[l.jsxs("div",{className:"readout",children:[l.jsxs("div",{className:"brand",children:[l.jsx("span",{className:"logo"}),l.jsx("h1",{children:Zt}),ze?l.jsxs("button",{type:"button",className:"v stale",onClick:()=>{En(),Me()},"aria-haspopup":"dialog","aria-label":QH({...ze,open:Ie}),title:ze.kind==="restart"?`Running v${ze.from}; v${ze.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ze.from}; v${ze.to} is on npm · click for what's new`,children:["v",ze.from,l.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:kt,latest:ee==null?void 0:ee.latest,latestPending:ee==null?void 0:ee.latestPending,checkedAgo:ee!=null&&ee.checkedAt?gd(Bt-ee.checkedAt):null,checkFailedAgo:ee!=null&&ee.checkFailedAt&&ee.checkFailedAt>(ee.checkedAt??0)?gd(Bt-ee.checkFailedAt):null,checkDisabled:ee==null?void 0:ee.checkDisabled,checking:lt};return l.jsxs("button",{type:"button",className:lt?"v checking":"v",onClick:()=>{En(),st(!0)},"aria-busy":lt||void 0,"aria-haspopup":"dialog","aria-label":ZH(D),title:XH(D),children:["v",D.running]})})()]}),l.jsx("span",{className:"status",children:(()=>{const D=d7({connected:Ee,paused:js,held:Tn.size,dropped:Tn.dropped});return D.resting?null:l.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:l.jsxs("span",{className:"pill-box",children:[l.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),l.jsx("span",{className:"pill-label",children:D.label})]})})})()}),l.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Vo}),$t.length>0&&l.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{yl.current=$t[0].id,qs($t[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
290
|
+
${$t.map(D=>` ${D.label}: ${Bi(D.waiting)} (${gd(Bt-D.waiting.since)})`).join(`
|
|
291
|
+
`)}`,"aria-label":`${$t.length} session${$t.length===1?"":"s"} waiting for you`,children:[l.jsx("span",{className:"ap-pulse","aria-hidden":!0}),l.jsx("b",{children:$t.length})," ",l.jsx("span",{className:"ws-word",children:"waiting"})]}),Br&&l.jsx("span",{className:Br==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Br==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:Br==="on"?"notifications on":"notifications blocked"})]}),fn&&(()=>{const D=Vn(fn),q=Math.max(0,((fn.endedAt??Bt)-fn.startedAt)/1e3),ae=fn.state==="active"?zx(D.total,q):null,ie=h.size-1;return l.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${fn.label}`,onClick:()=>{try{const Ce=yr.find(ve=>ve.id===fn.id);Ce&&e.fitView({padding:.35,duration:Ov(500),nodes:[Ce]}),Xn.current=Date.now()}catch{}},children:[l.jsx("span",{className:`state-pill state-${fn.state}`,children:fn.state==="active"?"live":fn.state}),l.jsx("span",{className:"selected-label",children:fn.label}),D.total>0&&l.jsxs("span",{className:"selected-cost",children:[St(D.total),ae?l.jsxs("span",{className:"selected-rate",children:[" · ",ae]}):null]}),ie>0&&l.jsxs("span",{className:"selected-extra",children:["+",ie]}),l.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ce=>{Ce.stopPropagation(),b()},children:"×"})]})})(),l.jsxs("div",{className:"actions",children:[l.jsxs("div",{className:"action-run",children:[l.jsxs("button",{className:"btn icon-btn",onClick:ha,title:`${M?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":M,"aria-controls":M?"session-list":void 0,children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),l.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),l.jsx("span",{className:"tb-word",children:"Session list"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>P(D=>!D),title:`${G?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":G,"aria-controls":G?"usage-panel":void 0,children:[l.jsxs("svg",{className:"tb-glyph-narrow",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M9.4 4.5C9 3.6 8.1 3.1 7 3.1c-1.4 0-2.4.8-2.4 1.9 0 1.2 1.2 1.6 2.4 2s2.4.8 2.4 2c0 1.1-1 1.9-2.4 1.9-1.1 0-2-.5-2.4-1.4"}),l.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),l.jsx("span",{className:"tb-word",children:"Usage"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>Ns(D=>!D),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),l.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),l.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),l.jsx("span",{className:"tb-word",children:"History"})]})]}),l.jsxs("div",{className:"action-run",children:[Ft.claude&&l.jsxs("button",{className:"btn icon-btn",onClick:fa,title:`${O?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":O,"aria-controls":O?"accounts-panel":void 0,children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),l.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),l.jsx("span",{className:"tb-word",children:"Accounts"})]}),l.jsxs("button",{className:"btn icon-btn",onClick:()=>W(D=>!D),title:`${B?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":B,"aria-controls":B?"system-panel":void 0,children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),l.jsx("path",{d:"M5.8 1.4v2.2M8.2 1.4v2.2M5.8 10.4v2.2M8.2 10.4v2.2M1.4 5.8h2.2M1.4 8.2h2.2M10.4 5.8h2.2M10.4 8.2h2.2"})]}),l.jsx("span",{className:"tb-word",children:"Machine"})]}),l.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>ga(D=>!D),title:Lr?"Browser watch — watching; the deck is keeping its own copy (B)":"Browser watch — not watching; reading the browser's history live (B)","aria-label":`Browser watch, ${Lr?"watching":"not watching"}`+(wa>0?`, ${wa} unread`:""),"aria-haspopup":"dialog",children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Lr||wa>0?l.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):l.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),l.jsx("span",{className:"tb-word",children:"Browser watch"}),wa>0&&l.jsx("span",{className:"bw-badge","aria-hidden":!0,children:wa})]})]}),l.jsxs("div",{className:"action-run action-run-utility",children:[Ft.claude&&U!==null&&l.jsxs("div",{className:"sound-slot",children:[l.jsxs("button",{ref:ct,className:"btn icon-btn",onClick:()=>Ke(D=>!D),...aa(!1),title:a7(Ft,{on:U===!0,locked:ce==="locked",prefs:Ue}),"aria-label":`Sound settings, ${U?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":be,"aria-controls":be?"sound-menu":void 0,children:[l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),l.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M10 5.6l2.6 2.8"}),l.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),l.jsx("span",{className:"tb-word",children:"Sound"})]}),be&&l.jsx(oB,{onClose:()=>Ke(!1),soundOn:U===!0,onToggleSound:de,prefs:Ue,onLevel:(D,q)=>je(D,{level:q}),onFigure:(D,q)=>je(D,{figure:q}),onPreview:D=>nt(D),notifyOn:Ba,onToggleNotify:xl,notifyVetoed:eu,notifyPermission:bl?Fa:"unsupported",onAskNotify:tu,openerRef:ct})]}),l.jsx("button",{className:"btn icon-btn",onClick:()=>Ta(D=>D==="dark"?"light":"dark"),title:`Switch to ${qn==="dark"?"light":"dark"} mode (T)`,"aria-label":`Switch to ${qn==="dark"?"light":"dark"} mode`,children:qn==="dark"?l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),l.jsx("path",{d:"M7 1.5v1.2M7 11.3v1.2M1.5 7h1.2M11.3 7h1.2M3.1 3.1l.85.85M10.05 10.05l.85.85M3.1 10.9l.85-.85M10.05 3.95l.85-.85"})]}):l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})})]})]})]}),pr?l.jsxs("div",{className:"ver-banner done",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:["Restarted — now running v",pr,"."]}),l.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Io&&!Ee?l.jsxs("div",{className:"conn-banner",role:"alert",children:[l.jsx("span",{className:"conn-dot"}),fr?el==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Zt}…`:(()=>{const D=c7({connected:Ee,paused:js});return l.jsxs(l.Fragment,{children:[`Lost connection to the ${Zt} server. Reconnecting…`,D&&l.jsx("span",{className:"conn-sub",children:D})]})})()]}):Ie&&ze?l.jsxs("div",{className:`ver-banner ${ze.kind}`,role:"status",children:[l.jsx("span",{className:`ver-dot${Lc==null?"":" armed"}`}),ze.kind==="restart"?l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:["v",ze.to," is installed — this deck still runs v",ze.from,"."]}),ee!=null&&ee.canRestart?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Dn(),...aa(fr),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
292
292
|
|
|
293
|
-
Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:fr?"restarting…":Cs.label}),!fr&&l.jsx("span",{className:"ver-sub",children:Cs.clause}),l.jsxs("label",{className:"ver-auto",children:[l.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":hr,onClick:Pc,"aria-label":"Auto-restart when idle",title:hr?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:l.jsx("span",{className:"switch-knob"})}),l.jsx("span",{"aria-hidden":!0,children:_8(hr,Lc)})]})]}):l.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:[Zt," v",fe.to," is out — you are on v",fe.from,"."]}),(ee==null?void 0:ee.upgradeMode)==="install"&&Jt!=="failed"&&l.jsx("button",{type:"button",className:"ver-act",onClick:ko,...sa(Jt==="running",Jt==="done"),title:`Runs ${((xt=ee==null?void 0:ee.upgrade)==null?void 0:xt.command)??(ee==null?void 0:ee.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Jt==="running"?"installing…":Jt==="done"?"installed":"Update now"}),(ee==null?void 0:ee.upgradeMode)==="npx"&&(ee==null?void 0:ee.canRestart)&&l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Pn({upgrade:!0}),...sa(fr),title:`Runs ${ee==null?void 0:ee.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:fr?"fetching…":Jt==="failed"?"Retry update":"Update & restart"}),Jt==="failed"?l.jsxs("span",{className:"ver-sub fail",title:((Xo=ee==null?void 0:ee.upgrade)==null?void 0:Xo.error)??"",children:[(ee==null?void 0:ee.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ba=ee==null?void 0:ee.upgrade)==null?void 0:Ba.error)??"unknown error"," — run it yourself:"]}):(ee==null?void 0:ee.upgradeMode)==="npx"?l.jsx("span",{className:"ver-sub",children:ee!=null&&ee.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Fv.npx}):ee!=null&&ee.upgradeBlocked?l.jsx("span",{className:"ver-sub",children:Object.hasOwn(Fv,ee.upgradeBlocked)?Fv[ee.upgradeBlocked]:"cannot install from here"}):null,l.jsxs("button",{type:"button",className:"ver-cmd",onClick:Ki,title:"Copy to clipboard",children:[l.jsx("code",{children:ee==null?void 0:ee.command}),l.jsx("span",{className:"ver-cmd-hint",children:ht?"copied":"copy"})]})]}),l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Le,children:"×"})]}):Zr&&yt?l.jsxs("div",{className:"ver-banner",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:[yt," still works — the deck is called ",Zt," now."]}),ee!=null&&ee.renameFix?l.jsx("span",{className:"ver-sub",children:ee.renameFix}):null,l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:kt,children:"×"})]}):null,cp(he)&&qt.claude&&l.jsx(g8,{leaving:he==="leaving",onClose:()=>V(!1)}),M&&l.jsx(uD,{state:i.current,now:Ft,selectedIds:h,onSelect:Ds,onClose:()=>K(!1)}),l.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${$a?" bubbling":""}${Ps?" dragging-any":""}`,"data-detail":Gc,ref:Po,onMouseDownCapture:Ah,onPointerDownCapture:$s,onPointerUpCapture:$s,onWheelCapture:$s,children:[Uo===0&&(!He&&wt?l.jsx(z7,{}):l.jsx(U7,{live:He,everConnected:Ro,providers:qt,workspace:Vn,onTour:()=>Z(!0)})),(Pa.length>1||Qr.size>0)&&l.jsx("div",{ref:wa,className:`cat-filter-bar${va?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Pa.map(D=>{const q=Qr.has(D);return l.jsxs("button",{type:"button",className:`cat-filter${q?" off":""}`,onClick:()=>$h(D),"aria-pressed":!q,title:`${q?"Show":"Hide"} ${Hd[D]} tools`,children:[l.jsx(O7,{cat:D}),l.jsx("span",{className:"cat-name",children:Hd[D]})]},D)})}),l.jsxs(P2,{nodes:Xc,edges:ul,nodeTypes:i7,edgesFocusable:!1,edgeTypes:l7,fitView:!Co,fitViewOptions:{padding:.25,duration:_d({durationMs:hT,documentHidden:document.hidden})?hT:0},minZoom:eM,maxZoom:tM,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(D,q)=>{if(q.type==="sessionGroup"){k();return}if(q.type==="recapNote"){j(q.data.parentId,D.shiftKey);return}j(q.id,D.shiftKey)},onPaneClick:()=>k(),onMoveStart:D=>{aT(nl(D))&&sl()},onMove:(D,q)=>{var oe;Ms(),aT(nl(D))&&sl();const ae=p7(q.zoom);ae!==rs.current&&(rs.current=ae,Vc(ae)),(oe=Po.current)==null||oe.style.setProperty("--zoom",String(q.zoom)),es.current&&window.clearTimeout(es.current),es.current=window.setTimeout(()=>M7(q),250)},onNodeDragStart:(D,q)=>{var ae;if(Mh(),al.current=!0,ba.current=new Map,cl(!0),Ms(),sl(),q.type==="sessionGroup"){const oe=(ae=q.data)==null?void 0:ae.sessionId,Ee=new Map;if(oe)for(const ve of yr){const Ge=ve.data;(Ge==null?void 0:Ge.sessionId)===oe&&Ee.set(ve.id,{x:ve.position.x,y:ve.position.y})}Sa.current={start:{x:q.position.x,y:q.position.y},members:Ee};return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y})},onNodeDrag:(D,q)=>{var ae;if(Ms(),q.type==="sessionGroup"){const oe=Sa.current;if(!oe)return;const Ee=q.position.x-oe.start.x,ve=q.position.y-oe.start.y;for(const[rt,_t]of oe.members){const Ze={x:_t.x+Ee,y:_t.y+ve};Bt.current.set(rt,Ze),sn.current.set(rt,Ze)}const Ge=ba.current;if(Ge){for(const[rt,_t]of oe.members)Ge.set(rt,{x:_t.x+Ee,y:_t.y+ve});Ge.set(q.id,{x:q.position.x,y:q.position.y})}So(rt=>rt+1);return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),(ae=ba.current)==null||ae.set(q.id,{x:q.position.x,y:q.position.y}),So(oe=>oe+1)},onNodeDragStop:(D,q)=>{if(Ms(),al.current=!1,ba.current=null,cl(!1),ya(ae=>ae+1),q.type==="sessionGroup"){const ae=Sa.current;if(ae){const oe=q.position.x-ae.start.x,Ee=q.position.y-ae.start.y;for(const[ve,Ge]of ae.members){const rt={x:Ge.x+oe,y:Ge.y+Ee};Bt.current.set(ve,rt),sn.current.set(ve,rt)}}Sa.current=null,hd(sn.current,Bt.current),ya(oe=>oe+1);return}Bt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),hd(sn.current,Bt.current)},children:[l.jsx(sL,{gap:28,size:1,color:Ts["--grid-line"]}),l.jsx(m6,{onFit:()=>{Xn.current=Date.now()}}),l.jsx(eD,{agents:i.current.agents,visibleAgentIds:ol,positions:sn.current,pinned:Bt.current,measured:ns.current,spotlight:Oo,hiddenCategories:Qr,now:Ft,onOpenTool:_}),rl&&l.jsxs("div",{className:"autofit-chip",children:[l.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),l.jsx("button",{type:"button",className:"autofit-resume",onClick:Fc,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),l.jsxs(QP,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[l.jsx(sr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Fc,title:rl?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":rl?"":void 0,children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:Zi,title:t7({paused:Ss,held:En.size,dropped:En.dropped}),"aria-label":e7,"aria-pressed":Ss,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Bo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"","data-danger":"",onClick:()=>Dr("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),l.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:()=>O(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),l.jsx(HP,{zoomable:!0,pannable:!0,nodeColor:Ao,nodeStrokeWidth:2,maskColor:Ts["--minimap-mask"],maskStrokeColor:Ts["--line"]})]})]}),cp(Y)&&l.jsx(zD,{state:i.current,now:Ft,providers:qt,liveSince:As,leaving:Y==="leaving",onClose:()=>P(!1)}),cp(J)&&l.jsx(wq,{usageOpen:G,leaving:J==="leaving",onClose:()=>L(!1)}),f&&fn?l.jsxs("aside",{className:"detail","aria-label":"Detail",children:[l.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),l.jsx(H7,{agent:fn,now:Ft,onOpenTool:_,onShowSummary:E,onExportSession:D=>I7(i.current,D)})]}):null,fl&&l.jsx(s6,{tool:fl,onClose:()=>_(null)}),ha&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(a7,{providers:qt,onClose:()=>_s(!1)})}),fa&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(o7,{onClose:()=>pa(!1),onSeen:D=>{Xi(D);try{localStorage.setItem(P_,String(D))}catch{}},onWatching:ma,palette:Ts})}),C&&(()=>{const D=i.current.agents.get(C);return D?l.jsx(N5,{agent:D,onClose:()=>T(null)}):null})(),S&&l.jsx(iD,{state:i.current,sessionId:S,onClose:()=>E(null)}),lt&&l.jsx(xB,{entries:lt.entries,since:lt.since,firstRun:lt.firstRun,running:Dt,onClose:()=>vt(null),onTour:()=>{vt(null),Z(!0)}}),(()=>{const{request:D,waiting:q}=QB(No,vn.current);return D?l.jsx(JB,{request:D,waiting:q,busy:Pr,now:Date.now(),onAccept:()=>void Oc("accept",D.fp),onDecline:()=>void Oc("dismiss",D.fp),onLater:()=>{Pr||(vn.current.add(D.fp),dr(ae=>[...ae]))}}):null})(),W&&l.jsx(I8,{onClose:()=>O(!1),onTour:()=>{O(!1),Z(!0)}}),B&&l.jsx(OA,{title:"What the deck shows you",steps:NF,onClose:()=>{Z(!1),gB($_());const D=Q.current;Q.current=null,D&&vt(D)}}),I&&l.jsx(A8,{agentCount:Uo,onConfirm:()=>Dr("confirmation"),onCancel:()=>F(!1)})]})}function z7(){return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),l.jsxs("h2",{children:["Too many ",Zt," tabs are open"]}),l.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",l.jsx("code",{children:Zt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function U7({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const i=!e;return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),i?l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),l.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",l.jsx("code",{children:Zt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):W7(n,s),!i&&l.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function W7(e,t){const n=GH(t);return l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?l.jsxs("p",{children:[n.lead," ",l.jsx("code",{children:n.workspace}),n.tail]}):l.jsxs("p",{children:["Run ",l.jsx("code",{children:"claude"})," or ",l.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),ZH(e).map(s=>l.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?l.jsx("code",{children:a.text},i):l.jsx("span",{children:a.text},i))},s.provider))]})}function H7({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=`${e.synthetic?"≥ ":""}${Pd(e.startedAt,e.endedAt,t)}`,c=Hn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=cM(N.name);p.set(_,(p.get(_)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,m=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,_)=>_[1]-N[1]),w=p.has("mcp")?K6(e.tools.map(N=>N.name)):null;return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"detail-hero",children:[l.jsxs("div",{className:"hero-line",children:[l.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),l.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),l.jsxs("div",{className:"hero-meta",children:[l.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),l.jsx("span",{className:"hero-sep",children:"·"}),l.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=J2(e);return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hero-sep",children:"·"}),l.jsxs("span",{className:"model-chip","data-family":Jd(e.model),title:N.length>0?`${e.model}
|
|
293
|
+
Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:fr?"restarting…":Ts.label}),!fr&&l.jsx("span",{className:"ver-sub",children:Ts.clause}),l.jsxs("label",{className:"ver-auto",children:[l.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":hr,onClick:Pc,"aria-label":"Auto-restart when idle",title:hr?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:l.jsx("span",{className:"switch-knob"})}),l.jsx("span",{"aria-hidden":!0,children:A8(hr,Lc)})]})]}):l.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):l.jsxs(l.Fragment,{children:[l.jsxs("strong",{children:[Zt," v",ze.to," is out — you are on v",ze.from,"."]}),(ee==null?void 0:ee.upgradeMode)==="install"&&Jt!=="failed"&&l.jsx("button",{type:"button",className:"ver-act",onClick:No,...aa(Jt==="running",Jt==="done"),title:`Runs ${((xt=ee==null?void 0:ee.upgrade)==null?void 0:xt.command)??(ee==null?void 0:ee.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Jt==="running"?"installing…":Jt==="done"?"installed":"Update now"}),(ee==null?void 0:ee.upgradeMode)==="npx"&&(ee==null?void 0:ee.canRestart)&&l.jsx("button",{type:"button",className:"ver-act",onClick:()=>Dn({upgrade:!0}),...aa(fr),title:`Runs ${ee==null?void 0:ee.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:fr?"fetching…":Jt==="failed"?"Retry update":"Update & restart"}),Jt==="failed"?l.jsxs("span",{className:"ver-sub fail",title:((Qo=ee==null?void 0:ee.upgrade)==null?void 0:Qo.error)??"",children:[(ee==null?void 0:ee.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ua=ee==null?void 0:ee.upgrade)==null?void 0:Ua.error)??"unknown error"," — run it yourself:"]}):(ee==null?void 0:ee.upgradeMode)==="npx"?l.jsx("span",{className:"ver-sub",children:ee!=null&&ee.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Fv.npx}):ee!=null&&ee.upgradeBlocked?l.jsx("span",{className:"ver-sub",children:Object.hasOwn(Fv,ee.upgradeBlocked)?Fv[ee.upgradeBlocked]:"cannot install from here"}):null,l.jsxs("button",{type:"button",className:"ver-cmd",onClick:Zi,title:"Copy to clipboard",children:[l.jsx("code",{children:ee==null?void 0:ee.command}),l.jsx("span",{className:"ver-cmd-hint",children:pt?"copied":"copy"})]})]}),l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:De,children:"×"})]}):Qr&&vt?l.jsxs("div",{className:"ver-banner",role:"status",children:[l.jsx("span",{className:"ver-dot"}),l.jsxs("strong",{children:[vt," still works — the deck is called ",Zt," now."]}),ee!=null&&ee.renameFix?l.jsx("span",{className:"ver-sub",children:ee.renameFix}):null,l.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:_t,children:"×"})]}):null,cp(oe)&&Ft.claude&&l.jsx(_8,{leaving:oe==="leaving",onClose:()=>F(!1)}),M&&l.jsx(uD,{state:i.current,now:Bt,selectedIds:h,onSelect:qs,onClose:()=>X(!1)}),l.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Pa?" bubbling":""}${Ls?" dragging-any":""}`,"data-detail":Gc,ref:Do,onMouseDownCapture:Ah,onPointerDownCapture:Os,onPointerUpCapture:Os,onWheelCapture:Os,children:[Ho===0&&(!Ee&&Xe?l.jsx(K7,{}):l.jsx(X7,{live:Ee,everConnected:Io,providers:Ft,workspace:Yn,onTour:()=>Q(!0)})),(Da.length>1||Jr.size>0)&&l.jsx("div",{ref:xa,className:`cat-filter-bar${ba?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Da.map(D=>{const q=Jr.has(D);return l.jsxs("button",{type:"button",className:`cat-filter${q?" off":""}`,onClick:()=>$h(D),"aria-pressed":!q,title:`${q?"Show":"Hide"} ${Hd[D]} tools`,children:[l.jsx(z7,{cat:D}),l.jsx("span",{className:"cat-name",children:Hd[D]})]},D)})}),l.jsxs(P2,{nodes:Xc,edges:hl,nodeTypes:p7,edgesFocusable:!1,edgeTypes:m7,fitView:!Ao,fitViewOptions:{padding:.25,duration:kd({durationMs:hT,documentHidden:document.hidden})?hT:0},minZoom:eM,maxZoom:tM,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(D,q)=>{if(q.type==="sessionGroup"){b();return}if(q.type==="recapNote"){S(q.data.parentId,D.shiftKey);return}S(q.id,D.shiftKey)},onPaneClick:()=>b(),onMoveStart:D=>{aT(sl(D))&&ol()},onMove:(D,q)=>{var ie;Is(),aT(sl(D))&&ol();const ae=b7(q.zoom);ae!==ss.current&&(ss.current=ae,Vc(ae)),(ie=Do.current)==null||ie.style.setProperty("--zoom",String(q.zoom)),ts.current&&window.clearTimeout(ts.current),ts.current=window.setTimeout(()=>q7(q),250)},onNodeDragStart:(D,q)=>{var ae;if(Mh(),il.current=!0,_a.current=new Map,dl(!0),Is(),ol(),q.type==="sessionGroup"){const ie=(ae=q.data)==null?void 0:ae.sessionId,Ce=new Map;if(ie)for(const ve of yr){const We=ve.data;(We==null?void 0:We.sessionId)===ie&&Ce.set(ve.id,{x:ve.position.x,y:ve.position.y})}Ea.current={start:{x:q.position.x,y:q.position.y},members:Ce};return}zt.current.set(q.id,{x:q.position.x,y:q.position.y})},onNodeDrag:(D,q)=>{var ae;if(Is(),q.type==="sessionGroup"){const ie=Ea.current;if(!ie)return;const Ce=q.position.x-ie.start.x,ve=q.position.y-ie.start.y;for(const[at,Nt]of ie.members){const Je={x:Nt.x+Ce,y:Nt.y+ve};zt.current.set(at,Je),sn.current.set(at,Je)}const We=_a.current;if(We){for(const[at,Nt]of ie.members)We.set(at,{x:Nt.x+Ce,y:Nt.y+ve});We.set(q.id,{x:q.position.x,y:q.position.y})}Eo(at=>at+1);return}zt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),(ae=_a.current)==null||ae.set(q.id,{x:q.position.x,y:q.position.y}),Eo(ie=>ie+1)},onNodeDragStop:(D,q)=>{if(Is(),il.current=!1,_a.current=null,dl(!1),va(ae=>ae+1),q.type==="sessionGroup"){const ae=Ea.current;if(ae){const ie=q.position.x-ae.start.x,Ce=q.position.y-ae.start.y;for(const[ve,We]of ae.members){const at={x:We.x+ie,y:We.y+Ce};zt.current.set(ve,at),sn.current.set(ve,at)}}Ea.current=null,dd(sn.current,zt.current),va(ie=>ie+1);return}zt.current.set(q.id,{x:q.position.x,y:q.position.y}),sn.current.set(q.id,{x:q.position.x,y:q.position.y}),dd(sn.current,zt.current)},children:[l.jsx(sL,{gap:28,size:1,color:As["--grid-line"]}),l.jsx(m6,{onFit:()=>{Xn.current=Date.now()}}),l.jsx(eD,{agents:i.current.agents,visibleAgentIds:ll,positions:sn.current,pinned:zt.current,measured:rs.current,spotlight:Lo,hiddenCategories:Jr,now:Bt,onOpenTool:_}),al&&l.jsxs("div",{className:"autofit-chip",children:[l.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),l.jsx("button",{type:"button",className:"autofit-resume",onClick:Fc,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),l.jsxs(QP,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[l.jsx(sr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Fc,title:al?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":al?"":void 0,children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:Ji,title:l7({paused:js,held:Tn.size,dropped:Tn.dropped}),"aria-label":i7,"aria-pressed":js,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:l.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),l.jsx(sr,{onClick:Uo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"","data-danger":"",onClick:()=>Fr("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),l.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),l.jsx(sr,{"data-group-start":"",onClick:()=>$(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[l.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),l.jsx(HP,{zoomable:!0,pannable:!0,nodeColor:Mo,nodeStrokeWidth:2,maskColor:As["--minimap-mask"],maskStrokeColor:As["--line"]})]})]}),cp(z)&&l.jsx(zD,{state:i.current,now:Bt,providers:Ft,liveSince:Rs,leaving:z==="leaving",onClose:()=>P(!1)}),cp(Z)&&l.jsx(wq,{usageOpen:G,leaving:Z==="leaving",onClose:()=>W(!1)}),f&&fn?l.jsxs("aside",{className:"detail","aria-label":"Detail",children:[l.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),l.jsx(Q7,{agent:fn,now:Bt,onOpenTool:_,onShowSummary:E,onExportSession:D=>F7(i.current,D)})]}):null,ml&&l.jsx(s6,{tool:ml,onClose:()=>_(null)}),pa&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(h7,{providers:Ft,onClose:()=>Ns(!1)})}),ma&&l.jsx(x.Suspense,{fallback:null,children:l.jsx(f7,{onClose:()=>ga(!1),onSeen:D=>{Qi(D);try{localStorage.setItem(P_,String(D))}catch{}},onWatching:ya,palette:As})}),C&&(()=>{const D=i.current.agents.get(C);return D?l.jsx(N5,{agent:D,onClose:()=>T(null)}):null})(),j&&l.jsx(iD,{state:i.current,sessionId:j,onClose:()=>E(null)}),Dt&&l.jsx(EB,{entries:Dt.entries,since:Dt.since,firstRun:Dt.firstRun,running:kt,onClose:()=>me(null),onTour:()=>{me(null),Q(!0)}}),(()=>{const{request:D,waiting:q}=az(jo,vn.current);return D?l.jsx(oz,{request:D,waiting:q,busy:Dr,now:Date.now(),onAccept:()=>void Oc("accept",D.fp),onDecline:()=>void Oc("dismiss",D.fp),onLater:()=>{Dr||(vn.current.add(D.fp),dr(ae=>[...ae]))}}):null})(),H&&l.jsx(F8,{onClose:()=>$(!1),onTour:()=>{$(!1),Q(!0)}}),V&&l.jsx(OA,{title:"What the deck shows you",steps:SF,onClose:()=>{Q(!1),_B($_());const D=J.current;J.current=null,D&&me(D)}}),I&&l.jsx(L8,{agentCount:Ho,onConfirm:()=>Fr("confirmation"),onCancel:()=>L(!1)})]})}function K7(){return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),l.jsxs("h2",{children:["Too many ",Zt," tabs are open"]}),l.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",l.jsx("code",{children:Zt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function X7({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const i=!e;return l.jsxs("div",{className:"empty-hero",children:[l.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[l.jsx("div",{className:"core"}),l.jsxs("div",{className:"orbit r1",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r2",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]}),l.jsxs("div",{className:"orbit r3",children:[l.jsx("span",{className:"dot"}),l.jsx("span",{className:"dot b"})]})]}),i?l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),l.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",l.jsx("code",{children:Zt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):Z7(n,s),!i&&l.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function Z7(e,t){const n=JH(t);return l.jsxs(l.Fragment,{children:[l.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?l.jsxs("p",{children:[n.lead," ",l.jsx("code",{children:n.workspace}),n.tail]}):l.jsxs("p",{children:["Run ",l.jsx("code",{children:"claude"})," or ",l.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),s7(e).map(s=>l.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?l.jsx("code",{children:a.text},i):l.jsx("span",{children:a.text},i))},s.provider))]})}function Q7({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=`${e.synthetic?"≥ ":""}${Od(e.startedAt,e.endedAt,t)}`,c=Vn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=cM(N.name);p.set(_,(p.get(_)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,m=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,_)=>_[1]-N[1]),w=p.has("mcp")?K6(e.tools.map(N=>N.name)):null;return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"detail-hero",children:[l.jsxs("div",{className:"hero-line",children:[l.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),l.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),l.jsxs("div",{className:"hero-meta",children:[l.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),l.jsx("span",{className:"hero-sep",children:"·"}),l.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=J2(e);return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hero-sep",children:"·"}),l.jsxs("span",{className:"model-chip","data-family":Jd(e.model),title:N.length>0?`${e.model}
|
|
294
294
|
spend on this panel also covers:
|
|
295
295
|
${N.join(`
|
|
296
|
-
`)}`:e.model,children:[
|
|
296
|
+
`)}`:e.model,children:[po(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&l.jsxs("div",{className:"hero-cost",children:[l.jsxs("div",{className:"hero-cost-headline",children:[l.jsx("span",{className:"hero-cost-value",children:St(c.total)}),l.jsx("span",{className:"hero-cost-label",children:"spend"})]}),l.jsx(Kx,{cost:c})]}),l.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&l.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const N=rh(e);if(!N)return null;const _=ox(N.at,t);return l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Recap ",l.jsx("span",{className:"section-count",title:_.title,children:_.label})]}),l.jsx("p",{className:"detail-recap",children:N.text})]})})(),e.tools.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Activity"}),l.jsxs("div",{className:"activity-row",children:[l.jsxs("div",{className:"activity-counters",children:[l.jsxs("span",{className:"ac-item",children:[l.jsx("b",{children:e.toolCount})," calls"]}),m>0&&l.jsxs("span",{className:"ac-item ac-live",children:[l.jsx("b",{children:m})," live"]}),h>0&&l.jsxs("span",{className:"ac-item ac-err",children:[l.jsx("b",{children:h})," err"]})]}),l.jsx("div",{className:"cat-strip",children:y.map(([N,_])=>{const S=N==="mcp"?w:null,b=S==null?void 0:S.hue,j=`${_} ${Hd[N]} call${_===1?"":"s"}`;return l.jsxs("span",{className:`cat-chip cat-${N}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[l.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:lM[N]}),l.jsx("span",{className:"cat-name",children:Hd[N]}),l.jsx("span",{className:"cat-count",children:_}),S&&l.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),f>0&&l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Tokens"}),l.jsxs("div",{className:"tokens-grid",children:[l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"in"}),l.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:wn(e.usage.inputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"out"}),l.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:wn(e.usage.outputTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache r"}),l.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:wn(e.usage.cacheReadTokens)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"k",children:"cache c"}),l.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:wn(e.usage.cacheCreateTokens)})]})]})]}),l.jsxs("section",{className:"detail-section",children:[l.jsx("h3",{children:"Identity"}),l.jsxs("div",{children:[e.cwd&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"cwd"}),l.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"session"}),l.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&l.jsxs("div",{className:"row",children:[l.jsx("span",{className:"k",children:"parent"}),l.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Prompts ",l.jsx("span",{className:"section-count",children:z2(e.prompts).length})]}),l.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,_)=>{const S=ox(N.at,t),b=qx(N.text);return b?l.jsxs("details",{className:"prompt-entry prompt-injected",children:[l.jsxs("summary",{children:[l.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),l.jsx("span",{className:"prompt-injected-label",children:b.label})]}),b.detail&&l.jsx("div",{className:"prompt-injected-detail",children:b.detail})]},_):l.jsxs("div",{className:"prompt-entry",children:[l.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),l.jsx("div",{className:"prompt-text",children:N.text})]},_)})})]}),l.jsxs("section",{className:"detail-section",children:[l.jsxs("h3",{children:["Tool calls ",l.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&l.jsx("div",{className:"empty",children:"No tool calls yet."}),l.jsx("div",{children:e.tools.slice().reverse().map(N=>l.jsx(e9,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const J7={inflight:"in-flight",done:"done",err:"error"};function e9({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=tA(e,"…");return l.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[l.jsxs("span",{className:"name",children:[l.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),l.jsx("span",{className:"vis-hidden",children:J7[n]}),e.name]}),l.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{A5(window.localStorage)}catch{}const t9=tI.createRoot(document.getElementById("root"));t9.render(l.jsx(H7,{}));export{P_ as S,n7 as a,r9 as b,gc as c,wn as d,n9 as e,St as f,po as g,ws as h,Vx as i,l as j,sz as k,J1 as p,x as r,aa as s,dn as u};
|