ccdeck 3.22.12 → 3.22.14
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.
|
@@ -0,0 +1,274 @@
|
|
|
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 l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xf={exports:{}},vl={},bf={exports:{}},Je={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ob;function sM(){if(Ob)return Je;Ob=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"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=m&&P[m]||P["@@iterator"],typeof P=="function"?P:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(P,V,he){this.props=P,this.context=V,this.refs=_,this.updater=he||v}S.prototype.isReactComponent={},S.prototype.setState=function(P,V){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,V,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function k(){}k.prototype=S.prototype;function j(P,V,he){this.props=P,this.context=V,this.refs=_,this.updater=he||v}var E=j.prototype=new k;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function D(P,V,he){var H,U={},ee=null,Y=null;if(V!=null)for(H in V.ref!==void 0&&(Y=V.ref),V.key!==void 0&&(ee=""+V.key),V)T.call(V,H)&&!A.hasOwnProperty(H)&&(U[H]=V[H]);var se=arguments.length-2;if(se===1)U.children=he;else if(1<se){for(var me=Array(se),ge=0;ge<se;ge++)me[ge]=arguments[ge+2];U.children=me}if(P&&P.defaultProps)for(H in se=P.defaultProps,se)U[H]===void 0&&(U[H]=se[H]);return{$$typeof:e,type:P,key:ee,ref:Y,props:U,_owner:R.current}}function O(P,V){return{$$typeof:e,type:P.type,key:V,ref:P.ref,props:P.props,_owner:P._owner}}function I(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function q(P){var V={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(he){return V[he]})}var J=/\/+/g;function Z(P,V){return typeof P=="object"&&P!==null&&P.key!=null?q(""+P.key):V.toString(36)}function $(P,V,he,H,U){var ee=typeof P;(ee==="undefined"||ee==="boolean")&&(P=null);var Y=!1;if(P===null)Y=!0;else switch(ee){case"string":case"number":Y=!0;break;case"object":switch(P.$$typeof){case e:case t:Y=!0}}if(Y)return Y=P,U=U(Y),P=H===""?"."+Z(Y,0):H,C(U)?(he="",P!=null&&(he=P.replace(J,"$&/")+"/"),$(U,V,he,"",function(ge){return ge})):U!=null&&(I(U)&&(U=O(U,he+(!U.key||Y&&Y.key===U.key?"":(""+U.key).replace(J,"$&/")+"/")+P)),V.push(U)),1;if(Y=0,H=H===""?".":H+":",C(P))for(var se=0;se<P.length;se++){ee=P[se];var me=H+Z(ee,se);Y+=$(ee,V,he,me,U)}else if(me=y(P),typeof me=="function")for(P=me.call(P),se=0;!(ee=P.next()).done;)ee=ee.value,me=H+Z(ee,se++),Y+=$(ee,V,he,me,U);else if(ee==="object")throw V=String(P),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return Y}function K(P,V,he){if(P==null)return P;var H=[],U=0;return $(P,H,"","",function(ee){return V.call(he,ee,U++)}),H}function G(P){if(P._status===-1){var V=P._result;V=V(),V.then(function(he){(P._status===0||P._status===-1)&&(P._status=1,P._result=he)},function(he){(P._status===0||P._status===-1)&&(P._status=2,P._result=he)}),P._status===-1&&(P._status=0,P._result=V)}if(P._status===1)return P._result.default;throw P._result}var z={current:null},X={transition:null},L={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:X,ReactCurrentOwner:R};function W(){throw Error("act(...) is not supported in production builds of React.")}return Je.Children={map:K,forEach:function(P,V,he){K(P,function(){V.apply(this,arguments)},he)},count:function(P){var V=0;return K(P,function(){V++}),V},toArray:function(P){return K(P,function(V){return V})||[]},only:function(P){if(!I(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Je.Component=S,Je.Fragment=n,Je.Profiler=a,Je.PureComponent=j,Je.StrictMode=s,Je.Suspense=h,Je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,Je.act=W,Je.cloneElement=function(P,V,he){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var H=N({},P.props),U=P.key,ee=P.ref,Y=P._owner;if(V!=null){if(V.ref!==void 0&&(ee=V.ref,Y=R.current),V.key!==void 0&&(U=""+V.key),P.type&&P.type.defaultProps)var se=P.type.defaultProps;for(me in V)T.call(V,me)&&!A.hasOwnProperty(me)&&(H[me]=V[me]===void 0&&se!==void 0?se[me]:V[me])}var me=arguments.length-2;if(me===1)H.children=he;else if(1<me){se=Array(me);for(var ge=0;ge<me;ge++)se[ge]=arguments[ge+2];H.children=se}return{$$typeof:e,type:P.type,key:U,ref:ee,props:H,_owner:Y}},Je.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:l,_context:P},P.Consumer=P},Je.createElement=D,Je.createFactory=function(P){var V=D.bind(null,P);return V.type=P,V},Je.createRef=function(){return{current:null}},Je.forwardRef=function(P){return{$$typeof:d,render:P}},Je.isValidElement=I,Je.lazy=function(P){return{$$typeof:f,_payload:{_status:-1,_result:P},_init:G}},Je.memo=function(P,V){return{$$typeof:p,type:P,compare:V===void 0?null:V}},Je.startTransition=function(P){var V=X.transition;X.transition={};try{P()}finally{X.transition=V}},Je.unstable_act=W,Je.useCallback=function(P,V){return z.current.useCallback(P,V)},Je.useContext=function(P){return z.current.useContext(P)},Je.useDebugValue=function(){},Je.useDeferredValue=function(P){return z.current.useDeferredValue(P)},Je.useEffect=function(P,V){return z.current.useEffect(P,V)},Je.useId=function(){return z.current.useId()},Je.useImperativeHandle=function(P,V,he){return z.current.useImperativeHandle(P,V,he)},Je.useInsertionEffect=function(P,V){return z.current.useInsertionEffect(P,V)},Je.useLayoutEffect=function(P,V){return z.current.useLayoutEffect(P,V)},Je.useMemo=function(P,V){return z.current.useMemo(P,V)},Je.useReducer=function(P,V,he){return z.current.useReducer(P,V,he)},Je.useRef=function(P){return z.current.useRef(P)},Je.useState=function(P){return z.current.useState(P)},Je.useSyncExternalStore=function(P,V,he){return z.current.useSyncExternalStore(P,V,he)},Je.useTransition=function(){return z.current.useTransition()},Je.version="18.3.1",Je}var Pb;function Xl(){return Pb||(Pb=1,bf.exports=sM()),bf.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Lb;function aM(){if(Lb)return vl;Lb=1;var e=Xl(),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,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,h,p){var f,m={},y=null,v=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(v=h.ref);for(f in h)s.call(h,f)&&!l.hasOwnProperty(f)&&(m[f]=h[f]);if(d&&d.defaultProps)for(f in h=d.defaultProps,h)m[f]===void 0&&(m[f]=h[f]);return{$$typeof:t,type:d,key:y,ref:v,props:m,_owner:a.current}}return vl.Fragment=n,vl.jsx=c,vl.jsxs=c,vl}var Db;function oM(){return Db||(Db=1,xf.exports=aM()),xf.exports}var i=oM(),xu={},kf={exports:{}},bn={},_f={exports:{}},Nf={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var qb;function iM(){return qb||(qb=1,(function(e){function t(X,L){var W=X.length;X.push(L);e:for(;0<W;){var P=W-1>>>1,V=X[P];if(0<a(V,L))X[P]=L,X[W]=V,W=P;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var L=X[0],W=X.pop();if(W!==L){X[0]=W;e:for(var P=0,V=X.length,he=V>>>1;P<he;){var H=2*(P+1)-1,U=X[H],ee=H+1,Y=X[ee];if(0>a(U,W))ee<V&&0>a(Y,U)?(X[P]=Y,X[ee]=W,P=ee):(X[P]=U,X[H]=W,P=H);else if(ee<V&&0>a(Y,W))X[P]=Y,X[ee]=W,P=ee;else break e}}return L}function a(X,L){var W=X.sortIndex-L.sortIndex;return W!==0?W:X.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],p=[],f=1,m=null,y=3,v=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,k=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(X){for(var L=n(p);L!==null;){if(L.callback===null)s(p);else if(L.startTime<=X)s(p),L.sortIndex=L.expirationTime,t(h,L);else break;L=n(p)}}function C(X){if(_=!1,E(X),!N)if(n(h)!==null)N=!0,G(T);else{var L=n(p);L!==null&&z(C,L.startTime-X)}}function T(X,L){N=!1,_&&(_=!1,k(D),D=-1),v=!0;var W=y;try{for(E(L),m=n(h);m!==null&&(!(m.expirationTime>L)||X&&!q());){var P=m.callback;if(typeof P=="function"){m.callback=null,y=m.priorityLevel;var V=P(m.expirationTime<=L);L=e.unstable_now(),typeof V=="function"?m.callback=V:m===n(h)&&s(h),E(L)}else s(h);m=n(h)}if(m!==null)var he=!0;else{var H=n(p);H!==null&&z(C,H.startTime-L),he=!1}return he}finally{m=null,y=W,v=!1}}var R=!1,A=null,D=-1,O=5,I=-1;function q(){return!(e.unstable_now()-I<O)}function J(){if(A!==null){var X=e.unstable_now();I=X;var L=!0;try{L=A(!0,X)}finally{L?Z():(R=!1,A=null)}}else R=!1}var Z;if(typeof j=="function")Z=function(){j(J)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,K=$.port2;$.port1.onmessage=J,Z=function(){K.postMessage(null)}}else Z=function(){S(J,0)};function G(X){A=X,R||(R=!0,Z())}function z(X,L){D=S(function(){X(e.unstable_now())},L)}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(X){X.callback=null},e.unstable_continueExecution=function(){N||v||(N=!0,G(T))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(y){case 1:case 2:case 3:var L=3;break;default:L=y}var W=y;y=L;try{return X()}finally{y=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,L){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var W=y;y=X;try{return L()}finally{y=W}},e.unstable_scheduleCallback=function(X,L,W){var P=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?P+W:P):W=P,X){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=W+V,X={id:f++,callback:L,priorityLevel:X,startTime:W,expirationTime:V,sortIndex:-1},W>P?(X.sortIndex=W,t(p,X),n(h)===null&&X===n(p)&&(_?(k(D),D=-1):_=!0,z(C,W-P))):(X.sortIndex=V,t(h,X),N||v||(N=!0,G(T))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var L=y;return function(){var W=y;y=L;try{return X.apply(this,arguments)}finally{y=W}}}})(Nf)),Nf}var Fb;function lM(){return Fb||(Fb=1,_f.exports=iM()),_f.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Bb;function cM(){if(Bb)return bn;Bb=1;var e=Xl(),t=lM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);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 l(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 d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=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]*$/,f={},m={};function y(r){return h.call(m,r)?!0:h.call(f,r)?!1:p.test(r)?m[r]=!0:(f[r]=!0,!1)}function v(r,o,u,g){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return g?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,u,g){if(o===null||typeof o>"u"||v(r,o,u,g))return!0;if(g)return!1;if(u!==null)switch(u.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,u,g,w,b,M){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=g,this.attributeNamespace=w,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=b,this.removeEmptyString=M}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 k=/[\-:]([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(k,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(k,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(k,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,u,g){var w=S.hasOwnProperty(o)?S[o]:null;(w!==null?w.type!==0:g||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,u,w,g)&&(u=null),g||w===null?y(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):w.mustUseProperty?r[w.propertyName]=u===null?w.type===3?!1:"":u:(o=w.attributeName,g=w.attributeNamespace,u===null?r.removeAttribute(o):(w=w.type,u=w===3||w===4&&u===!0?"":""+u,g?r.setAttributeNS(g,o,u):r.setAttribute(o,u))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),q=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),X=Symbol.iterator;function L(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var W=Object.assign,P;function V(r){if(P===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);P=o&&o[1]||""}return`
|
|
34
|
+
`+P+r}var he=!1;function H(r,o){if(!r||he)return"";he=!0;var u=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(de){var g=de}Reflect.construct(r,[],o)}else{try{o.call()}catch(de){g=de}r.call(o.prototype)}else{try{throw Error()}catch(de){g=de}r()}}catch(de){if(de&&g&&typeof de.stack=="string"){for(var w=de.stack.split(`
|
|
35
|
+
`),b=g.stack.split(`
|
|
36
|
+
`),M=w.length-1,Q=b.length-1;1<=M&&0<=Q&&w[M]!==b[Q];)Q--;for(;1<=M&&0<=Q;M--,Q--)if(w[M]!==b[Q]){if(M!==1||Q!==1)do if(M--,Q--,0>Q||w[M]!==b[Q]){var te=`
|
|
37
|
+
`+w[M].replace(" at new "," at ");return r.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",r.displayName)),te}while(1<=M&&0<=Q);break}}}finally{he=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?V(r):""}function U(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=H(r.type,!1),r;case 11:return r=H(r.type.render,!1),r;case 1:return r=H(r.type,!0),r;default:return""}}function ee(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 A:return"Fragment";case R:return"Portal";case O:return"Profiler";case D:return"StrictMode";case Z:return"Suspense";case $:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case I:return(r._context.displayName||"Context")+".Provider";case J: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:ee(r.type)||"Memo";case G:o=r._payload,r=r._init;try{return ee(r(o))}catch{}}return null}function Y(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 ee(o);case 8:return o===D?"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 se(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",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),g=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,b=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(M){g=""+M,b.call(this,M)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Re(r){r._valueTracker||(r._valueTracker=ge(r))}function Oe(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),g="";return r&&(g=me(r)?r.checked?"true":"false":r.value),r=g,r!==u?(o.setValue(r),!0):!1}function ce(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 we(r,o){var u=o.checked;return W({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function be(r,o){var u=o.defaultValue==null?"":o.defaultValue,g=o.checked!=null?o.checked:o.defaultChecked;u=se(o.value!=null?o.value:u),r._wrapperState={initialChecked:g,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Be(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function _e(r,o){Be(r,o);var u=se(o.value),g=o.type;if(u!=null)g==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ge(r,o.type,u):o.hasOwnProperty("defaultValue")&&Ge(r,o.type,se(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Ce(r,o,u){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,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Ge(r,o,u){(o!=="number"||ce(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var tt=Array.isArray;function Qe(r,o,u,g){if(r=r.options,o){o={};for(var w=0;w<u.length;w++)o["$"+u[w]]=!0;for(u=0;u<r.length;u++)w=o.hasOwnProperty("$"+r[u].value),r[u].selected!==w&&(r[u].selected=w),w&&g&&(r[u].defaultSelected=!0)}else{for(u=""+se(u),o=null,w=0;w<r.length;w++){if(r[w].value===u){r[w].selected=!0,g&&(r[w].defaultSelected=!0);return}o!==null||r[w].disabled||(o=r[w])}o!==null&&(o.selected=!0)}}function Xe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return W({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ke(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(tt(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:se(u)}}function fe(r,o){var u=se(o.value),g=se(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),g!=null&&(r.defaultValue=""+g)}function dt(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function yt(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 ot(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?yt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ye,je=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,g,w){MSApp.execUnsafeLocalFunction(function(){return r(o,u,g,w)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ye=ye||document.createElement("div"),ye.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ye.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Fe(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Ye={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},ct=["Webkit","ms","Moz","O"];Object.keys(Ye).forEach(function(r){ct.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Ye[o]=Ye[r]})});function re(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Ye.hasOwnProperty(r)&&Ye[r]?(""+o).trim():o+"px"}function Ae(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var g=u.indexOf("--")===0,w=re(u,o[u],g);u==="float"&&(u="cssFloat"),g?r.setProperty(u,w):r[u]=w}}var ae=W({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 Ee(r,o){if(o){if(ae[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 De(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 xt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Me=null,Ze=null,ht=null;function wt(r){if(r=sl(r)){if(typeof Me!="function")throw Error(n(280));var o=r.stateNode;o&&(o=$c(o),Me(r.stateNode,r.type,o))}}function Wt(r){Ze?ht?ht.push(r):ht=[r]:Ze=r}function Fr(){if(Ze){var r=Ze,o=ht;if(ht=Ze=null,wt(r),o)for(r=0;r<o.length;r++)wt(o[r])}}function Kn(r,o){return r(o)}function Br(){}var Xn=!1;function eo(r,o,u){if(Xn)return r(o,u);Xn=!0;try{return Kn(r,o,u)}finally{Xn=!1,(Ze!==null||ht!==null)&&(Br(),Fr())}}function zr(r,o){var u=r.stateNode;if(u===null)return null;var g=$c(u);if(g===null)return null;u=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(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var ta=!1;if(d)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){ta=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{ta=!1}function Rn(r,o,u,g,w,b,M,Q,te){var de=Array.prototype.slice.call(arguments,3);try{o.apply(u,de)}catch(xe){this.onError(xe)}}var Wr=!1,ks=null,qt=!1,xr=null,na={onError:function(r){Wr=!0,ks=r}};function Ei(r,o,u,g,w,b,M,Q,te){Wr=!1,ks=null,Rn.apply(na,arguments)}function to(r,o,u,g,w,b,M,Q,te){if(Ei.apply(this,arguments),Wr){if(Wr){var de=ks;Wr=!1,ks=null}else throw Error(n(198));qt||(qt=!0,xr=de)}}function Mn(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function ra(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 sa(r){if(Mn(r)!==r)throw Error(n(188))}function aa(r){var o=r.alternate;if(!o){if(o=Mn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,g=o;;){var w=u.return;if(w===null)break;var b=w.alternate;if(b===null){if(g=w.return,g!==null){u=g;continue}break}if(w.child===b.child){for(b=w.child;b;){if(b===u)return sa(w),r;if(b===g)return sa(w),o;b=b.sibling}throw Error(n(188))}if(u.return!==g.return)u=w,g=b;else{for(var M=!1,Q=w.child;Q;){if(Q===u){M=!0,u=w,g=b;break}if(Q===g){M=!0,g=w,u=b;break}Q=Q.sibling}if(!M){for(Q=b.child;Q;){if(Q===u){M=!0,u=b,g=w;break}if(Q===g){M=!0,g=b,u=w;break}Q=Q.sibling}if(!M)throw Error(n(189))}}if(u.alternate!==g)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function oa(r){return r=aa(r),r!==null?ia(r):null}function ia(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=ia(r);if(o!==null)return o;r=r.sibling}return null}var la=t.unstable_scheduleCallback,no=t.unstable_cancelCallback,ca=t.unstable_shouldYield,Ci=t.unstable_requestPaint,ft=t.unstable_now,ro=t.unstable_getCurrentPriorityLevel,ua=t.unstable_ImmediatePriority,Hr=t.unstable_UserBlockingPriority,Gr=t.unstable_NormalPriority,Vr=t.unstable_LowPriority,da=t.unstable_IdlePriority,Yr=null,$t=null;function ha(r){if($t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(Yr,r,void 0,(r.current.flags&128)===128)}catch{}}var hn=Math.clz32?Math.clz32:hc,dc=Math.log,Kd=Math.LN2;function hc(r){return r>>>=0,r===0?32:31-(dc(r)/Kd|0)|0}var br=64,so=4194304;function _s(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 Zt(r,o){var u=r.pendingLanes;if(u===0)return 0;var g=0,w=r.suspendedLanes,b=r.pingedLanes,M=u&268435455;if(M!==0){var Q=M&~w;Q!==0?g=_s(Q):(b&=M,b!==0&&(g=_s(b)))}else M=u&~w,M!==0?g=_s(M):b!==0&&(g=_s(b));if(g===0)return 0;if(o!==0&&o!==g&&(o&w)===0&&(w=g&-g,b=o&-o,w>=b||w===16&&(b&4194240)!==0))return o;if((g&4)!==0&&(g|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=g;0<o;)u=31-hn(o),w=1<<u,g|=r[u],o&=~w;return g}function ao(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 Xd(r,o){for(var u=r.suspendedLanes,g=r.pingedLanes,w=r.expirationTimes,b=r.pendingLanes;0<b;){var M=31-hn(b),Q=1<<M,te=w[M];te===-1?((Q&u)===0||(Q&g)!==0)&&(w[M]=ao(Q,o)):te<=o&&(r.expiredLanes|=Q),b&=~Q}}function fa(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Tt(){var r=br;return br<<=1,(br&4194240)===0&&(br=64),r}function Ti(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function ln(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-hn(o),r[o]=u}function oo(r,o){var u=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<u;){var w=31-hn(u),b=1<<w;o[w]=0,g[w]=-1,r[w]=-1,u&=~b}}function io(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var g=31-hn(u),w=1<<g;w&o|r[g]&o&&(r[g]|=o),u&=~w}}var lt=0;function Qn(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var pa,Ai,fc,Ri,Mi,kr=!1,ma=[],Zn=null,Nn=null,In=null,Ns=new Map,Ss=new Map,Jn=[],pc="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 Jt(r,o){switch(r){case"focusin":case"focusout":Zn=null;break;case"dragenter":case"dragleave":Nn=null;break;case"mouseover":case"mouseout":In=null;break;case"pointerover":case"pointerout":Ns.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ss.delete(o.pointerId)}}function _r(r,o,u,g,w,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:u,eventSystemFlags:g,nativeEvent:b,targetContainers:[w]},o!==null&&(o=sl(o),o!==null&&Ai(o)),r):(r.eventSystemFlags|=g,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function lo(r,o,u,g,w){switch(o){case"focusin":return Zn=_r(Zn,r,o,u,g,w),!0;case"dragenter":return Nn=_r(Nn,r,o,u,g,w),!0;case"mouseover":return In=_r(In,r,o,u,g,w),!0;case"pointerover":var b=w.pointerId;return Ns.set(b,_r(Ns.get(b)||null,r,o,u,g,w)),!0;case"gotpointercapture":return b=w.pointerId,Ss.set(b,_r(Ss.get(b)||null,r,o,u,g,w)),!0}return!1}function co(r){var o=Ea(r.target);if(o!==null){var u=Mn(o);if(u!==null){if(o=u.tag,o===13){if(o=ra(u),o!==null){r.blockedOn=o,Mi(r.priority,function(){fc(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function uo(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Qr(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var g=new u.constructor(u.type,u);mt=g,u.target.dispatchEvent(g),mt=null}else return o=sl(u),o!==null&&Ai(o),r.blockedOn=u,!1;o.shift()}return!0}function Kr(r,o,u){uo(r)&&u.delete(o)}function mc(){kr=!1,Zn!==null&&uo(Zn)&&(Zn=null),Nn!==null&&uo(Nn)&&(Nn=null),In!==null&&uo(In)&&(In=null),Ns.forEach(Kr),Ss.forEach(Kr)}function fn(r,o){r.blockedOn===o&&(r.blockedOn=null,kr||(kr=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mc)))}function ga(r){function o(w){return fn(w,r)}if(0<ma.length){fn(ma[0],r);for(var u=1;u<ma.length;u++){var g=ma[u];g.blockedOn===r&&(g.blockedOn=null)}}for(Zn!==null&&fn(Zn,r),Nn!==null&&fn(Nn,r),In!==null&&fn(In,r),Ns.forEach(o),Ss.forEach(o),u=0;u<Jn.length;u++)g=Jn[u],g.blockedOn===r&&(g.blockedOn=null);for(;0<Jn.length&&(u=Jn[0],u.blockedOn===null);)co(u),u.blockedOn===null&&Jn.shift()}var Xr=C.ReactCurrentBatchConfig,ho=!0;function Qd(r,o,u,g){var w=lt,b=Xr.transition;Xr.transition=null;try{lt=1,Ii(r,o,u,g)}finally{lt=w,Xr.transition=b}}function gc(r,o,u,g){var w=lt,b=Xr.transition;Xr.transition=null;try{lt=4,Ii(r,o,u,g)}finally{lt=w,Xr.transition=b}}function Ii(r,o,u,g){if(ho){var w=Qr(r,o,u,g);if(w===null)nn(r,o,g,$n,u),Jt(r,g);else if(lo(w,r,o,u,g))g.stopPropagation();else if(Jt(r,g),o&4&&-1<pc.indexOf(r)){for(;w!==null;){var b=sl(w);if(b!==null&&pa(b),b=Qr(r,o,u,g),b===null&&nn(r,o,g,$n,u),b===w)break;w=b}w!==null&&g.stopPropagation()}else nn(r,o,g,null,u)}}var $n=null;function Qr(r,o,u,g){if($n=null,r=xt(g),r=Ea(r),r!==null)if(o=Mn(r),o===null)r=null;else if(u=o.tag,u===13){if(r=ra(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return $n=r,null}function $i(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(ro()){case ua:return 1;case Hr:return 4;case Gr:case Vr:return 16;case da:return 536870912;default:return 16}default:return 16}}var Nr=null,fo=null,js=null;function On(){if(js)return js;var r,o=fo,u=o.length,g,w="value"in Nr?Nr.value:Nr.textContent,b=w.length;for(r=0;r<u&&o[r]===w[r];r++);var M=u-r;for(g=1;g<=M&&o[u-g]===w[b-g];g++);return js=w.slice(r,1<g?1-g:void 0)}function po(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 cn(){return!0}function mo(){return!1}function Ht(r){function o(u,g,w,b,M){this._reactName=u,this._targetInst=w,this.type=g,this.nativeEvent=b,this.target=M,this.currentTarget=null;for(var Q in r)r.hasOwnProperty(Q)&&(u=r[Q],this[Q]=u?u(b):b[Q]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?cn:mo,this.isPropagationStopped=mo,this}return W(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=cn)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=cn)},persist:function(){},isPersistent:cn}),o}var Zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Es=Ht(Zr),Jr=W({},Zr,{view:0,detail:0}),yc=Ht(Jr),ya,go,es,wa=W({},Jr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sr,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!==es&&(es&&r.type==="mousemove"?(ya=r.screenX-es.screenX,go=r.screenY-es.screenY):go=ya=0,es=r),ya)},movementY:function(r){return"movementY"in r?r.movementY:go}}),ts=Ht(wa),wc=W({},wa,{dataTransfer:0}),vc=Ht(wc),Oi=W({},Jr,{relatedTarget:0}),Pi=Ht(Oi),Li=W({},Zr,{animationName:0,elapsedTime:0,pseudoElement:0}),Cs=Ht(Li),xc=W({},Zr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Zd=Ht(xc),bc=W({},Zr,{data:0}),Di=Ht(bc),Jd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pn={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"},eh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qi(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=eh[r])?!!o[r]:!1}function Sr(){return qi}var va=W({},Jr,{key:function(r){if(r.key){var o=Jd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=po(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pn[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sr,charCode:function(r){return r.type==="keypress"?po(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?po(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Fi=Ht(va),Bi=W({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yo=Ht(Bi),wo=W({},Jr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sr}),kc=Ht(wo),th=W({},Zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),nh=Ht(th),_c=W({},wa,{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=Ht(_c),sh=[9,13,27,32],xa=d&&"CompositionEvent"in window,mn=null;d&&"documentMode"in document&&(mn=document.documentMode);var zi=d&&"TextEvent"in window&&!mn,Ui=d&&(!xa||mn&&8<mn&&11>=mn),Nc=" ",Sc=!1;function Wi(r,o){switch(r){case"keyup":return sh.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ts=!1;function ah(r,o){switch(r){case"compositionend":return jc(o);case"keypress":return o.which!==32?null:(Sc=!0,Nc);case"textInput":return r=o.data,r===Nc&&Sc?null:r;default:return null}}function oh(r,o){if(Ts)return r==="compositionend"||!xa&&Wi(r,o)?(r=On(),js=fo=Nr=null,Ts=!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 Ui&&o.locale!=="ko"?null:o.data;default:return null}}var Ec={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 Hi(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Ec[r.type]:o==="textarea"}function er(r,o,u,g){Wt(g),o=ja(o,"onChange"),0<o.length&&(u=new Es("onChange","change",null,u,g),r.push({event:u,listeners:o}))}var ba=null,As=null;function ih(r){Te(r,0)}function ns(r){var o=Ro(r);if(Oe(o))return r}function lh(r,o){if(r==="change")return o}var en=!1;if(d){var ka;if(d){var vo="oninput"in document;if(!vo){var Gi=document.createElement("div");Gi.setAttribute("oninput","return;"),vo=typeof Gi.oninput=="function"}ka=vo}else ka=!1;en=ka&&(!document.documentMode||9<document.documentMode)}function Vi(){ba&&(ba.detachEvent("onpropertychange",xo),As=ba=null)}function xo(r){if(r.propertyName==="value"&&ns(As)){var o=[];er(o,As,r,xt(r)),eo(ih,o)}}function bo(r,o,u){r==="focusin"?(Vi(),ba=o,As=u,ba.attachEvent("onpropertychange",xo)):r==="focusout"&&Vi()}function Yi(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ns(As)}function Cc(r,o){if(r==="click")return ns(o)}function ko(r,o){if(r==="input"||r==="change")return ns(o)}function Ki(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var tn=typeof Object.is=="function"?Object.is:Ki;function tr(r,o){if(tn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),g=Object.keys(o);if(u.length!==g.length)return!1;for(g=0;g<u.length;g++){var w=u[g];if(!h.call(o,w)||!tn(r[w],o[w]))return!1}return!0}function Xi(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Qi(r,o){var u=Xi(r);r=0;for(var g;u;){if(u.nodeType===3){if(g=r+u.textContent.length,r<=o&&g>=o)return{node:u,offset:o-r};r=g}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Xi(u)}}function Gt(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Gt(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Zi(){for(var r=window,o=ce();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=ce(r.document)}return o}function _o(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 ch(r){var o=Zi(),u=r.focusedElem,g=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Gt(u.ownerDocument.documentElement,u)){if(g!==null&&_o(u)){if(o=g.start,r=g.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var w=u.textContent.length,b=Math.min(g.start,w);g=g.end===void 0?b:Math.min(g.end,w),!r.extend&&b>g&&(w=g,g=b,b=w),w=Qi(u,b);var M=Qi(u,g);w&&M&&(r.rangeCount!==1||r.anchorNode!==w.node||r.anchorOffset!==w.offset||r.focusNode!==M.node||r.focusOffset!==M.offset)&&(o=o.createRange(),o.setStart(w.node,w.offset),r.removeAllRanges(),b>g?(r.addRange(o),r.extend(M.node,M.offset)):(o.setEnd(M.node,M.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var uh=d&&"documentMode"in document&&11>=document.documentMode,rs=null,Rs=null,_a=null,nr=!1;function No(r,o,u){var g=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;nr||rs==null||rs!==ce(g)||(g=rs,"selectionStart"in g&&_o(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}),_a&&tr(_a,g)||(_a=g,g=ja(Rs,"onSelect"),0<g.length&&(o=new Es("onSelect","select",null,o,u),r.push({event:o,listeners:g}),o.target=rs)))}function ss(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var jr={animationend:ss("Animation","AnimationEnd"),animationiteration:ss("Animation","AnimationIteration"),animationstart:ss("Animation","AnimationStart"),transitionend:ss("Transition","TransitionEnd")},Ji={},el={};d&&(el=document.createElement("div").style,"AnimationEvent"in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),"TransitionEvent"in window||delete jr.transitionend.transition);function Na(r){if(Ji[r])return Ji[r];if(!jr[r])return r;var o=jr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in el)return Ji[r]=o[u];return r}var Tc=Na("animationend"),Ac=Na("animationiteration"),tl=Na("animationstart"),Sa=Na("transitionend"),So=new Map,Rc="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 rr(r,o){So.set(r,o),l(o,[r])}for(var jo=0;jo<Rc.length;jo++){var Eo=Rc[jo],Mc=Eo.toLowerCase(),F=Eo[0].toUpperCase()+Eo.slice(1);rr(Mc,"on"+F)}rr(Tc,"onAnimationEnd"),rr(Ac,"onAnimationIteration"),rr(tl,"onAnimationStart"),rr("dblclick","onDoubleClick"),rr("focusin","onFocus"),rr("focusout","onBlur"),rr(Sa,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var B="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(" "),oe=new Set("cancel close invalid load scroll toggle".split(" ").concat(B));function ie(r,o,u){var g=r.type||"unknown-event";r.currentTarget=u,to(g,o,void 0,r),r.currentTarget=null}function Te(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var g=r[u],w=g.event;g=g.listeners;e:{var b=void 0;if(o)for(var M=g.length-1;0<=M;M--){var Q=g[M],te=Q.instance,de=Q.currentTarget;if(Q=Q.listener,te!==b&&w.isPropagationStopped())break e;ie(w,Q,de),b=te}else for(M=0;M<g.length;M++){if(Q=g[M],te=Q.instance,de=Q.currentTarget,Q=Q.listener,te!==b&&w.isPropagationStopped())break e;ie(w,Q,de),b=te}}}if(qt)throw r=xr,qt=!1,xr=null,r}function Ne(r,o){var u=o[mh];u===void 0&&(u=o[mh]=new Set);var g=r+"__bubble";u.has(g)||(st(o,r,2,!1),u.add(g))}function Ue(r,o,u){var g=0;o&&(g|=4),st(u,r,g,o)}var nt="_reactListening"+Math.random().toString(36).slice(2);function pt(r){if(!r[nt]){r[nt]=!0,s.forEach(function(u){u!=="selectionchange"&&(oe.has(u)||Ue(u,!1,r),Ue(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[nt]||(o[nt]=!0,Ue("selectionchange",!1,o))}}function st(r,o,u,g){switch($i(o)){case 1:var w=Qd;break;case 4:w=gc;break;default:w=Ii}u=w.bind(null,o,u,r),w=void 0,!ta||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),g?w!==void 0?r.addEventListener(o,u,{capture:!0,passive:w}):r.addEventListener(o,u,!0):w!==void 0?r.addEventListener(o,u,{passive:w}):r.addEventListener(o,u,!1)}function nn(r,o,u,g,w){var b=g;if((o&1)===0&&(o&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var Q=g.stateNode.containerInfo;if(Q===w||Q.nodeType===8&&Q.parentNode===w)break;if(M===4)for(M=g.return;M!==null;){var te=M.tag;if((te===3||te===4)&&(te=M.stateNode.containerInfo,te===w||te.nodeType===8&&te.parentNode===w))return;M=M.return}for(;Q!==null;){if(M=Ea(Q),M===null)return;if(te=M.tag,te===5||te===6){g=b=M;continue e}Q=Q.parentNode}}g=g.return}eo(function(){var de=b,xe=xt(u),ke=[];e:{var ve=So.get(r);if(ve!==void 0){var Ie=Es,Pe=r;switch(r){case"keypress":if(po(u)===0)break e;case"keydown":case"keyup":Ie=Fi;break;case"focusin":Pe="focus",Ie=Pi;break;case"focusout":Pe="blur",Ie=Pi;break;case"beforeblur":case"afterblur":Ie=Pi;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ie=ts;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ie=vc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ie=kc;break;case Tc:case Ac:case tl:Ie=Cs;break;case Sa:Ie=nh;break;case"scroll":Ie=yc;break;case"wheel":Ie=rh;break;case"copy":case"cut":case"paste":Ie=Zd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ie=yo}var Le=(o&4)!==0,Ct=!Le&&r==="scroll",le=Le?ve!==null?ve+"Capture":null:ve;Le=[];for(var ne=de,ue;ne!==null;){ue=ne;var Se=ue.stateNode;if(ue.tag===5&&Se!==null&&(ue=Se,le!==null&&(Se=zr(ne,le),Se!=null&&Le.push(Er(ne,Se,ue)))),Ct)break;ne=ne.return}0<Le.length&&(ve=new Ie(ve,Pe,null,u,xe),ke.push({event:ve,listeners:Le}))}}if((o&7)===0){e:{if(ve=r==="mouseover"||r==="pointerover",Ie=r==="mouseout"||r==="pointerout",ve&&u!==mt&&(Pe=u.relatedTarget||u.fromElement)&&(Ea(Pe)||Pe[as]))break e;if((Ie||ve)&&(ve=xe.window===xe?xe:(ve=xe.ownerDocument)?ve.defaultView||ve.parentWindow:window,Ie?(Pe=u.relatedTarget||u.toElement,Ie=de,Pe=Pe?Ea(Pe):null,Pe!==null&&(Ct=Mn(Pe),Pe!==Ct||Pe.tag!==5&&Pe.tag!==6)&&(Pe=null)):(Ie=null,Pe=de),Ie!==Pe)){if(Le=ts,Se="onMouseLeave",le="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Le=yo,Se="onPointerLeave",le="onPointerEnter",ne="pointer"),Ct=Ie==null?ve:Ro(Ie),ue=Pe==null?ve:Ro(Pe),ve=new Le(Se,ne+"leave",Ie,u,xe),ve.target=Ct,ve.relatedTarget=ue,Se=null,Ea(xe)===de&&(Le=new Le(le,ne+"enter",Pe,u,xe),Le.target=ue,Le.relatedTarget=Ct,Se=Le),Ct=Se,Ie&&Pe)t:{for(Le=Ie,le=Pe,ne=0,ue=Le;ue;ue=Ms(ue))ne++;for(ue=0,Se=le;Se;Se=Ms(Se))ue++;for(;0<ne-ue;)Le=Ms(Le),ne--;for(;0<ue-ne;)le=Ms(le),ue--;for(;ne--;){if(Le===le||le!==null&&Le===le.alternate)break t;Le=Ms(Le),le=Ms(le)}Le=null}else Le=null;Ie!==null&&nl(ke,ve,Ie,Le,!1),Pe!==null&&Ct!==null&&nl(ke,Ct,Pe,Le,!0)}}e:{if(ve=de?Ro(de):window,Ie=ve.nodeName&&ve.nodeName.toLowerCase(),Ie==="select"||Ie==="input"&&ve.type==="file")var qe=lh;else if(Hi(ve))if(en)qe=ko;else{qe=Yi;var We=bo}else(Ie=ve.nodeName)&&Ie.toLowerCase()==="input"&&(ve.type==="checkbox"||ve.type==="radio")&&(qe=Cc);if(qe&&(qe=qe(r,de))){er(ke,qe,u,xe);break e}We&&We(r,ve,de),r==="focusout"&&(We=ve._wrapperState)&&We.controlled&&ve.type==="number"&&Ge(ve,"number",ve.value)}switch(We=de?Ro(de):window,r){case"focusin":(Hi(We)||We.contentEditable==="true")&&(rs=We,Rs=de,_a=null);break;case"focusout":_a=Rs=rs=null;break;case"mousedown":nr=!0;break;case"contextmenu":case"mouseup":case"dragend":nr=!1,No(ke,u,xe);break;case"selectionchange":if(uh)break;case"keydown":case"keyup":No(ke,u,xe)}var He;if(xa)e:{switch(r){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else Ts?Wi(r,u)&&(Ve="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Ve="onCompositionStart");Ve&&(Ui&&u.locale!=="ko"&&(Ts||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Ts&&(He=On()):(Nr=xe,fo="value"in Nr?Nr.value:Nr.textContent,Ts=!0)),We=ja(de,Ve),0<We.length&&(Ve=new Di(Ve,r,null,u,xe),ke.push({event:Ve,listeners:We}),He?Ve.data=He:(He=jc(u),He!==null&&(Ve.data=He)))),(He=zi?ah(r,u):oh(r,u))&&(de=ja(de,"onBeforeInput"),0<de.length&&(xe=new Di("onBeforeInput","beforeinput",null,u,xe),ke.push({event:xe,listeners:de}),xe.data=He))}Te(ke,o)})}function Er(r,o,u){return{instance:r,listener:o,currentTarget:u}}function ja(r,o){for(var u=o+"Capture",g=[];r!==null;){var w=r,b=w.stateNode;w.tag===5&&b!==null&&(w=b,b=zr(r,u),b!=null&&g.unshift(Er(r,b,w)),b=zr(r,o),b!=null&&g.push(Er(r,b,w))),r=r.return}return g}function Ms(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function nl(r,o,u,g,w){for(var b=o._reactName,M=[];u!==null&&u!==g;){var Q=u,te=Q.alternate,de=Q.stateNode;if(te!==null&&te===g)break;Q.tag===5&&de!==null&&(Q=de,w?(te=zr(u,b),te!=null&&M.unshift(Er(u,te,Q))):w||(te=zr(u,b),te!=null&&M.push(Er(u,te,Q)))),u=u.return}M.length!==0&&r.push({event:o,listeners:M})}var dh=/\r\n?/g,Ic=/\u0000|\uFFFD/g;function Co(r){return(typeof r=="string"?r:""+r).replace(dh,`
|
|
38
|
+
`).replace(Ic,"")}function Cr(r,o,u){if(o=Co(o),Co(r)!==o&&u)throw Error(n(425))}function Tr(){}var St=null,To=null;function hh(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 fh=typeof setTimeout=="function"?setTimeout:void 0,wR=typeof clearTimeout=="function"?clearTimeout:void 0,t0=typeof Promise=="function"?Promise:void 0,vR=typeof queueMicrotask=="function"?queueMicrotask:typeof t0<"u"?function(r){return t0.resolve(null).then(r).catch(xR)}:fh;function xR(r){setTimeout(function(){throw r})}function ph(r,o){var u=o,g=0;do{var w=u.nextSibling;if(r.removeChild(u),w&&w.nodeType===8)if(u=w.data,u==="/$"){if(g===0){r.removeChild(w),ga(o);return}g--}else u!=="$"&&u!=="$?"&&u!=="$!"||g++;u=w}while(u);ga(o)}function Is(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 n0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var Ao=Math.random().toString(36).slice(2),Ar="__reactFiber$"+Ao,rl="__reactProps$"+Ao,as="__reactContainer$"+Ao,mh="__reactEvents$"+Ao,bR="__reactListeners$"+Ao,kR="__reactHandles$"+Ao;function Ea(r){var o=r[Ar];if(o)return o;for(var u=r.parentNode;u;){if(o=u[as]||u[Ar]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=n0(r);r!==null;){if(u=r[Ar])return u;r=n0(r)}return o}r=u,u=r.parentNode}return null}function sl(r){return r=r[Ar]||r[as],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ro(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function $c(r){return r[rl]||null}var gh=[],Mo=-1;function $s(r){return{current:r}}function vt(r){0>Mo||(r.current=gh[Mo],gh[Mo]=null,Mo--)}function gt(r,o){Mo++,gh[Mo]=r.current,r.current=o}var Os={},rn=$s(Os),gn=$s(!1),Ca=Os;function Io(r,o){var u=r.type.contextTypes;if(!u)return Os;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===o)return g.__reactInternalMemoizedMaskedChildContext;var w={},b;for(b in u)w[b]=o[b];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function yn(r){return r=r.childContextTypes,r!=null}function Oc(){vt(gn),vt(rn)}function r0(r,o,u){if(rn.current!==Os)throw Error(n(168));gt(rn,o),gt(gn,u)}function s0(r,o,u){var g=r.stateNode;if(o=o.childContextTypes,typeof g.getChildContext!="function")return u;g=g.getChildContext();for(var w in g)if(!(w in o))throw Error(n(108,Y(r)||"Unknown",w));return W({},u,g)}function Pc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Os,Ca=rn.current,gt(rn,r),gt(gn,gn.current),!0}function a0(r,o,u){var g=r.stateNode;if(!g)throw Error(n(169));u?(r=s0(r,o,Ca),g.__reactInternalMemoizedMergedChildContext=r,vt(gn),vt(rn),gt(rn,r)):vt(gn),gt(gn,u)}var os=null,Lc=!1,yh=!1;function o0(r){os===null?os=[r]:os.push(r)}function _R(r){Lc=!0,o0(r)}function Ps(){if(!yh&&os!==null){yh=!0;var r=0,o=lt;try{var u=os;for(lt=1;r<u.length;r++){var g=u[r];do g=g(!0);while(g!==null)}os=null,Lc=!1}catch(w){throw os!==null&&(os=os.slice(r+1)),la(ua,Ps),w}finally{lt=o,yh=!1}}return null}var $o=[],Oo=0,Dc=null,qc=0,Pn=[],Ln=0,Ta=null,is=1,ls="";function Aa(r,o){$o[Oo++]=qc,$o[Oo++]=Dc,Dc=r,qc=o}function i0(r,o,u){Pn[Ln++]=is,Pn[Ln++]=ls,Pn[Ln++]=Ta,Ta=r;var g=is;r=ls;var w=32-hn(g)-1;g&=~(1<<w),u+=1;var b=32-hn(o)+w;if(30<b){var M=w-w%5;b=(g&(1<<M)-1).toString(32),g>>=M,w-=M,is=1<<32-hn(o)+w|u<<w|g,ls=b+r}else is=1<<b|u<<w|g,ls=r}function wh(r){r.return!==null&&(Aa(r,1),i0(r,1,0))}function vh(r){for(;r===Dc;)Dc=$o[--Oo],$o[Oo]=null,qc=$o[--Oo],$o[Oo]=null;for(;r===Ta;)Ta=Pn[--Ln],Pn[Ln]=null,ls=Pn[--Ln],Pn[Ln]=null,is=Pn[--Ln],Pn[Ln]=null}var Sn=null,jn=null,bt=!1,sr=null;function l0(r,o){var u=Bn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function c0(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,Sn=r,jn=Is(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Sn=r,jn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=Ta!==null?{id:is,overflow:ls}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Bn(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,Sn=r,jn=null,!0):!1;default:return!1}}function xh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function bh(r){if(bt){var o=jn;if(o){var u=o;if(!c0(r,o)){if(xh(r))throw Error(n(418));o=Is(u.nextSibling);var g=Sn;o&&c0(r,o)?l0(g,u):(r.flags=r.flags&-4097|2,bt=!1,Sn=r)}}else{if(xh(r))throw Error(n(418));r.flags=r.flags&-4097|2,bt=!1,Sn=r}}}function u0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Sn=r}function Fc(r){if(r!==Sn)return!1;if(!bt)return u0(r),bt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!hh(r.type,r.memoizedProps)),o&&(o=jn)){if(xh(r))throw d0(),Error(n(418));for(;o;)l0(r,o),o=Is(o.nextSibling)}if(u0(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 u=r.data;if(u==="/$"){if(o===0){jn=Is(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}jn=null}}else jn=Sn?Is(r.stateNode.nextSibling):null;return!0}function d0(){for(var r=jn;r;)r=Is(r.nextSibling)}function Po(){jn=Sn=null,bt=!1}function kh(r){sr===null?sr=[r]:sr.push(r)}var NR=C.ReactCurrentBatchConfig;function al(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var g=u.stateNode}if(!g)throw Error(n(147,r));var w=g,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(M){var Q=w.refs;M===null?delete Q[b]:Q[b]=M},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Bc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function h0(r){var o=r._init;return o(r._payload)}function f0(r){function o(le,ne){if(r){var ue=le.deletions;ue===null?(le.deletions=[ne],le.flags|=16):ue.push(ne)}}function u(le,ne){if(!r)return null;for(;ne!==null;)o(le,ne),ne=ne.sibling;return null}function g(le,ne){for(le=new Map;ne!==null;)ne.key!==null?le.set(ne.key,ne):le.set(ne.index,ne),ne=ne.sibling;return le}function w(le,ne){return le=Ws(le,ne),le.index=0,le.sibling=null,le}function b(le,ne,ue){return le.index=ue,r?(ue=le.alternate,ue!==null?(ue=ue.index,ue<ne?(le.flags|=2,ne):ue):(le.flags|=2,ne)):(le.flags|=1048576,ne)}function M(le){return r&&le.alternate===null&&(le.flags|=2),le}function Q(le,ne,ue,Se){return ne===null||ne.tag!==6?(ne=pf(ue,le.mode,Se),ne.return=le,ne):(ne=w(ne,ue),ne.return=le,ne)}function te(le,ne,ue,Se){var qe=ue.type;return qe===A?xe(le,ne,ue.props.children,Se,ue.key):ne!==null&&(ne.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&h0(qe)===ne.type)?(Se=w(ne,ue.props),Se.ref=al(le,ne,ue),Se.return=le,Se):(Se=du(ue.type,ue.key,ue.props,null,le.mode,Se),Se.ref=al(le,ne,ue),Se.return=le,Se)}function de(le,ne,ue,Se){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ue.containerInfo||ne.stateNode.implementation!==ue.implementation?(ne=mf(ue,le.mode,Se),ne.return=le,ne):(ne=w(ne,ue.children||[]),ne.return=le,ne)}function xe(le,ne,ue,Se,qe){return ne===null||ne.tag!==7?(ne=Da(ue,le.mode,Se,qe),ne.return=le,ne):(ne=w(ne,ue),ne.return=le,ne)}function ke(le,ne,ue){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=pf(""+ne,le.mode,ue),ne.return=le,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return ue=du(ne.type,ne.key,ne.props,null,le.mode,ue),ue.ref=al(le,null,ne),ue.return=le,ue;case R:return ne=mf(ne,le.mode,ue),ne.return=le,ne;case G:var Se=ne._init;return ke(le,Se(ne._payload),ue)}if(tt(ne)||L(ne))return ne=Da(ne,le.mode,ue,null),ne.return=le,ne;Bc(le,ne)}return null}function ve(le,ne,ue,Se){var qe=ne!==null?ne.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return qe!==null?null:Q(le,ne,""+ue,Se);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:return ue.key===qe?te(le,ne,ue,Se):null;case R:return ue.key===qe?de(le,ne,ue,Se):null;case G:return qe=ue._init,ve(le,ne,qe(ue._payload),Se)}if(tt(ue)||L(ue))return qe!==null?null:xe(le,ne,ue,Se,null);Bc(le,ue)}return null}function Ie(le,ne,ue,Se,qe){if(typeof Se=="string"&&Se!==""||typeof Se=="number")return le=le.get(ue)||null,Q(ne,le,""+Se,qe);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case T:return le=le.get(Se.key===null?ue:Se.key)||null,te(ne,le,Se,qe);case R:return le=le.get(Se.key===null?ue:Se.key)||null,de(ne,le,Se,qe);case G:var We=Se._init;return Ie(le,ne,ue,We(Se._payload),qe)}if(tt(Se)||L(Se))return le=le.get(ue)||null,xe(ne,le,Se,qe,null);Bc(ne,Se)}return null}function Pe(le,ne,ue,Se){for(var qe=null,We=null,He=ne,Ve=ne=0,zt=null;He!==null&&Ve<ue.length;Ve++){He.index>Ve?(zt=He,He=null):zt=He.sibling;var it=ve(le,He,ue[Ve],Se);if(it===null){He===null&&(He=zt);break}r&&He&&it.alternate===null&&o(le,He),ne=b(it,ne,Ve),We===null?qe=it:We.sibling=it,We=it,He=zt}if(Ve===ue.length)return u(le,He),bt&&Aa(le,Ve),qe;if(He===null){for(;Ve<ue.length;Ve++)He=ke(le,ue[Ve],Se),He!==null&&(ne=b(He,ne,Ve),We===null?qe=He:We.sibling=He,We=He);return bt&&Aa(le,Ve),qe}for(He=g(le,He);Ve<ue.length;Ve++)zt=Ie(He,le,Ve,ue[Ve],Se),zt!==null&&(r&&zt.alternate!==null&&He.delete(zt.key===null?Ve:zt.key),ne=b(zt,ne,Ve),We===null?qe=zt:We.sibling=zt,We=zt);return r&&He.forEach(function(Hs){return o(le,Hs)}),bt&&Aa(le,Ve),qe}function Le(le,ne,ue,Se){var qe=L(ue);if(typeof qe!="function")throw Error(n(150));if(ue=qe.call(ue),ue==null)throw Error(n(151));for(var We=qe=null,He=ne,Ve=ne=0,zt=null,it=ue.next();He!==null&&!it.done;Ve++,it=ue.next()){He.index>Ve?(zt=He,He=null):zt=He.sibling;var Hs=ve(le,He,it.value,Se);if(Hs===null){He===null&&(He=zt);break}r&&He&&Hs.alternate===null&&o(le,He),ne=b(Hs,ne,Ve),We===null?qe=Hs:We.sibling=Hs,We=Hs,He=zt}if(it.done)return u(le,He),bt&&Aa(le,Ve),qe;if(He===null){for(;!it.done;Ve++,it=ue.next())it=ke(le,it.value,Se),it!==null&&(ne=b(it,ne,Ve),We===null?qe=it:We.sibling=it,We=it);return bt&&Aa(le,Ve),qe}for(He=g(le,He);!it.done;Ve++,it=ue.next())it=Ie(He,le,Ve,it.value,Se),it!==null&&(r&&it.alternate!==null&&He.delete(it.key===null?Ve:it.key),ne=b(it,ne,Ve),We===null?qe=it:We.sibling=it,We=it);return r&&He.forEach(function(rM){return o(le,rM)}),bt&&Aa(le,Ve),qe}function Ct(le,ne,ue,Se){if(typeof ue=="object"&&ue!==null&&ue.type===A&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case T:e:{for(var qe=ue.key,We=ne;We!==null;){if(We.key===qe){if(qe=ue.type,qe===A){if(We.tag===7){u(le,We.sibling),ne=w(We,ue.props.children),ne.return=le,le=ne;break e}}else if(We.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===G&&h0(qe)===We.type){u(le,We.sibling),ne=w(We,ue.props),ne.ref=al(le,We,ue),ne.return=le,le=ne;break e}u(le,We);break}else o(le,We);We=We.sibling}ue.type===A?(ne=Da(ue.props.children,le.mode,Se,ue.key),ne.return=le,le=ne):(Se=du(ue.type,ue.key,ue.props,null,le.mode,Se),Se.ref=al(le,ne,ue),Se.return=le,le=Se)}return M(le);case R:e:{for(We=ue.key;ne!==null;){if(ne.key===We)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){u(le,ne.sibling),ne=w(ne,ue.children||[]),ne.return=le,le=ne;break e}else{u(le,ne);break}else o(le,ne);ne=ne.sibling}ne=mf(ue,le.mode,Se),ne.return=le,le=ne}return M(le);case G:return We=ue._init,Ct(le,ne,We(ue._payload),Se)}if(tt(ue))return Pe(le,ne,ue,Se);if(L(ue))return Le(le,ne,ue,Se);Bc(le,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,ne!==null&&ne.tag===6?(u(le,ne.sibling),ne=w(ne,ue),ne.return=le,le=ne):(u(le,ne),ne=pf(ue,le.mode,Se),ne.return=le,le=ne),M(le)):u(le,ne)}return Ct}var Lo=f0(!0),p0=f0(!1),zc=$s(null),Uc=null,Do=null,_h=null;function Nh(){_h=Do=Uc=null}function Sh(r){var o=zc.current;vt(zc),r._currentValue=o}function jh(r,o,u){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===u)break;r=r.return}}function qo(r,o){Uc=r,_h=Do=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(wn=!0),r.firstContext=null)}function Dn(r){var o=r._currentValue;if(_h!==r)if(r={context:r,memoizedValue:o,next:null},Do===null){if(Uc===null)throw Error(n(308));Do=r,Uc.dependencies={lanes:0,firstContext:r}}else Do=Do.next=r;return o}var Ra=null;function Eh(r){Ra===null?Ra=[r]:Ra.push(r)}function m0(r,o,u,g){var w=o.interleaved;return w===null?(u.next=u,Eh(o)):(u.next=w.next,w.next=u),o.interleaved=u,cs(r,g)}function cs(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Ls=!1;function Ch(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function g0(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 us(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ds(r,o,u){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(at&2)!==0){var w=g.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),g.pending=o,cs(r,u)}return w=g.interleaved,w===null?(o.next=o,Eh(g)):(o.next=w.next,w.next=o),g.interleaved=o,cs(r,u)}function Wc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,io(r,u)}}function y0(r,o){var u=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,u===g)){var w=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var M={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};b===null?w=b=M:b=b.next=M,u=u.next}while(u!==null);b===null?w=b=o:b=b.next=o}else w=b=o;u={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:b,shared:g.shared,effects:g.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Hc(r,o,u,g){var w=r.updateQueue;Ls=!1;var b=w.firstBaseUpdate,M=w.lastBaseUpdate,Q=w.shared.pending;if(Q!==null){w.shared.pending=null;var te=Q,de=te.next;te.next=null,M===null?b=de:M.next=de,M=te;var xe=r.alternate;xe!==null&&(xe=xe.updateQueue,Q=xe.lastBaseUpdate,Q!==M&&(Q===null?xe.firstBaseUpdate=de:Q.next=de,xe.lastBaseUpdate=te))}if(b!==null){var ke=w.baseState;M=0,xe=de=te=null,Q=b;do{var ve=Q.lane,Ie=Q.eventTime;if((g&ve)===ve){xe!==null&&(xe=xe.next={eventTime:Ie,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Pe=r,Le=Q;switch(ve=o,Ie=u,Le.tag){case 1:if(Pe=Le.payload,typeof Pe=="function"){ke=Pe.call(Ie,ke,ve);break e}ke=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Le.payload,ve=typeof Pe=="function"?Pe.call(Ie,ke,ve):Pe,ve==null)break e;ke=W({},ke,ve);break e;case 2:Ls=!0}}Q.callback!==null&&Q.lane!==0&&(r.flags|=64,ve=w.effects,ve===null?w.effects=[Q]:ve.push(Q))}else Ie={eventTime:Ie,lane:ve,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},xe===null?(de=xe=Ie,te=ke):xe=xe.next=Ie,M|=ve;if(Q=Q.next,Q===null){if(Q=w.shared.pending,Q===null)break;ve=Q,Q=ve.next,ve.next=null,w.lastBaseUpdate=ve,w.shared.pending=null}}while(!0);if(xe===null&&(te=ke),w.baseState=te,w.firstBaseUpdate=de,w.lastBaseUpdate=xe,o=w.shared.interleaved,o!==null){w=o;do M|=w.lane,w=w.next;while(w!==o)}else b===null&&(w.shared.lanes=0);$a|=M,r.lanes=M,r.memoizedState=ke}}function w0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var g=r[o],w=g.callback;if(w!==null){if(g.callback=null,g=u,typeof w!="function")throw Error(n(191,w));w.call(g)}}}var ol={},Rr=$s(ol),il=$s(ol),ll=$s(ol);function Ma(r){if(r===ol)throw Error(n(174));return r}function Th(r,o){switch(gt(ll,o),gt(il,r),gt(Rr,ol),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ot(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ot(o,r)}vt(Rr),gt(Rr,o)}function Fo(){vt(Rr),vt(il),vt(ll)}function v0(r){Ma(ll.current);var o=Ma(Rr.current),u=ot(o,r.type);o!==u&&(gt(il,r),gt(Rr,u))}function Ah(r){il.current===r&&(vt(Rr),vt(il))}var _t=$s(0);function Gc(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.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 Rh=[];function Mh(){for(var r=0;r<Rh.length;r++)Rh[r]._workInProgressVersionPrimary=null;Rh.length=0}var Vc=C.ReactCurrentDispatcher,Ih=C.ReactCurrentBatchConfig,Ia=0,Nt=null,Ot=null,Ft=null,Yc=!1,cl=!1,ul=0,SR=0;function sn(){throw Error(n(321))}function $h(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!tn(r[u],o[u]))return!1;return!0}function Oh(r,o,u,g,w,b){if(Ia=b,Nt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Vc.current=r===null||r.memoizedState===null?TR:AR,r=u(g,w),cl){b=0;do{if(cl=!1,ul=0,25<=b)throw Error(n(301));b+=1,Ft=Ot=null,o.updateQueue=null,Vc.current=RR,r=u(g,w)}while(cl)}if(Vc.current=Qc,o=Ot!==null&&Ot.next!==null,Ia=0,Ft=Ot=Nt=null,Yc=!1,o)throw Error(n(300));return r}function Ph(){var r=ul!==0;return ul=0,r}function Mr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?Nt.memoizedState=Ft=r:Ft=Ft.next=r,Ft}function qn(){if(Ot===null){var r=Nt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=Ft===null?Nt.memoizedState:Ft.next;if(o!==null)Ft=o,Ot=r;else{if(r===null)throw Error(n(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Ft===null?Nt.memoizedState=Ft=r:Ft=Ft.next=r}return Ft}function dl(r,o){return typeof o=="function"?o(r):o}function Lh(r){var o=qn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=Ot,w=g.baseQueue,b=u.pending;if(b!==null){if(w!==null){var M=w.next;w.next=b.next,b.next=M}g.baseQueue=w=b,u.pending=null}if(w!==null){b=w.next,g=g.baseState;var Q=M=null,te=null,de=b;do{var xe=de.lane;if((Ia&xe)===xe)te!==null&&(te=te.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 ke={lane:xe,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};te===null?(Q=te=ke,M=g):te=te.next=ke,Nt.lanes|=xe,$a|=xe}de=de.next}while(de!==null&&de!==b);te===null?M=g:te.next=Q,tn(g,o.memoizedState)||(wn=!0),o.memoizedState=g,o.baseState=M,o.baseQueue=te,u.lastRenderedState=g}if(r=u.interleaved,r!==null){w=r;do b=w.lane,Nt.lanes|=b,$a|=b,w=w.next;while(w!==r)}else w===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function Dh(r){var o=qn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var g=u.dispatch,w=u.pending,b=o.memoizedState;if(w!==null){u.pending=null;var M=w=w.next;do b=r(b,M.action),M=M.next;while(M!==w);tn(b,o.memoizedState)||(wn=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),u.lastRenderedState=b}return[b,g]}function x0(){}function b0(r,o){var u=Nt,g=qn(),w=o(),b=!tn(g.memoizedState,w);if(b&&(g.memoizedState=w,wn=!0),g=g.queue,qh(N0.bind(null,u,g,r),[r]),g.getSnapshot!==o||b||Ft!==null&&Ft.memoizedState.tag&1){if(u.flags|=2048,hl(9,_0.bind(null,u,g,w,o),void 0,null),Bt===null)throw Error(n(349));(Ia&30)!==0||k0(u,o,w)}return w}function k0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function _0(r,o,u,g){o.value=u,o.getSnapshot=g,S0(o)&&j0(r)}function N0(r,o,u){return u(function(){S0(o)&&j0(r)})}function S0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!tn(r,u)}catch{return!0}}function j0(r){var o=cs(r,1);o!==null&&lr(o,r,1,-1)}function E0(r){var o=Mr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:dl,lastRenderedState:r},o.queue=r,r=r.dispatch=CR.bind(null,Nt,r),[o.memoizedState,r]}function hl(r,o,u,g){return r={tag:r,create:o,destroy:u,deps:g,next:null},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(g=u.next,u.next=r,r.next=g,o.lastEffect=r)),r}function C0(){return qn().memoizedState}function Kc(r,o,u,g){var w=Mr();Nt.flags|=r,w.memoizedState=hl(1|o,u,void 0,g===void 0?null:g)}function Xc(r,o,u,g){var w=qn();g=g===void 0?null:g;var b=void 0;if(Ot!==null){var M=Ot.memoizedState;if(b=M.destroy,g!==null&&$h(g,M.deps)){w.memoizedState=hl(o,u,b,g);return}}Nt.flags|=r,w.memoizedState=hl(1|o,u,b,g)}function T0(r,o){return Kc(8390656,8,r,o)}function qh(r,o){return Xc(2048,8,r,o)}function A0(r,o){return Xc(4,2,r,o)}function R0(r,o){return Xc(4,4,r,o)}function M0(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 I0(r,o,u){return u=u!=null?u.concat([r]):null,Xc(4,4,M0.bind(null,o,r),u)}function Fh(){}function $0(r,o){var u=qn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&$h(o,g[1])?g[0]:(u.memoizedState=[r,o],r)}function O0(r,o){var u=qn();o=o===void 0?null:o;var g=u.memoizedState;return g!==null&&o!==null&&$h(o,g[1])?g[0]:(r=r(),u.memoizedState=[r,o],r)}function P0(r,o,u){return(Ia&21)===0?(r.baseState&&(r.baseState=!1,wn=!0),r.memoizedState=u):(tn(u,o)||(u=Tt(),Nt.lanes|=u,$a|=u,r.baseState=!0),o)}function jR(r,o){var u=lt;lt=u!==0&&4>u?u:4,r(!0);var g=Ih.transition;Ih.transition={};try{r(!1),o()}finally{lt=u,Ih.transition=g}}function L0(){return qn().memoizedState}function ER(r,o,u){var g=zs(r);if(u={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null},D0(r))q0(o,u);else if(u=m0(r,o,u,g),u!==null){var w=dn();lr(u,r,g,w),F0(u,o,g)}}function CR(r,o,u){var g=zs(r),w={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null};if(D0(r))q0(o,w);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var M=o.lastRenderedState,Q=b(M,u);if(w.hasEagerState=!0,w.eagerState=Q,tn(Q,M)){var te=o.interleaved;te===null?(w.next=w,Eh(o)):(w.next=te.next,te.next=w),o.interleaved=w;return}}catch{}finally{}u=m0(r,o,w,g),u!==null&&(w=dn(),lr(u,r,g,w),F0(u,o,g))}}function D0(r){var o=r.alternate;return r===Nt||o!==null&&o===Nt}function q0(r,o){cl=Yc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function F0(r,o,u){if((u&4194240)!==0){var g=o.lanes;g&=r.pendingLanes,u|=g,o.lanes=u,io(r,u)}}var Qc={readContext:Dn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},TR={readContext:Dn,useCallback:function(r,o){return Mr().memoizedState=[r,o===void 0?null:o],r},useContext:Dn,useEffect:T0,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Kc(4194308,4,M0.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Kc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Kc(4,2,r,o)},useMemo:function(r,o){var u=Mr();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var g=Mr();return o=u!==void 0?u(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=ER.bind(null,Nt,r),[g.memoizedState,r]},useRef:function(r){var o=Mr();return r={current:r},o.memoizedState=r},useState:E0,useDebugValue:Fh,useDeferredValue:function(r){return Mr().memoizedState=r},useTransition:function(){var r=E0(!1),o=r[0];return r=jR.bind(null,r[1]),Mr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var g=Nt,w=Mr();if(bt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Bt===null)throw Error(n(349));(Ia&30)!==0||k0(g,o,u)}w.memoizedState=u;var b={value:u,getSnapshot:o};return w.queue=b,T0(N0.bind(null,g,b,r),[r]),g.flags|=2048,hl(9,_0.bind(null,g,b,u,o),void 0,null),u},useId:function(){var r=Mr(),o=Bt.identifierPrefix;if(bt){var u=ls,g=is;u=(g&~(1<<32-hn(g)-1)).toString(32)+u,o=":"+o+"R"+u,u=ul++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=SR++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},AR={readContext:Dn,useCallback:$0,useContext:Dn,useEffect:qh,useImperativeHandle:I0,useInsertionEffect:A0,useLayoutEffect:R0,useMemo:O0,useReducer:Lh,useRef:C0,useState:function(){return Lh(dl)},useDebugValue:Fh,useDeferredValue:function(r){var o=qn();return P0(o,Ot.memoizedState,r)},useTransition:function(){var r=Lh(dl)[0],o=qn().memoizedState;return[r,o]},useMutableSource:x0,useSyncExternalStore:b0,useId:L0,unstable_isNewReconciler:!1},RR={readContext:Dn,useCallback:$0,useContext:Dn,useEffect:qh,useImperativeHandle:I0,useInsertionEffect:A0,useLayoutEffect:R0,useMemo:O0,useReducer:Dh,useRef:C0,useState:function(){return Dh(dl)},useDebugValue:Fh,useDeferredValue:function(r){var o=qn();return Ot===null?o.memoizedState=r:P0(o,Ot.memoizedState,r)},useTransition:function(){var r=Dh(dl)[0],o=qn().memoizedState;return[r,o]},useMutableSource:x0,useSyncExternalStore:b0,useId:L0,unstable_isNewReconciler:!1};function ar(r,o){if(r&&r.defaultProps){o=W({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function Bh(r,o,u,g){o=r.memoizedState,u=u(g,o),u=u==null?o:W({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Zc={isMounted:function(r){return(r=r._reactInternals)?Mn(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var g=dn(),w=zs(r),b=us(g,w);b.payload=o,u!=null&&(b.callback=u),o=Ds(r,b,w),o!==null&&(lr(o,r,w,g),Wc(o,r,w))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var g=dn(),w=zs(r),b=us(g,w);b.tag=1,b.payload=o,u!=null&&(b.callback=u),o=Ds(r,b,w),o!==null&&(lr(o,r,w,g),Wc(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=dn(),g=zs(r),w=us(u,g);w.tag=2,o!=null&&(w.callback=o),o=Ds(r,w,g),o!==null&&(lr(o,r,g,u),Wc(o,r,g))}};function B0(r,o,u,g,w,b,M){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,b,M):o.prototype&&o.prototype.isPureReactComponent?!tr(u,g)||!tr(w,b):!0}function z0(r,o,u){var g=!1,w=Os,b=o.contextType;return typeof b=="object"&&b!==null?b=Dn(b):(w=yn(o)?Ca:rn.current,g=o.contextTypes,b=(g=g!=null)?Io(r,w):Os),o=new o(u,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Zc,r.stateNode=o,o._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=b),o}function U0(r,o,u,g){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,g),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,g),o.state!==r&&Zc.enqueueReplaceState(o,o.state,null)}function zh(r,o,u,g){var w=r.stateNode;w.props=u,w.state=r.memoizedState,w.refs={},Ch(r);var b=o.contextType;typeof b=="object"&&b!==null?w.context=Dn(b):(b=yn(o)?Ca:rn.current,w.context=Io(r,b)),w.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(Bh(r,o,b,u),w.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(o=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),o!==w.state&&Zc.enqueueReplaceState(w,w.state,null),Hc(r,u,w,g),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function Bo(r,o){try{var u="",g=o;do u+=U(g),g=g.return;while(g);var w=u}catch(b){w=`
|
|
39
|
+
Error generating stack: `+b.message+`
|
|
40
|
+
`+b.stack}return{value:r,source:o,stack:w,digest:null}}function Uh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Wh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var MR=typeof WeakMap=="function"?WeakMap:Map;function W0(r,o,u){u=us(-1,u),u.tag=3,u.payload={element:null};var g=o.value;return u.callback=function(){au||(au=!0,af=g),Wh(r,o)},u}function H0(r,o,u){u=us(-1,u),u.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var w=o.value;u.payload=function(){return g(w)},u.callback=function(){Wh(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(u.callback=function(){Wh(r,o),typeof g!="function"&&(Fs===null?Fs=new Set([this]):Fs.add(this));var M=o.stack;this.componentDidCatch(o.value,{componentStack:M!==null?M:""})}),u}function G0(r,o,u){var g=r.pingCache;if(g===null){g=r.pingCache=new MR;var w=new Set;g.set(o,w)}else w=g.get(o),w===void 0&&(w=new Set,g.set(o,w));w.has(u)||(w.add(u),r=GR.bind(null,r,o,u),o.then(r,r))}function V0(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 Y0(r,o,u,g,w){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=us(-1,1),o.tag=2,Ds(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var IR=C.ReactCurrentOwner,wn=!1;function un(r,o,u,g){o.child=r===null?p0(o,null,u,g):Lo(o,r.child,u,g)}function K0(r,o,u,g,w){u=u.render;var b=o.ref;return qo(o,w),g=Oh(r,o,u,g,b,w),u=Ph(),r!==null&&!wn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ds(r,o,w)):(bt&&u&&wh(o),o.flags|=1,un(r,o,g,w),o.child)}function X0(r,o,u,g,w){if(r===null){var b=u.type;return typeof b=="function"&&!ff(b)&&b.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=b,Q0(r,o,b,g,w)):(r=du(u.type,null,g,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&w)===0){var M=b.memoizedProps;if(u=u.compare,u=u!==null?u:tr,u(M,g)&&r.ref===o.ref)return ds(r,o,w)}return o.flags|=1,r=Ws(b,g),r.ref=o.ref,r.return=o,o.child=r}function Q0(r,o,u,g,w){if(r!==null){var b=r.memoizedProps;if(tr(b,g)&&r.ref===o.ref)if(wn=!1,o.pendingProps=g=b,(r.lanes&w)!==0)(r.flags&131072)!==0&&(wn=!0);else return o.lanes=r.lanes,ds(r,o,w)}return Hh(r,o,u,g,w)}function Z0(r,o,u){var g=o.pendingProps,w=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},gt(Uo,En),En|=u;else{if((u&1073741824)===0)return r=b!==null?b.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,gt(Uo,En),En|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=b!==null?b.baseLanes:u,gt(Uo,En),En|=g}else b!==null?(g=b.baseLanes|u,o.memoizedState=null):g=u,gt(Uo,En),En|=g;return un(r,o,w,u),o.child}function J0(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Hh(r,o,u,g,w){var b=yn(u)?Ca:rn.current;return b=Io(o,b),qo(o,w),u=Oh(r,o,u,g,b,w),g=Ph(),r!==null&&!wn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ds(r,o,w)):(bt&&g&&wh(o),o.flags|=1,un(r,o,u,w),o.child)}function eb(r,o,u,g,w){if(yn(u)){var b=!0;Pc(o)}else b=!1;if(qo(o,w),o.stateNode===null)eu(r,o),z0(o,u,g),zh(o,u,g,w),g=!0;else if(r===null){var M=o.stateNode,Q=o.memoizedProps;M.props=Q;var te=M.context,de=u.contextType;typeof de=="object"&&de!==null?de=Dn(de):(de=yn(u)?Ca:rn.current,de=Io(o,de));var xe=u.getDerivedStateFromProps,ke=typeof xe=="function"||typeof M.getSnapshotBeforeUpdate=="function";ke||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==g||te!==de)&&U0(o,M,g,de),Ls=!1;var ve=o.memoizedState;M.state=ve,Hc(o,g,M,w),te=o.memoizedState,Q!==g||ve!==te||gn.current||Ls?(typeof xe=="function"&&(Bh(o,u,xe,g),te=o.memoizedState),(Q=Ls||B0(o,u,Q,g,ve,te,de))?(ke||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(o.flags|=4194308)):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=g,o.memoizedState=te),M.props=g,M.state=te,M.context=de,g=Q):(typeof M.componentDidMount=="function"&&(o.flags|=4194308),g=!1)}else{M=o.stateNode,g0(r,o),Q=o.memoizedProps,de=o.type===o.elementType?Q:ar(o.type,Q),M.props=de,ke=o.pendingProps,ve=M.context,te=u.contextType,typeof te=="object"&&te!==null?te=Dn(te):(te=yn(u)?Ca:rn.current,te=Io(o,te));var Ie=u.getDerivedStateFromProps;(xe=typeof Ie=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==ke||ve!==te)&&U0(o,M,g,te),Ls=!1,ve=o.memoizedState,M.state=ve,Hc(o,g,M,w);var Pe=o.memoizedState;Q!==ke||ve!==Pe||gn.current||Ls?(typeof Ie=="function"&&(Bh(o,u,Ie,g),Pe=o.memoizedState),(de=Ls||B0(o,u,de,g,ve,Pe,te)||!1)?(xe||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(g,Pe,te),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(g,Pe,te)),typeof M.componentDidUpdate=="function"&&(o.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),o.memoizedProps=g,o.memoizedState=Pe),M.props=g,M.state=Pe,M.context=te,g=de):(typeof M.componentDidUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===r.memoizedProps&&ve===r.memoizedState||(o.flags|=1024),g=!1)}return Gh(r,o,u,g,b,w)}function Gh(r,o,u,g,w,b){J0(r,o);var M=(o.flags&128)!==0;if(!g&&!M)return w&&a0(o,u,!1),ds(r,o,b);g=o.stateNode,IR.current=o;var Q=M&&typeof u.getDerivedStateFromError!="function"?null:g.render();return o.flags|=1,r!==null&&M?(o.child=Lo(o,r.child,null,b),o.child=Lo(o,null,Q,b)):un(r,o,Q,b),o.memoizedState=g.state,w&&a0(o,u,!0),o.child}function tb(r){var o=r.stateNode;o.pendingContext?r0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&r0(r,o.context,!1),Th(r,o.containerInfo)}function nb(r,o,u,g,w){return Po(),kh(w),o.flags|=256,un(r,o,u,g),o.child}var Vh={dehydrated:null,treeContext:null,retryLane:0};function Yh(r){return{baseLanes:r,cachePool:null,transitions:null}}function rb(r,o,u){var g=o.pendingProps,w=_t.current,b=!1,M=(o.flags&128)!==0,Q;if((Q=M)||(Q=r!==null&&r.memoizedState===null?!1:(w&2)!==0),Q?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),gt(_t,w&1),r===null)return bh(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):(M=g.children,r=g.fallback,b?(g=o.mode,b=o.child,M={mode:"hidden",children:M},(g&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=M):b=hu(M,g,0,null),r=Da(r,g,u,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=Yh(u),o.memoizedState=Vh,r):Kh(o,M));if(w=r.memoizedState,w!==null&&(Q=w.dehydrated,Q!==null))return $R(r,o,M,g,Q,w,u);if(b){b=g.fallback,M=o.mode,w=r.child,Q=w.sibling;var te={mode:"hidden",children:g.children};return(M&1)===0&&o.child!==w?(g=o.child,g.childLanes=0,g.pendingProps=te,o.deletions=null):(g=Ws(w,te),g.subtreeFlags=w.subtreeFlags&14680064),Q!==null?b=Ws(Q,b):(b=Da(b,M,u,null),b.flags|=2),b.return=o,g.return=o,g.sibling=b,o.child=g,g=b,b=o.child,M=r.child.memoizedState,M=M===null?Yh(u):{baseLanes:M.baseLanes|u,cachePool:null,transitions:M.transitions},b.memoizedState=M,b.childLanes=r.childLanes&~u,o.memoizedState=Vh,g}return b=r.child,r=b.sibling,g=Ws(b,{mode:"visible",children:g.children}),(o.mode&1)===0&&(g.lanes=u),g.return=o,g.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=g,o.memoizedState=null,g}function Kh(r,o){return o=hu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Jc(r,o,u,g){return g!==null&&kh(g),Lo(o,r.child,null,u),r=Kh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function $R(r,o,u,g,w,b,M){if(u)return o.flags&256?(o.flags&=-257,g=Uh(Error(n(422))),Jc(r,o,M,g)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=g.fallback,w=o.mode,g=hu({mode:"visible",children:g.children},w,0,null),b=Da(b,w,M,null),b.flags|=2,g.return=o,b.return=o,g.sibling=b,o.child=g,(o.mode&1)!==0&&Lo(o,r.child,null,M),o.child.memoizedState=Yh(M),o.memoizedState=Vh,b);if((o.mode&1)===0)return Jc(r,o,M,null);if(w.data==="$!"){if(g=w.nextSibling&&w.nextSibling.dataset,g)var Q=g.dgst;return g=Q,b=Error(n(419)),g=Uh(b,g,void 0),Jc(r,o,M,g)}if(Q=(M&r.childLanes)!==0,wn||Q){if(g=Bt,g!==null){switch(M&-M){case 4:w=2;break;case 16:w=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:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(g.suspendedLanes|M))!==0?0:w,w!==0&&w!==b.retryLane&&(b.retryLane=w,cs(r,w),lr(g,r,w,-1))}return hf(),g=Uh(Error(n(421))),Jc(r,o,M,g)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=VR.bind(null,r),w._reactRetry=o,null):(r=b.treeContext,jn=Is(w.nextSibling),Sn=o,bt=!0,sr=null,r!==null&&(Pn[Ln++]=is,Pn[Ln++]=ls,Pn[Ln++]=Ta,is=r.id,ls=r.overflow,Ta=o),o=Kh(o,g.children),o.flags|=4096,o)}function sb(r,o,u){r.lanes|=o;var g=r.alternate;g!==null&&(g.lanes|=o),jh(r.return,o,u)}function Xh(r,o,u,g,w){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:g,tail:u,tailMode:w}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=g,b.tail=u,b.tailMode=w)}function ab(r,o,u){var g=o.pendingProps,w=g.revealOrder,b=g.tail;if(un(r,o,g.children,u),g=_t.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&&sb(r,u,o);else if(r.tag===19)sb(r,u,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(gt(_t,g),(o.mode&1)===0)o.memoizedState=null;else switch(w){case"forwards":for(u=o.child,w=null;u!==null;)r=u.alternate,r!==null&&Gc(r)===null&&(w=u),u=u.sibling;u=w,u===null?(w=o.child,o.child=null):(w=u.sibling,u.sibling=null),Xh(o,!1,w,u,b);break;case"backwards":for(u=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Gc(r)===null){o.child=w;break}r=w.sibling,w.sibling=u,u=w,w=r}Xh(o,!0,u,null,b);break;case"together":Xh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function eu(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function ds(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),$a|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Ws(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Ws(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function OR(r,o,u){switch(o.tag){case 3:tb(o),Po();break;case 5:v0(o);break;case 1:yn(o.type)&&Pc(o);break;case 4:Th(o,o.stateNode.containerInfo);break;case 10:var g=o.type._context,w=o.memoizedProps.value;gt(zc,g._currentValue),g._currentValue=w;break;case 13:if(g=o.memoizedState,g!==null)return g.dehydrated!==null?(gt(_t,_t.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?rb(r,o,u):(gt(_t,_t.current&1),r=ds(r,o,u),r!==null?r.sibling:null);gt(_t,_t.current&1);break;case 19:if(g=(u&o.childLanes)!==0,(r.flags&128)!==0){if(g)return ab(r,o,u);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),gt(_t,_t.current),g)break;return null;case 22:case 23:return o.lanes=0,Z0(r,o,u)}return ds(r,o,u)}var ob,Qh,ib,lb;ob=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Qh=function(){},ib=function(r,o,u,g){var w=r.memoizedProps;if(w!==g){r=o.stateNode,Ma(Rr.current);var b=null;switch(u){case"input":w=we(r,w),g=we(r,g),b=[];break;case"select":w=W({},w,{value:void 0}),g=W({},g,{value:void 0}),b=[];break;case"textarea":w=Xe(r,w),g=Xe(r,g),b=[];break;default:typeof w.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=Tr)}Ee(u,g);var M;u=null;for(de in w)if(!g.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var Q=w[de];for(M in Q)Q.hasOwnProperty(M)&&(u||(u={}),u[M]="")}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 te=g[de];if(Q=w!=null?w[de]:void 0,g.hasOwnProperty(de)&&te!==Q&&(te!=null||Q!=null))if(de==="style")if(Q){for(M in Q)!Q.hasOwnProperty(M)||te&&te.hasOwnProperty(M)||(u||(u={}),u[M]="");for(M in te)te.hasOwnProperty(M)&&Q[M]!==te[M]&&(u||(u={}),u[M]=te[M])}else u||(b||(b=[]),b.push(de,u)),u=te;else de==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(b=b||[]).push(de,te)):de==="children"?typeof te!="string"&&typeof te!="number"||(b=b||[]).push(de,""+te):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(te!=null&&de==="onScroll"&&Ne("scroll",r),b||Q===te||(b=[])):(b=b||[]).push(de,te))}u&&(b=b||[]).push("style",u);var de=b;(o.updateQueue=de)&&(o.flags|=4)}},lb=function(r,o,u,g){u!==g&&(o.flags|=4)};function fl(r,o){if(!bt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function an(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,g=0;if(o)for(var w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags&14680064,g|=w.flags&14680064,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)u|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=g,r.childLanes=u,o}function PR(r,o,u){var g=o.pendingProps;switch(vh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return an(o),null;case 1:return yn(o.type)&&Oc(),an(o),null;case 3:return g=o.stateNode,Fo(),vt(gn),vt(rn),Mh(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(Fc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,sr!==null&&(cf(sr),sr=null))),Qh(r,o),an(o),null;case 5:Ah(o);var w=Ma(ll.current);if(u=o.type,r!==null&&o.stateNode!=null)ib(r,o,u,g,w),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!g){if(o.stateNode===null)throw Error(n(166));return an(o),null}if(r=Ma(Rr.current),Fc(o)){g=o.stateNode,u=o.type;var b=o.memoizedProps;switch(g[Ar]=o,g[rl]=b,r=(o.mode&1)!==0,u){case"dialog":Ne("cancel",g),Ne("close",g);break;case"iframe":case"object":case"embed":Ne("load",g);break;case"video":case"audio":for(w=0;w<B.length;w++)Ne(B[w],g);break;case"source":Ne("error",g);break;case"img":case"image":case"link":Ne("error",g),Ne("load",g);break;case"details":Ne("toggle",g);break;case"input":be(g,b),Ne("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!b.multiple},Ne("invalid",g);break;case"textarea":Ke(g,b),Ne("invalid",g)}Ee(u,b),w=null;for(var M in b)if(b.hasOwnProperty(M)){var Q=b[M];M==="children"?typeof Q=="string"?g.textContent!==Q&&(b.suppressHydrationWarning!==!0&&Cr(g.textContent,Q,r),w=["children",Q]):typeof Q=="number"&&g.textContent!==""+Q&&(b.suppressHydrationWarning!==!0&&Cr(g.textContent,Q,r),w=["children",""+Q]):a.hasOwnProperty(M)&&Q!=null&&M==="onScroll"&&Ne("scroll",g)}switch(u){case"input":Re(g),Ce(g,b,!0);break;case"textarea":Re(g),dt(g);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(g.onclick=Tr)}g=w,o.updateQueue=g,g!==null&&(o.flags|=4)}else{M=w.nodeType===9?w:w.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=yt(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=M.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=M.createElement(u,{is:g.is}):(r=M.createElement(u),u==="select"&&(M=r,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):r=M.createElementNS(r,u),r[Ar]=o,r[rl]=g,ob(r,o,!1,!1),o.stateNode=r;e:{switch(M=De(u,g),u){case"dialog":Ne("cancel",r),Ne("close",r),w=g;break;case"iframe":case"object":case"embed":Ne("load",r),w=g;break;case"video":case"audio":for(w=0;w<B.length;w++)Ne(B[w],r);w=g;break;case"source":Ne("error",r),w=g;break;case"img":case"image":case"link":Ne("error",r),Ne("load",r),w=g;break;case"details":Ne("toggle",r),w=g;break;case"input":be(r,g),w=we(r,g),Ne("invalid",r);break;case"option":w=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},w=W({},g,{value:void 0}),Ne("invalid",r);break;case"textarea":Ke(r,g),w=Xe(r,g),Ne("invalid",r);break;default:w=g}Ee(u,w),Q=w;for(b in Q)if(Q.hasOwnProperty(b)){var te=Q[b];b==="style"?Ae(r,te):b==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&je(r,te)):b==="children"?typeof te=="string"?(u!=="textarea"||te!=="")&&Fe(r,te):typeof te=="number"&&Fe(r,""+te):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?te!=null&&b==="onScroll"&&Ne("scroll",r):te!=null&&E(r,b,te,M))}switch(u){case"input":Re(r),Ce(r,g,!1);break;case"textarea":Re(r),dt(r);break;case"option":g.value!=null&&r.setAttribute("value",""+se(g.value));break;case"select":r.multiple=!!g.multiple,b=g.value,b!=null?Qe(r,!!g.multiple,b,!1):g.defaultValue!=null&&Qe(r,!!g.multiple,g.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=Tr)}switch(u){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 an(o),null;case 6:if(r&&o.stateNode!=null)lb(r,o,r.memoizedProps,g);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(u=Ma(ll.current),Ma(Rr.current),Fc(o)){if(g=o.stateNode,u=o.memoizedProps,g[Ar]=o,(b=g.nodeValue!==u)&&(r=Sn,r!==null))switch(r.tag){case 3:Cr(g.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Cr(g.nodeValue,u,(r.mode&1)!==0)}b&&(o.flags|=4)}else g=(u.nodeType===9?u:u.ownerDocument).createTextNode(g),g[Ar]=o,o.stateNode=g}return an(o),null;case 13:if(vt(_t),g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(bt&&jn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)d0(),Po(),o.flags|=98560,b=!1;else if(b=Fc(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[Ar]=o}else Po(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;an(o),b=!1}else sr!==null&&(cf(sr),sr=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?Pt===0&&(Pt=3):hf())),o.updateQueue!==null&&(o.flags|=4),an(o),null);case 4:return Fo(),Qh(r,o),r===null&&pt(o.stateNode.containerInfo),an(o),null;case 10:return Sh(o.type._context),an(o),null;case 17:return yn(o.type)&&Oc(),an(o),null;case 19:if(vt(_t),b=o.memoizedState,b===null)return an(o),null;if(g=(o.flags&128)!==0,M=b.rendering,M===null)if(g)fl(b,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(M=Gc(r),M!==null){for(o.flags|=128,fl(b,!1),g=M.updateQueue,g!==null&&(o.updateQueue=g,o.flags|=4),o.subtreeFlags=0,g=u,u=o.child;u!==null;)b=u,r=g,b.flags&=14680066,M=b.alternate,M===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=M.childLanes,b.lanes=M.lanes,b.child=M.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=M.memoizedProps,b.memoizedState=M.memoizedState,b.updateQueue=M.updateQueue,b.type=M.type,r=M.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return gt(_t,_t.current&1|2),o.child}r=r.sibling}b.tail!==null&&ft()>Wo&&(o.flags|=128,g=!0,fl(b,!1),o.lanes=4194304)}else{if(!g)if(r=Gc(M),r!==null){if(o.flags|=128,g=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),fl(b,!0),b.tail===null&&b.tailMode==="hidden"&&!M.alternate&&!bt)return an(o),null}else 2*ft()-b.renderingStartTime>Wo&&u!==1073741824&&(o.flags|=128,g=!0,fl(b,!1),o.lanes=4194304);b.isBackwards?(M.sibling=o.child,o.child=M):(u=b.last,u!==null?u.sibling=M:o.child=M,b.last=M)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=ft(),o.sibling=null,u=_t.current,gt(_t,g?u&1|2:u&1),o):(an(o),null);case 22:case 23:return df(),g=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(o.flags|=8192),g&&(o.mode&1)!==0?(En&1073741824)!==0&&(an(o),o.subtreeFlags&6&&(o.flags|=8192)):an(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function LR(r,o){switch(vh(o),o.tag){case 1:return yn(o.type)&&Oc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Fo(),vt(gn),vt(rn),Mh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Ah(o),null;case 13:if(vt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Po()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return vt(_t),null;case 4:return Fo(),null;case 10:return Sh(o.type._context),null;case 22:case 23:return df(),null;case 24:return null;default:return null}}var tu=!1,on=!1,DR=typeof WeakSet=="function"?WeakSet:Set,$e=null;function zo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(g){jt(r,o,g)}else u.current=null}function Zh(r,o,u){try{u()}catch(g){jt(r,o,g)}}var cb=!1;function qR(r,o){if(St=ho,r=Zi(),_o(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var g=u.getSelection&&u.getSelection();if(g&&g.rangeCount!==0){u=g.anchorNode;var w=g.anchorOffset,b=g.focusNode;g=g.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var M=0,Q=-1,te=-1,de=0,xe=0,ke=r,ve=null;t:for(;;){for(var Ie;ke!==u||w!==0&&ke.nodeType!==3||(Q=M+w),ke!==b||g!==0&&ke.nodeType!==3||(te=M+g),ke.nodeType===3&&(M+=ke.nodeValue.length),(Ie=ke.firstChild)!==null;)ve=ke,ke=Ie;for(;;){if(ke===r)break t;if(ve===u&&++de===w&&(Q=M),ve===b&&++xe===g&&(te=M),(Ie=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Ie}u=Q===-1||te===-1?null:{start:Q,end:te}}else u=null}u=u||{start:0,end:0}}else u=null;for(To={focusedElem:r,selectionRange:u},ho=!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 Pe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Pe!==null){var Le=Pe.memoizedProps,Ct=Pe.memoizedState,le=o.stateNode,ne=le.getSnapshotBeforeUpdate(o.elementType===o.type?Le:ar(o.type,Le),Ct);le.__reactInternalSnapshotBeforeUpdate=ne}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(Se){jt(o,o.return,Se)}if(r=o.sibling,r!==null){r.return=o.return,$e=r;break}$e=o.return}return Pe=cb,cb=!1,Pe}function pl(r,o,u){var g=o.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var w=g=g.next;do{if((w.tag&r)===r){var b=w.destroy;w.destroy=void 0,b!==void 0&&Zh(o,u,b)}w=w.next}while(w!==g)}}function nu(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var g=u.create;u.destroy=g()}u=u.next}while(u!==o)}}function Jh(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function ub(r){var o=r.alternate;o!==null&&(r.alternate=null,ub(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Ar],delete o[rl],delete o[mh],delete o[bR],delete o[kR])),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 db(r){return r.tag===5||r.tag===3||r.tag===4}function hb(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||db(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 ef(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Tr));else if(g!==4&&(r=r.child,r!==null))for(ef(r,o,u),r=r.sibling;r!==null;)ef(r,o,u),r=r.sibling}function tf(r,o,u){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(tf(r,o,u),r=r.sibling;r!==null;)tf(r,o,u),r=r.sibling}var Vt=null,or=!1;function qs(r,o,u){for(u=u.child;u!==null;)fb(r,o,u),u=u.sibling}function fb(r,o,u){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(Yr,u)}catch{}switch(u.tag){case 5:on||zo(u,o);case 6:var g=Vt,w=or;Vt=null,qs(r,o,u),Vt=g,or=w,Vt!==null&&(or?(r=Vt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Vt.removeChild(u.stateNode));break;case 18:Vt!==null&&(or?(r=Vt,u=u.stateNode,r.nodeType===8?ph(r.parentNode,u):r.nodeType===1&&ph(r,u),ga(r)):ph(Vt,u.stateNode));break;case 4:g=Vt,w=or,Vt=u.stateNode.containerInfo,or=!0,qs(r,o,u),Vt=g,or=w;break;case 0:case 11:case 14:case 15:if(!on&&(g=u.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){w=g=g.next;do{var b=w,M=b.destroy;b=b.tag,M!==void 0&&((b&2)!==0||(b&4)!==0)&&Zh(u,o,M),w=w.next}while(w!==g)}qs(r,o,u);break;case 1:if(!on&&(zo(u,o),g=u.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=u.memoizedProps,g.state=u.memoizedState,g.componentWillUnmount()}catch(Q){jt(u,o,Q)}qs(r,o,u);break;case 21:qs(r,o,u);break;case 22:u.mode&1?(on=(g=on)||u.memoizedState!==null,qs(r,o,u),on=g):qs(r,o,u);break;default:qs(r,o,u)}}function pb(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new DR),o.forEach(function(g){var w=YR.bind(null,r,g);u.has(g)||(u.add(g),g.then(w,w))})}}function ir(r,o){var u=o.deletions;if(u!==null)for(var g=0;g<u.length;g++){var w=u[g];try{var b=r,M=o,Q=M;e:for(;Q!==null;){switch(Q.tag){case 5:Vt=Q.stateNode,or=!1;break e;case 3:Vt=Q.stateNode.containerInfo,or=!0;break e;case 4:Vt=Q.stateNode.containerInfo,or=!0;break e}Q=Q.return}if(Vt===null)throw Error(n(160));fb(b,M,w),Vt=null,or=!1;var te=w.alternate;te!==null&&(te.return=null),w.return=null}catch(de){jt(w,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)mb(o,r),o=o.sibling}function mb(r,o){var u=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(ir(o,r),Ir(r),g&4){try{pl(3,r,r.return),nu(3,r)}catch(Le){jt(r,r.return,Le)}try{pl(5,r,r.return)}catch(Le){jt(r,r.return,Le)}}break;case 1:ir(o,r),Ir(r),g&512&&u!==null&&zo(u,u.return);break;case 5:if(ir(o,r),Ir(r),g&512&&u!==null&&zo(u,u.return),r.flags&32){var w=r.stateNode;try{Fe(w,"")}catch(Le){jt(r,r.return,Le)}}if(g&4&&(w=r.stateNode,w!=null)){var b=r.memoizedProps,M=u!==null?u.memoizedProps:b,Q=r.type,te=r.updateQueue;if(r.updateQueue=null,te!==null)try{Q==="input"&&b.type==="radio"&&b.name!=null&&Be(w,b),De(Q,M);var de=De(Q,b);for(M=0;M<te.length;M+=2){var xe=te[M],ke=te[M+1];xe==="style"?Ae(w,ke):xe==="dangerouslySetInnerHTML"?je(w,ke):xe==="children"?Fe(w,ke):E(w,xe,ke,de)}switch(Q){case"input":_e(w,b);break;case"textarea":fe(w,b);break;case"select":var ve=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!b.multiple;var Ie=b.value;Ie!=null?Qe(w,!!b.multiple,Ie,!1):ve!==!!b.multiple&&(b.defaultValue!=null?Qe(w,!!b.multiple,b.defaultValue,!0):Qe(w,!!b.multiple,b.multiple?[]:"",!1))}w[rl]=b}catch(Le){jt(r,r.return,Le)}}break;case 6:if(ir(o,r),Ir(r),g&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,b=r.memoizedProps;try{w.nodeValue=b}catch(Le){jt(r,r.return,Le)}}break;case 3:if(ir(o,r),Ir(r),g&4&&u!==null&&u.memoizedState.isDehydrated)try{ga(o.containerInfo)}catch(Le){jt(r,r.return,Le)}break;case 4:ir(o,r),Ir(r);break;case 13:ir(o,r),Ir(r),w=r.child,w.flags&8192&&(b=w.memoizedState!==null,w.stateNode.isHidden=b,!b||w.alternate!==null&&w.alternate.memoizedState!==null||(sf=ft())),g&4&&pb(r);break;case 22:if(xe=u!==null&&u.memoizedState!==null,r.mode&1?(on=(de=on)||xe,ir(o,r),on=de):ir(o,r),Ir(r),g&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!xe&&(r.mode&1)!==0)for($e=r,xe=r.child;xe!==null;){for(ke=$e=xe;$e!==null;){switch(ve=$e,Ie=ve.child,ve.tag){case 0:case 11:case 14:case 15:pl(4,ve,ve.return);break;case 1:zo(ve,ve.return);var Pe=ve.stateNode;if(typeof Pe.componentWillUnmount=="function"){g=ve,u=ve.return;try{o=g,Pe.props=o.memoizedProps,Pe.state=o.memoizedState,Pe.componentWillUnmount()}catch(Le){jt(g,u,Le)}}break;case 5:zo(ve,ve.return);break;case 22:if(ve.memoizedState!==null){wb(ke);continue}}Ie!==null?(Ie.return=ve,$e=Ie):wb(ke)}xe=xe.sibling}e:for(xe=null,ke=r;;){if(ke.tag===5){if(xe===null){xe=ke;try{w=ke.stateNode,de?(b=w.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(Q=ke.stateNode,te=ke.memoizedProps.style,M=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=re("display",M))}catch(Le){jt(r,r.return,Le)}}}else if(ke.tag===6){if(xe===null)try{ke.stateNode.nodeValue=de?"":ke.memoizedProps}catch(Le){jt(r,r.return,Le)}}else if((ke.tag!==22&&ke.tag!==23||ke.memoizedState===null||ke===r)&&ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===r)break e;for(;ke.sibling===null;){if(ke.return===null||ke.return===r)break e;xe===ke&&(xe=null),ke=ke.return}xe===ke&&(xe=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:ir(o,r),Ir(r),g&4&&pb(r);break;case 21:break;default:ir(o,r),Ir(r)}}function Ir(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(db(u)){var g=u;break e}u=u.return}throw Error(n(160))}switch(g.tag){case 5:var w=g.stateNode;g.flags&32&&(Fe(w,""),g.flags&=-33);var b=hb(r);tf(r,b,w);break;case 3:case 4:var M=g.stateNode.containerInfo,Q=hb(r);ef(r,Q,M);break;default:throw Error(n(161))}}catch(te){jt(r,r.return,te)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function FR(r,o,u){$e=r,gb(r)}function gb(r,o,u){for(var g=(r.mode&1)!==0;$e!==null;){var w=$e,b=w.child;if(w.tag===22&&g){var M=w.memoizedState!==null||tu;if(!M){var Q=w.alternate,te=Q!==null&&Q.memoizedState!==null||on;Q=tu;var de=on;if(tu=M,(on=te)&&!de)for($e=w;$e!==null;)M=$e,te=M.child,M.tag===22&&M.memoizedState!==null?vb(w):te!==null?(te.return=M,$e=te):vb(w);for(;b!==null;)$e=b,gb(b),b=b.sibling;$e=w,tu=Q,on=de}yb(r)}else(w.subtreeFlags&8772)!==0&&b!==null?(b.return=w,$e=b):yb(r)}}function yb(r){for(;$e!==null;){var o=$e;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:on||nu(5,o);break;case 1:var g=o.stateNode;if(o.flags&4&&!on)if(u===null)g.componentDidMount();else{var w=o.elementType===o.type?u.memoizedProps:ar(o.type,u.memoizedProps);g.componentDidUpdate(w,u.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&w0(o,b,g);break;case 3:var M=o.updateQueue;if(M!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}w0(o,M,u)}break;case 5:var Q=o.stateNode;if(u===null&&o.flags&4){u=Q;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&u.focus();break;case"img":te.src&&(u.src=te.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 xe=de.memoizedState;if(xe!==null){var ke=xe.dehydrated;ke!==null&&ga(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}on||o.flags&512&&Jh(o)}catch(ve){jt(o,o.return,ve)}}if(o===r){$e=null;break}if(u=o.sibling,u!==null){u.return=o.return,$e=u;break}$e=o.return}}function wb(r){for(;$e!==null;){var o=$e;if(o===r){$e=null;break}var u=o.sibling;if(u!==null){u.return=o.return,$e=u;break}$e=o.return}}function vb(r){for(;$e!==null;){var o=$e;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{nu(4,o)}catch(te){jt(o,u,te)}break;case 1:var g=o.stateNode;if(typeof g.componentDidMount=="function"){var w=o.return;try{g.componentDidMount()}catch(te){jt(o,w,te)}}var b=o.return;try{Jh(o)}catch(te){jt(o,b,te)}break;case 5:var M=o.return;try{Jh(o)}catch(te){jt(o,M,te)}}}catch(te){jt(o,o.return,te)}if(o===r){$e=null;break}var Q=o.sibling;if(Q!==null){Q.return=o.return,$e=Q;break}$e=o.return}}var BR=Math.ceil,ru=C.ReactCurrentDispatcher,nf=C.ReactCurrentOwner,Fn=C.ReactCurrentBatchConfig,at=0,Bt=null,At=null,Yt=0,En=0,Uo=$s(0),Pt=0,ml=null,$a=0,su=0,rf=0,gl=null,vn=null,sf=0,Wo=1/0,hs=null,au=!1,af=null,Fs=null,ou=!1,Bs=null,iu=0,yl=0,of=null,lu=-1,cu=0;function dn(){return(at&6)!==0?ft():lu!==-1?lu:lu=ft()}function zs(r){return(r.mode&1)===0?1:(at&2)!==0&&Yt!==0?Yt&-Yt:NR.transition!==null?(cu===0&&(cu=Tt()),cu):(r=lt,r!==0||(r=window.event,r=r===void 0?16:$i(r.type)),r)}function lr(r,o,u,g){if(50<yl)throw yl=0,of=null,Error(n(185));ln(r,u,g),((at&2)===0||r!==Bt)&&(r===Bt&&((at&2)===0&&(su|=u),Pt===4&&Us(r,Yt)),xn(r,g),u===1&&at===0&&(o.mode&1)===0&&(Wo=ft()+500,Lc&&Ps()))}function xn(r,o){var u=r.callbackNode;Xd(r,o);var g=Zt(r,r===Bt?Yt:0);if(g===0)u!==null&&no(u),r.callbackNode=null,r.callbackPriority=0;else if(o=g&-g,r.callbackPriority!==o){if(u!=null&&no(u),o===1)r.tag===0?_R(bb.bind(null,r)):o0(bb.bind(null,r)),vR(function(){(at&6)===0&&Ps()}),u=null;else{switch(Qn(g)){case 1:u=ua;break;case 4:u=Hr;break;case 16:u=Gr;break;case 536870912:u=da;break;default:u=Gr}u=Tb(u,xb.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function xb(r,o){if(lu=-1,cu=0,(at&6)!==0)throw Error(n(327));var u=r.callbackNode;if(Ho()&&r.callbackNode!==u)return null;var g=Zt(r,r===Bt?Yt:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||o)o=uu(r,g);else{o=g;var w=at;at|=2;var b=_b();(Bt!==r||Yt!==o)&&(hs=null,Wo=ft()+500,Pa(r,o));do try{WR();break}catch(Q){kb(r,Q)}while(!0);Nh(),ru.current=b,at=w,At!==null?o=0:(Bt=null,Yt=0,o=Pt)}if(o!==0){if(o===2&&(w=fa(r),w!==0&&(g=w,o=lf(r,w))),o===1)throw u=ml,Pa(r,0),Us(r,g),xn(r,ft()),u;if(o===6)Us(r,g);else{if(w=r.current.alternate,(g&30)===0&&!zR(w)&&(o=uu(r,g),o===2&&(b=fa(r),b!==0&&(g=b,o=lf(r,b))),o===1))throw u=ml,Pa(r,0),Us(r,g),xn(r,ft()),u;switch(r.finishedWork=w,r.finishedLanes=g,o){case 0:case 1:throw Error(n(345));case 2:La(r,vn,hs);break;case 3:if(Us(r,g),(g&130023424)===g&&(o=sf+500-ft(),10<o)){if(Zt(r,0)!==0)break;if(w=r.suspendedLanes,(w&g)!==g){dn(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=fh(La.bind(null,r,vn,hs),o);break}La(r,vn,hs);break;case 4:if(Us(r,g),(g&4194240)===g)break;for(o=r.eventTimes,w=-1;0<g;){var M=31-hn(g);b=1<<M,M=o[M],M>w&&(w=M),g&=~b}if(g=w,g=ft()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*BR(g/1960))-g,10<g){r.timeoutHandle=fh(La.bind(null,r,vn,hs),g);break}La(r,vn,hs);break;case 5:La(r,vn,hs);break;default:throw Error(n(329))}}}return xn(r,ft()),r.callbackNode===u?xb.bind(null,r):null}function lf(r,o){var u=gl;return r.current.memoizedState.isDehydrated&&(Pa(r,o).flags|=256),r=uu(r,o),r!==2&&(o=vn,vn=u,o!==null&&cf(o)),r}function cf(r){vn===null?vn=r:vn.push.apply(vn,r)}function zR(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var g=0;g<u.length;g++){var w=u[g],b=w.getSnapshot;w=w.value;try{if(!tn(b(),w))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;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 Us(r,o){for(o&=~rf,o&=~su,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-hn(o),g=1<<u;r[u]=-1,o&=~g}}function bb(r){if((at&6)!==0)throw Error(n(327));Ho();var o=Zt(r,0);if((o&1)===0)return xn(r,ft()),null;var u=uu(r,o);if(r.tag!==0&&u===2){var g=fa(r);g!==0&&(o=g,u=lf(r,g))}if(u===1)throw u=ml,Pa(r,0),Us(r,o),xn(r,ft()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,La(r,vn,hs),xn(r,ft()),null}function uf(r,o){var u=at;at|=1;try{return r(o)}finally{at=u,at===0&&(Wo=ft()+500,Lc&&Ps())}}function Oa(r){Bs!==null&&Bs.tag===0&&(at&6)===0&&Ho();var o=at;at|=1;var u=Fn.transition,g=lt;try{if(Fn.transition=null,lt=1,r)return r()}finally{lt=g,Fn.transition=u,at=o,(at&6)===0&&Ps()}}function df(){En=Uo.current,vt(Uo)}function Pa(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,wR(u)),At!==null)for(u=At.return;u!==null;){var g=u;switch(vh(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&Oc();break;case 3:Fo(),vt(gn),vt(rn),Mh();break;case 5:Ah(g);break;case 4:Fo();break;case 13:vt(_t);break;case 19:vt(_t);break;case 10:Sh(g.type._context);break;case 22:case 23:df()}u=u.return}if(Bt=r,At=r=Ws(r.current,null),Yt=En=o,Pt=0,ml=null,rf=su=$a=0,vn=gl=null,Ra!==null){for(o=0;o<Ra.length;o++)if(u=Ra[o],g=u.interleaved,g!==null){u.interleaved=null;var w=g.next,b=u.pending;if(b!==null){var M=b.next;b.next=w,g.next=M}u.pending=g}Ra=null}return r}function kb(r,o){do{var u=At;try{if(Nh(),Vc.current=Qc,Yc){for(var g=Nt.memoizedState;g!==null;){var w=g.queue;w!==null&&(w.pending=null),g=g.next}Yc=!1}if(Ia=0,Ft=Ot=Nt=null,cl=!1,ul=0,nf.current=null,u===null||u.return===null){Pt=1,ml=o,At=null;break}e:{var b=r,M=u.return,Q=u,te=o;if(o=Yt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var de=te,xe=Q,ke=xe.tag;if((xe.mode&1)===0&&(ke===0||ke===11||ke===15)){var ve=xe.alternate;ve?(xe.updateQueue=ve.updateQueue,xe.memoizedState=ve.memoizedState,xe.lanes=ve.lanes):(xe.updateQueue=null,xe.memoizedState=null)}var Ie=V0(M);if(Ie!==null){Ie.flags&=-257,Y0(Ie,M,Q,b,o),Ie.mode&1&&G0(b,de,o),o=Ie,te=de;var Pe=o.updateQueue;if(Pe===null){var Le=new Set;Le.add(te),o.updateQueue=Le}else Pe.add(te);break e}else{if((o&1)===0){G0(b,de,o),hf();break e}te=Error(n(426))}}else if(bt&&Q.mode&1){var Ct=V0(M);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),Y0(Ct,M,Q,b,o),kh(Bo(te,Q));break e}}b=te=Bo(te,Q),Pt!==4&&(Pt=2),gl===null?gl=[b]:gl.push(b),b=M;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var le=W0(b,te,o);y0(b,le);break e;case 1:Q=te;var ne=b.type,ue=b.stateNode;if((b.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&(Fs===null||!Fs.has(ue)))){b.flags|=65536,o&=-o,b.lanes|=o;var Se=H0(b,Q,o);y0(b,Se);break e}}b=b.return}while(b!==null)}Sb(u)}catch(qe){o=qe,At===u&&u!==null&&(At=u=u.return);continue}break}while(!0)}function _b(){var r=ru.current;return ru.current=Qc,r===null?Qc:r}function hf(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Bt===null||($a&268435455)===0&&(su&268435455)===0||Us(Bt,Yt)}function uu(r,o){var u=at;at|=2;var g=_b();(Bt!==r||Yt!==o)&&(hs=null,Pa(r,o));do try{UR();break}catch(w){kb(r,w)}while(!0);if(Nh(),at=u,ru.current=g,At!==null)throw Error(n(261));return Bt=null,Yt=0,Pt}function UR(){for(;At!==null;)Nb(At)}function WR(){for(;At!==null&&!ca();)Nb(At)}function Nb(r){var o=Cb(r.alternate,r,En);r.memoizedProps=r.pendingProps,o===null?Sb(r):At=o,nf.current=null}function Sb(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=PR(u,o,En),u!==null){At=u;return}}else{if(u=LR(u,o),u!==null){u.flags&=32767,At=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,At=null;return}}if(o=o.sibling,o!==null){At=o;return}At=o=r}while(o!==null);Pt===0&&(Pt=5)}function La(r,o,u){var g=lt,w=Fn.transition;try{Fn.transition=null,lt=1,HR(r,o,u,g)}finally{Fn.transition=w,lt=g}return null}function HR(r,o,u,g){do Ho();while(Bs!==null);if((at&6)!==0)throw Error(n(327));u=r.finishedWork;var w=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=u.lanes|u.childLanes;if(oo(r,b),r===Bt&&(At=Bt=null,Yt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||ou||(ou=!0,Tb(Gr,function(){return Ho(),null})),b=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||b){b=Fn.transition,Fn.transition=null;var M=lt;lt=1;var Q=at;at|=4,nf.current=null,qR(r,u),mb(u,r),ch(To),ho=!!St,To=St=null,r.current=u,FR(u),Ci(),at=Q,lt=M,Fn.transition=b}else r.current=u;if(ou&&(ou=!1,Bs=r,iu=w),b=r.pendingLanes,b===0&&(Fs=null),ha(u.stateNode),xn(r,ft()),o!==null)for(g=r.onRecoverableError,u=0;u<o.length;u++)w=o[u],g(w.value,{componentStack:w.stack,digest:w.digest});if(au)throw au=!1,r=af,af=null,r;return(iu&1)!==0&&r.tag!==0&&Ho(),b=r.pendingLanes,(b&1)!==0?r===of?yl++:(yl=0,of=r):yl=0,Ps(),null}function Ho(){if(Bs!==null){var r=Qn(iu),o=Fn.transition,u=lt;try{if(Fn.transition=null,lt=16>r?16:r,Bs===null)var g=!1;else{if(r=Bs,Bs=null,iu=0,(at&6)!==0)throw Error(n(331));var w=at;for(at|=4,$e=r.current;$e!==null;){var b=$e,M=b.child;if(($e.flags&16)!==0){var Q=b.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var de=Q[te];for($e=de;$e!==null;){var xe=$e;switch(xe.tag){case 0:case 11:case 15:pl(8,xe,b)}var ke=xe.child;if(ke!==null)ke.return=xe,$e=ke;else for(;$e!==null;){xe=$e;var ve=xe.sibling,Ie=xe.return;if(ub(xe),xe===de){$e=null;break}if(ve!==null){ve.return=Ie,$e=ve;break}$e=Ie}}}var Pe=b.alternate;if(Pe!==null){var Le=Pe.child;if(Le!==null){Pe.child=null;do{var Ct=Le.sibling;Le.sibling=null,Le=Ct}while(Le!==null)}}$e=b}}if((b.subtreeFlags&2064)!==0&&M!==null)M.return=b,$e=M;else e:for(;$e!==null;){if(b=$e,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:pl(9,b,b.return)}var le=b.sibling;if(le!==null){le.return=b.return,$e=le;break e}$e=b.return}}var ne=r.current;for($e=ne;$e!==null;){M=$e;var ue=M.child;if((M.subtreeFlags&2064)!==0&&ue!==null)ue.return=M,$e=ue;else e:for(M=ne;$e!==null;){if(Q=$e,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:nu(9,Q)}}catch(qe){jt(Q,Q.return,qe)}if(Q===M){$e=null;break e}var Se=Q.sibling;if(Se!==null){Se.return=Q.return,$e=Se;break e}$e=Q.return}}if(at=w,Ps(),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(Yr,r)}catch{}g=!0}return g}finally{lt=u,Fn.transition=o}}return!1}function jb(r,o,u){o=Bo(u,o),o=W0(r,o,1),r=Ds(r,o,1),o=dn(),r!==null&&(ln(r,1,o),xn(r,o))}function jt(r,o,u){if(r.tag===3)jb(r,r,u);else for(;o!==null;){if(o.tag===3){jb(o,r,u);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Fs===null||!Fs.has(g))){r=Bo(u,r),r=H0(o,r,1),o=Ds(o,r,1),r=dn(),o!==null&&(ln(o,1,r),xn(o,r));break}}o=o.return}}function GR(r,o,u){var g=r.pingCache;g!==null&&g.delete(o),o=dn(),r.pingedLanes|=r.suspendedLanes&u,Bt===r&&(Yt&u)===u&&(Pt===4||Pt===3&&(Yt&130023424)===Yt&&500>ft()-sf?Pa(r,0):rf|=u),xn(r,o)}function Eb(r,o){o===0&&((r.mode&1)===0?o=1:(o=so,so<<=1,(so&130023424)===0&&(so=4194304)));var u=dn();r=cs(r,o),r!==null&&(ln(r,o,u),xn(r,u))}function VR(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),Eb(r,u)}function YR(r,o){var u=0;switch(r.tag){case 13:var g=r.stateNode,w=r.memoizedState;w!==null&&(u=w.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(o),Eb(r,u)}var Cb;Cb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||gn.current)wn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return wn=!1,OR(r,o,u);wn=(r.flags&131072)!==0}else wn=!1,bt&&(o.flags&1048576)!==0&&i0(o,qc,o.index);switch(o.lanes=0,o.tag){case 2:var g=o.type;eu(r,o),r=o.pendingProps;var w=Io(o,rn.current);qo(o,u),w=Oh(null,o,g,r,w,u);var b=Ph();return o.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,yn(g)?(b=!0,Pc(o)):b=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Ch(o),w.updater=Zc,o.stateNode=w,w._reactInternals=o,zh(o,g,r,u),o=Gh(null,o,g,!0,b,u)):(o.tag=0,bt&&b&&wh(o),un(null,o,w,u),o=o.child),o;case 16:g=o.elementType;e:{switch(eu(r,o),r=o.pendingProps,w=g._init,g=w(g._payload),o.type=g,w=o.tag=XR(g),r=ar(g,r),w){case 0:o=Hh(null,o,g,r,u);break e;case 1:o=eb(null,o,g,r,u);break e;case 11:o=K0(null,o,g,r,u);break e;case 14:o=X0(null,o,g,ar(g.type,r),u);break e}throw Error(n(306,g,""))}return o;case 0:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:ar(g,w),Hh(r,o,g,w,u);case 1:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:ar(g,w),eb(r,o,g,w,u);case 3:e:{if(tb(o),r===null)throw Error(n(387));g=o.pendingProps,b=o.memoizedState,w=b.element,g0(r,o),Hc(o,g,null,u);var M=o.memoizedState;if(g=M.element,b.isDehydrated)if(b={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){w=Bo(Error(n(423)),o),o=nb(r,o,g,u,w);break e}else if(g!==w){w=Bo(Error(n(424)),o),o=nb(r,o,g,u,w);break e}else for(jn=Is(o.stateNode.containerInfo.firstChild),Sn=o,bt=!0,sr=null,u=p0(o,null,g,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Po(),g===w){o=ds(r,o,u);break e}un(r,o,g,u)}o=o.child}return o;case 5:return v0(o),r===null&&bh(o),g=o.type,w=o.pendingProps,b=r!==null?r.memoizedProps:null,M=w.children,hh(g,w)?M=null:b!==null&&hh(g,b)&&(o.flags|=32),J0(r,o),un(r,o,M,u),o.child;case 6:return r===null&&bh(o),null;case 13:return rb(r,o,u);case 4:return Th(o,o.stateNode.containerInfo),g=o.pendingProps,r===null?o.child=Lo(o,null,g,u):un(r,o,g,u),o.child;case 11:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:ar(g,w),K0(r,o,g,w,u);case 7:return un(r,o,o.pendingProps,u),o.child;case 8:return un(r,o,o.pendingProps.children,u),o.child;case 12:return un(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(g=o.type._context,w=o.pendingProps,b=o.memoizedProps,M=w.value,gt(zc,g._currentValue),g._currentValue=M,b!==null)if(tn(b.value,M)){if(b.children===w.children&&!gn.current){o=ds(r,o,u);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var Q=b.dependencies;if(Q!==null){M=b.child;for(var te=Q.firstContext;te!==null;){if(te.context===g){if(b.tag===1){te=us(-1,u&-u),te.tag=2;var de=b.updateQueue;if(de!==null){de=de.shared;var xe=de.pending;xe===null?te.next=te:(te.next=xe.next,xe.next=te),de.pending=te}}b.lanes|=u,te=b.alternate,te!==null&&(te.lanes|=u),jh(b.return,u,o),Q.lanes|=u;break}te=te.next}}else if(b.tag===10)M=b.type===o.type?null:b.child;else if(b.tag===18){if(M=b.return,M===null)throw Error(n(341));M.lanes|=u,Q=M.alternate,Q!==null&&(Q.lanes|=u),jh(M,u,o),M=b.sibling}else M=b.child;if(M!==null)M.return=b;else for(M=b;M!==null;){if(M===o){M=null;break}if(b=M.sibling,b!==null){b.return=M.return,M=b;break}M=M.return}b=M}un(r,o,w.children,u),o=o.child}return o;case 9:return w=o.type,g=o.pendingProps.children,qo(o,u),w=Dn(w),g=g(w),o.flags|=1,un(r,o,g,u),o.child;case 14:return g=o.type,w=ar(g,o.pendingProps),w=ar(g.type,w),X0(r,o,g,w,u);case 15:return Q0(r,o,o.type,o.pendingProps,u);case 17:return g=o.type,w=o.pendingProps,w=o.elementType===g?w:ar(g,w),eu(r,o),o.tag=1,yn(g)?(r=!0,Pc(o)):r=!1,qo(o,u),z0(o,g,w),zh(o,g,w,u),Gh(null,o,g,!0,r,u);case 19:return ab(r,o,u);case 22:return Z0(r,o,u)}throw Error(n(156,o.tag))};function Tb(r,o){return la(r,o)}function KR(r,o,u,g){this.tag=r,this.key=u,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 Bn(r,o,u,g){return new KR(r,o,u,g)}function ff(r){return r=r.prototype,!(!r||!r.isReactComponent)}function XR(r){if(typeof r=="function")return ff(r)?1:0;if(r!=null){if(r=r.$$typeof,r===J)return 11;if(r===K)return 14}return 2}function Ws(r,o){var u=r.alternate;return u===null?(u=Bn(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function du(r,o,u,g,w,b){var M=2;if(g=r,typeof r=="function")ff(r)&&(M=1);else if(typeof r=="string")M=5;else e:switch(r){case A:return Da(u.children,w,b,o);case D:M=8,w|=8;break;case O:return r=Bn(12,u,o,w|2),r.elementType=O,r.lanes=b,r;case Z:return r=Bn(13,u,o,w),r.elementType=Z,r.lanes=b,r;case $:return r=Bn(19,u,o,w),r.elementType=$,r.lanes=b,r;case z:return hu(u,w,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case I:M=10;break e;case q:M=9;break e;case J:M=11;break e;case K:M=14;break e;case G:M=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Bn(M,u,o,w),o.elementType=r,o.type=g,o.lanes=b,o}function Da(r,o,u,g){return r=Bn(7,r,g,o),r.lanes=u,r}function hu(r,o,u,g){return r=Bn(22,r,g,o),r.elementType=z,r.lanes=u,r.stateNode={isHidden:!1},r}function pf(r,o,u){return r=Bn(6,r,null,o),r.lanes=u,r}function mf(r,o,u){return o=Bn(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function QR(r,o,u,g,w){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=Ti(0),this.expirationTimes=Ti(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ti(0),this.identifierPrefix=g,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function gf(r,o,u,g,w,b,M,Q,te){return r=new QR(r,o,u,Q,te),o===1?(o=1,b===!0&&(o|=8)):o=0,b=Bn(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:g,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ch(b),r}function ZR(r,o,u){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:u}}function Ab(r){if(!r)return Os;r=r._reactInternals;e:{if(Mn(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(yn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(yn(u))return s0(r,u,o)}return o}function Rb(r,o,u,g,w,b,M,Q,te){return r=gf(u,g,!0,r,w,b,M,Q,te),r.context=Ab(null),u=r.current,g=dn(),w=zs(u),b=us(g,w),b.callback=o??null,Ds(u,b,w),r.current.lanes=w,ln(r,w,g),xn(r,g),r}function fu(r,o,u,g){var w=o.current,b=dn(),M=zs(w);return u=Ab(u),o.context===null?o.context=u:o.pendingContext=u,o=us(b,M),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ds(w,o,M),r!==null&&(lr(r,w,M,b),Wc(r,w,M)),M}function pu(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 Mb(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function yf(r,o){Mb(r,o),(r=r.alternate)&&Mb(r,o)}function JR(){return null}var Ib=typeof reportError=="function"?reportError:function(r){console.error(r)};function wf(r){this._internalRoot=r}mu.prototype.render=wf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));fu(r,o,null,null)},mu.prototype.unmount=wf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Oa(function(){fu(null,r,null,null)}),o[as]=null}};function mu(r){this._internalRoot=r}mu.prototype.unstable_scheduleHydration=function(r){if(r){var o=Ri();r={blockedOn:null,target:r,priority:o};for(var u=0;u<Jn.length&&o!==0&&o<Jn[u].priority;u++);Jn.splice(u,0,r),u===0&&co(r)}};function vf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function gu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function $b(){}function eM(r,o,u,g,w){if(w){if(typeof g=="function"){var b=g;g=function(){var de=pu(M);b.call(de)}}var M=Rb(o,g,r,0,null,!1,!1,"",$b);return r._reactRootContainer=M,r[as]=M.current,pt(r.nodeType===8?r.parentNode:r),Oa(),M}for(;w=r.lastChild;)r.removeChild(w);if(typeof g=="function"){var Q=g;g=function(){var de=pu(te);Q.call(de)}}var te=gf(r,0,!1,null,null,!1,!1,"",$b);return r._reactRootContainer=te,r[as]=te.current,pt(r.nodeType===8?r.parentNode:r),Oa(function(){fu(o,te,u,g)}),te}function yu(r,o,u,g,w){var b=u._reactRootContainer;if(b){var M=b;if(typeof w=="function"){var Q=w;w=function(){var te=pu(M);Q.call(te)}}fu(o,M,r,w)}else M=eM(u,o,r,w,g);return pu(M)}pa=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=_s(o.pendingLanes);u!==0&&(io(o,u|1),xn(o,ft()),(at&6)===0&&(Wo=ft()+500,Ps()))}break;case 13:Oa(function(){var g=cs(r,1);if(g!==null){var w=dn();lr(g,r,1,w)}}),yf(r,1)}},Ai=function(r){if(r.tag===13){var o=cs(r,134217728);if(o!==null){var u=dn();lr(o,r,134217728,u)}yf(r,134217728)}},fc=function(r){if(r.tag===13){var o=zs(r),u=cs(r,o);if(u!==null){var g=dn();lr(u,r,o,g)}yf(r,o)}},Ri=function(){return lt},Mi=function(r,o){var u=lt;try{return lt=r,o()}finally{lt=u}},Me=function(r,o,u){switch(o){case"input":if(_e(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var g=u[o];if(g!==r&&g.form===r.form){var w=$c(g);if(!w)throw Error(n(90));Oe(g),_e(g,w)}}}break;case"textarea":fe(r,u);break;case"select":o=u.value,o!=null&&Qe(r,!!u.multiple,o,!1)}},Kn=uf,Br=Oa;var tM={usingClientEntryPoint:!1,Events:[sl,Ro,$c,Wt,Fr,uf]},wl={findFiberByHostInstance:Ea,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nM={bundleType:wl.bundleType,version:wl.version,rendererPackageName:wl.rendererPackageName,rendererConfig:wl.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=oa(r),r===null?null:r.stateNode},findFiberByHostInstance:wl.findFiberByHostInstance||JR,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 wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{Yr=wu.inject(nM),$t=wu}catch{}}return bn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tM,bn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vf(o))throw Error(n(200));return ZR(r,o,null,u)},bn.createRoot=function(r,o){if(!vf(r))throw Error(n(299));var u=!1,g="",w=Ib;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=gf(r,1,!1,null,null,u,!1,g,w),r[as]=o.current,pt(r.nodeType===8?r.parentNode:r),new wf(o)},bn.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=oa(o),r=r===null?null:r.stateNode,r},bn.flushSync=function(r){return Oa(r)},bn.hydrate=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!0,u)},bn.hydrateRoot=function(r,o,u){if(!vf(r))throw Error(n(405));var g=u!=null&&u.hydratedSources||null,w=!1,b="",M=Ib;if(u!=null&&(u.unstable_strictMode===!0&&(w=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(M=u.onRecoverableError)),o=Rb(o,null,r,1,u??null,w,!1,b,M),r[as]=o.current,pt(r),g)for(r=0;r<g.length;r++)u=g[r],w=u._getVersion,w=w(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,w]:o.mutableSourceEagerHydrationData.push(u,w);return new mu(o)},bn.render=function(r,o,u){if(!gu(o))throw Error(n(200));return yu(null,r,o,!1,u)},bn.unmountComponentAtNode=function(r){if(!gu(r))throw Error(n(40));return r._reactRootContainer?(Oa(function(){yu(null,null,r,!1,function(){r._reactRootContainer=null,r[as]=null})}),!0):!1},bn.unstable_batchedUpdates=uf,bn.unstable_renderSubtreeIntoContainer=function(r,o,u,g){if(!gu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return yu(r,o,u,!1,g)},bn.version="18.3.1-next-f1338f8080-20240426",bn}var zb;function FC(){if(zb)return kf.exports;zb=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(),kf.exports=cM(),kf.exports}var Ub;function uM(){if(Ub)return xu;Ub=1;var e=FC();return xu.createRoot=e.createRoot,xu.hydrateRoot=e.hydrateRoot,xu}var dM=uM(),x=Xl();const pe=Qv(x);function Qt(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=Qt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Sf={exports:{}},jf={},Ef={exports:{}},Cf={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var Wb;function hM(){if(Wb)return Cf;Wb=1;var e=Xl();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,l=e.useLayoutEffect,c=e.useDebugValue;function d(m,y){var v=y(),N=s({inst:{value:v,getSnapshot:y}}),_=N[0].inst,S=N[1];return l(function(){_.value=v,_.getSnapshot=y,h(_)&&S({inst:_})},[m,v,y]),a(function(){return h(_)&&S({inst:_}),m(function(){h(_)&&S({inst:_})})},[m]),c(v),v}function h(m){var y=m.getSnapshot;m=m.value;try{var v=y();return!n(m,v)}catch{return!0}}function p(m,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return Cf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Cf}var Hb;function fM(){return Hb||(Hb=1,Ef.exports=hM()),Ef.exports}/**
|
|
49
|
+
* @license React
|
|
50
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/var Gb;function pM(){if(Gb)return jf;Gb=1;var e=Xl(),t=fM();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,d=e.useMemo,h=e.useDebugValue;return jf.useSyncExternalStoreWithSelector=function(p,f,m,y,v){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=d(function(){function k(R){if(!j){if(j=!0,E=R,R=y(R),v!==void 0&&_.hasValue){var A=_.value;if(v(A,R))return C=A}return C=R}if(A=C,s(E,R))return A;var D=y(R);return v!==void 0&&v(A,D)?(E=R,A):(E=R,C=D)}var j=!1,E,C,T=m===void 0?null:m;return[function(){return k(f())},T===null?void 0:function(){return k(T())}]},[f,m,y,v]);var S=a(p,N[0],N[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},jf}var Vb;function mM(){return Vb||(Vb=1,Sf.exports=pM()),Sf.exports}var gM=mM();const yM=Qv(gM),wM={},Yb=e=>{let t;const n=new Set,s=(f,m)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const v=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,v))}},a=()=>t,h={setState:s,getState:a,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(wM?"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,h);return h},vM=e=>e?Yb(e):Yb,{useDebugValue:xM}=pe,{useSyncExternalStoreWithSelector:bM}=yM,kM=e=>e;function BC(e,t=kM,n){const s=bM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xM(s),s}const Kb=(e,t)=>{const n=vM(e),s=(a,l=t)=>BC(n,a,l);return Object.assign(s,n),s},_M=(e,t)=>e?Kb(e,t):Kb;function Dt(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 NM={value:()=>{}};function vd(){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 Wu(n)}function Wu(e){this._=e}function SM(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}})}Wu.prototype=vd.prototype={constructor:Wu,on:function(e,t){var n=this._,s=SM(e+"",n),a,l=-1,c=s.length;if(arguments.length<2){for(;++l<c;)if((a=(e=s[l]).type)&&(a=jM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(a=(e=s[l]).type)n[a]=Xb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Xb(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 Wu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,l;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],s=0,a=l.length;s<a;++s)l[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,l=s.length;a<l;++a)s[a].value.apply(t,n)}};function jM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function Xb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=NM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var mv="http://www.w3.org/1999/xhtml";const Qb={svg:"http://www.w3.org/2000/svg",xhtml:mv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qb.hasOwnProperty(t)?{space:Qb[t],local:e}:e}function EM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mv&&t.documentElement.namespaceURI===mv?t.createElement(e):t.createElementNS(n,e)}}function CM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zC(e){var t=xd(e);return(t.local?CM:EM)(t)}function TM(){}function Zv(e){return e==null?TM:function(){return this.querySelector(e)}}function AM(e){typeof e!="function"&&(e=Zv(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=new Array(c),h,p,f=0;f<c;++f)(h=l[f])&&(p=e.call(h,h.__data__,f,l))&&("__data__"in h&&(p.__data__=h.__data__),d[f]=p);return new Tn(s,this._parents)}function RM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function MM(){return[]}function UC(e){return e==null?MM:function(){return this.querySelectorAll(e)}}function IM(e){return function(){return RM(e.apply(this,arguments))}}function $M(e){typeof e=="function"?e=IM(e):e=UC(e);for(var t=this._groups,n=t.length,s=[],a=[],l=0;l<n;++l)for(var c=t[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&(s.push(e.call(h,h.__data__,p,c)),a.push(h));return new Tn(s,a)}function WC(e){return function(){return this.matches(e)}}function HC(e){return function(t){return t.matches(e)}}var OM=Array.prototype.find;function PM(e){return function(){return OM.call(this.children,e)}}function LM(){return this.firstElementChild}function DM(e){return this.select(e==null?LM:PM(typeof e=="function"?e:HC(e)))}var qM=Array.prototype.filter;function FM(){return Array.from(this.children)}function BM(e){return function(){return qM.call(this.children,e)}}function zM(e){return this.selectAll(e==null?FM:BM(typeof e=="function"?e:HC(e)))}function UM(e){typeof e!="function"&&(e=WC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new Tn(s,this._parents)}function GC(e){return new Array(e.length)}function WM(){return new Tn(this._enter||this._groups.map(GC),this._parents)}function Ju(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ju.prototype={constructor:Ju,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 HM(e){return function(){return e}}function GM(e,t,n,s,a,l){for(var c=0,d,h=t.length,p=l.length;c<p;++c)(d=t[c])?(d.__data__=l[c],s[c]=d):n[c]=new Ju(e,l[c]);for(;c<h;++c)(d=t[c])&&(a[c]=d)}function VM(e,t,n,s,a,l,c){var d,h,p=new Map,f=t.length,m=l.length,y=new Array(f),v;for(d=0;d<f;++d)(h=t[d])&&(y[d]=v=c.call(h,h.__data__,d,t)+"",p.has(v)?a[d]=h:p.set(v,h));for(d=0;d<m;++d)v=c.call(e,l[d],d,l)+"",(h=p.get(v))?(s[d]=h,h.__data__=l[d],p.delete(v)):n[d]=new Ju(e,l[d]);for(d=0;d<f;++d)(h=t[d])&&p.get(y[d])===h&&(a[d]=h)}function YM(e){return e.__data__}function KM(e,t){if(!arguments.length)return Array.from(this,YM);var n=t?VM:GM,s=this._parents,a=this._groups;typeof e!="function"&&(e=HM(e));for(var l=a.length,c=new Array(l),d=new Array(l),h=new Array(l),p=0;p<l;++p){var f=s[p],m=a[p],y=m.length,v=XM(e.call(f,f&&f.__data__,p,s)),N=v.length,_=d[p]=new Array(N),S=c[p]=new Array(N),k=h[p]=new Array(y);n(f,m,_,S,k,v,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 Tn(c,s),c._enter=d,c._exit=h,c}function XM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function QM(){return new Tn(this._exit||this._groups.map(GC),this._parents)}function ZM(e,t,n){var s=this.enter(),a=this,l=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?l.remove():n(l),s&&a?s.merge(a).order():a}function JM(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,l=s.length,c=Math.min(a,l),d=new Array(a),h=0;h<c;++h)for(var p=n[h],f=s[h],m=p.length,y=d[h]=new Array(m),v,N=0;N<m;++N)(v=p[N]||f[N])&&(y[N]=v);for(;h<a;++h)d[h]=n[h];return new Tn(d,this._parents)}function eI(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,l=s[a],c;--a>=0;)(c=s[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function tI(e){e||(e=nI);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),l=0;l<s;++l){for(var c=n[l],d=c.length,h=a[l]=new Array(d),p,f=0;f<d;++f)(p=c[f])&&(h[f]=p);h.sort(t)}return new Tn(a,this._parents).order()}function nI(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sI(){return Array.from(this)}function aI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length;a<l;++a){var c=s[a];if(c)return c}return null}function oI(){let e=0;for(const t of this)++e;return e}function iI(){return!this.node()}function lI(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],l=0,c=a.length,d;l<c;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function cI(e){return function(){this.removeAttribute(e)}}function uI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dI(e,t){return function(){this.setAttribute(e,t)}}function hI(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fI(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function pI(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 mI(e,t){var n=xd(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?uI:cI:typeof t=="function"?n.local?pI:fI:n.local?hI:dI)(n,t))}function VC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gI(e){return function(){this.style.removeProperty(e)}}function yI(e,t,n){return function(){this.style.setProperty(e,t,n)}}function wI(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function vI(e,t,n){return arguments.length>1?this.each((t==null?gI:typeof t=="function"?wI:yI)(e,t,n??"")):ui(this.node(),e)}function ui(e,t){return e.style.getPropertyValue(t)||VC(e).getComputedStyle(e,null).getPropertyValue(t)}function xI(e){return function(){delete this[e]}}function bI(e,t){return function(){this[e]=t}}function kI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _I(e,t){return arguments.length>1?this.each((t==null?xI:typeof t=="function"?kI:bI)(e,t)):this.node()[e]}function YC(e){return e.trim().split(/^|\s+/)}function Jv(e){return e.classList||new KC(e)}function KC(e){this._node=e,this._names=YC(e.getAttribute("class")||"")}KC.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 XC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function QC(e,t){for(var n=Jv(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function NI(e){return function(){XC(this,e)}}function SI(e){return function(){QC(this,e)}}function jI(e,t){return function(){(t.apply(this,arguments)?XC:QC)(this,e)}}function EI(e,t){var n=YC(e+"");if(arguments.length<2){for(var s=Jv(this.node()),a=-1,l=n.length;++a<l;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?jI:t?NI:SI)(n,t))}function CI(){this.textContent=""}function TI(e){return function(){this.textContent=e}}function AI(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function RI(e){return arguments.length?this.each(e==null?CI:(typeof e=="function"?AI:TI)(e)):this.node().textContent}function MI(){this.innerHTML=""}function II(e){return function(){this.innerHTML=e}}function $I(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function OI(e){return arguments.length?this.each(e==null?MI:(typeof e=="function"?$I:II)(e)):this.node().innerHTML}function PI(){this.nextSibling&&this.parentNode.appendChild(this)}function LI(){return this.each(PI)}function DI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qI(){return this.each(DI)}function FI(e){var t=typeof e=="function"?e:zC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BI(){return null}function zI(e,t){var n=typeof e=="function"?e:zC(e),s=t==null?BI:typeof t=="function"?t:Zv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function UI(){var e=this.parentNode;e&&e.removeChild(this)}function WI(){return this.each(UI)}function HI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function GI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function VI(e){return this.select(e?GI:HI)}function YI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function KI(e){return function(t){e.call(this,t,this.__data__)}}function XI(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 QI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++s]=l;++s?t.length=s:delete this.__on}}}function ZI(e,t,n){return function(){var s=this.__on,a,l=KI(t);if(s){for(var c=0,d=s.length;c<d;++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=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},s?s.push(a):this.__on=[a]}}function JI(e,t,n){var s=XI(e+""),a,l=s.length,c;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,p=d.length,f;h<p;++h)for(a=0,f=d[h];a<l;++a)if((c=s[a]).type===f.type&&c.name===f.name)return f.value}return}for(d=t?ZI:QI,a=0;a<l;++a)this.each(d(s[a],t,n));return this}function ZC(e,t,n){var s=VC(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 e$(e,t){return function(){return ZC(this,e,t)}}function t$(e,t){return function(){return ZC(this,e,t.apply(this,arguments))}}function n$(e,t){return this.each((typeof t=="function"?t$:e$)(e,t))}function*r$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,l=s.length,c;a<l;++a)(c=s[a])&&(yield c)}var JC=[null];function Tn(e,t){this._groups=e,this._parents=t}function Ql(){return new Tn([[document.documentElement]],JC)}function s$(){return this}Tn.prototype=Ql.prototype={constructor:Tn,select:AM,selectAll:$M,selectChild:DM,selectChildren:zM,filter:UM,data:KM,enter:WM,exit:QM,join:ZM,merge:JM,selection:s$,order:eI,sort:tI,call:rI,nodes:sI,node:aI,size:oI,empty:iI,each:lI,attr:mI,style:vI,property:_I,classed:EI,text:RI,html:OI,raise:LI,lower:qI,append:FI,insert:zI,remove:WI,clone:VI,datum:YI,on:JI,dispatch:n$,[Symbol.iterator]:r$};function Un(e){return typeof e=="string"?new Tn([[document.querySelector(e)]],[document.documentElement]):new Tn([[e]],JC)}function a$(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ur(e,t){if(e=a$(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 o$={passive:!1},Ll={capture:!0,passive:!1};function Tf(e){e.stopImmediatePropagation()}function ai(e){e.preventDefault(),e.stopImmediatePropagation()}function eT(e){var t=e.document.documentElement,n=Un(e).on("dragstart.drag",ai,Ll);"onselectstart"in t?n.on("selectstart.drag",ai,Ll):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function tT(e,t){var n=e.document.documentElement,s=Un(e).on("dragstart.drag",null);t&&(s.on("click.drag",ai,Ll),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 bu=e=>()=>e;function gv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:l,x:c,y:d,dx:h,dy:p,dispatch:f}){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:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}gv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function i$(e){return!e.ctrlKey&&!e.button}function l$(){return this.parentNode}function c$(e,t){return t??{x:e.x,y:e.y}}function u$(){return navigator.maxTouchPoints||"ontouchstart"in this}function d$(){var e=i$,t=l$,n=c$,s=u$,a={},l=vd("start","drag","end"),c=0,d,h,p,f,m=0;function y(C){C.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",k,o$).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,T){if(!(f||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(Un(C.view).on("mousemove.drag",N,Ll).on("mouseup.drag",_,Ll),eT(C.view),Tf(C),p=!1,d=C.clientX,h=C.clientY,R("start",C))}}function N(C){if(ai(C),!p){var T=C.clientX-d,R=C.clientY-h;p=T*T+R*R>m}a.mouse("drag",C)}function _(C){Un(C.view).on("mousemove.drag mouseup.drag",null),tT(C.view,p),ai(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var R=C.changedTouches,A=t.call(this,C,T),D=R.length,O,I;for(O=0;O<D;++O)(I=E(this,A,C,T,R[O].identifier,R[O]))&&(Tf(C),I("start",C,R[O]))}}function k(C){var T=C.changedTouches,R=T.length,A,D;for(A=0;A<R;++A)(D=a[T[A].identifier])&&(ai(C),D("drag",C,T[A]))}function j(C){var T=C.changedTouches,R=T.length,A,D;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<R;++A)(D=a[T[A].identifier])&&(Tf(C),D("end",C,T[A]))}function E(C,T,R,A,D,O){var I=l.copy(),q=ur(O||R,T),J,Z,$;if(($=n.call(C,new gv("beforestart",{sourceEvent:R,target:y,identifier:D,active:c,x:q[0],y:q[1],dx:0,dy:0,dispatch:I}),A))!=null)return J=$.x-q[0]||0,Z=$.y-q[1]||0,function K(G,z,X){var L=q,W;switch(G){case"start":a[D]=K,W=c++;break;case"end":delete a[D],--c;case"drag":q=ur(X||z,T),W=c;break}I.call(G,C,new gv(G,{sourceEvent:z,subject:$,target:y,identifier:D,active:W,x:q[0]+J,y:q[1]+Z,dx:q[0]-L[0],dy:q[1]-L[1],dispatch:I}),A)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:bu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:bu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:bu(!!C),y):s},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function ex(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nT(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Zl(){}var Dl=.7,ed=1/Dl,oi="\\s*([+-]?\\d+)\\s*",ql="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Pr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h$=/^#([0-9a-f]{3,8})$/,f$=new RegExp(`^rgb\\(${oi},${oi},${oi}\\)$`),p$=new RegExp(`^rgb\\(${Pr},${Pr},${Pr}\\)$`),m$=new RegExp(`^rgba\\(${oi},${oi},${oi},${ql}\\)$`),g$=new RegExp(`^rgba\\(${Pr},${Pr},${Pr},${ql}\\)$`),y$=new RegExp(`^hsl\\(${ql},${Pr},${Pr}\\)$`),w$=new RegExp(`^hsla\\(${ql},${Pr},${Pr},${ql}\\)$`),Zb={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};ex(Zl,Fl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Jb,formatHex:Jb,formatHex8:v$,formatHsl:x$,formatRgb:ek,toString:ek});function Jb(){return this.rgb().formatHex()}function v$(){return this.rgb().formatHex8()}function x$(){return rT(this).formatHsl()}function ek(){return this.rgb().formatRgb()}function Fl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=h$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tk(t):n===3?new kn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ku(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ku(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=f$.exec(e))?new kn(t[1],t[2],t[3],1):(t=p$.exec(e))?new kn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=m$.exec(e))?ku(t[1],t[2],t[3],t[4]):(t=g$.exec(e))?ku(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=y$.exec(e))?sk(t[1],t[2]/100,t[3]/100,1):(t=w$.exec(e))?sk(t[1],t[2]/100,t[3]/100,t[4]):Zb.hasOwnProperty(e)?tk(Zb[e]):e==="transparent"?new kn(NaN,NaN,NaN,0):null}function tk(e){return new kn(e>>16&255,e>>8&255,e&255,1)}function ku(e,t,n,s){return s<=0&&(e=t=n=NaN),new kn(e,t,n,s)}function b$(e){return e instanceof Zl||(e=Fl(e)),e?(e=e.rgb(),new kn(e.r,e.g,e.b,e.opacity)):new kn}function yv(e,t,n,s){return arguments.length===1?b$(e):new kn(e,t,n,s??1)}function kn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}ex(kn,yv,nT(Zl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new kn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dl:Math.pow(Dl,e),new kn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kn(Wa(this.r),Wa(this.g),Wa(this.b),td(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:nk,formatHex:nk,formatHex8:k$,formatRgb:rk,toString:rk}));function nk(){return`#${za(this.r)}${za(this.g)}${za(this.b)}`}function k$(){return`#${za(this.r)}${za(this.g)}${za(this.b)}${za((isNaN(this.opacity)?1:this.opacity)*255)}`}function rk(){const e=td(this.opacity);return`${e===1?"rgb(":"rgba("}${Wa(this.r)}, ${Wa(this.g)}, ${Wa(this.b)}${e===1?")":`, ${e})`}`}function td(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function za(e){return e=Wa(e),(e<16?"0":"")+e.toString(16)}function sk(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new dr(e,t,n,s)}function rT(e){if(e instanceof dr)return new dr(e.h,e.s,e.l,e.opacity);if(e instanceof Zl||(e=Fl(e)),!e)return new dr;if(e instanceof dr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),l=Math.max(t,n,s),c=NaN,d=l-a,h=(l+a)/2;return d?(t===l?c=(n-s)/d+(n<s)*6:n===l?c=(s-t)/d+2:c=(t-n)/d+4,d/=h<.5?l+a:2-l-a,c*=60):d=h>0&&h<1?0:c,new dr(c,d,h,e.opacity)}function _$(e,t,n,s){return arguments.length===1?rT(e):new dr(e,t,n,s??1)}function dr(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}ex(dr,_$,nT(Zl,{brighter(e){return e=e==null?ed:Math.pow(ed,e),new dr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dl:Math.pow(Dl,e),new dr(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 kn(Af(e>=240?e-240:e+120,a,s),Af(e,a,s),Af(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new dr(ak(this.h),_u(this.s),_u(this.l),td(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=td(this.opacity);return`${e===1?"hsl(":"hsla("}${ak(this.h)}, ${_u(this.s)*100}%, ${_u(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ak(e){return e=(e||0)%360,e<0?e+360:e}function _u(e){return Math.max(0,Math.min(1,e||0))}function Af(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 sT=e=>()=>e;function N$(e,t){return function(n){return e+n*t}}function S$(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 j$(e){return(e=+e)==1?aT:function(t,n){return n-t?S$(t,n,e):sT(isNaN(t)?n:t)}}function aT(e,t){var n=t-e;return n?N$(e,n):sT(isNaN(e)?t:e)}const ok=(function e(t){var n=j$(t);function s(a,l){var c=n((a=yv(a)).r,(l=yv(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),p=aT(a.opacity,l.opacity);return function(f){return a.r=c(f),a.g=d(f),a.b=h(f),a.opacity=p(f),a+""}}return s.gamma=e,s})(1);function Ys(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var wv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rf=new RegExp(wv.source,"g");function E$(e){return function(){return e}}function C$(e){return function(t){return e(t)+""}}function T$(e,t){var n=wv.lastIndex=Rf.lastIndex=0,s,a,l,c=-1,d=[],h=[];for(e=e+"",t=t+"";(s=wv.exec(e))&&(a=Rf.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[c]?d[c]+=l:d[++c]=l),(s=s[0])===(a=a[0])?d[c]?d[c]+=a:d[++c]=a:(d[++c]=null,h.push({i:c,x:Ys(s,a)})),n=Rf.lastIndex;return n<t.length&&(l=t.slice(n),d[c]?d[c]+=l:d[++c]=l),d.length<2?h[0]?C$(h[0].x):E$(t):(t=h.length,function(p){for(var f=0,m;f<t;++f)d[(m=h[f]).i]=m.x(p);return d.join("")})}var ik=180/Math.PI,vv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oT(e,t,n,s,a,l){var c,d,h;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,h/=d),e*s<t*n&&(e=-e,t=-t,h=-h,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*ik,skewX:Math.atan(h)*ik,scaleX:c,scaleY:d}}var Nu;function A$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?vv:oT(t.a,t.b,t.c,t.d,t.e,t.f)}function R$(e){return e==null||(Nu||(Nu=document.createElementNS("http://www.w3.org/2000/svg","g")),Nu.setAttribute("transform",e),!(e=Nu.transform.baseVal.consolidate()))?vv:(e=e.matrix,oT(e.a,e.b,e.c,e.d,e.e,e.f))}function iT(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function l(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push("translate(",null,t,null,n);N.push({i:_-4,x:Ys(p,m)},{i:_-2,x:Ys(f,y)})}else(m||y)&&v.push("translate("+m+t+y+n)}function c(p,f,m,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,s)-2,x:Ys(p,f)})):f&&m.push(a(m)+"rotate("+f+s)}function d(p,f,m,y){p!==f?y.push({i:m.push(a(m)+"skewX(",null,s)-2,x:Ys(p,f)}):f&&m.push(a(m)+"skewX("+f+s)}function h(p,f,m,y,v,N){if(p!==m||f!==y){var _=v.push(a(v)+"scale(",null,",",null,")");N.push({i:_-4,x:Ys(p,m)},{i:_-2,x:Ys(f,y)})}else(m!==1||y!==1)&&v.push(a(v)+"scale("+m+","+y+")")}return function(p,f){var m=[],y=[];return p=e(p),f=e(f),l(p.translateX,p.translateY,f.translateX,f.translateY,m,y),c(p.rotate,f.rotate,m,y),d(p.skewX,f.skewX,m,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,m,y),p=f=null,function(v){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(v);return m.join("")}}}var M$=iT(A$,"px, ","px)","deg)"),I$=iT(R$,", ",")",")"),$$=1e-12;function lk(e){return((e=Math.exp(e))+1/e)/2}function O$(e){return((e=Math.exp(e))-1/e)/2}function P$(e){return((e=Math.exp(2*e))-1)/(e+1)}const L$=(function e(t,n,s){function a(l,c){var d=l[0],h=l[1],p=l[2],f=c[0],m=c[1],y=c[2],v=f-d,N=m-h,_=v*v+N*N,S,k;if(_<$$)k=Math.log(y/p)/t,S=function(A){return[d+A*v,h+A*N,p*Math.exp(t*A*k)]};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);k=(R-T)/t,S=function(A){var D=A*k,O=lk(T),I=p/(n*j)*(O*P$(t*D+T)-O$(T));return[d+I*v,h+I*N,p*O/lk(t*D+T)]}}return S.duration=k*1e3*t/Math.SQRT2,S}return a.rho=function(l){var c=Math.max(.001,+l),d=c*c,h=d*d;return e(c,d,h)},a})(Math.SQRT2,2,4);var di=0,Al=0,xl=0,lT=1e3,nd,Rl,rd=0,Ga=0,bd=0,Bl=typeof performance=="object"&&performance.now?performance:Date,cT=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tx(){return Ga||(cT(D$),Ga=Bl.now()+bd)}function D$(){Ga=0}function sd(){this._call=this._time=this._next=null}sd.prototype=uT.prototype={constructor:sd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tx():+n)+(t==null?0:+t),!this._next&&Rl!==this&&(Rl?Rl._next=this:nd=this,Rl=this),this._call=e,this._time=n,xv()},stop:function(){this._call&&(this._call=null,this._time=1/0,xv())}};function uT(e,t,n){var s=new sd;return s.restart(e,t,n),s}function q$(){tx(),++di;for(var e=nd,t;e;)(t=Ga-e._time)>=0&&e._call.call(void 0,t),e=e._next;--di}function ck(){Ga=(rd=Bl.now())+bd,di=Al=0;try{q$()}finally{di=0,B$(),Ga=0}}function F$(){var e=Bl.now(),t=e-rd;t>lT&&(bd-=t,rd=e)}function B$(){for(var e,t=nd,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:nd=n);Rl=e,xv(s)}function xv(e){if(!di){Al&&(Al=clearTimeout(Al));var t=e-Ga;t>24?(e<1/0&&(Al=setTimeout(ck,e-Bl.now()-bd)),xl&&(xl=clearInterval(xl))):(xl||(rd=Bl.now(),xl=setInterval(F$,lT)),di=1,cT(ck))}}function uk(e,t,n){var s=new sd;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var z$=vd("start","end","cancel","interrupt"),U$=[],dT=0,dk=1,bv=2,Hu=3,hk=4,kv=5,Gu=6;function kd(e,t,n,s,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;W$(e,n,{name:t,index:s,group:a,on:z$,tween:U$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:dT})}function nx(e,t){var n=wr(e,t);if(n.state>dT)throw new Error("too late; already scheduled");return n}function Dr(e,t){var n=wr(e,t);if(n.state>Hu)throw new Error("too late; already running");return n}function wr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function W$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=uT(l,0,n.time);function l(p){n.state=dk,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var f,m,y,v;if(n.state!==dk)return h();for(f in s)if(v=s[f],v.name===n.name){if(v.state===Hu)return uk(c);v.state===hk?(v.state=Gu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[f]):+f<t&&(v.state=Gu,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[f])}if(uk(function(){n.state===Hu&&(n.state=hk,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=bv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===bv){for(n.state=Hu,a=new Array(y=n.tween.length),f=0,m=-1;f<y;++f)(v=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=v);a.length=m+1}}function d(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=kv,1),m=-1,y=a.length;++m<y;)a[m].call(e,f);n.state===kv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=Gu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Vu(e,t){var n=e.__transition,s,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){l=!1;continue}a=s.state>bv&&s.state<kv,s.state=Gu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}l&&delete e.__transition}}function H$(e){return this.each(function(){Vu(this,e)})}function G$(e,t){var n,s;return function(){var a=Dr(this,e),l=a.tween;if(l!==n){s=n=l;for(var c=0,d=s.length;c<d;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function V$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var l=Dr(this,e),c=l.tween;if(c!==s){a=(s=c).slice();for(var d={name:t,value:n},h=0,p=a.length;h<p;++h)if(a[h].name===t){a[h]=d;break}h===p&&a.push(d)}l.tween=a}}function Y$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=wr(this.node(),n).tween,a=0,l=s.length,c;a<l;++a)if((c=s[a]).name===e)return c.value;return null}return this.each((t==null?G$:V$)(n,e,t))}function rx(e,t,n){var s=e._id;return e.each(function(){var a=Dr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return wr(a,s).value[t]}}function hT(e,t){var n;return(typeof t=="number"?Ys:t instanceof Fl?ok:(n=Fl(t))?(t=n,ok):T$)(e,t)}function K$(e){return function(){this.removeAttribute(e)}}function X$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===s?l:l=t(s=c,n)}}function Z$(e,t,n){var s,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===s?l:l=t(s=c,n)}}function J$(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttribute(e):(c=this.getAttribute(e),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function eO(e,t,n){var s,a,l;return function(){var c,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),h=d+"",c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d)))}}function tO(e,t){var n=xd(e),s=n==="transform"?I$:hT;return this.attrTween(e,typeof t=="function"?(n.local?eO:J$)(n,s,rx(this,"attr."+e,t)):t==null?(n.local?X$:K$)(n):(n.local?Z$:Q$)(n,s,t))}function nO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function rO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function sO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&rO(e,l)),n}return a._value=t,a}function aO(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&nO(e,l)),n}return a._value=t,a}function oO(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=xd(e);return this.tween(n,(s.local?sO:aO)(s,t))}function iO(e,t){return function(){nx(this,e).delay=+t.apply(this,arguments)}}function lO(e,t){return t=+t,function(){nx(this,e).delay=t}}function cO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iO:lO)(t,e)):wr(this.node(),t).delay}function uO(e,t){return function(){Dr(this,e).duration=+t.apply(this,arguments)}}function dO(e,t){return t=+t,function(){Dr(this,e).duration=t}}function hO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uO:dO)(t,e)):wr(this.node(),t).duration}function fO(e,t){if(typeof t!="function")throw new Error;return function(){Dr(this,e).ease=t}}function pO(e){var t=this._id;return arguments.length?this.each(fO(t,e)):wr(this.node(),t).ease}function mO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,e).ease=n}}function gO(e){if(typeof e!="function")throw new Error;return this.each(mO(this._id,e))}function yO(e){typeof e!="function"&&(e=WC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,d=s[a]=[],h,p=0;p<c;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&d.push(h);return new gs(s,this._parents,this._name,this._id)}function wO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,l=Math.min(s,a),c=new Array(s),d=0;d<l;++d)for(var h=t[d],p=n[d],f=h.length,m=c[d]=new Array(f),y,v=0;v<f;++v)(y=h[v]||p[v])&&(m[v]=y);for(;d<s;++d)c[d]=t[d];return new gs(c,this._parents,this._name,this._id)}function vO(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 xO(e,t,n){var s,a,l=vO(t)?nx:Dr;return function(){var c=l(this,e),d=c.on;d!==s&&(a=(s=d).copy()).on(t,n),c.on=a}}function bO(e,t){var n=this._id;return arguments.length<2?wr(this.node(),n).on.on(e):this.each(xO(n,e,t))}function kO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function _O(){return this.on("end.remove",kO(this._id))}function NO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zv(e));for(var s=this._groups,a=s.length,l=new Array(a),c=0;c<a;++c)for(var d=s[c],h=d.length,p=l[c]=new Array(h),f,m,y=0;y<h;++y)(f=d[y])&&(m=e.call(f,f.__data__,y,d))&&("__data__"in f&&(m.__data__=f.__data__),p[y]=m,kd(p[y],t,n,y,p,wr(f,n)));return new gs(l,this._parents,t,n)}function SO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=UC(e));for(var s=this._groups,a=s.length,l=[],c=[],d=0;d<a;++d)for(var h=s[d],p=h.length,f,m=0;m<p;++m)if(f=h[m]){for(var y=e.call(f,f.__data__,m,h),v,N=wr(f,n),_=0,S=y.length;_<S;++_)(v=y[_])&&kd(v,t,n,_,y,N);l.push(y),c.push(f)}return new gs(l,c,t,n)}var jO=Ql.prototype.constructor;function EO(){return new jO(this._groups,this._parents)}function CO(e,t){var n,s,a;return function(){var l=ui(this,e),c=(this.style.removeProperty(e),ui(this,e));return l===c?null:l===n&&c===s?a:a=t(n=l,s=c)}}function fT(e){return function(){this.style.removeProperty(e)}}function TO(e,t,n){var s,a=n+"",l;return function(){var c=ui(this,e);return c===a?null:c===s?l:l=t(s=c,n)}}function AO(e,t,n){var s,a,l;return function(){var c=ui(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),ui(this,e))),c===h?null:c===s&&h===a?l:(a=h,l=t(s=c,d))}}function RO(e,t){var n,s,a,l="style."+t,c="end."+l,d;return function(){var h=Dr(this,e),p=h.on,f=h.value[l]==null?d||(d=fT(t)):void 0;(p!==n||a!==f)&&(s=(n=p).copy()).on(c,a=f),h.on=s}}function MO(e,t,n){var s=(e+="")=="transform"?M$:hT;return t==null?this.styleTween(e,CO(e,s)).on("end.style."+e,fT(e)):typeof t=="function"?this.styleTween(e,AO(e,s,rx(this,"style."+e,t))).each(RO(this._id,e)):this.styleTween(e,TO(e,s,t),n).on("end.style."+e,null)}function IO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function $O(e,t,n){var s,a;function l(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&IO(e,c,n)),s}return l._value=t,l}function OO(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,$O(e,t,n??""))}function PO(e){return function(){this.textContent=e}}function LO(e){return function(){var t=e(this);this.textContent=t??""}}function DO(e){return this.tween("text",typeof e=="function"?LO(rx(this,"text",e)):PO(e==null?"":e+""))}function qO(e){return function(t){this.textContent=e.call(this,t)}}function FO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&qO(a)),t}return s._value=e,s}function BO(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,FO(e))}function zO(){for(var e=this._name,t=this._id,n=pT(),s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)if(h=c[p]){var f=wr(h,t);kd(h,e,n,p,c,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new gs(s,this._parents,e,n)}function UO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(l,c){var d={value:c},h={value:function(){--a===0&&l()}};n.each(function(){var p=Dr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),p.on=t}),a===0&&l()})}var WO=0;function gs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function pT(){return++WO}var fs=Ql.prototype;gs.prototype={constructor:gs,select:NO,selectAll:SO,selectChild:fs.selectChild,selectChildren:fs.selectChildren,filter:yO,merge:wO,selection:EO,transition:zO,call:fs.call,nodes:fs.nodes,node:fs.node,size:fs.size,empty:fs.empty,each:fs.each,on:bO,attr:tO,attrTween:oO,style:MO,styleTween:OO,text:DO,textTween:BO,remove:_O,tween:Y$,delay:cO,duration:hO,ease:pO,easeVarying:gO,end:UO,[Symbol.iterator]:fs[Symbol.iterator]};function HO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var GO={time:null,delay:0,duration:250,ease:HO};function VO(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 YO(e){var t,n;e instanceof gs?(t=e._id,e=e._name):(t=pT(),(n=GO).time=tx(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],d=c.length,h,p=0;p<d;++p)(h=c[p])&&kd(h,e,t,p,c,n||VO(h,t));return new gs(s,this._parents,e,t)}Ql.prototype.interrupt=H$;Ql.prototype.transition=YO;const Su=e=>()=>e;function KO(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 ps(e,t,n){this.k=e,this.x=t,this.y=n}ps.prototype={constructor:ps,scale:function(e){return e===1?this:new ps(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ps(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 ms=new ps(1,0,0);ps.prototype;function Mf(e){e.stopImmediatePropagation()}function bl(e){e.preventDefault(),e.stopImmediatePropagation()}function XO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QO(){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 fk(){return this.__zoom||ms}function ZO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function JO(){return navigator.maxTouchPoints||"ontouchstart"in this}function eP(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=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>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function mT(){var e=XO,t=QO,n=eP,s=ZO,a=JO,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,h=L$,p=vd("start","zoom","end"),f,m,y,v=500,N=150,_=0,S=10;function k($){$.property("__zoom",fk).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",I).filter(a).on("touchstart.zoom",q).on("touchmove.zoom",J).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function($,K,G,z){var X=$.selection?$.selection():$;X.property("__zoom",fk),$!==X?T($,K,G,z):X.interrupt().each(function(){R(this,arguments).event(z).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},k.scaleBy=function($,K,G,z){k.scaleTo($,function(){var X=this.__zoom.k,L=typeof K=="function"?K.apply(this,arguments):K;return X*L},G,z)},k.scaleTo=function($,K,G,z){k.transform($,function(){var X=t.apply(this,arguments),L=this.__zoom,W=G==null?C(X):typeof G=="function"?G.apply(this,arguments):G,P=L.invert(W),V=typeof K=="function"?K.apply(this,arguments):K;return n(E(j(L,V),W,P),X,c)},G,z)},k.translateBy=function($,K,G,z){k.transform($,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,z)},k.translateTo=function($,K,G,z,X){k.transform($,function(){var L=t.apply(this,arguments),W=this.__zoom,P=z==null?C(L):typeof z=="function"?z.apply(this,arguments):z;return n(ms.translate(P[0],P[1]).scale(W.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof G=="function"?-G.apply(this,arguments):-G),L,c)},z,X)};function j($,K){return K=Math.max(l[0],Math.min(l[1],K)),K===$.k?$:new ps(K,$.x,$.y)}function E($,K,G){var z=K[0]-G[0]*$.k,X=K[1]-G[1]*$.k;return z===$.x&&X===$.y?$:new ps($.k,z,X)}function C($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function T($,K,G,z){$.on("start.zoom",function(){R(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(z).end()}).tween("zoom",function(){var X=this,L=arguments,W=R(X,L).event(z),P=t.apply(X,L),V=G==null?C(P):typeof G=="function"?G.apply(X,L):G,he=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),H=X.__zoom,U=typeof K=="function"?K.apply(X,L):K,ee=h(H.invert(V).concat(he/H.k),U.invert(V).concat(he/U.k));return function(Y){if(Y===1)Y=U;else{var se=ee(Y),me=he/se[2];Y=new ps(me,V[0]-se[0]*me,V[1]-se[1]*me)}W.zoom(null,Y)}})}function R($,K,G){return!G&&$.__zooming||new A($,K)}function A($,K){this.that=$,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply($,K),this.taps=0}A.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,K){return this.mouse&&$!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&$!=="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($){var K=Un(this.that).datum();p.call($,this.that,new KO($,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),K)}};function D($,...K){if(!e.apply(this,arguments))return;var G=R(this,K).event($),z=this.__zoom,X=Math.max(l[0],Math.min(l[1],z.k*Math.pow(2,s.apply(this,arguments)))),L=ur($);if(G.wheel)(G.mouse[0][0]!==L[0]||G.mouse[0][1]!==L[1])&&(G.mouse[1]=z.invert(G.mouse[0]=L)),clearTimeout(G.wheel);else{if(z.k===X)return;G.mouse=[L,z.invert(L)],Vu(this),G.start()}bl($),G.wheel=setTimeout(W,N),G.zoom("mouse",n(E(j(z,X),G.mouse[0],G.mouse[1]),G.extent,c));function W(){G.wheel=null,G.end()}}function O($,...K){if(y||!e.apply(this,arguments))return;var G=$.currentTarget,z=R(this,K,!0).event($),X=Un($.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",he,!0),L=ur($,G),W=$.clientX,P=$.clientY;eT($.view),Mf($),z.mouse=[L,this.__zoom.invert(L)],Vu(this),z.start();function V(H){if(bl(H),!z.moved){var U=H.clientX-W,ee=H.clientY-P;z.moved=U*U+ee*ee>_}z.event(H).zoom("mouse",n(E(z.that.__zoom,z.mouse[0]=ur(H,G),z.mouse[1]),z.extent,c))}function he(H){X.on("mousemove.zoom mouseup.zoom",null),tT(H.view,z.moved),bl(H),z.event(H).end()}}function I($,...K){if(e.apply(this,arguments)){var G=this.__zoom,z=ur($.changedTouches?$.changedTouches[0]:$,this),X=G.invert(z),L=G.k*($.shiftKey?.5:2),W=n(E(j(G,L),z,X),t.apply(this,K),c);bl($),d>0?Un(this).transition().duration(d).call(T,W,z,$):Un(this).call(k.transform,W,z,$)}}function q($,...K){if(e.apply(this,arguments)){var G=$.touches,z=G.length,X=R(this,K,$.changedTouches.length===z).event($),L,W,P,V;for(Mf($),W=0;W<z;++W)P=G[W],V=ur(P,this),V=[V,this.__zoom.invert(V),P.identifier],X.touch0?!X.touch1&&X.touch0[2]!==V[2]&&(X.touch1=V,X.taps=0):(X.touch0=V,L=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),L&&(X.taps<2&&(m=V[0],f=setTimeout(function(){f=null},v)),Vu(this),X.start())}}function J($,...K){if(this.__zooming){var G=R(this,K).event($),z=$.changedTouches,X=z.length,L,W,P,V;for(bl($),L=0;L<X;++L)W=z[L],P=ur(W,this),G.touch0&&G.touch0[2]===W.identifier?G.touch0[0]=P:G.touch1&&G.touch1[2]===W.identifier&&(G.touch1[0]=P);if(W=G.that.__zoom,G.touch1){var he=G.touch0[0],H=G.touch0[1],U=G.touch1[0],ee=G.touch1[1],Y=(Y=U[0]-he[0])*Y+(Y=U[1]-he[1])*Y,se=(se=ee[0]-H[0])*se+(se=ee[1]-H[1])*se;W=j(W,Math.sqrt(Y/se)),P=[(he[0]+U[0])/2,(he[1]+U[1])/2],V=[(H[0]+ee[0])/2,(H[1]+ee[1])/2]}else if(G.touch0)P=G.touch0[0],V=G.touch0[1];else return;G.zoom("touch",n(E(W,P,V),G.extent,c))}}function Z($,...K){if(this.__zooming){var G=R(this,K).event($),z=$.changedTouches,X=z.length,L,W;for(Mf($),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),L=0;L<X;++L)W=z[L],G.touch0&&G.touch0[2]===W.identifier?delete G.touch0:G.touch1&&G.touch1[2]===W.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&&(W=ur(W,this),Math.hypot(m[0]-W[0],m[1]-W[1])<S)){var P=Un(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return k.wheelDelta=function($){return arguments.length?(s=typeof $=="function"?$:Su(+$),k):s},k.filter=function($){return arguments.length?(e=typeof $=="function"?$:Su(!!$),k):e},k.touchable=function($){return arguments.length?(a=typeof $=="function"?$:Su(!!$),k):a},k.extent=function($){return arguments.length?(t=typeof $=="function"?$:Su([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),k):t},k.scaleExtent=function($){return arguments.length?(l[0]=+$[0],l[1]=+$[1],k):[l[0],l[1]]},k.translateExtent=function($){return arguments.length?(c[0][0]=+$[0][0],c[1][0]=+$[1][0],c[0][1]=+$[0][1],c[1][1]=+$[1][1],k):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},k.constrain=function($){return arguments.length?(n=$,k):n},k.duration=function($){return arguments.length?(d=+$,k):d},k.interpolate=function($){return arguments.length?(h=$,k):h},k.on=function(){var $=p.on.apply(p,arguments);return $===p?k:$},k.clickDistance=function($){return arguments.length?(_=($=+$)*$,k):Math.sqrt(_)},k.tapDistance=function($){return arguments.length?(S=+$,k):S},k}var vs=FC();const _d=x.createContext(null),tP=_d.Provider,ys={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.`},gT=ys.error001();function ut(e,t){const n=x.useContext(_d);if(n===null)throw new Error(gT);return BC(n,e,t)}const Mt=()=>{const e=x.useContext(_d);if(e===null)throw new Error(gT);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},nP=e=>e.userSelectionActive?"none":"all";function sx({position:e,children:t,className:n,style:s,...a}){const l=ut(nP),c=`${e}`.split("-");return pe.createElement("div",{className:Qt(["react-flow__panel",n,...c]),style:{...s,pointerEvents:l},...a},t)}function rP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(sx,{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 sP=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:d=2,children:h,className:p,...f})=>{const m=x.useRef(null),[y,v]=x.useState({x:0,y:0,width:0,height:0}),N=Qt(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const _=m.current.getBBox();v({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",...f},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:l,rx:d,ry:d}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:s},n),h)};var aP=x.memo(sP);const ax=e=>({width:e.offsetWidth,height:e.offsetHeight}),hi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ox=(e={x:0,y:0},t)=>({x:hi(e.x,t[0][0],t[1][0]),y:hi(e.y,t[0][1],t[1][1])}),pk=(e,t,n)=>e<t?hi(Math.abs(e-t),1,50)/50:e>n?-hi(Math.abs(e-n),1,50)/50:0,yT=(e,t)=>{const n=pk(e.x,35,t.width-35)*20,s=pk(e.y,35,t.height-35)*20;return[n,s]},wT=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},vT=(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)}),zl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),xT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),mk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),oP=(e,t)=>xT(vT(zl(e),zl(t))),_v=(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)},iP=e=>Wn(e.width)&&Wn(e.height)&&Wn(e.x)&&Wn(e.y),Wn=e=>!isNaN(e)&&isFinite(e),Et=Symbol.for("internals"),bT=["Enter"," ","Escape"],lP=(e,t)=>{},cP=e=>"nativeEvent"in e;function Nv(e){var a,l;const t=cP(e)?e.nativeEvent:e,n=((l=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:l[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 kT=e=>"clientX"in e,Qs=(e,t)=>{var l,c;const n=kT(e),s=n?e.clientX:(l=e.touches)==null?void 0:l[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},Jl=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),v&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),a&&Wn(n)&&Wn(s)?pe.createElement(aP,{x:n,y:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p}):null);Jl.displayName="BaseEdge";function kl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(l=>l.id===e);a&&n(s,{...a})}}function _T({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(s-t)/2,d=s<t?s+c:s-c;return[l,d,a,c]}function NT({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d}){const h=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+d*.375+s*.125,f=Math.abs(h-e),m=Math.abs(p-t);return[h,p,f,m]}var Va;(function(e){e.Strict="strict",e.Loose="loose"})(Va||(Va={}));var Ua;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ua||(Ua={}));var Ul;(function(e){e.Partial="partial",e.Full="full"})(Ul||(Ul={}));var Xs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Xs||(Xs={}));var od;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(od||(od={}));var ze;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ze||(ze={}));function gk({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 ST({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:l=ze.Top}){const[c,d]=gk({pos:n,x1:e,y1:t,x2:s,y2:a}),[h,p]=gk({pos:l,x1:s,y1:a,x2:e,y2:t}),[f,m,y,v]=NT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${t} C${c},${d} ${h},${p} ${s},${a}`,f,m,y,v]}const ix=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:l=ze.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})=>{const[S,k,j]=ST({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l});return pe.createElement(Jl,{path:S,labelX:k,labelY:j,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:_})});ix.displayName="SimpleBezierEdge";const yk={[ze.Left]:{x:-1,y:0},[ze.Right]:{x:1,y:0},[ze.Top]:{x:0,y:-1},[ze.Bottom]:{x:0,y:1}},uP=({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},wk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dP({source:e,sourcePosition:t=ze.Bottom,target:n,targetPosition:s=ze.Top,center:a,offset:l}){const c=yk[t],d=yk[s],h={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+d.x*l,y:n.y+d.y*l},f=uP({source:h,sourcePosition:t,target:p}),m=f.x!==0?"x":"y",y=f[m];let v=[],N,_;const S={x:0,y:0},k={x:0,y:0},[j,E,C,T]=_T({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*d[m]===-1){N=a.x??j,_=a.y??E;const A=[{x:N,y:h.y},{x:N,y:p.y}],D=[{x:h.x,y:_},{x:p.x,y:_}];c[m]===y?v=m==="x"?A:D:v=m==="x"?D:A}else{const A=[{x:h.x,y:p.y}],D=[{x:p.x,y:h.y}];if(m==="x"?v=c.x===y?D:A:v=c.y===y?A:D,t===s){const Z=Math.abs(e[m]-n[m]);if(Z<=l){const $=Math.min(l-1,l-Z);c[m]===y?S[m]=(h[m]>e[m]?-1:1)*$:k[m]=(p[m]>n[m]?-1:1)*$}}if(t!==s){const Z=m==="x"?"y":"x",$=c[m]===d[Z],K=h[Z]>p[Z],G=h[Z]<p[Z];(c[m]===1&&(!$&&K||$&&G)||c[m]!==1&&(!$&&G||$&&K))&&(v=m==="x"?A:D)}const O={x:h.x+S.x,y:h.y+S.y},I={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(O.x-v[0].x),Math.abs(I.x-v[0].x)),J=Math.max(Math.abs(O.y-v[0].y),Math.abs(I.y-v[0].y));q>=J?(N=(O.x+I.x)/2,_=v[0].y):(N=v[0].x,_=(O.y+I.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...v,{x:p.x+k.x,y:p.y+k.y},n],N,_,C,T]}function hP(e,t,n,s){const a=Math.min(wk(e,t)/2,wk(t,n)/2,s),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*f}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${c+a*h}Q ${l},${c} ${l+a*d},${c}`}function Sv({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:l=ze.Top,borderRadius:c=5,centerX:d,centerY:h,offset:p=20}){const[f,m,y,v,N]=dP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:l,center:{x:d,y:h},offset:p});return[f.reduce((S,k,j)=>{let E="";return j>0&&j<f.length-1?E=hP(f[j-1],k,f[j+1],c):E=`${j===0?"M":"L"}${k.x} ${k.y}`,S+=E,S},""),m,y,v,N]}const Nd=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:m=ze.Bottom,targetPosition:y=ze.Top,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=Sv({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(Jl,{path:k,labelX:j,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:v,markerStart:N,interactionWidth:S})});Nd.displayName="SmoothStepEdge";const lx=x.memo(e=>{var t;return pe.createElement(Nd,{...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])})});lx.displayName="StepEdge";function fP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,l,c,d]=_T({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,l,c,d]}const cx=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[N,_,S]=fP({sourceX:e,sourceY:t,targetX:n,targetY:s});return pe.createElement(Jl,{path:N,labelX:_,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:m,markerStart:y,interactionWidth:v})});cx.displayName="StraightEdge";function ju(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vk({pos:e,x1:t,y1:n,x2:s,y2:a,c:l}){switch(e){case ze.Left:return[t-ju(t-s,l),n];case ze.Right:return[t+ju(s-t,l),n];case ze.Top:return[t,n-ju(n-a,l)];case ze.Bottom:return[t,n+ju(a-n,l)]}}function jT({sourceX:e,sourceY:t,sourcePosition:n=ze.Bottom,targetX:s,targetY:a,targetPosition:l=ze.Top,curvature:c=.25}){const[d,h]=vk({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,f]=vk({pos:l,x1:s,y1:a,x2:e,y2:t,c}),[m,y,v,N]=NT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${d},${h} ${p},${f} ${s},${a}`,m,y,v,N]}const id=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=ze.Bottom,targetPosition:l=ze.Top,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[k,j,E]=jT({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l,curvature:_==null?void 0:_.curvature});return pe.createElement(Jl,{path:k,labelX:j,labelY:E,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:v,markerStart:N,interactionWidth:S})});id.displayName="BezierEdge";const ux=x.createContext(null),pP=ux.Provider;ux.Consumer;const mP=()=>x.useContext(ux),gP=e=>"id"in e&&"source"in e&&"target"in e,yP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,jv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,wP=(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)),vP=(e,t)=>{if(!e.source||!e.target)return t;let n;return gP(e)?n={...e}:n={...e,id:yP(e)},wP(n,t)?t:t.concat(n)},Ev=({x:e,y:t},[n,s,a],l,[c,d])=>{const h={x:(e-n)/a,y:(t-s)/a};return l?{x:c*Math.round(h.x/c),y:d*Math.round(h.y/d)}:h},ET=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Ha=(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}},Sd=(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:l,y:c}=Ha(a,t).positionAbsolute;return vT(s,zl({x:l,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xT(n)},CT=(e,t,[n,s,a]=[0,0,1],l=!1,c=!1,d=[0,0])=>{const h={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(f=>{const{width:m,height:y,selectable:v=!0,hidden:N=!1}=f;if(c&&!v||N)return!1;const{positionAbsolute:_}=Ha(f,d),S={x:_.x,y:_.y,width:m||0,height:y||0},k=_v(h,S),j=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&k>0,C=(m||0)*(y||0);(j||E||k>=C||f.dragging)&&p.push(f)}),p},TT=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},AT=(e,t,n,s,a,l=.1)=>{const c=t/(e.width*(1+l)),d=n/(e.height*(1+l)),h=Math.min(c,d),p=hi(h,s,a),f=e.x+e.width/2,m=e.y+e.height/2,y=t/2-f*p,v=n/2-m*p;return{x:y,y:v,zoom:p}},Ba=(e,t=0)=>e.transition().duration(t);function xk(e,t,n,s){return(t[n]||[]).reduce((a,l)=>{var c,d;return`${e.id}-${l.id}-${n}`!==s&&a.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+l.y+l.height/2}),a},[])}function xP(e,t,n,s,a,l){const{x:c,y:d}=Qs(e),p=t.elementsFromPoint(c,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=dx(void 0,p),S=p.getAttribute("data-handleid"),k=l({nodeId:N,id:S,type:_});if(k){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:k}}}}let f=[],m=1/0;if(a.forEach(N=>{const _=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(_<=s){const S=l(N);_<=m&&(_<m?f=[{handle:N,validHandleResult:S}]:_===m&&f.push({handle:N,validHandleResult:S}),m=_)}}),!f.length)return{handle:null,validHandleResult:RT()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),v=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:_})=>v?N.type==="target":y?_.isValid:!0)||f[0]}const bP={source:null,target:null,sourceHandle:null,targetHandle:null},RT=()=>({handleDomNode:null,isValid:!1,connection:bP,endHandle:null});function MT(e,t,n,s,a,l,c){const d=a==="target",h=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={...RT(),handleDomNode:h};if(h){const f=dx(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),v=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:d?m:n,sourceHandle:d?y:s,target:d?n:m,targetHandle:d?s:y};p.connection=_,v&&N&&(t===Va.Strict?d&&f==="source"||!d&&f==="target":m!==n||y!==s)&&(p.endHandle={nodeId:m,handleId:y,type:f},p.isValid=l(_))}return p}function kP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,l)=>{if(l[Et]){const{handleBounds:c}=l[Et];let d=[],h=[];c&&(d=xk(l,c,"source",`${t}-${n}-${s}`),h=xk(l,c,"target",`${t}-${n}-${s}`)),a.push(...d,...h)}return a},[])}function dx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function If(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function _P(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function IT({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:l,setState:c,isValidConnection:d,edgeUpdaterType:h,onReconnectEnd:p}){const f=wT(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:v,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:k,cancelConnection:j}=l();let E=0,C;const{x:T,y:R}=Qs(e),A=f==null?void 0:f.elementFromPoint(T,R),D=dx(h,A),O=y==null?void 0:y.getBoundingClientRect();if(!O||!D)return;let I,q=Qs(e,O),J=!1,Z=null,$=!1,K=null;const G=kP({nodes:k(),nodeId:n,handleId:t,handleType:D}),z=()=>{if(!v)return;const[W,P]=yT(q,O);S({x:W,y:P}),E=requestAnimationFrame(z)};c({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:D});function X(W){const{transform:P}=l();q=Qs(W,O);const{handle:V,validHandleResult:he}=xP(W,f,Ev(q,P,!1,[1,1]),N,G,H=>MT(H,m,n,t,a?"target":"source",d,f));if(C=V,J||(z(),J=!0),K=he.handleDomNode,Z=he.connection,$=he.isValid,c({connectionPosition:C&&$?ET({x:C.x,y:C.y},P):q,connectionStatus:_P(!!C,$),connectionEndHandle:he.endHandle}),!C&&!$&&!K)return If(I);Z.source!==Z.target&&K&&(If(I),I=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",$),K.classList.toggle("react-flow__handle-valid",$))}function L(W){var P,V;(C||K)&&Z&&$&&(s==null||s(Z)),(V=(P=l()).onConnectEnd)==null||V.call(P,W),h&&(p==null||p(W)),If(I),j(),cancelAnimationFrame(E),J=!1,$=!1,Z=null,K=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",L),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",L)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",L),f.addEventListener("touchmove",X),f.addEventListener("touchend",L)}const bk=()=>!0,NP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),SP=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:l,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||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},$T=x.forwardRef(({type:e="source",position:t=ze.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:d,children:h,className:p,onMouseDown:f,onTouchStart:m,...y},v)=>{var O,I;const N=c||null,_=e==="target",S=Mt(),k=mP(),{connectOnClick:j,noPanClassName:E}=ut(NP,Dt),{connecting:C,clickConnecting:T}=ut(SP(k,N,e),Dt);k||(I=(O=S.getState()).onError)==null||I.call(O,"010",ys.error010());const R=q=>{const{defaultEdgeOptions:J,onConnect:Z,hasDefaultEdges:$}=S.getState(),K={...J,...q};if($){const{edges:G,setEdges:z}=S.getState();z(vP(K,G))}Z==null||Z(K),d==null||d(K)},A=q=>{if(!k)return;const J=kT(q);a&&(J&&q.button===0||!J)&&IT({event:q,handleId:N,nodeId:k,onConnect:R,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||bk}),J?f==null||f(q):m==null||m(q)},D=q=>{const{onClickConnectStart:J,onClickConnectEnd:Z,connectionClickStartHandle:$,connectionMode:K,isValidConnection:G}=S.getState();if(!k||!$&&!a)return;if(!$){J==null||J(q,{nodeId:k,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const z=wT(q.target),X=n||G||bk,{connection:L,isValid:W}=MT({nodeId:k,id:N,type:e},K,$.nodeId,$.handleId||null,$.type,X,z);W&&R(L),Z==null||Z(q),S.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Qt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:l,connecting:T,connectionindicator:s&&(a&&!C||l&&C)}]),onMouseDown:A,onTouchStart:A,onClick:j?D:void 0,ref:v,...y},h)});$T.displayName="Handle";var fi=x.memo($T);const OT=({data:e,isConnectable:t,targetPosition:n=ze.Top,sourcePosition:s=ze.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(fi,{type:"source",position:s,isConnectable:t}));OT.displayName="DefaultNode";var Cv=x.memo(OT);const PT=({data:e,isConnectable:t,sourcePosition:n=ze.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(fi,{type:"source",position:n,isConnectable:t}));PT.displayName="InputNode";var LT=x.memo(PT);const DT=({data:e,isConnectable:t,targetPosition:n=ze.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);DT.displayName="OutputNode";var qT=x.memo(DT);const hx=()=>null;hx.displayName="GroupNode";const jP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Eu=e=>e.id;function EP(e,t){return Dt(e.selectedNodes.map(Eu),t.selectedNodes.map(Eu))&&Dt(e.selectedEdges.map(Eu),t.selectedEdges.map(Eu))}const FT=x.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=ut(jP,EP);return x.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,s,e]),null});FT.displayName="SelectionListener";const CP=e=>!!e.onSelectionChange;function TP({onSelectionChange:e}){const t=ut(CP);return e||t?pe.createElement(FT,{onSelectionChange:e}):null}const AP=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 Go(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function et(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const RP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:d,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:v,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:D,connectOnClick:O,defaultEdgeOptions:I,fitView:q,fitViewOptions:J,onNodesDelete:Z,onEdgesDelete:$,onNodeDrag:K,onNodeDragStart:G,onNodeDragStop:z,onSelectionDrag:X,onSelectionDragStart:L,onSelectionDragStop:W,noPanClassName:P,nodeOrigin:V,rfId:he,autoPanOnConnect:H,autoPanOnNodeDrag:U,onError:ee,connectionRadius:Y,isValidConnection:se,nodeDragThreshold:me})=>{const{setNodes:ge,setEdges:Re,setDefaultNodesAndEdges:Oe,setMinZoom:ce,setMaxZoom:we,setTranslateExtent:be,setNodeExtent:Be,reset:_e}=ut(AP,Dt),Ce=Mt();return x.useEffect(()=>{const Ge=s==null?void 0:s.map(tt=>({...tt,...I}));return Oe(n,Ge),()=>{_e()}},[]),et("defaultEdgeOptions",I,Ce.setState),et("connectionMode",T,Ce.setState),et("onConnect",a,Ce.setState),et("onConnectStart",l,Ce.setState),et("onConnectEnd",c,Ce.setState),et("onClickConnectStart",d,Ce.setState),et("onClickConnectEnd",h,Ce.setState),et("nodesDraggable",p,Ce.setState),et("nodesConnectable",f,Ce.setState),et("nodesFocusable",m,Ce.setState),et("edgesFocusable",y,Ce.setState),et("edgesUpdatable",v,Ce.setState),et("elementsSelectable",C,Ce.setState),et("elevateNodesOnSelect",N,Ce.setState),et("snapToGrid",A,Ce.setState),et("snapGrid",R,Ce.setState),et("onNodesChange",j,Ce.setState),et("onEdgesChange",E,Ce.setState),et("connectOnClick",O,Ce.setState),et("fitViewOnInit",q,Ce.setState),et("fitViewOnInitOptions",J,Ce.setState),et("onNodesDelete",Z,Ce.setState),et("onEdgesDelete",$,Ce.setState),et("onNodeDrag",K,Ce.setState),et("onNodeDragStart",G,Ce.setState),et("onNodeDragStop",z,Ce.setState),et("onSelectionDrag",X,Ce.setState),et("onSelectionDragStart",L,Ce.setState),et("onSelectionDragStop",W,Ce.setState),et("noPanClassName",P,Ce.setState),et("nodeOrigin",V,Ce.setState),et("rfId",he,Ce.setState),et("autoPanOnConnect",H,Ce.setState),et("autoPanOnNodeDrag",U,Ce.setState),et("onError",ee,Ce.setState),et("connectionRadius",Y,Ce.setState),et("isValidConnection",se,Ce.setState),et("nodeDragThreshold",me,Ce.setState),Go(e,ge),Go(t,Re),Go(_,ce),Go(S,we),Go(D,be),Go(k,Be),null},kk={display:"none"},MP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},BT="react-flow__node-desc",zT="react-flow__edge-desc",IP="react-flow__aria-live",$P=e=>e.ariaLiveMessage;function OP({rfId:e}){const t=ut($P);return pe.createElement("div",{id:`${IP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:MP},t)}function PP({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${BT}-${e}`,style:kk},"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:`${zT}-${e}`,style:kk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement(OP,{rfId:e}))}var Wl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,d]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=p.reduce((m,y)=>m.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return x.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=v=>{if(a.current=v.ctrlKey||v.metaKey||v.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Nv(v))return!1;const _=Nk(v.code,d);l.current.add(v[_]),_k(c,l.current,!1)&&(v.preventDefault(),s(!0))},m=v=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Nv(v))return!1;const _=Nk(v.code,d);_k(c,l.current,!0)?(s(!1),l.current.clear()):l.current.delete(v[_]),v.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,s]),n};function _k(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Nk(e,t){return t.includes(e)?"code":"key"}function UT(e,t,n,s){var d,h;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Ha(l,s);return UT(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((d=l[Et])==null?void 0:d.z)??0)>(n.z??0)?((h=l[Et])==null?void 0:h.z)??0:n.z??0},s)}function WT(e,t,n){e.forEach(s=>{var l;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:d,z:h}=UT(s,e,{...s.position,z:((l=s[Et])==null?void 0:l.z)??0},t);s.positionAbsolute={x:c,y:d},s[Et].z=h,n!=null&&n[s.id]&&(s[Et].isParent=!0)}})}function $f(e,t,n,s){const a=new Map,l={},c=s?1e3:0;return e.forEach(d=>{var v;const h=(Wn(d.zIndex)?d.zIndex:0)+(d.selected?c:0),p=t.get(d.id),f={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},m=d.parentNode||d.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(f,Et,{enumerable:!1,value:{handleBounds:y||(v=p==null?void 0:p[Et])==null?void 0:v.handleBounds,z:h}}),a.set(d.id,f)}),WT(a,n,l),a}function HT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:l,maxZoom:c,d3Zoom:d,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:m}=e(),y=t.initial&&!p&&f;if(d&&h&&(y||!t.initial)){const N=n().filter(S=>{var j;const k=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?k&&t.nodes.some(E=>E.id===S.id):k}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Sd(N,m),{x:k,y:j,zoom:E}=AT(S,s,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=ms.translate(k,j).scale(E);return typeof t.duration=="number"&&t.duration>0?d.transform(Ba(h,t.duration),C):d.transform(h,C),!0}}return!1}function LP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Et]:s[Et],selected:n.selected})}),new Map(t)}function DP(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function Cu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:d,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:LP(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:DP(t,l)}),d==null||d(t))}const Vo=()=>{},qP={zoomIn:Vo,zoomOut:Vo,zoomTo:Vo,getZoom:()=>1,setViewport:Vo,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Vo,fitBounds:Vo,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},FP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),BP=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=ut(FP,Dt);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Ba(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Ba(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(Ba(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,d,h]=e.getState().transform,p=ms.translate(a.x??c,a.y??d).scale(a.zoom??h);t.transform(Ba(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[a,l,c]=e.getState().transform;return{x:a,y:l,zoom:c}},fitView:a=>HT(e.getState,a),setCenter:(a,l,c)=>{const{width:d,height:h,maxZoom:p}=e.getState(),f=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=d/2-a*f,y=h/2-l*f,v=ms.translate(m,y).scale(f);t.transform(Ba(n,c==null?void 0:c.duration),v)},fitBounds:(a,l)=>{const{width:c,height:d,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:m,zoom:y}=AT(a,c,d,h,p,(l==null?void 0:l.padding)??.1),v=ms.translate(f,m).scale(y);t.transform(Ba(n,l==null?void 0:l.duration),v)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:d}=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"),Ev(a,l,c,d)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:d,domNode:h}=e.getState();if(!h)return a;const{x:p,y:f}=h.getBoundingClientRect(),m={x:a.x-p,y:a.y-f};return Ev(m,l,c,d)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:d,y:h}=c.getBoundingClientRect(),p=ET(a,l);return{x:p.x+d,y:p.y+h}},viewportInitialized:!0}:qP,[t,n])};function ec(){const e=BP(),t=Mt(),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}))},[]),l=x.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(k=>k.id===_)},[]),c=x.useCallback(_=>{const{getNodes:S,setNodes:k,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),T=typeof _=="function"?_(C):_;if(j)k(T);else if(E){const R=T.length===0?C.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));E(R)}},[]),d=x.useCallback(_=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(S):_;if(j)k(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)}},[]),h=x.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:k,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...k(),...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:k=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([...k,...S]);else if(C){const T=S.map(R=>({item:R,type:"add"}));C(T)}},[]),f=x.useCallback(()=>{const{getNodes:_,edges:S=[],transform:k}=t.getState(),[j,E,C]=k;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:k,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:D,onEdgesChange:O}=t.getState(),I=(_||[]).map(K=>K.id),q=(S||[]).map(K=>K.id),J=j().reduce((K,G)=>{const z=G.parentNode||G.parentId,X=!I.includes(G.id)&&z&&K.find(W=>W.id===z);return(typeof G.deletable=="boolean"?G.deletable:!0)&&(I.includes(G.id)||X)&&K.push(G),K},[]),Z=E.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),$=Z.filter(K=>q.includes(K.id));if(J||$){const K=TT(J,Z),G=[...$,...K],z=G.reduce((X,L)=>(X.includes(L.id)||X.push(L.id),X),[]);if((T||C)&&(T&&t.setState({edges:E.filter(X=>!z.includes(X.id))}),C&&(J.forEach(X=>{k.delete(X.id)}),t.setState({nodeInternals:new Map(k)}))),z.length>0&&(A==null||A(G),O&&O(z.map(X=>({id:X,type:"remove"})))),J.length>0&&(R==null||R(J),D)){const X=J.map(L=>({id:L.id,type:"remove"}));D(X)}}},[]),y=x.useCallback(_=>{const S=iP(_),k=S?null:t.getState().nodeInternals.get(_.id);return!S&&!k?[null,null,S]:[S?_:mk(k),k,S]},[]),v=x.useCallback((_,S=!0,k)=>{const[j,E,C]=y(_);return j?(k||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=mk(T),A=_v(R,j);return S&&A>0||A>=j.width*j.height}):[]},[]),N=x.useCallback((_,S,k=!0)=>{const[j]=y(_);if(!j)return!1;const E=_v(j,S);return k&&E>0||E>=j.width*j.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:l,setNodes:c,setEdges:d,addNodes:h,addEdges:p,toObject:f,deleteElements:m,getIntersectingNodes:v,isNodeIntersecting:N}),[e,n,s,a,l,c,d,h,p,f,m,v,N])}const zP={actInsideInputWithModifier:!1};var UP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=ec(),a=Wl(e,zP),l=Wl(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:d}=n.getState(),h=d().filter(f=>f.selected),p=c.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function WP(e){const t=Mt();x.useEffect(()=>{let n;const s=()=>{var l,c;if(!e.current)return;const a=ax(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",ys.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 fx={position:"absolute",width:"100%",height:"100%",top:0,left:0},HP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Tu=e=>({x:e.x,y:e.y,zoom:e.k}),Yo=(e,t)=>e.target.closest(`.${t}`),Sk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),jk=e=>{const t=e.ctrlKey&&ad()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},GP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),VP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:d=.5,panOnScrollMode:h=Ua.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:y,translateExtent:v,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Mt(),A=x.useRef(!1),D=x.useRef(!1),O=x.useRef(null),I=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:J,d3ZoomHandler:Z,userSelectionActive:$}=ut(GP,Dt),K=Wl(S),G=x.useRef(0),z=x.useRef(!1),X=x.useRef();return WP(O),x.useEffect(()=>{if(O.current){const L=O.current.getBoundingClientRect(),W=mT().scaleExtent([N,_]).translateExtent(v),P=Un(O.current).call(W),V=ms.translate(y.x,y.y).scale(hi(y.zoom,N,_)),he=[[0,0],[L.width,L.height]],H=W.constrain()(V,he,v);W.transform(P,H),W.wheelDelta(jk),R.setState({d3Zoom:W,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:O.current.closest(".react-flow")})}},[]),x.useEffect(()=>{J&&q&&(c&&!K&&!$?J.on("wheel.zoom",L=>{if(Yo(L,E))return!1;L.preventDefault(),L.stopImmediatePropagation();const W=J.property("__zoom").k||1;if(L.ctrlKey&&l){const se=ur(L),me=jk(L),ge=W*Math.pow(2,me);q.scaleTo(J,ge,se,L);return}const P=L.deltaMode===1?20:1;let V=h===Ua.Vertical?0:L.deltaX*P,he=h===Ua.Horizontal?0:L.deltaY*P;!ad()&&L.shiftKey&&h!==Ua.Vertical&&(V=L.deltaY*P,he=0),q.translateBy(J,-(V/W)*d,-(he/W)*d,{internal:!0});const H=Tu(J.property("__zoom")),{onViewportChangeStart:U,onViewportChange:ee,onViewportChangeEnd:Y}=R.getState();clearTimeout(X.current),z.current||(z.current=!0,t==null||t(L,H),U==null||U(H)),z.current&&(e==null||e(L,H),ee==null||ee(H),X.current=setTimeout(()=>{n==null||n(L,H),Y==null||Y(H),z.current=!1},150))},{passive:!1}):typeof Z<"u"&&J.on("wheel.zoom",function(L,W){if(!k&&L.type==="wheel"&&!L.ctrlKey||Yo(L,E))return null;L.preventDefault(),Z.call(this,L,W)},{passive:!1}))},[$,c,h,J,q,Z,K,l,k,E,t,e,n]),x.useEffect(()=>{q&&q.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:W}=R.getState(),P=Tu(L.transform);A.current=!0,I.current=P,((he=L.sourceEvent)==null?void 0:he.type)==="mousedown"&&R.setState({paneDragging:!0}),W==null||W(P),t==null||t(L.sourceEvent,P)})},[q,t]),x.useEffect(()=>{q&&($&&!A.current?q.on("zoom",null):$||q.on("zoom",L=>{var P;const{onViewportChange:W}=R.getState();if(R.setState({transform:[L.transform.x,L.transform.y,L.transform.k]}),D.current=!!(s&&Sk(m,G.current??0)),(e||W)&&!((P=L.sourceEvent)!=null&&P.internal)){const V=Tu(L.transform);W==null||W(V),e==null||e(L.sourceEvent,V)}}))},[$,q,e,m,s]),x.useEffect(()=>{q&&q.on("end",L=>{if(!L.sourceEvent||L.sourceEvent.internal)return null;const{onViewportChangeEnd:W}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),s&&Sk(m,G.current??0)&&!D.current&&s(L.sourceEvent),D.current=!1,(n||W)&&HP(I.current,L.transform)){const P=Tu(L.transform);I.current=P,clearTimeout(T.current),T.current=setTimeout(()=>{W==null||W(P),n==null||n(L.sourceEvent,P)},c?150:0)}})},[q,c,m,n,s]),x.useEffect(()=>{q&&q.filter(L=>{const W=K||a,P=l&&L.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&L.button===1&&L.type==="mousedown"&&(Yo(L,"react-flow__node")||Yo(L,"react-flow__edge")))return!0;if(!m&&!W&&!c&&!p&&!l||$||!p&&L.type==="dblclick"||Yo(L,E)&&L.type==="wheel"||Yo(L,C)&&(L.type!=="wheel"||c&&L.type==="wheel"&&!K)||!l&&L.ctrlKey&&L.type==="wheel"||!W&&!c&&!P&&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})},[$,q,a,l,c,p,m,f,K]),pe.createElement("div",{className:"react-flow__renderer",ref:O,style:fx},j)},YP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function KP(){const{userSelectionActive:e,userSelectionRect:t}=ut(YP,Dt);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 Ek(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,l=t.position.y+t.height-s.height;if(a>0||l>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),l>0&&(s.style.height+=l),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 XP(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 l=e.filter(d=>d.id===a.id);if(l.length===0)return s.push(a),s;const c={...a};for(const d of l)if(d)switch(d.type){case"select":{c.selected=d.selected;break}case"position":{typeof d.position<"u"&&(c.position=d.position),typeof d.positionAbsolute<"u"&&(c.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(c.dragging=d.dragging),c.expandParent&&Ek(s,c);break}case"dimensions":{typeof d.dimensions<"u"&&(c.width=d.dimensions.width,c.height=d.dimensions.height),typeof d.updateStyle<"u"&&(c.style={...c.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(c.resizing=d.resizing),c.expandParent&&Ek(s,c);break}case"remove":return s}return s.push(c),s},n)}function QP(e,t){return XP(e,t)}const Ks=(e,t)=>({id:e,type:"select",selected:t});function ti(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Ks(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Ks(s.id,!1))),n},[])}const Of=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},ZP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),GT=x.memo(({isSelecting:e,selectionMode:t=Ul.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:m})=>{const y=x.useRef(null),v=Mt(),N=x.useRef(0),_=x.useRef(0),S=x.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:E}=ut(ZP,Dt),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},T=Z=>{l==null||l(Z),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},R=Z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Z.preventDefault();return}c==null||c(Z)},A=d?Z=>d(Z):void 0,D=Z=>{const{resetSelectedElements:$,domNode:K}=v.getState();if(S.current=K==null?void 0:K.getBoundingClientRect(),!j||!e||Z.button!==0||Z.target!==y.current||!S.current)return;const{x:G,y:z}=Qs(Z,S.current);$(),v.setState({userSelectionRect:{width:0,height:0,startX:G,startY:z,x:G,y:z}}),s==null||s(Z)},O=Z=>{const{userSelectionRect:$,nodeInternals:K,edges:G,transform:z,onNodesChange:X,onEdgesChange:L,nodeOrigin:W,getNodes:P}=v.getState();if(!e||!S.current||!$)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Qs(Z,S.current),he=$.startX??0,H=$.startY??0,U={...$,x:V.x<he?V.x:he,y:V.y<H?V.y:H,width:Math.abs(V.x-he),height:Math.abs(V.y-H)},ee=P(),Y=CT(K,U,z,t===Ul.Partial,!0,W),se=TT(Y,G).map(ge=>ge.id),me=Y.map(ge=>ge.id);if(N.current!==me.length){N.current=me.length;const ge=ti(ee,me);ge.length&&(X==null||X(ge))}if(_.current!==se.length){_.current=se.length;const ge=ti(G,se);ge.length&&(L==null||L(ge))}v.setState({userSelectionRect:U})},I=Z=>{if(Z.button!==0)return;const{userSelectionRect:$}=v.getState();!k&&$&&Z.target===y.current&&(T==null||T(Z)),v.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(Z)},q=Z=>{k&&(v.setState({nodesSelectionActive:N.current>0}),a==null||a(Z)),C()},J=j&&(e||k);return pe.createElement("div",{className:Qt(["react-flow__pane",{dragging:E,selection:e}]),onClick:J?void 0:Of(T,y),onContextMenu:Of(R,y),onWheel:Of(A,y),onMouseEnter:J?void 0:h,onMouseDown:J?D:void 0,onMouseMove:J?O:p,onMouseUp:J?I:void 0,onMouseLeave:J?q:f,ref:y,style:fx},m,pe.createElement(KP,null))});GT.displayName="Pane";function VT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:VT(s,t):!1}function Ck(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 JP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!VT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var l,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=a.positionAbsolute)==null?void 0:l.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 e3(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function YT(e,t,n,s,a=[0,0],l){const c=e3(e,e.extent||s);let d=c;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=n.get(h),{x:y,y:v}=Ha(m,a).positionAbsolute;d=m&&Wn(y)&&Wn(v)&&Wn(m.width)&&Wn(m.height)?[[y+e.width*a[0],v+e.height*a[1]],[y+m.width-e.width+e.width*a[0],v+m.height-e.height+e.height*a[1]]]:d}else l==null||l("005",ys.error005()),d=c;else if(e.extent&&h&&e.extent!=="parent"){const m=n.get(h),{x:y,y:v}=Ha(m,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+v],[e.extent[1][0]+y,e.extent[1][1]+v]]}let p={x:0,y:0};if(h){const m=n.get(h);p=Ha(m,a).positionAbsolute}const f=d&&d!=="parent"?ox(t,d):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Pf({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 Tk=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),d={x:c.width*s[0],y:c.height*s[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-c.left-d.x)/n,y:(p.top-c.top-d.y)/n,...ax(h)}})};function _l(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function Tv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:d,onError:h}=t.getState(),p=d.get(e);if(!p){h==null||h("012",ys.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):a([e])}function t3(){const e=Mt();return x.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,h={x:(c-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:l?a[0]*Math.round(h.x/a[0]):h.x,ySnapped:l?a[1]*Math.round(h.y/a[1]):h.y,...h}},[])}function Lf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function KT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const d=Mt(),[h,p]=x.useState(!1),f=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),v=x.useRef(null),N=x.useRef({x:0,y:0}),_=x.useRef(null),S=x.useRef(!1),k=x.useRef(!1),j=x.useRef(!1),E=t3();return x.useEffect(()=>{if(e!=null&&e.current){const C=Un(e.current),T=({x:D,y:O})=>{const{nodeInternals:I,onNodeDrag:q,onSelectionDrag:J,updateNodePositions:Z,nodeExtent:$,snapGrid:K,snapToGrid:G,nodeOrigin:z,onError:X}=d.getState();m.current={x:D,y:O};let L=!1,W={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&$){const V=Sd(f.current,z);W=zl(V)}if(f.current=f.current.map(V=>{const he={x:D-V.distance.x,y:O-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 H=[[$[0][0],$[0][1]],[$[1][0],$[1][1]]];f.current.length>1&&$&&!V.extent&&(H[0][0]=V.positionAbsolute.x-W.x+$[0][0],H[1][0]=V.positionAbsolute.x+(V.width??0)-W.x2+$[1][0],H[0][1]=V.positionAbsolute.y-W.y+$[0][1],H[1][1]=V.positionAbsolute.y+(V.height??0)-W.y2+$[1][1]);const U=YT(V,he,I,H,z,X);return L=L||V.position.x!==U.position.x||V.position.y!==U.position.y,V.position=U.position,V.positionAbsolute=U.positionAbsolute,V}),!L)return;Z(f.current,!0,!0),p(!0);const P=a?q:Lf(J);if(P&&_.current){const[V,he]=Pf({nodeId:a,dragItems:f.current,nodeInternals:I});P(_.current,V,he)}},R=()=>{if(!v.current)return;const[D,O]=yT(N.current,v.current);if(D!==0||O!==0){const{transform:I,panBy:q}=d.getState();m.current.x=(m.current.x??0)-D/I[2],m.current.y=(m.current.y??0)-O/I[2],q({x:D,y:O})&&T(m.current)}y.current=requestAnimationFrame(R)},A=D=>{var z;const{nodeInternals:O,multiSelectionActive:I,nodesDraggable:q,unselectNodesAndEdges:J,onNodeDragStart:Z,onSelectionDragStart:$}=d.getState();k.current=!0;const K=a?Z:Lf($);(!c||!l)&&!I&&a&&((z=O.get(a))!=null&&z.selected||J()),a&&l&&c&&Tv({id:a,store:d,nodeRef:e});const G=E(D);if(m.current=G,f.current=JP(O,q,G,a),K&&f.current){const[X,L]=Pf({nodeId:a,dragItems:f.current,nodeInternals:O});K(D.sourceEvent,X,L)}};if(t)C.on(".drag",null);else{const D=d$().on("start",O=>{const{domNode:I,nodeDragThreshold:q}=d.getState();q===0&&A(O),j.current=!1;const J=E(O);m.current=J,v.current=(I==null?void 0:I.getBoundingClientRect())||null,N.current=Qs(O.sourceEvent,v.current)}).on("drag",O=>{var Z,$;const I=E(O),{autoPanOnNodeDrag:q,nodeDragThreshold:J}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&q&&(S.current=!0,R()),!k.current){const K=I.xSnapped-(((Z=m==null?void 0:m.current)==null?void 0:Z.x)??0),G=I.ySnapped-((($=m==null?void 0:m.current)==null?void 0:$.y)??0);Math.sqrt(K*K+G*G)>J&&A(O)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(_.current=O.sourceEvent,N.current=Qs(O.sourceEvent,v.current),T(I))}}).on("end",O=>{if(!(!k.current||j.current)&&(p(!1),S.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:I,nodeInternals:q,onNodeDragStop:J,onSelectionDragStop:Z}=d.getState(),$=a?J:Lf(Z);if(I(f.current,!1,!1),$){const[K,G]=Pf({nodeId:a,dragItems:f.current,nodeInternals:q});$(O.sourceEvent,K,G)}}}).filter(O=>{const I=O.target;return!O.button&&(!n||!Ck(I,`.${n}`,e))&&(!s||Ck(I,s,e))});return C.call(D),()=>{C.on(".drag",null)}}}},[e,t,n,s,l,d,a,c,E]),h}function XT(){const e=Mt();return x.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:d,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),m=c().filter(j=>j.selected&&(j.draggable||f&&typeof j.draggable>"u")),y=d?h[0]:5,v=d?h[1]:5,N=n.isShiftPressed?4:1,_=n.x*y*N,S=n.y*v*N,k=m.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+_,y:j.positionAbsolute.y+S};d&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:C,position:T}=YT(j,E,s,a,void 0,p);j.position=T,j.positionAbsolute=C}return j});l(k,!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 Nl=e=>{const t=({id:n,type:s,data:a,xPos:l,yPos:c,xPosOrigin:d,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:m,onMouseMove:y,onMouseLeave:v,onContextMenu:N,onDoubleClick:_,style:S,className:k,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:D,hidden:O,resizeObserver:I,dragHandle:q,zIndex:J,isParent:Z,noDragClassName:$,noPanClassName:K,initialized:G,disableKeyboardA11y:z,ariaLabel:X,rfId:L,hasHandleBounds:W})=>{const P=Mt(),V=x.useRef(null),he=x.useRef(null),H=x.useRef(A),U=x.useRef(D),ee=x.useRef(s),Y=E||j||f||m||y||v,se=XT(),me=_l(n,P.getState,m),ge=_l(n,P.getState,y),Re=_l(n,P.getState,v),Oe=_l(n,P.getState,N),ce=_l(n,P.getState,_),we=_e=>{const{nodeDragThreshold:Ce}=P.getState();if(E&&(!R||!j||Ce>0)&&Tv({id:n,store:P,nodeRef:V}),f){const Ge=P.getState().nodeInternals.get(n);Ge&&f(_e,{...Ge})}},be=_e=>{if(!Nv(_e)&&!z)if(bT.includes(_e.key)&&E){const Ce=_e.key==="Escape";Tv({id:n,store:P,unselect:Ce,nodeRef:V})}else j&&p&&Object.prototype.hasOwnProperty.call(ii,_e.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${_e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),se({x:ii[_e.key].x,y:ii[_e.key].y,isShiftPressed:_e.shiftKey}))};x.useEffect(()=>()=>{he.current&&(I==null||I.unobserve(he.current),he.current=null)},[]),x.useEffect(()=>{if(V.current&&!O){const _e=V.current;(!G||!W||he.current!==_e)&&(he.current&&(I==null||I.unobserve(he.current)),I==null||I.observe(_e),he.current=_e)}},[O,G,W]),x.useEffect(()=>{const _e=ee.current!==s,Ce=H.current!==A,Ge=U.current!==D;V.current&&(_e||Ce||Ge)&&(_e&&(ee.current=s),Ce&&(H.current=A),Ge&&(U.current=D),P.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,A,D]);const Be=KT({nodeRef:V,disabled:O||!j,noDragClassName:$,handleSelector:q,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return O?null:pe.createElement("div",{className:Qt(["react-flow__node",`react-flow__node-${s}`,{[K]:j},k,{selected:p,selectable:E,parent:Z,dragging:Be}]),ref:V,style:{zIndex:J,transform:`translate(${d}px,${h}px)`,pointerEvents:Y?"all":"none",visibility:G?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ge,onMouseLeave:Re,onContextMenu:Oe,onClick:we,onDoubleClick:ce,onKeyDown:T?be:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":z?void 0:`${BT}-${L}`,"aria-label":X},pe.createElement(pP,{value:n},pe.createElement(e,{id:n,data:a,type:s,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:A,targetPosition:D,dragging:Be,dragHandle:q,zIndex:J})))};return t.displayName="NodeWrapper",x.memo(t)};const n3=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Sd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function r3({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:a,height:l,x:c,y:d,transformString:h,userSelectionActive:p}=ut(n3,Dt),f=XT(),m=x.useRef(null);if(x.useEffect(()=>{var N;n||(N=m.current)==null||N.focus({preventScroll:!0})},[n]),KT({nodeRef:m}),p||!a||!l)return null;const y=e?N=>{const _=s.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,v=N=>{Object.prototype.hasOwnProperty.call(ii,N.key)&&f({x:ii[N.key].x,y:ii[N.key].y,isShiftPressed:N.shiftKey})};return pe.createElement("div",{className:Qt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l,top:d,left:c}}))}var s3=x.memo(r3);const a3=e=>e.nodesSelectionActive,QT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:d,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:I,defaultViewport:q,translateExtent:J,minZoom:Z,maxZoom:$,preventScrolling:K,onSelectionContextMenu:G,noWheelClassName:z,noPanClassName:X,disableKeyboardA11y:L})=>{const W=ut(a3),P=Wl(m),V=Wl(k),he=V||I,H=V||R,U=P||y&&he!==!0;return UP({deleteKeyCode:d,multiSelectionKeyCode:S}),pe.createElement(VP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:H,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:!P&&he,defaultViewport:q,translateExtent:J,minZoom:Z,maxZoom:$,zoomActivationKeyCode:j,preventScrolling:K,noWheelClassName:z,noPanClassName:X},pe.createElement(GT,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:he,isSelecting:!!U,selectionMode:v},e,W&&pe.createElement(s3,{onSelectionContextMenu:G,noPanClassName:X,disableKeyboardA11y:L})))};QT.displayName="FlowRenderer";var o3=x.memo(QT);function i3(e){return ut(x.useCallback(n=>e?CT(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function l3(e){const t={input:Nl(e.input||LT),default:Nl(e.default||Cv),output:Nl(e.output||qT),group:Nl(e.group||hx)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=Nl(e[l]||Cv),a),n);return{...t,...s}}const c3=({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]},u3=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ZT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:l,onError:c}=ut(u3,Dt),d=i3(e.onlyRenderVisibleElements),h=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const y=m.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));l(y)});return h.current=f,f},[]);return x.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:fx},d.map(f=>{var T,R,A;let m=f.type||"default";e.nodeTypes[m]||(c==null||c("003",ys.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,v=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||a&&typeof f.selectable>"u"),_=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?ox(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,j=(k==null?void 0:k.x)??0,E=(k==null?void 0:k.y)??0,C=c3({x:j,y:E,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||ze.Bottom,targetPosition:f.targetPosition||ze.Top,hidden:f.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:!!f.selected,isDraggable:v,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((T=f[Et])==null?void 0:T.z)??0,isParent:!!((R=f[Et])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((A=f[Et])!=null&&A.handleBounds)})}))};ZT.displayName="NodeRenderer";var d3=x.memo(ZT);const h3=(e,t,n)=>n===ze.Left?e-t:n===ze.Right?e+t:e,f3=(e,t,n)=>n===ze.Top?e-t:n===ze.Bottom?e+t:e,Ak="react-flow__edgeupdater",Rk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:d})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Qt([Ak,`${Ak}-${d}`]),cx:h3(t,s,e),cy:f3(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),p3=()=>!0;var Ko=e=>{const t=({id:n,className:s,type:a,data:l,onClick:c,onEdgeDoubleClick:d,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:k,target:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,elementsSelectable:O,hidden:I,sourceHandleId:q,targetHandleId:J,onContextMenu:Z,onMouseEnter:$,onMouseMove:K,onMouseLeave:G,reconnectRadius:z,onReconnect:X,onReconnectStart:L,onReconnectEnd:W,markerEnd:P,markerStart:V,rfId:he,ariaLabel:H,isFocusable:U,isReconnectable:ee,pathOptions:Y,interactionWidth:se,disableKeyboardA11y:me})=>{const ge=x.useRef(null),[Re,Oe]=x.useState(!1),[ce,we]=x.useState(!1),be=Mt(),Be=x.useMemo(()=>`url('#${jv(V,he)}')`,[V,he]),_e=x.useMemo(()=>`url('#${jv(P,he)}')`,[P,he]);if(I)return null;const Ce=Ye=>{var De;const{edges:ct,addSelectedEdges:re,unselectNodesAndEdges:Ae,multiSelectionActive:ae}=be.getState(),Ee=ct.find(mt=>mt.id===n);Ee&&(O&&(be.setState({nodesSelectionActive:!1}),Ee.selected&&ae?(Ae({nodes:[],edges:[Ee]}),(De=ge.current)==null||De.blur()):re([n])),c&&c(Ye,Ee))},Ge=kl(n,be.getState,d),tt=kl(n,be.getState,Z),Qe=kl(n,be.getState,$),Xe=kl(n,be.getState,K),Ke=kl(n,be.getState,G),fe=(Ye,ct)=>{if(Ye.button!==0)return;const{edges:re,isValidConnection:Ae}=be.getState(),ae=ct?j:k,Ee=(ct?J:q)||null,De=ct?"target":"source",mt=Ae||p3,xt=ct,Me=re.find(wt=>wt.id===n);we(!0),L==null||L(Ye,Me,De);const Ze=wt=>{we(!1),W==null||W(wt,Me,De)};IT({event:Ye,handleId:Ee,nodeId:ae,onConnect:wt=>X==null?void 0:X(Me,wt),isTarget:xt,getState:be.getState,setState:be.setState,isValidConnection:mt,edgeUpdaterType:De,onReconnectEnd:Ze})},dt=Ye=>fe(Ye,!0),yt=Ye=>fe(Ye,!1),ot=()=>Oe(!0),ye=()=>Oe(!1),je=!O&&!c,Fe=Ye=>{var ct;if(!me&&bT.includes(Ye.key)&&O){const{unselectNodesAndEdges:re,addSelectedEdges:Ae,edges:ae}=be.getState();Ye.key==="Escape"?((ct=ge.current)==null||ct.blur(),re({edges:[ae.find(De=>De.id===n)]})):Ae([n])}};return pe.createElement("g",{className:Qt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:h,animated:p,inactive:je,updating:Re}]),onClick:Ce,onDoubleClick:Ge,onContextMenu:tt,onMouseEnter:Qe,onMouseMove:Xe,onMouseLeave:Ke,onKeyDown:U?Fe:void 0,tabIndex:U?0:void 0,role:U?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":H===null?void 0:H||`Edge from ${k} to ${j}`,"aria-describedby":U?`${zT}-${he}`:void 0,ref:ge},!ce&&pe.createElement(e,{id:n,source:k,target:j,selected:h,animated:p,label:f,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:D,sourceHandleId:q,targetHandleId:J,markerStart:Be,markerEnd:_e,pathOptions:Y,interactionWidth:se}),ee&&pe.createElement(pe.Fragment,null,(ee==="source"||ee===!0)&&pe.createElement(Rk,{position:A,centerX:E,centerY:C,radius:z,onMouseDown:dt,onMouseEnter:ot,onMouseOut:ye,type:"source"}),(ee==="target"||ee===!0)&&pe.createElement(Rk,{position:D,centerX:T,centerY:R,radius:z,onMouseDown:yt,onMouseEnter:ot,onMouseOut:ye,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function m3(e){const t={default:Ko(e.default||id),straight:Ko(e.bezier||cx),step:Ko(e.step||lx),smoothstep:Ko(e.step||Nd),simplebezier:Ko(e.simplebezier||ix)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Ko(e[l]||id),a),n);return{...t,...s}}function Mk(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,l=(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+l/2,y:a};case ze.Right:return{x:s+l,y:a+c/2};case ze.Bottom:return{x:s+l/2,y:a+c};case ze.Left:return{x:s,y:a+c/2}}}function Ik(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const g3=(e,t,n,s,a,l)=>{const c=Mk(n,e,t),d=Mk(l,s,a);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y}};function y3({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:l,width:c,height:d,transform:h}){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+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=zl({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:c/h[2],height:d/h[2]}),m=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(m*y)>0}function $k(e){var s,a,l,c,d;const t=((s=e==null?void 0:e[Et])==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((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((d=e==null?void 0:e.positionAbsolute)==null?void 0:d.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const w3=[{level:0,isMaxLevel:!0,edges:[]}];function v3(e,t,n=!1){let s=-1;const a=e.reduce((c,d)=>{var f,m;const h=Wn(d.zIndex);let p=h?d.zIndex:0;if(n){const y=t.get(d.target),v=t.get(d.source),N=d.selected||(y==null?void 0:y.selected)||(v==null?void 0:v.selected),_=Math.max(((f=v==null?void 0:v[Et])==null?void 0:f.z)||0,((m=y==null?void 0:y[Et])==null?void 0:m.z)||0,1e3);p=(h?d.zIndex:0)+(N?_:0)}return c[p]?c[p].push(d):c[p]=[d],s=p>s?p:s,c},{}),l=Object.entries(a).map(([c,d])=>{const h=+c;return{edges:d,level:h,isMaxLevel:h===s}});return l.length===0?w3:l}function x3(e,t,n){const s=ut(x.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),d=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&y3({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return v3(s,t,n)}const b3=({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"}),k3=({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"}),Ok={[od.Arrow]:b3,[od.ArrowClosed]:k3};function _3(e){const t=Mt();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(Ok,e)?Ok[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",ys.error009(e)),null)},[e])}const N3=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:d="auto-start-reverse"})=>{const h=_3(t);return h?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0"},pe.createElement(h,{color:n,strokeWidth:c})):null},S3=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const d=jv(c,t);s.includes(d)||(a.push({id:d,color:c.color||e,...c}),s.push(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},JT=({defaultColor:e,rfId:t})=>{const n=ut(x.useCallback(S3({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((l,c)=>l.id!==a[c].id)));return pe.createElement("defs",null,n.map(s=>pe.createElement(N3,{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})))};JT.displayName="MarkerDefinitions";var j3=x.memo(JT);const E3=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}),e2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:A,nodeInternals:D,onError:O}=ut(E3,Dt),I=x3(t,D,n);return T?pe.createElement(pe.Fragment,null,I.map(({level:q,edges:J,isMaxLevel:Z})=>pe.createElement("svg",{key:q,style:{zIndex:q},width:T,height:R,className:"react-flow__edges react-flow__container"},Z&&pe.createElement(j3,{defaultColor:e,rfId:s}),pe.createElement("g",null,J.map($=>{const[K,G,z]=$k(D.get($.source)),[X,L,W]=$k(D.get($.target));if(!z||!W)return null;let P=$.type||"default";a[P]||(O==null||O("011",ys.error011(P)),P="default");const V=a[P]||a.default,he=A===Va.Strict?L.target:(L.target??[]).concat(L.source??[]),H=Ik(G.source,$.sourceHandle),U=Ik(he,$.targetHandle),ee=(H==null?void 0:H.position)||ze.Bottom,Y=(U==null?void 0:U.position)||ze.Top,se=!!($.focusable||j&&typeof $.focusable>"u"),me=$.reconnectable||$.updatable,ge=typeof y<"u"&&(me||E&&typeof me>"u");if(!H||!U)return O==null||O("008",ys.error008(H,$)),null;const{sourceX:Re,sourceY:Oe,targetX:ce,targetY:we}=g3(K,H,ee,X,U,Y);return pe.createElement(V,{key:$.id,id:$.id,className:Qt([$.className,l]),type:P,data:$.data,selected:!!$.selected,animated:!!$.animated,hidden:!!$.hidden,label:$.label,labelStyle:$.labelStyle,labelShowBg:$.labelShowBg,labelBgStyle:$.labelBgStyle,labelBgPadding:$.labelBgPadding,labelBgBorderRadius:$.labelBgBorderRadius,style:$.style,source:$.source,target:$.target,sourceHandleId:$.sourceHandle,targetHandleId:$.targetHandle,markerEnd:$.markerEnd,markerStart:$.markerStart,sourceX:Re,sourceY:Oe,targetX:ce,targetY:we,sourcePosition:ee,targetPosition:Y,elementsSelectable:C,onContextMenu:c,onMouseEnter:d,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:_,rfId:s,ariaLabel:$.ariaLabel,isFocusable:se,isReconnectable:ge,pathOptions:"pathOptions"in $?$.pathOptions:void 0,interactionWidth:$.interactionWidth,disableKeyboardA11y:k})})))),S):null};e2.displayName="EdgeRenderer";var C3=x.memo(e2);const T3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function A3({children:e}){const t=ut(T3);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function R3(e){const t=ec(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const M3={[ze.Left]:ze.Right,[ze.Right]:ze.Left,[ze.Top]:ze.Bottom,[ze.Bottom]:ze.Top},t2=({nodeId:e,handleType:t,style:n,type:s=Xs.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,A,D;const{fromNode:c,handleId:d,toX:h,toY:p,connectionMode:f}=ut(x.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),Dt),m=(R=c==null?void 0:c[Et])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(f===Va.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const v=d?y.find(O=>O.id===d):y[0],N=v?v.x+v.width/2:(c.width??0)/2,_=v?v.y+v.height/2:c.height??0,S=(((A=c.positionAbsolute)==null?void 0:A.x)??0)+N,k=(((D=c.positionAbsolute)==null?void 0:D.y)??0)+_,j=v==null?void 0:v.position,E=j?M3[j]:null;if(!j||!E)return null;if(a)return pe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:v,fromX:S,fromY:k,toX:h,toY:p,fromPosition:j,toPosition:E,connectionStatus:l});let C="";const T={sourceX:S,sourceY:k,sourcePosition:j,targetX:h,targetY:p,targetPosition:E};return s===Xs.Bezier?[C]=jT(T):s===Xs.Step?[C]=Sv({...T,borderRadius:0}):s===Xs.SmoothStep?[C]=Sv(T):s===Xs.SimpleBezier?[C]=ST(T):C=`M${S},${k} ${h},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};t2.displayName="ConnectionLine";const I3=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function $3({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:l,nodesConnectable:c,width:d,height:h,connectionStatus:p}=ut(I3,Dt);return!(a&&l&&d&&c)?null:pe.createElement("svg",{style:e,width:d,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:Qt(["react-flow__connection",p])},pe.createElement(t2,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Pk(e,t){return x.useRef(null),Mt(),x.useMemo(()=>t(e),[e])}const n2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:d,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:I,deleteKeyCode:q,onlyRenderVisibleElements:J,elementsSelectable:Z,selectNodesOnDrag:$,defaultViewport:K,translateExtent:G,minZoom:z,maxZoom:X,preventScrolling:L,defaultMarkerColor:W,zoomOnScroll:P,zoomOnPinch:V,panOnScroll:he,panOnScrollSpeed:H,panOnScrollMode:U,zoomOnDoubleClick:ee,panOnDrag:Y,onPaneClick:se,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneScroll:Oe,onPaneContextMenu:ce,onEdgeContextMenu:we,onEdgeMouseEnter:be,onEdgeMouseMove:Be,onEdgeMouseLeave:_e,onReconnect:Ce,onReconnectStart:Ge,onReconnectEnd:tt,reconnectRadius:Qe,noDragClassName:Xe,noWheelClassName:Ke,noPanClassName:fe,elevateEdgesOnSelect:dt,disableKeyboardA11y:yt,nodeOrigin:ot,nodeExtent:ye,rfId:je})=>{const Fe=Pk(e,l3),Ye=Pk(t,m3);return R3(l),pe.createElement(o3,{onPaneClick:se,onPaneMouseEnter:me,onPaneMouseMove:ge,onPaneMouseLeave:Re,onPaneContextMenu:ce,onPaneScroll:Oe,deleteKeyCode:q,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:I,elementsSelectable:Z,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:V,zoomOnDoubleClick:ee,panOnScroll:he,panOnScrollSpeed:H,panOnScrollMode:U,panOnDrag:Y,defaultViewport:K,translateExtent:G,minZoom:z,maxZoom:X,onSelectionContextMenu:N,preventScrolling:L,noDragClassName:Xe,noWheelClassName:Ke,noPanClassName:fe,disableKeyboardA11y:yt},pe.createElement(A3,null,pe.createElement(C3,{edgeTypes:Ye,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:J,onEdgeContextMenu:we,onEdgeMouseEnter:be,onEdgeMouseMove:Be,onEdgeMouseLeave:_e,onReconnect:Ce,onReconnectStart:Ge,onReconnectEnd:tt,reconnectRadius:Qe,defaultMarkerColor:W,noPanClassName:fe,elevateEdgesOnSelect:!!dt,disableKeyboardA11y:yt,rfId:je},pe.createElement($3,{style:j,type:k,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(d3,{nodeTypes:Fe,onNodeClick:c,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:$,onlyRenderVisibleElements:J,noPanClassName:fe,noDragClassName:Xe,disableKeyboardA11y:yt,nodeOrigin:ot,nodeExtent:ye,rfId:je})))};n2.displayName="GraphView";var O3=x.memo(n2);const Av=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Gs={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:Av,nodeExtent:Av,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Va.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:lP,isValidConnection:void 0},P3=()=>_M((e,t)=>({...Gs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:$f(n,s,a,l)})},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",l=typeof s<"u",c=a?$f(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?s:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:d,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=n.reduce((_,S)=>{const k=a.get(S.id);if(k!=null&&k.hidden)a.set(k.id,{...k,[Et]:{...k[Et],handleBounds:void 0}});else if(k){const j=ax(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(a.set(k.id,{...k,[Et]:{...k[Et],handleBounds:{source:Tk(".source",S.nodeElement,y,p),target:Tk(".target",S.nodeElement,y,p)}},...j}),_.push({id:k.id,type:"dimensions",dimensions:j}))}return _},[]);WT(a,p);const N=c||l&&!c&&HT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(v==null?void 0:v.length)>0&&(s==null||s(v))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(d=>{const h={id:d.id,type:"position",dragging:a};return s&&(h.positionAbsolute=d.positionAbsolute,h.position=d.position),h});l(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:d,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(l){const p=QP(n,d()),f=$f(p,a,c,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Ks(h,!0)):(c=ti(l(),n),d=ti(a,[])),Cu({changedNodes:c,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,d=null;s?c=n.map(h=>Ks(h,!0)):(c=ti(a,n),d=ti(l(),[])),Cu({changedNodes:d,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),d=s||a,h=c.map(f=>(f.selected=!1,Ks(f.id,!1))),p=d.map(f=>Ks(f.id,!1));Cu({changedNodes:h,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(),l=s().filter(d=>d.selected).map(d=>Ks(d.id,!1)),c=n.filter(d=>d.selected).map(d=>Ks(d.id,!1));Cu({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=ox(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:l,d3Zoom:c,d3Selection:d,translateExtent:h}=t();if(!c||!d||!n.x&&!n.y)return!1;const p=ms.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,f,h);return c.transform(d,m),s[0]!==m.x||s[1]!==m.y||s[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Gs.connectionNodeId,connectionHandleId:Gs.connectionHandleId,connectionHandleType:Gs.connectionHandleType,connectionStatus:Gs.connectionStatus,connectionStartHandle:Gs.connectionStartHandle,connectionEndHandle:Gs.connectionEndHandle}),reset:()=>e({...Gs})}),Object.is),px=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=P3()),pe.createElement(tP,{value:t.current},e)};px.displayName="ReactFlowProvider";const r2=({children:e})=>x.useContext(_d)?pe.createElement(pe.Fragment,null,e):pe.createElement(px,null,e);r2.displayName="ReactFlowWrapper";const L3={input:LT,default:Cv,output:qT,group:hx},D3={default:id,straight:cx,step:lx,smoothstep:Nd,simplebezier:ix},q3=[0,0],F3=[15,15],B3={x:0,y:0,zoom:1},z3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},s2=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:l=L3,edgeTypes:c=D3,onNodeClick:d,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:I,onEdgesDelete:q,onSelectionChange:J,onSelectionDragStart:Z,onSelectionDrag:$,onSelectionDragStop:K,onSelectionContextMenu:G,onSelectionStart:z,onSelectionEnd:X,connectionMode:L=Va.Strict,connectionLineType:W=Xs.Bezier,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,deleteKeyCode:H="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:ee=!1,selectionMode:Y=Ul.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:me=ad()?"Meta":"Control",zoomActivationKeyCode:ge=ad()?"Meta":"Control",snapToGrid:Re=!1,snapGrid:Oe=F3,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:we=!0,nodesDraggable:be,nodesConnectable:Be,nodesFocusable:_e,nodeOrigin:Ce=q3,edgesFocusable:Ge,edgesUpdatable:tt,elementsSelectable:Qe,defaultViewport:Xe=B3,minZoom:Ke=.5,maxZoom:fe=2,translateExtent:dt=Av,preventScrolling:yt=!0,nodeExtent:ot,defaultMarkerColor:ye="#b1b1b7",zoomOnScroll:je=!0,zoomOnPinch:Fe=!0,panOnScroll:Ye=!1,panOnScrollSpeed:ct=.5,panOnScrollMode:re=Ua.Free,zoomOnDoubleClick:Ae=!0,panOnDrag:ae=!0,onPaneClick:Ee,onPaneMouseEnter:De,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Me,onPaneContextMenu:Ze,children:ht,onEdgeContextMenu:wt,onEdgeDoubleClick:Wt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Kn,onEdgeMouseLeave:Br,onEdgeUpdate:Xn,onEdgeUpdateStart:eo,onEdgeUpdateEnd:zr,onReconnect:ta,onReconnectStart:Ur,onReconnectEnd:Rn,reconnectRadius:Wr=10,edgeUpdaterRadius:ks=10,onNodesChange:qt,onEdgesChange:xr,noDragClassName:na="nodrag",noWheelClassName:Ei="nowheel",noPanClassName:to="nopan",fitView:Mn=!1,fitViewOptions:ra,connectOnClick:sa=!0,attributionPosition:aa,proOptions:oa,defaultEdgeOptions:ia,elevateNodesOnSelect:la=!0,elevateEdgesOnSelect:no=!1,disableKeyboardA11y:ca=!1,autoPanOnConnect:Ci=!0,autoPanOnNodeDrag:ft=!0,connectionRadius:ro=20,isValidConnection:ua,onError:Hr,style:Gr,id:Vr,nodeDragThreshold:da,...Yr},$t)=>{const ha=Vr||"1";return pe.createElement("div",{...Yr,style:{...Gr,...z3},ref:$t,className:Qt(["react-flow",a]),"data-testid":"rf__wrapper",id:Vr},pe.createElement(r2,null,pe.createElement(O3,{onInit:p,onMove:f,onMoveStart:m,onMoveEnd:y,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:W,connectionLineStyle:P,connectionLineComponent:V,connectionLineContainerStyle:he,selectionKeyCode:U,selectionOnDrag:ee,selectionMode:Y,deleteKeyCode:H,multiSelectionKeyCode:me,panActivationKeyCode:se,zoomActivationKeyCode:ge,onlyRenderVisibleElements:ce,selectNodesOnDrag:we,defaultViewport:Xe,translateExtent:dt,minZoom:Ke,maxZoom:fe,preventScrolling:yt,zoomOnScroll:je,zoomOnPinch:Fe,zoomOnDoubleClick:Ae,panOnScroll:Ye,panOnScrollSpeed:ct,panOnScrollMode:re,panOnDrag:ae,onPaneClick:Ee,onPaneMouseEnter:De,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Me,onPaneContextMenu:Ze,onSelectionContextMenu:G,onSelectionStart:z,onSelectionEnd:X,onEdgeContextMenu:wt,onEdgeDoubleClick:Wt,onEdgeMouseEnter:Fr,onEdgeMouseMove:Kn,onEdgeMouseLeave:Br,onReconnect:ta??Xn,onReconnectStart:Ur??eo,onReconnectEnd:Rn??zr,reconnectRadius:Wr??ks,defaultMarkerColor:ye,noDragClassName:na,noWheelClassName:Ei,noPanClassName:to,elevateEdgesOnSelect:no,rfId:ha,disableKeyboardA11y:ca,nodeOrigin:Ce,nodeExtent:ot}),pe.createElement(RP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:be,nodesConnectable:Be,nodesFocusable:_e,edgesFocusable:Ge,edgesUpdatable:tt,elementsSelectable:Qe,elevateNodesOnSelect:la,minZoom:Ke,maxZoom:fe,nodeExtent:ot,onNodesChange:qt,onEdgesChange:xr,snapToGrid:Re,snapGrid:Oe,connectionMode:L,translateExtent:dt,connectOnClick:sa,defaultEdgeOptions:ia,fitView:Mn,fitViewOptions:ra,onNodesDelete:I,onEdgesDelete:q,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:$,onSelectionDragStart:Z,onSelectionDragStop:K,noPanClassName:to,nodeOrigin:Ce,rfId:ha,autoPanOnConnect:Ci,autoPanOnNodeDrag:ft,onError:Hr,connectionRadius:ro,isValidConnection:ua,nodeDragThreshold:da}),pe.createElement(TP,{onSelectionChange:J}),ht,pe.createElement(rP,{proOptions:oa,position:aa}),pe.createElement(PP,{rfId:ha,disableKeyboardA11y:ca})))});s2.displayName="ReactFlow";const U3=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function a2(){return ut(U3,Dt)}const o2=({id:e,x:t,y:n,width:s,height:a,style:l,color:c,strokeColor:d,strokeWidth:h,className:p,borderRadius:f,shapeRendering:m,onClick:y,selected:v})=>{const{background:N,backgroundColor:_}=l||{},S=c||N||_;return pe.createElement("rect",{className:Qt(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:f,ry:f,width:s,height:a,fill:S,stroke:d,strokeWidth:h,shapeRendering:m,onClick:y?k=>y(k,e):void 0})};o2.displayName="MiniMapNode";var W3=x.memo(o2);const H3=e=>e.nodeOrigin,G3=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Df=e=>e instanceof Function?e:()=>e;function V3({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:l=W3,onClick:c}){const d=ut(G3,Dt),h=ut(H3),p=Df(t),f=Df(e),m=Df(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,d.map(v=>{const{x:N,y:_}=Ha(v,h).positionAbsolute;return pe.createElement(l,{key:v.id,x:N,y:_,width:v.width,height:v.height,style:v.style,selected:v.selected,className:m(v),color:p(v),borderRadius:s,strokeColor:f(v),strokeWidth:a,shapeRendering:y,onClick:c,id:v.id})}))}var Y3=x.memo(V3);const K3=200,X3=150,Q3=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?oP(Sd(t,e.nodeOrigin),n):n,rfId:e.rfId}},Z3="react-flow__minimap-desc";function i2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:d,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:y,onNodeClick:v,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:E=5}){const C=Mt(),T=x.useRef(null),{boundingRect:R,viewBB:A,rfId:D}=ut(Q3,Dt),O=(e==null?void 0:e.width)??K3,I=(e==null?void 0:e.height)??X3,q=R.width/O,J=R.height/I,Z=Math.max(q,J),$=Z*O,K=Z*I,G=E*Z,z=R.x-($-R.width)/2-G,X=R.y-(K-R.height)/2-G,L=$+G*2,W=K+G*2,P=`${Z3}-${D}`,V=x.useRef(0);V.current=Z,x.useEffect(()=>{if(T.current){const U=Un(T.current),ee=me=>{const{transform:ge,d3Selection:Re,d3Zoom:Oe}=C.getState();if(me.sourceEvent.type!=="wheel"||!Re||!Oe)return;const ce=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*j,we=ge[2]*Math.pow(2,ce);Oe.scaleTo(Re,we)},Y=me=>{const{transform:ge,d3Selection:Re,d3Zoom:Oe,translateExtent:ce,width:we,height:be}=C.getState();if(me.sourceEvent.type!=="mousemove"||!Re||!Oe)return;const Be=V.current*Math.max(1,ge[2])*(k?-1:1),_e={x:ge[0]-me.sourceEvent.movementX*Be,y:ge[1]-me.sourceEvent.movementY*Be},Ce=[[0,0],[we,be]],Ge=ms.translate(_e.x,_e.y).scale(ge[2]),tt=Oe.constrain()(Ge,Ce,ce);Oe.transform(Re,tt)},se=mT().on("zoom",N?Y:null).on("zoom.wheel",_?ee:null);return U.call(se),()=>{U.on("zoom",null)}}},[N,_,k,j]);const he=y?U=>{const ee=ur(U);y(U,{x:ee[0],y:ee[1]})}:void 0,H=v?(U,ee)=>{const Y=C.getState().nodeInternals.get(ee);v(U,Y)}:void 0;return pe.createElement(sx,{position:m,style:e,className:Qt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:O,height:I,viewBox:`${z} ${X} ${L} ${W}`,role:"img","aria-labelledby":P,ref:T,onClick:he},S&&pe.createElement("title",{id:P},S),pe.createElement(Y3,{onClick:H,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:d}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-G},${X-G}h${L+G*2}v${W+G*2}h${-L-G*2}z
|
|
57
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}i2.displayName="MiniMap";var J3=x.memo(i2);function eL(){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 tL(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function nL(){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 rL(){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 sL(){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 Or=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:Qt(["react-flow__controls-button",t]),...n},e);Or.displayName="ControlButton";const aL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),l2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:d,onInteractiveChange:h,className:p,children:f,position:m="bottom-left"})=>{const y=Mt(),[v,N]=x.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:k}=ut(aL,Dt),{zoomIn:j,zoomOut:E,fitView:C}=ec();if(x.useEffect(()=>{N(!0)},[]),!v)return null;const T=()=>{j(),l==null||l()},R=()=>{E(),c==null||c()},A=()=>{C(a),d==null||d()},D=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return pe.createElement(sx,{className:Qt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(Or,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},pe.createElement(eL,null)),pe.createElement(Or,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},pe.createElement(tL,null))),n&&pe.createElement(Or,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},pe.createElement(nL,null)),s&&pe.createElement(Or,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},_?pe.createElement(sL,null):pe.createElement(rL,null)),f)};l2.displayName="Controls";var oL=x.memo(l2),mr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(mr||(mr={}));function iL({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 lL({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const cL={[mr.Dots]:"#91919a",[mr.Lines]:"#eee",[mr.Cross]:"#e2e2e2"},uL={[mr.Dots]:1,[mr.Lines]:1,[mr.Cross]:6},dL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function c2({id:e,variant:t=mr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:l=2,color:c,style:d,className:h}){const p=x.useRef(null),{transform:f,patternId:m}=ut(dL,Dt),y=c||cL[t],v=s||uL[t],N=t===mr.Dots,_=t===mr.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],j=v*f[2],E=_?[j,j]:k,C=N?[j/l,j/l]:[E[0]/l,E[1]/l];return pe.createElement("svg",{className:Qt(["react-flow__background",h]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.createElement("pattern",{id:m+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?pe.createElement(lL,{color:y,radius:j/l}):pe.createElement(iL,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}c2.displayName="Background";var hL=x.memo(c2);const fL=["us-gov","global","apac","us","eu","jp","au"],pL=new RegExp(`^(?:(?:${fL.join("|")})\\.)?anthropic\\.`,"i");function tc(e){return e.replace(pL,"")}const mL=["command","cmd","file_path","path","url","pattern","notebook_path"],Lk=120,qf=e=>e.length>Lk?`${e.slice(0,Lk-1)}…`:e;function gL(e){if(typeof e=="string")return e.trim()?qf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of mL){const s=t[n];if(typeof s=="string"&&s.trim())return qf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return qf(a)}}return null}function u2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function mx(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 yL(e){const t=mx(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 wL(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]=yL(s));return Object.keys(t).length?t:void 0}function d2(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),...mx(n)};for(const s of Object.values(n)){const a=d2(s,t+1);if(a)return a}return null}const vL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function h2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&vL.test(tc(n.model)))return n.model;for(const s of Object.values(n)){const a=h2(s,t+1);if(a)return a}return null}function Rv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Zs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Dk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function nc(e,t){return`${e}::${t}`}function ld(e){return e.agent_type??e.subagent_type??"subagent"}function Ol(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function ni(e,t,n,s){const a=t;let l=e.agents.get(a);return l||(l={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:u2()},e.agents.set(a,l),l)}function f2(e,t,n,s){const a=nc(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&s.cwd&&(l.cwd=s.cwd,l.cwdBasename=Zs(s.cwd));const c=ld(s);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function xL(e,t,n){const s=t.session_id??"unknown",a=Ol(t);if(a){const h=f2(e,s,a,t);if(h)return h}const l=e.activeSubagentStack.get(s),c=l&&l.length>0?l[l.length-1]:null;if(c){const h=e.agents.get(nc(s,c));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Zs(t.cwd)),h}const d=ni(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=Zs(t.cwd)),d.label==="session"&&t.cwd&&(d.label=Zs(t.cwd)??"session"),d}function bL(e,t,n,s,a){const l=nc(t,n),c=ni(e,t,a,!0);let d=e.agents.get(l);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=Zs(s.cwd));const h=ld(s);return h&&(d.label==="subagent"||!d.label)&&(d.label=h),d}return d={id:l,sessionId:t,label:ld(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Zs(s.cwd),toolCount:0,childCount:0,usage:u2()},e.agents.set(l,d),c.childCount+=1,d}function kL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function _L(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 Au(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 qk=200,NL=25;function SL(e,t){const n=t.tools;if(n.length>qk){const s=n.splice(0,n.length-qk);for(const a of s)e.toolIndex.get(a.id)===a&&(e.toolIndex.delete(a.id),e.toolOwner.delete(a.id))}for(let s=n.length-NL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function jL(e,t,n){const s=e.toolIndex.get(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 Fk=2e3;function EL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-Fk)return!1;if(a.text===n&&a.at<=t+Fk)return!0}return!1}function p2(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function rc(e,t){return t&&(e.revision+=1),t}function CL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,l=[],c=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const m=c.get(f.parentId);m?m.push(p):c.set(f.parentId,[p])}a(f)&&l.push({id:p,endedAt:f.endedAt})}if(l.length===0)return!1;l.sort((p,f)=>p.endedAt-f.endedAt);let d=0;const h=p=>{const f=e.agents.get(p);f&&(p2(e,f),e.agents.delete(p),d++)};for(const p of l){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(c.get(p.id)??[]).map(m=>e.agents.get(m)).filter(m=>m!=null);if(!f.some(m=>!a(m))){for(const m of f)h(m.id);h(p.id)}}return rc(e,d>0)}function TL(e,t,n,s){const a=new Map;for(const[p,f]of e.agents){let m=a.get(f.sessionId);m||(m={ids:[],endedAt:0,live:!1,closed:!1},a.set(f.sessionId,m)),m.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(m.closed=!0),f.state==="done"&&f.endedAt!=null?m.endedAt=Math.max(m.endedAt,f.endedAt):m.live=!0}const l=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let h=!1;for(const p of l){if(d<=0)break;for(const f of p.ids){const m=e.agents.get(f);m&&p2(e,m),e.agents.delete(f)}d--,h=!0}return rc(e,h)}function AL(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&&e.toolIndex.has(a)}function RL(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 rc(e,t)}function ML(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const l=e.agents.get(a.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const d of a.tools){const h=Math.max(d.startedAt,c??d.startedAt);d.endedAt==null&&t-h>n&&(d.endedAt=h,d.ok=!1,d.errorPreview=d.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(d.id),e.toolOwner.delete(d.id),s=!0)}}return rc(e,s)}const Bk=90*6e4;function IL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const l=a.lastEventAt??a.startedAt;if(!(t-l<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,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=l,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return rc(e,s)}function $L(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const OL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function PL(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 LL=3e4;function DL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>LL)&&!(e.startedAt>t))return{name:e.name,preview:gL(e.input)??""}}function qL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const l=PL(e,t),c={kind:n,message:s,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const d=DL(l,a);return d&&(c.tool=d),c}function FL(e,t,n){if(e.kind==="idle")return!0;const s=Ol(t);return s==null?!0:e.subagentId!=null&&nc(n,s)===e.subagentId}function zk(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,l=s.hook_event_name??"Unknown";if(l==="__clear")return{...Rv(),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(!OL.has(l)){const f=e.agents.get(c);f!=null&&f.waiting&&FL(f.waiting,s,c)&&(f.waiting=null)}const d=e.agents.get(c);if(d&&a>(d.lastEventAt??0)&&(d.lastEventAt=a,d.reaped&&(d.reaped=!1,d.state="active",d.endedAt=void 0,d.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(c);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(c);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(c);f&&(f.context={...f.context??Dk(),currentContextTokens:s.context_tokens})}if(l==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(c);y&&(y.model=f)}const m=s.subagentModels;if(m&&typeof m=="object")for(const[y,v]of Object.entries(m)){if(typeof v!="string")continue;const N=`${c}::${y}`,_=e.agents.get(N);_&&(_.model=v)}return e}if(l==="ContextObserved"){const f=s.context??null;if(f){const m=e.agents.get(c);if(m){const y=m.context??Dk(),v=(_,S)=>typeof f[_]=="number"?f[_]:S,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;m.context={msgsUser:v("msgsUser",y.msgsUser),msgsAssistant:v("msgsAssistant",y.msgsAssistant),toolUses:v("toolUses",y.toolUses),toolResults:v("toolResults",y.toolResults),systemReminders:v("systemReminders",y.systemReminders),currentContextTokens:v("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(l==="SessionNamed"){const f=e.agents.get(c);if(f){const m=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";m&&(f.sessionName=m),y&&(f.sessionTitle=y);const v=f.sessionName??"";f.sessionTitle&&v&&f.sessionTitle.toLowerCase()===v.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(l==="OutputObserved"){const f=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(!f)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,f!=="tool_use"){const v=(y.outputs??[]).filter(N=>m-N<BL);v.push(m),y.outputs=v.length>Uk?v.slice(-Uk):v}return e.revision+=1,e}if(l==="UsageObserved"){const f=s.usage??null;if(f){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(f.input_tokens??0),m.usage.outputTokens=Number(f.output_tokens??0),m.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=mx(f);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),m.usageByModel=wL(s.usageByModel)}}return e}const h=xL(e,s,a);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=h2(s);switch(p&&(h.model=p),l){case"SessionStart":{const f=ni(e,c,a,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||a,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Zs(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Zs(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 f=ni(e,c,a,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const m=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";m&&!EL(f,a,m)&&(f.prompts.push({at:a,text:m}),f.firstPrompt||(f.firstPrompt=Au(m,120)));break}case"PreToolUse":{const f=s.tool_use_id?jL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Au(s.tool_input));break}const m=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Ol(s),v={id:m,name:s.tool_name??"?",input:s.tool_input,inputPreview:Au(s.tool_input),agentId:h.id,explicitSubagentId:y?nc(c,y):void 0,startedAt:a};h.tools.push(v),h.toolCount+=1,h.state="active",e.toolIndex.set(m,v),e.toolOwner.set(m,h.id),SL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let m=e.toolIndex.get(f),y=!1;if(!m)for(const N of e.agents.values()){const _=N.tools.find(S=>S.id===f);if(_){m=_,y=!0;break}}if(!m||m.outcomeApplied)break;m.outcomeApplied=!0,m.outcomeGap=void 0,m.endedAt=a,m.ok=l==="PostToolUse",m.trimmed||(m.response=s.tool_response),l==="PostToolUseFailure"?m.errorPreview=Au(s.tool_response):y&&(m.errorPreview=void 0);const v=d2(s.tool_response);v&&(m.usage=v),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Ol(s);if(!f)break;const m=bL(e,c,f,s,a);m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0;const y=ld(s);y&&(m.label=y),kL(e,c,f);break}case"SubagentStop":{const f=Ol(s);if(!f)break;const m=f2(e,c,f,s);if(!m)break;m.state="done",m.endedAt=a,_L(e,c,f);break}case"Stop":case"SessionEnd":{const f=ni(e,c,a,!1);f.state="done",f.endedAt=a;for(const m of f.provider==="codex"?[]:f.tools)m.endedAt==null&&(m.endedAt=a,m.ok=!1,m.errorPreview=m.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(m.id),e.toolOwner.delete(m.id));l==="SessionEnd"&&(f.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const f=$L(s.notification_type);if(!f)break;const m=ni(e,c,a,!1),y=typeof s.message=="string"?s.message:"",v=m.waiting;m.waiting=v&&v.kind===f&&v.message===y?{...v,since:Math.min(v.since,a)}:qL(e,c,f,y,a);break}}return e}const BL=6e4,Uk=64;function gx(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 zL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},UL=[{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:zL},{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[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{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/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/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 WL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function vi(e,t=Date.now()){if(!e)return null;const n=tc(e);for(const s of UL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function m2(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),l=s+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function g2(e,t,n=Date.now()){if(!WL(t))return e.inputTokens;const s=vi(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 yx(e,t,n=Date.now()){const s=vi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=g2(e,t,n)*s.input/1e6,l=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,d=m2(e,s),h=d.usd5m+d.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:h,total:a+l+c+h}}const Wk=2e5,HL=1e6,GL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],VL=[{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 YL(e){if(!e)return Wk;const t=tc(e);for(const n of GL)if(n.test(t))return HL;for(const n of VL)if(n.match.test(t))return n.window;return Wk}function y2(e,t){return typeof e=="number"&&e>0?e:YL(t)}const ei="not priced";function rt(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 wx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${rt(s)}/min`:`${rt(n*3600)}/hr`}function KL(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 XL(e,t){let n=0,s=0,a=0,l=0,c=0,d=0;for(const m of t)n+=m.inputTokens,s+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,d+=m.cacheCreate5mTokens??0;const h=(m,y)=>Math.max(0,m-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,a),cacheCreateTokens:h(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function sc(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(l=>({model:l,usage:t[l]})),a=XL(e.usage,s.map(l=>l.usage));if(a){const l=s.findIndex(c=>c.model===e.model);l>=0?s[l]={model:s[l].model,usage:KL(s[l].usage,a)}:s.push({model:e.model,usage:a})}return s}function An(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of sc(e)){const a=yx(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 cd(e,t=Date.now()){let n=0;for(const s of sc(e))vi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function w2(e){const t=[];for(const n of sc(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 v2(e){return w2(e).filter(t=>t!==e.model)}const QL=new Set(["untrusted","on-request","on-failure"]);function ZL(e){return typeof e!="string"||!e?null:QL.has(e)?!0:e==="never"?!1:null}function JL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=ZL(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 Hk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function ws(e){const t=tc(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=Hk(n[1]),l=n[2].replace(/[-_]/g,".");return`${a} ${l}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),l=s[2].split(/[-_]/).filter(Boolean).map(Hk);return[`GPT-${a}`,...l].join(" ")}return e}function jd(e){const t=tc(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function xi(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Gk(e){const t=[];for(const n of e)n.kind==="root"&&xi(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 e4(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Ed(e,t){return`${e}@${t.since}`}function x2(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 t4(e){const t=e.message||"Needs your permission",n=x2(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function n4(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const l of e){if(!xi(l.waiting))continue;const c=Ed(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:t4(l.waiting),sessionId:l.id})}return a}function r4(e,t,n){const s=new Set;for(const l of e)s.add(Ed(l.id,l.waiting));const a=new Set;for(const l of n)s.has(l)&&a.add(l);for(const l of t)a.add(l.key);return a}function Vk(e){return new Set(e.map(t=>Ed(t.id,t.waiting)))}function s4(e,t){return e!==t}function Rt(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 ud(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 l=Math.floor(a/60),c=a%60;return`${l}m ${String(c).padStart(2,"0")}s`}function b2(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 k2(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 a4=1;function o4(){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 l={dismiss:s,layer:a,seq:t++};return e.push(l),()=>{const c=e.indexOf(l);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 dd=o4();function i4(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Yk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function l4(e,t){return!e||!e.isConnected||Yk(e)?!1:t==null||Yk(t)}const Kk="a[href], button, input, select, textarea, [tabindex]";function c4(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function u4(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function d4({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 vx(e){return e.ctrlKey||e.metaKey||e.altKey}const h4=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),f4=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),p4=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function xx(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function m4(e){return xx(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function bx(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=xx(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!h4.has(String(e.type??"text").toLowerCase())}function g4(e,t){if(!e)return!1;if(bx(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&m4(e))return!1;if(f4.has(xx(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(s=>p4.has(s))}function y4({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function _2(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(Kk))return c4({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&u4({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(Kk)!=null})}):[]}function w4(e,t){const n=_2(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 Ut(e,t={}){const{focusRef:n,layer:s}=t,a=x.useRef(null),l=x.useRef(e);l.current=e;const c=x.useRef(null);c.current===null&&(c.current=()=>l.current());const d=c.current;return x.useEffect(()=>dd.push(d,s),[d,s]),x.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??_2(a.current)[0])==null||p.focus(),()=>{l4(h,document.activeElement)&&h.focus()}},[]),x.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||vx(p))return;const f=a.current;if(!f)return;const m=document.activeElement;if(!(m!=null&&f.contains(m))&&!dd.isTop(d))return;const v=w4(f,m),N=d4({count:v.length,index:m?v.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=v[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[d]),a}function v4(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 zn(e){return e.toLocaleString()}function x4(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const b4=60;function k4(e,t=b4){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 _4({agent:e,onClose:t}){var y;const n=x.useRef(null),s=Ut(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,d=y2(e.contextWindow,e.model),h=Math.min(100,c/d*100),p=An(e),f=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=v4(e.provider);return i.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:s,className:"ctx-modal",onClick:v=>v.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[i.jsxs("header",{className:"ctx-modal-head",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),i.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),i.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("section",{className:"ctx-window-row",children:[i.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:i.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),i.jsxs("div",{className:"ctx-window-meta",children:[i.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),i.jsxs("span",{children:[zn(c)," / ",zn(d)," tok (",m.windowScope,")"]})]})]}),i.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),i.jsxs("div",{className:"ctx-grid",children:[i.jsx(cr,{label:"input tokens",val:zn(l.inputTokens)}),i.jsx(cr,{label:"output tokens",val:zn(l.outputTokens)}),i.jsx(cr,{label:"cache reads",val:zn(l.cacheReadTokens)}),i.jsx(cr,{label:"cache writes",val:zn(l.cacheCreateTokens)}),i.jsx(cr,{label:"cumulative total",val:zn(f)}),i.jsx(cr,{label:"estimated cost",val:rt(p.total),accent:!0})]}),i.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?i.jsxs("div",{className:"ctx-grid",children:[i.jsx(cr,{label:"user messages",val:zn((a==null?void 0:a.msgsUser)??0)}),i.jsx(cr,{label:"assistant messages",val:zn((a==null?void 0:a.msgsAssistant)??0)}),i.jsx(cr,{label:"tool uses",val:zn((a==null?void 0:a.toolUses)??0)}),i.jsx(cr,{label:"tool results",val:zn((a==null?void 0:a.toolResults)??0)}),i.jsx(cr,{label:"system-reminders",val:zn((a==null?void 0:a.systemReminders)??0)})]}):i.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),i.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?i.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):i.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(v=>i.jsxs("li",{children:[i.jsx("span",{className:"ctx-md-path",title:v.path,children:k4(v.path)}),i.jsx("span",{className:"ctx-md-size",children:x4(v.bytes)})]},v.path))})]})})}function cr({label:e,val:t,accent:n}){return i.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[i.jsx("span",{className:"ctx-row-label",children:e}),i.jsx("span",{className:"ctx-row-val",children:t})]})}function N4({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const l=y2(n,t),c=Math.min(1,e/l),d=s/2-3,h=s/2,p=2*Math.PI*d,f=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return i.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:i.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[i.jsx("circle",{cx:h,cy:h,r:d,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),i.jsx("circle",{cx:h,cy:h,r:d,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),i.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function Xk(e,t){const n=vi(t);if(!n)return`model: ${t}
|
|
61
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),a=f=>`$${f}/MTok`,l=yx(e,t),c=m2(e,n),d=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${rt(c.usd5m)}`,`cache w1h${s(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${rt(c.usd1h)}`]:[`cache w ${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${rt(c.usd5m)}`],h=g2(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${a(n.input).padEnd(11)} = ${rt(l.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${rt(l.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${rt(l.cacheRead)}`,...d,"─────────────────────────────────────────",`total = ${rt(l.total)}`].join(`
|
|
62
|
+
`)}function Qk(e){const t=sc(e);return t.length<=1?Xk(e.usage,e.model):[...t.map(n=>Xk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${rt(An(e).total)}`].join(`
|
|
63
|
+
`)}function S4({data:e,selected:t}){var v,N;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(_=>!_.endedAt).length,l=e.tools.filter(_=>_.ok===!1).length,c=gx(e.sessionId),d=((v=e.context)==null?void 0:v.currentContextTokens)??0,h=e.kind==="root"&&d>0,p=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,f=v2(e),m=f.length>0?`${e.model}
|
|
65
|
+
spend on this card also covers:
|
|
66
|
+
${f.join(`
|
|
67
|
+
`)}`:e.model,y=k2(e.sessionName,e.sessionTitle);return i.jsxs("div",{className:s,style:{"--session-hue":c},children:[i.jsx("span",{className:"accent-stripe"}),i.jsx(fi,{type:"target",position:ze.Left,style:{background:"transparent",border:"none"}}),i.jsxs("div",{className:"head",children:[i.jsxs("div",{className:"title",children:[i.jsx(j4,{state:e.state}),i.jsx("span",{className:"label",title:p,children:e.label}),e.synthetic&&i.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),i.jsxs("div",{className:"head-right",children:[h&&e.onOpenContext&&i.jsx(N4,{currentContextTokens:d,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),i.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?"≥ ":"",ud(e.startedAt,e.endedAt,n)]})]})]}),i.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&i.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?i.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:m,children:[ws(e.model),f.length>0?` +${f.length}`:""]}):e.provider==="codex"?i.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&y.face&&i.jsx("div",{className:"session-name",title:y.tooltip,children:y.face}),e.waiting&&i.jsx(A4,{waiting:e.waiting,now:n}),(()=>{const _=JL(e);return _?i.jsxs("div",{className:"approval-blind-row",title:_.detail,children:[i.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),i.jsx("span",{className:"approval-blind-said",children:_.label})]}):null})(),(e.tools.length>0||(((N=e.outputs)==null?void 0:N.length)??0)>0)&&i.jsx(R4,{tools:e.tools,outputs:e.outputs,now:n}),i.jsxs("div",{className:"meta",children:[i.jsxs("span",{children:[i.jsx("b",{children:e.toolCount})," tools"]}),l>0&&i.jsxs("span",{className:"failed-meta",title:`${l} tool ${l===1?"call":"calls"} returned an error`,children:[i.jsx("b",{children:l})," err"]}),a>0&&i.jsxs("span",{className:"inflight-meta",children:[i.jsx("b",{children:a})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&i.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:[i.jsx("b",{children:Rt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const _=vi(e.model),S=An(e),k=cd(e);if(!_&&S.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:i.jsx("span",{className:"cost-unpriced",title:Qk(e),children:ei});if(S.total<=0)return null;const j=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),E=e.state==="active"&&!e.synthetic?wx(S.total,j):null,C=Qk(e)+(E?`
|
|
68
|
+
burn: ${E}`:"");return i.jsx("span",{className:"cost-meta",title:C,children:i.jsxs("b",{children:[rt(S.total),k>0?"+":""]})})})()]}),i.jsx(fi,{type:"source",position:ze.Right,style:{background:"transparent",border:"none"}})]})}function Hl(e){return e==="active"?"live":e==="done"?"done":"err"}function j4({state:e}){return i.jsx("span",{className:`state-pill state-${e}`,children:Hl(e)})}function pi(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function E4(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,s=An(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",Hl(e.state),xi(e.waiting)?pi(e.waiting):null,e.model?ws(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,s>0?`${rt(s)}${cd(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function C4(e,t){const n=x2(e,t);return n?`Likely on: ${n}`:null}function T4(e){return e.kind==="idle"?"Your turn":pi(e)}function A4({waiting:e,now:t}){const n=xi(e),s=pi(e);return i.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${ud(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?i.jsx("span",{className:"ap-pulse","aria-hidden":!0}):i.jsx("span",{className:"waiting-dot","aria-hidden":!0}),i.jsx("span",{className:"waiting-said",children:T4(e)}),i.jsx("b",{children:ud(e.since,void 0,t)})]})}function R4({tools:e,outputs:t,now:n}){const c=new Array(24).fill(0);let d=0;const h=E=>{const C=n-E;if(C<0||C>=6e4)return;const T=23-Math.floor(C/2500);T>=0&&T<24&&(c[T]+=1,d+=1)};for(const E of e)h(E.startedAt);for(const E of t??[])h(E);const p=2,f=Math.max(0,...c),m=132,y=14,v=m/24,N=f/(2500/1e3),_=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<6e4).length,S=d-_,k=[_>0?`${_} tool ${_===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),j=d===0?"nothing in the last 60s":`${k.join(" · ")} in last 60s · peak ${N.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:j,children:[i.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===23&&E>0,D=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return i.jsx("rect",{x:C*v+.4,y:y-T,width:Math.max(.5,v-1),height:T,rx:.8,className:D},R?`landed:${E}`:C)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function M4(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Ff(e){return e!=="gone"}function Bf(e,t){const[n,s]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{s(l=>M4(e,l))},[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}function Zk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function I4({tool:e,onClose:t}){const n=Ut(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),i.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),i.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",children:b2(e,"in-flight…")}),i.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("section",{className:"modal-body",children:[e.trimmed&&i.jsx("div",{className:"modal-section",children:i.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h4",{children:"Input"}),i.jsx("pre",{children:Zk(e.input??e.inputPreview)})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h4",{children:["Response ",s==="err"&&i.jsx("span",{className:"err-tag",children:"error"})]}),i.jsx("pre",{children:e.endedAt==null?"(waiting…)":Zk(e.response??e.errorPreview)})]})]})]})})}const Ru=18,Jk=26,$4=12;function O4(e){return P4(e.nodeInternals.values())}function P4(e){const t=new Map;for(const a of e){if(a.type!=="agent")continue;const l=a.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,d=a.position.y,h=c+a.width,p=d+a.height,f=t.get(l.sessionId);f?(f.minX=Math.min(f.minX,c),f.minY=Math.min(f.minY,d),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),l.kind==="root"&&(f.label=n1(l)??f.label),l.kind==="root"&&(f.name=r1(l))):t.set(l.sessionId,{minX:c,minY:d,maxX:h,maxY:p,label:n1(l)??l.sessionId,name:r1(l)})}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,l]of t){const c=(n.get(l.label)??0)>1;s.push({sessionId:a,...q4(l.label,l.name,a,c),x:l.minX-Ru,y:l.minY-Ru-Jk,w:l.maxX-l.minX+Ru*2,h:l.maxY-l.minY+Ru*2+Jk})}return s}const Mv=" · ",L4=32,D4=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function e1(e){return D4.test(e)?2:1}function t1(e,t=L4){const n=[...e];let s=0;for(const c of n)s+=e1(c);if(s<=t)return e;const a=[];let l=0;for(const c of n){const d=e1(c);if(l+d>t-1)break;a.push(c),l+=d}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function q4(e,t,n,s){const a=(t==null?void 0:t.trim())??"",l=s?F4(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:t1(e),name:a?t1(a):void 0,shortId:l,fullLabel:c.join(Mv)}}function F4(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function n1(e){if(e.kind==="root")return e.label}function r1(e){if(e.kind==="root")return k2(e.sessionName,e.sessionTitle).face}function B4({onFit:e}){const{x:t,y:n,zoom:s}=a2(),a=ec(),l=ut(O4,z4);if(l.length<=1)return null;const c=h=>{try{const p=a.getNodes().filter(f=>{const m=f.data;return(m==null?void 0:m.sessionId)===h});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},d={transform:`translate(${t}px, ${n}px) scale(${s})`};return i.jsx("div",{className:"session-clusters",style:d,children:l.map(h=>{const p=gx(h.sessionId),f={position:"absolute",left:h.x,top:h.y,width:h.w,height:h.h,"--session-hue":p},m={position:"absolute",left:h.x+16,top:h.y-$4,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return i.jsxs(pe.Fragment,{children:[i.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),i.jsxs("button",{type:"button",className:"cluster-label",style:m,title:`Fit view to ${h.fullLabel}
|
|
70
|
+
drag the wrapper to move the whole session`,onClick:()=>c(h.sessionId),children:[h.label,h.name?i.jsxs(i.Fragment,{children:[Mv,i.jsx("span",{className:"cluster-label-name",children:h.name})]}):null,h.shortId?i.jsx("span",{className:"cluster-label-id",children:Mv+h.shortId}):null]})]},h.sessionId)})})}function z4(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 U4({data:e}){return i.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const ac={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"}},W4=Object.fromEntries(Object.entries(ac).map(([e,t])=>[e,t.category])),H4=Object.fromEntries(Object.entries(ac).map(([e,t])=>[e,t.emoji])),G4=Object.fromEntries(Object.entries(ac).map(([e,t])=>[e,t.label])),V4=new Set(Object.keys(ac)),Y4=new Set(Object.entries(ac).filter(([,e])=>e.shell).map(([e])=>e)),s1={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",...W4};function N2(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(s1,e)?s1[e]:"other"}const K4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,X4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function Q4(e){if(typeof e!="string"||!e)return null;const t=K4.exec(e);if(t){const s=Z4(t[2]);if(s.trim())return s}const n=X4.exec(e);return n?n[1]:null}function Z4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const S2=600,J4=4,e5=36,Iv=16,t5=60,n5=6,a1=220,o1=96,r5=28,i1={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:"📡",...H4};function l1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(i1,e)?i1[e]:"✨"}const c1={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 j2(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 j2(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[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 s5(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=Q4(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 a5=new Set(["Bash","PowerShell",...Y4]),o5=V4;function i5(e,t){return o5.has(e)||e.startsWith("mcp__")?Math.max(o1,34+t.length*7.5):o1}function l5(e,t){if(!a5.has(e))return null;const n=s5(t);if(!n)return null;const s=j2(n);return s?{emoji:Object.hasOwn(c1,s)?c1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const c5=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),u1={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:"🗄️"},d1={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 u5(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function d5(e){const t=e.toLowerCase();if(Object.hasOwn(d1,t))return d1[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(u1,s))return u1[s]}return"📄"}function h5(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 f5(e,t){if(!c5.has(e))return null;const n=h5(e,t);if(!n)return null;const s=u5(n);return s?{emoji:e==="LS"?"📂":d5(s),label:s,category:"file",detail:n}:null}const h1={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 kx(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 p5(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 E2(e){const t=e.toLowerCase();return Object.hasOwn(h1,t)?h1[t]:void 0}function m5(e,t){const n=kx(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const l=E2(s);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${s} · ${a}`}}function g5(e,t){return l5(e,t)??f5(e,t)??m5(e)}const f1=G4,p1=18;function y5(e){const t=[...e];return t.length<=p1?e:t.slice(0,p1-1).join("")+"…"}function C2(e){const t=kx(e);if(t){const s=E2(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:y5(t.server),hue:p5(t.server)}}const n=Object.hasOwn(f1,e)?f1[e]:"";return n?{emoji:l1(e),label:n}:{emoji:l1(e),label:e}}function w5(e){let t=null,n="";for(const s of e){const a=kx(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:C2(n)}function v5(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function x5(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/S2)}function b5(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];s.has(l.id)||(s.add(l.id),n.push(l))}return n.reverse()}function k5(e,t,n,s,a,l){const c=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&l-d.exitAt>S2)continue;const h=s.get(d.id)??n.get(d.id);if(!h)continue;const p=b5(d.tools,J4);if(p.length===0)continue;const f=d.exitAt??null,m=a.get(d.id),y=Math.max((m==null?void 0:m.width)??a1,a1),v=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,k=_+v/2;p.forEach((j,E)=>{const C=E*e5,T=N+y+t5,R=_+n5+C,A=x5(l,f),D=j.inputPreview??"",O=v5(j),I=A<.999,q=C2(j.name);c.push({id:`${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:q.label,emoji:q.emoji,status:O,category:N2(j.name),mcpHue:q.hue,inputPreview:D,fade:A,fading:I,worldX:T,worldY:R,anchorX:S,anchorY:k,spawnDx:S-T,spawnDy:k-(R+Iv)});const J=g5(j.name,j.input);if(J){const Z=i5(j.name,q.label),$=T+Z+r5,K=R,G=T+Z,z=R+Iv;c.push({id:`sub:${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:J.label,emoji:J.emoji,isSub:!0,status:O,category:J.category,inputPreview:J.detail??D,fade:A,fading:I,worldX:$,worldY:K,anchorX:G,anchorY:z,spawnDx:G-$,spawnDy:0})}})}return c}function _5({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:l,hiddenCategories:c,now:d,onOpenTool:h}){const p=k5(e,t,n,s,a,d),f=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return i.jsx(N5,{bursts:f,spotlight:l,onOpenTool:h})}function N5({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:l}=a2();return i.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[i.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const d=c.anchorX*l+s,h=c.anchorY*l+a,p=(c.worldX+6)*l+s,f=(c.worldY+Iv)*l+a,m=Math.max(1,p-d),y=Math.min(1,Math.abs(f-h)/m),v=d+m*(.55-.22*y),N=t!=null&&!t.has(c.agentId),_=c.fade*(N?.14:1);return i.jsx("path",{d:`M ${d} ${h} Q ${v} ${h}, ${p} ${f}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const d=c.worldX*l+s,h=c.worldY*l+a,p={left:`${d}px`,top:`${h}px`,transform:`scale(${l})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},f=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,m=c.inputPreview?`${f} · ${c.inputPreview}`:f,y=n!=null,v=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=t!=null&&!t.has(c.agentId)?" dim":"";return i.jsx("div",{className:"tool-burst-wrap",style:p,children:i.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${y?" clickable":""}${c.isSub?" sub":""}${_}`,style:v,title:m,onClick:y?()=>n(c.toolId):void 0,children:[i.jsx("span",{className:"tb-emoji",children:c.emoji}),i.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&i.jsx("span",{className:"tb-spin"}),c.status==="done"&&i.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&i.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function S5(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,l=0;for(const c of e){const d=An(c);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:l,sum:n+s}}const j5="spend on this board",E5="on this board",m1=`Everything on the board right now, and only that.
|
|
72
|
+
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.
|
|
73
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,T2="session spend";function _x({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(l,c,d)=>{if(l<=0)return null;const h=l/n*100;return i.jsx("span",{className:`cb-seg ${c}`,style:{width:`${h}%`},title:`${d}: ${rt(l)} (${h.toFixed(0)}%)`},c)},a=t==="lg";return i.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 C5({state:e,sessionId:t,onClose:n}){const s=x.useMemo(()=>T5(e,t),[e,t]),a=x.useRef(null),l=Ut(n,{focusRef:a});return s?i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),i.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),i.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),i.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body",children:[i.jsxs("section",{className:"ss-hero",children:[i.jsxs("div",{className:"ss-hero-left",children:[i.jsx("div",{className:"ss-cost-label",children:T2}),i.jsx("div",{className:"ss-cost",children:rt(s.cost.total)}),s.modelChips.length>0&&i.jsx("div",{className:"ss-models",children:s.modelChips.map(c=>i.jsx("span",{className:"model-chip","data-family":jd(c),title:c,children:ws(c)},c))})]}),i.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&i.jsxs(i.Fragment,{children:[i.jsx(_x,{cost:s.cost,size:"lg"}),i.jsxs("div",{className:"ss-cost-legend",children:[i.jsxs("span",{className:"ssl ssl-in",children:["input ",i.jsx("b",{children:rt(s.cost.input)})]}),i.jsxs("span",{className:"ssl ssl-out",children:["output ",i.jsx("b",{children:rt(s.cost.output)})]}),i.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",i.jsx("b",{children:rt(s.cost.cacheRead)})]}),i.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",i.jsx("b",{children:rt(s.cost.cacheWrite)})]})]})]})})]}),i.jsxs("section",{className:"ss-stats",children:[i.jsx(Xo,{label:"agents",value:s.agentCount}),i.jsx(Xo,{label:"subagents",value:s.subagentCount}),i.jsx(Xo,{label:"tool calls",value:s.toolCount}),i.jsx(Xo,{label:"prompts",value:s.promptCount}),i.jsx(Xo,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&i.jsx(Xo,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Most-used tools"}),i.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([c,d])=>i.jsxs("div",{className:"ss-tt",children:[i.jsx("span",{className:"ss-tt-name",children:c}),i.jsx("span",{className:"ss-tt-bar",children:i.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${d/s.topTools[0][1]*100}%`}})}),i.jsx("span",{className:"ss-tt-count",children:d})]},c))})]}),s.firstPrompt&&i.jsxs("section",{className:"modal-section",children:[i.jsx("h4",{children:"Opening prompt"}),i.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function Xo({label:e,value:t,tone:n}){return i.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[i.jsx("div",{className:"ss-stat-value",children:t}),i.jsx("div",{className:"ss-stat-label",children:e})]})}function T5(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},l=new Set,c=new Map;let d=0,h=0,p=0,f=0,m=0,y,v=1/0,N=0;for(const E of s){const C=An(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const T of w2(E))l.add(T);E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,d+=E.toolCount,v=Math.min(v,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const T of E.tools)c.set(T.name,(c.get(T.name)??0)+1),T.ok===!1&&f++}const _=Math.max(0,N-v),S=Math.floor(_/1e3),k=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:k,cost:a,modelChips:Array.from(l),agentCount:s.length,subagentCount:m,toolCount:d,promptCount:h,tokensSum:p,errCount:f,topTools:j,firstPrompt:y}}function g1(e){return e.waiting?xi(e.waiting)?0:1:e.state==="active"?2:3}function A5(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,l=An(s).total,c=s.endedAt??s.startedAt;for(const d of e.agents.values()){if(d.sessionId!==s.sessionId||d.kind==="root")continue;a+=d.toolCount,l+=An(d).total;const h=d.endedAt??d.startedAt;h>c&&(c=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:a,cost:l,startedAt:s.startedAt,lastActivity:c})}return n.sort((s,a)=>{const l=g1(s),c=g1(a);return l!==c?l-c:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function y1(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 l=Math.floor(a/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function R5({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const l=x.useMemo(()=>A5(e),[e,e.revision,t]),c=l.filter(h=>h.state==="active").length,d=l.filter(h=>xi(h.waiting)).length;return i.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[i.jsxs("div",{className:"sl-header",children:[i.jsxs("h2",{children:["Sessions ",i.jsx("span",{className:"sl-count",children:l.length})]}),d>0&&i.jsxs("span",{className:"sl-waiting-count",children:[d," waiting"]}),c>0&&i.jsxs("span",{className:"sl-live-count",children:[c," live"]}),i.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),i.jsxs("div",{className:"sl-rows",children:[l.length===0&&i.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=n.has(h.sessionId);return i.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[i.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:Hl(h.state)}),i.jsxs("div",{className:"sl-row-body",children:[i.jsxs("div",{className:"sl-row-head",children:[i.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&i.jsx("span",{className:"model-chip","data-family":jd(h.modelId),title:h.modelId,children:ws(h.modelId)})]}),i.jsxs("div",{className:"sl-row-meta",children:[i.jsxs("span",{title:"tool calls",children:[i.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&i.jsx("span",{className:"sl-cost",title:T2,children:i.jsx("b",{children:rt(h.cost)})}),h.waiting?i.jsxs("span",{className:"sl-waiting",title:[pi(h.waiting),C4(h.waiting,pi(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",y1(h.waiting.since,void 0,t),h.waiting.tool&&i.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):i.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:y1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const M5=e=>1-Math.pow(1-e,5),A2=420;function I5(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 $5(e,t,n,s=A2){return n>=s?t:n<=0?e:e+(t-e)*M5(n/s)}function O5(e,t,n,s={}){const a=s.now??(()=>performance.now()),l=s.raf??(v=>requestAnimationFrame(v)),c=s.cancel??(v=>cancelAnimationFrame(v)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||h()||!I5(e,t))return n(t),()=>{};const p=a();let f=0,m=!0;const y=()=>{if(!m)return;const v=a()-p;n($5(e,t,v)),v<A2&&(f=l(y))};return f=l(y),()=>{m=!1,f&&c(f)}}const $v={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function w1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=An(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 P5(e,t){if(!e)return $v;const n={...$v};for(const[s,a]of t){const l=e.get(s);if(!l)continue;const c={cost:a.cost-l.cost,inputTokens:a.inputTokens-l.inputTokens,outputTokens:a.outputTokens-l.outputTokens,cacheReadTokens:a.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-l.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}const R2=10*6e4,L5=6e4,D5=5e3,q5=20;function F5(e,t,n){const s=e[e.length-1];if(s&&(n<s.cost||n-s.cost>q5))return[{t,cost:n}];const a=e.filter(l=>t-l.t<=R2);return(!s||t-s.t>=D5)&&a.push({t,cost:n}),a}function B5(e,t,n){const s=e[0];if(!s)return null;const a=t-s.t;if(a<L5)return null;const l=n-s.cost;return l>0?{spent:l,spanSec:a/1e3,spanMin:Math.min(R2/6e4,Math.ceil(a/6e4))}:null}function Ov(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Cd=[{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 z5(e,t,n=Cd.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 U5(e,t=new Date){return e==="today"?Ov(1,t):e==="month"?Ov(t.getDate(),t):"20200101"}const Cn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Yu=e=>typeof e=="string"?e:"";function M2(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 l of a){const c=Yu(l==null?void 0:l.modelName);if(!c)continue;let d=n.get(c);d||(d={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,d)),d.cost+=Cn(l==null?void 0:l.cost),d.inputTokens+=Cn(l==null?void 0:l.inputTokens),d.outputTokens+=Cn(l==null?void 0:l.outputTokens),d.cacheReadTokens+=Cn(l==null?void 0:l.cacheReadTokens),d.cacheCreateTokens+=Cn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}const W5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function H5(e){var t;return((t=W5.exec(e))==null?void 0:t[0])??e}function G5(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const l=Yu(a==null?void 0:a.period);if(!l)continue;const c=H5(l),d=a==null?void 0:a.metadata,h=typeof(d==null?void 0:d.lastActivity)=="string"?Date.parse(d.lastActivity):NaN;s.push({sessionId:c,label:t.get(c)??null,agent:Yu(a==null?void 0:a.agent)||"claude",cost:Cn(a==null?void 0:a.totalCost),tokens:Cn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Yu).filter(Boolean):[],lastActivityMs:Number.isFinite(h)?h:null})}return s.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function I2(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=Cn(t.cacheReadTokens),p=Cn(t.cacheCreationTokens),f=Cn(t.inputTokens),m=Cn(t.outputTokens);return{cost:Cn(t.totalCost),inputTokens:f,outputTokens:m,cacheReadTokens:h,cacheCreateTokens:p,tokens:Cn(t.totalTokens)||f+m+h+p}}const n=M2(e),s=h=>n.reduce((p,f)=>p+h(f),0),a=s(h=>h.inputTokens),l=s(h=>h.outputTokens),c=s(h=>h.cacheReadTokens),d=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:d,tokens:a+l+c+d}}function V5(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 v1(e,t){var n;return((n=Cd.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Y5(e,t,n){const s=e!=null,a=I2(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 K5="1",x1="agent-dag.schema",X5=["agent-dag.layout","agent-dag.viewport"];function bi(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Q5(e,t=K5){let n=null;try{n=e.getItem(x1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of X5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(x1,t)}catch{}return s}const Xt="ccdeck";function $2(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 Pv(e){return $2(Math.floor(e/1e3))}function O2(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function Z5(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function J5(e,t,n){const s=new Date(e),a=Pv(t-e);return{label:Z5(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Js(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Td(e){return e==null}const Lv="self";function fr(e,t=!1){const n=Js(e?Lv:null,Lv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function pr(e){return Td(e?Lv:null)}function eD(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function tD(e){return e==null||e==="BODY"||e==="HTML"}const P2="agent-dag.usagePeriod";function nD(){const e=bi(P2);return Cd.some(t=>t.key===e)?e:"today"}function rD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(P2,e)}catch{}}const L2="agent-dag.usageSessionsOpen";function sD(){return bi(L2)==="1"}function aD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(L2,e?"1":"0")}catch{}}function b1(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 oD(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 zf="__unknown__";function iD(e,t,n,s){const a=Math.max(0,t-s),l=Math.max(0,n-a);if(l<120)return null;const c=Math.min(100,l/n*100),d=e-c;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(d>0){const h=100-e,p=l>0?e/l:0,f=p>0?h/p:1/0,m={label:`${Math.round(d)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(f<a&&f<86400){const y=Math.floor(f/3600),v=Math.floor(f%3600/60);m.runsOutIn=y>0?`${y}h ${v}m`:`${v}m`}return m}return{label:`${Math.round(-d)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function qa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:l,nowSec:c}){const d=Math.min(100,Math.max(0,e)),p=l||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",f=d===0?"< 1%":`${d}%`,m=d===0?2:d,y=s?O2(s,c):null,v=s&&a?iD(d,s,a,c):null;return i.jsxs("div",{className:"qb-row",children:[i.jsxs("div",{className:"qb-meta",children:[i.jsxs("span",{className:"qb-label",children:[t,l&&i.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),i.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),i.jsxs("div",{className:"qb-track",children:[i.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:d===0?.4:1}}),v&&i.jsx("div",{className:"qb-pace-marker",style:{left:`${v.expectedPct}%`,background:v.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(v.expectedPct)}% by now`})]}),i.jsxs("div",{className:"qb-reset-row",children:[y?i.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?i.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,v&&i.jsx("span",{className:"qb-pace",style:{color:v.color},children:v.runsOutIn?`runs out in ${v.runsOutIn}`:v.label})]})]})}const lD=6e4;function cD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!pr(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return d(!0),l.current=window.setInterval(()=>d(!1),lD),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function uD(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 D2=6e4,k1=6e4;function hD(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),d=async(p=!1)=>{if(!(p&&!pr(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 d(!0),l.current=window.setInterval(()=>d(!1),D2),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function fD(e){const[t,n]=x.useState(null),s=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,D2),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function pD(e,t,n){const[s,a]=x.useState(null),[l,c]=x.useState(!1),[d,h]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&h(_=>_+1)},v=window.setInterval(y,k1),N=()=>{m()&&Date.now()-p.current>=k1&&h(_=>_+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",N)}},[]);const f=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==f.current;f.current=t;const v=e,N=U5(v);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:v,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,d]),{...V5(s,e),loading:l}}function Sl(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 O5(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function mD({state:e,now:t,providers:n,leaving:s,onClose:a,liveSince:l=null}){var yt,ot;const{quota:c,loading:d,refresh:h}=cD(n.claude),{data:p,loading:f,refresh:m}=hD(n.codex),{data:y}=fD(n.codex),[v,N]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ye=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ye)},[]);const _=x.useRef([]),S=x.useRef(null),{byModel:k,totalCost:j,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ye=new Map;for(const re of e.agents.values())for(const Ae of sc(re)){const ae=Ae.model??zf,Ee=yx(Ae.usage,Ae.model),De=ye.get(ae);De?(De.inputTokens+=Ae.usage.inputTokens,De.outputTokens+=Ae.usage.outputTokens,De.cacheReadTokens+=Ae.usage.cacheReadTokens,De.cacheCreateTokens+=Ae.usage.cacheCreateTokens,De.cost.total+=Ee.total,De.cost.input+=Ee.input,De.cost.output+=Ee.output,De.cost.cacheRead+=Ee.cacheRead,De.cost.cacheWrite+=Ee.cacheWrite,De.agentCount++):ye.set(ae,{model:ae,inputTokens:Ae.usage.inputTokens,outputTokens:Ae.usage.outputTokens,cacheReadTokens:Ae.usage.cacheReadTokens,cacheCreateTokens:Ae.usage.cacheCreateTokens,cost:{...Ee},agentCount:1,priced:vi(Ae.model)!=null})}const je=Array.from(ye.values()).sort((re,Ae)=>Ae.cost.total-re.cost.total||Ae.inputTokens+Ae.outputTokens-(re.inputTokens+re.outputTokens)),Fe=S5(e.agents.values());S.current!==l&&(S.current=l,_.current=[]),l!=null&&(_.current=F5(_.current,t,Fe.cost.total));const Ye=l==null?null:B5(_.current,t,Fe.cost.total),ct=Ye?{label:wx(Ye.spent,Ye.spanSec),spanMin:Ye.spanMin}:null;return{byModel:je,totalCost:Fe.cost,totalTokens:Fe,burnRate:ct}},[e,e.revision,t,l]),T=x.useMemo(()=>{const ye=[];for(const je of e.agents.values()){if(je.kind!=="root")continue;let Fe=An(je).total,Ye=je.usage.inputTokens,ct=je.usage.outputTokens,re=cd(je);for(const Ae of e.agents.values())Ae.sessionId!==je.sessionId||Ae.kind==="root"||(Fe+=An(Ae).total,Ye+=Ae.usage.inputTokens,ct+=Ae.usage.outputTokens,re+=cd(Ae));ye.push({sessionId:je.sessionId,label:je.label||je.cwdBasename||"session",state:je.state,cost:Fe,inputTokens:Ye,outputTokens:ct,unpricedTokens:re})}return ye.sort((je,Fe)=>Fe.cost-je.cost||Fe.inputTokens+Fe.outputTokens-(je.inputTokens+je.outputTokens)).slice(0,12)},[e,e.revision]),[R,A]=x.useState(nD);x.useEffect(()=>{rD(R)},[R]);const[D,O]=x.useState(sD);x.useEffect(()=>{aD(D)},[D]);const I=x.useRef([]),[q,J]=x.useState(0),Z=x.useRef(()=>new Map);Z.current=()=>w1(e.agents.values(),t);const $=x.useCallback(()=>Z.current(),[]),{data:K,shown:G,stale:z,loading:X,baseline:L}=pD(R,q,$),W=K!=null,P=X&&z,V=x.useMemo(()=>{const ye=new Map;for(const je of e.agents.values()){if(je.kind!=="root"||!je.sessionId)continue;const Fe=je.label||je.cwdBasename;Fe&&ye.set(je.sessionId,Fe)}return ye},[e,e.revision]),he=x.useMemo(()=>{const ye=new Map;for(const je of e.agents.values())je.kind!=="root"||!je.sessionId||ye.set(je.sessionId,je.state);return ye},[e,e.revision]),H=x.useMemo(()=>W?M2(K):[],[K,W]),U=x.useMemo(()=>{if(!W)return[];const ye=G5(K,V).slice(0,12),je=new Map;for(const Fe of ye)Fe.label&&je.set(Fe.label,(je.get(Fe.label)??0)+1);return ye.map(Fe=>Fe.label&&(je.get(Fe.label)??0)>1?{...Fe,label:`${Fe.label} ${Fe.sessionId.slice(0,4)}`}:Fe)},[K,W,V]),ee=x.useMemo(()=>I2(K),[K]),Y=v1(G,R),se=z?" up-stale":"",me=x.useMemo(()=>W?P5(L,w1(e.agents.values(),t)):$v,[e,e.revision,L,W,t]),ge=Y5(K,{...E,cost:j},me),Re=ge.hasCost,Oe=ge.tokenSum,ce=Sl(ge.cost),we=Sl(ge.inputTokens),be=Sl(ge.outputTokens),Be=Sl(ge.cacheReadTokens),_e=Sl(ge.cacheCreateTokens),Ce=k.filter(ye=>ye.cost.total>0||ye.inputTokens+ye.outputTokens>0),Ge=T.filter(ye=>ye.cost>0||ye.inputTokens+ye.outputTokens>0),tt=W?H.some(ye=>ye.cost<=0&&ye.tokens>0):Ce.some(ye=>!ye.priced),Qe=d||f,Xe=b1(c==null?void 0:c.fetchedAt,v),Ke=b1(p==null?void 0:p.fetchedAt,v),fe=()=>{h(),m(),J(ye=>ye+1)},dt=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return i.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[i.jsxs("div",{className:"up-header",children:[i.jsx("h2",{children:"Usage"}),C&&i.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,i.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),i.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&i.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:fe,...fr(Qe),"aria-label":dt,title:dt,children:Qe?"…":"↻"}),i.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Claude quota",Xe&&!d&&i.jsx("span",{className:"up-section-age",title:oD(c==null?void 0:c.source),children:Xe})]}),c!=null&&c.ok?i.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&i.jsx(qa,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:v}),c.week7dPct!=null&&i.jsx(qa,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:v}),c.weekSonnetPct!=null&&i.jsx(qa,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:v}),c.weekOpusPct!=null&&i.jsx(qa,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:v})]}):(c==null?void 0:c.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:uD(c.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&i.jsxs("section",{className:"up-section up-quota-section",children:[i.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&i.jsx("span",{className:"up-plan-badge",children:p.planLabel}),Ke&&!f&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Ke})]}),p!=null&&p.ok?i.jsxs("div",{className:"up-quota-bars",children:[(yt=p.windows)==null?void 0:yt.map(ye=>i.jsx(qa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,limitReached:p.limitReached&&ye.pct>=100,nowSec:v},ye.id)),(ot=p.extraWindows)==null?void 0:ot.map(ye=>i.jsx(qa,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,nowSec:v},ye.id)),p.creditLimit&&i.jsx(qa,{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:v}),p.creditsBalance&&!p.creditsUnlimited&&i.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&i.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&i.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Xt} 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&&i.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&i.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?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:dD(p.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&i.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
|
|
75
|
+
last 5h: ${Rt(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[Rt(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),W&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":P||void 0,onKeyDown:ye=>{var Ye;const je=I.current.indexOf(ye.target);if(je<0)return;const Fe=z5(ye.key,je);Fe!==null&&(ye.preventDefault(),(Ye=I.current[Fe])==null||Ye.focus())},children:Cd.map((ye,je)=>i.jsx("button",{type:"button",ref:Fe=>{I.current[je]=Fe},tabIndex:R===ye.key?0:-1,"aria-pressed":R===ye.key,"data-pending":R===ye.key&&P?"":void 0,title:R===ye.key&&P?`Reading ${ye.noun} from the transcripts on this machine…`:ye.hint,className:"uh-range-btn",onClick:()=>A(ye.key),children:ye.label},ye.key))}),W&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:P?`Reading ${v1(R,R)}…`:""}),Oe>0?i.jsxs(i.Fragment,{children:[Re&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`up-total${se}`,title:W?void 0:m1,children:[i.jsx("span",{className:"up-total-value",children:rt(ce)}),i.jsx("span",{className:"up-total-label",children:W?Y:j5})]}),ge.showCostBar&&i.jsx(_x,{cost:j})]}),i.jsxs("div",{className:`up-tokens-row${se}`,title:W?void 0:m1,children:[i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"in"}),Rt(we)]}),i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"out"}),Rt(be)]}),ge.cacheReadTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache r"}),Rt(Be)]}),ge.cacheCreateTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache c"}),Rt(_e)]}),!Re&&i.jsx("span",{className:"up-tok up-scope",children:E5})]}),(W?H.length:Ce.length)>0&&i.jsxs("section",{className:`up-section${se}`,children:[i.jsx("h3",{className:"up-section-title",children:"By model"}),i.jsxs("table",{className:"up-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Model"}),i.jsx("th",{children:"Tokens"}),i.jsx("th",{children:"Cost"})]})}),i.jsx("tbody",{children:W?H.map(ye=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ye.model,children:ws(ye.model)}),i.jsx("td",{className:"up-num",children:Rt(ye.tokens)}),ye.cost>0?i.jsx("td",{className:"up-num up-cost-val",children:rt(ye.cost)}):i.jsx("td",{className:"up-num up-unpriced",children:ei})]},ye.model)):Ce.map(ye=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ye.model===zf?"no model reported yet":ye.model,children:ye.model===zf?"unknown":ws(ye.model)}),i.jsx("td",{className:"up-num",children:Rt(ye.inputTokens+ye.outputTokens)}),ye.priced?i.jsx("td",{className:"up-num up-cost-val",children:rt(ye.cost.total)}):i.jsx("td",{className:"up-num up-unpriced",children:ei})]},ye.model))})]})]}),W&&U.length===0&&ee.tokens>0&&i.jsxs("section",{className:"up-section",children:[i.jsx("h3",{className:"up-section-title",children:"By session"}),i.jsxs("div",{className:"up-hint",children:["No session is dated ",Y," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(W?U.length:Ge.length)>0&&(()=>{const ye=W?U.length:Ge.length;return i.jsxs("section",{className:`up-section${se}`,children:[i.jsx("h3",{className:"up-section-title",children:i.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":D,"aria-controls":"up-sessions",title:D?"Hide the per-session breakdown":`Show the per-session breakdown — ${ye} session${ye===1?"":"s"}`,onClick:()=>O(je=>!je),children:["By session",W&&i.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Y}, each showing what that session has cost since it started.
|
|
76
|
+
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 ",Y]}),i.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:i.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),i.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!D,children:[W&&U.map(je=>{const Fe=he.get(je.sessionId);return i.jsxs("div",{className:"up-session-row",children:[Fe?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`sl-dot state-${Fe}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:Hl(Fe)})]}):i.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),i.jsx("span",{className:`up-session-label${je.label?"":" up-session-id"}`,title:je.label?`${je.label}
|
|
77
|
+
${je.sessionId}`:je.sessionId,children:je.label??je.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:Rt(je.tokens)}),je.cost>0?i.jsx("span",{className:"up-session-cost",title:je.models.join(", ")||void 0,children:rt(je.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ei})]},je.sessionId)}),!W&&Ge.map(je=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${je.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:Hl(je.state)}),i.jsx("span",{className:"up-session-label",children:je.label}),i.jsx("span",{className:"up-session-tokens",children:Rt(je.inputTokens+je.outputTokens)}),je.cost>0?i.jsxs("span",{className:"up-session-cost",title:je.unpricedTokens>0?`${Rt(je.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[rt(je.cost),je.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ei})]},je.sessionId))]})]})})(),tt&&i.jsxs("div",{className:"up-hint",children:["“",ei,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):i.jsx("div",{className:"up-empty",children:W?i.jsxs(i.Fragment,{children:["No usage ",Y,".",i.jsx("br",{}),"Try a longer period."]}):i.jsxs(i.Fragment,{children:["No usage data yet.",i.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Kt={l:30,r:6,t:6,b:2},Vs={l:0,r:0,t:2,b:1},Ad=104,gD=64;function hr(e,t=100,n=Ad,s=Kt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function q2(e,t,n,s=100,a=Ad,l=Kt){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,d=f=>{const m=t-l.l-l.r;return l.l+(c>0?m*(f-e[0].t)/c:m/2)};let h="",p=null;for(const f of e){const m=p&&f.t-p.t<=n*2?"L":"M";h+=`${m}${d(f.t).toFixed(1)} ${hr(f.v,s,a,l).toFixed(1)}`,p=f}return h}function F2(e,t,n,s=100,a=Ad,l=Kt){if(e.length<2)return"";const c=a-l.b,d=e[e.length-1].t-e[0].t,h=t-l.l-l.r,p=v=>l.l+(d>0?h*(v-e[0].t)/d:h/2);let f="",m=[];const y=()=>{if(m.length>=2){let v=`M${p(m[0].t).toFixed(1)} ${c}`;for(const N of m)v+=`L${p(N.t).toFixed(1)} ${hr(N.v,s,a,l).toFixed(1)}`;f+=`${v}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const v of e)m.length&&v.t-m[m.length-1].t>n*2&&y(),m.push(v);return y(),f}function yD(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 B2(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function wD(e,t,n=s=>Pl(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),l=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function Pl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Nx(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 vD({group:e,title:t,onClose:n}){const s=Ut(n),[a,l]=x.useState(null);x.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const v=await y.json();p&&(v!=null&&v.ok)&&l(v)}catch{}};f();const m=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[d,h]=x.useMemo(()=>{let p=1/0,f=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),f=Math.max(f,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,f]},[c,a==null?void 0:a.sinceMs]);return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&i.jsxs("span",{className:"hist-since",children:["since ",Pl(d)," · ",Nx(d,h||Date.now())]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsx("div",{className:"hist-body",children:a==null?i.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?i.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>i.jsx(xD,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function xD({series:e,stepMs:t}){const n=x.useRef(null),[s,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const A=n.current;if(!A||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return D.observe(A),()=>D.disconnect()},[]);const{points:d,unit:h,warnAt:p,critAt:f,label:m,top:y,restsAtZero:v}=e,N=v?gD:Ad,{now:_,peak:S}=yD(d),k=h==="C"?"°C":h,j=m==="Throttling"?wD(d,t):null,E=l!=null?d[l]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,T=A=>{const D=s-Kt.l-Kt.r;return Kt.l+(C>0?D*(A-d[0].t)/C:D/2)},R=A=>{if(d.length<2)return;const D=A.currentTarget.getBoundingClientRect(),O=(A.clientX-D.left-Kt.l)/Math.max(1,D.width-Kt.l-Kt.r),I=d[0].t+C*Math.max(0,Math.min(1,O));let q=0;for(let J=1;J<d.length;J++)Math.abs(d[J].t-I)<Math.abs(d[q].t-I)&&(q=J);c(q)};return i.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[i.jsxs("div",{className:"hist-head",children:[i.jsx("span",{className:"hist-label",children:m}),i.jsxs("span",{className:"hist-stats",children:[_!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_}),i.jsxs("span",{children:[k," now"]})]}),S!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:B2(S,p,f),children:S}),i.jsxs("span",{children:[k," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.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 ${S}${k}, over ${Nx(d[0].t,d[d.length-1].t)}`,onPointerMove:R,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",f]].map(([A,D])=>D==null||D>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${A}`,x1:Kt.l,x2:s-Kt.r,y1:hr(D,y,N),y2:hr(D,y,N)}),i.jsx("text",{className:`hist-rule-tag ${A}`,x:2,y:hr(D,y,N)+3,children:D})]},A)),i.jsx("line",{className:"hist-floor",x1:Kt.l,x2:s-Kt.r,y1:N-Kt.b,y2:N-Kt.b}),i.jsx("path",{className:"hist-area",d:F2(d,s,t,y,N)}),i.jsx("path",{className:"hist-line",d:q2(d,s,t,y,N)}),d.length===1&&i.jsx("circle",{className:"hist-dot",cx:T(d[0].t),cy:hr(d[0].v,y,N),r:3}),E&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:T(E.t),x2:T(E.t),y1:Kt.t,y2:N-Kt.b}),i.jsx("circle",{className:"hist-dot",cx:T(E.t),cy:hr(E.v,y,N),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:E?i.jsxs("span",{className:"hist-at",children:[Pl(E.t)," — ",i.jsx("b",{children:E.v}),k]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:d.length?Pl(d[0].t):""}),i.jsx("span",{children:d.length?Pl(d[d.length-1].t):""})]})}),j&&i.jsx("div",{className:"hist-note",children:j})]})}const bD="thermal:Throttling";function kD(e){var n,s,a,l;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(l=e.thermal)!=null&&l.throttle&&(t[bD]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ku(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Mu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Ku(e,t)}const _1=["cores","memory","load","thermal"],Fa=116,$r=24,_D=60,ND=6e4;function SD(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 ED(e,t=_D){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function CD({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const d=async()=>{const p=await Promise.all(_1.map(async f=>{try{const m=await fetch(`/api/system/history?group=${f}`);return m.ok?[f,await m.json()]:[f,null]}catch{return[f,null]}}));c&&n(f=>{const m={...f};for(const[y,v]of p)v!=null&&v.ok&&(m[y]=v);return m})};d();const h=setInterval(()=>void d(),ND);return()=>{c=!1,clearInterval(h)}},[]);const s=x.useMemo(()=>kD(e),[e]),a=x.useMemo(()=>_1.flatMap(c=>{const d=t[c];return d?d.series.filter(SD).map(h=>({series:ED(h),stepMs:d.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,d=-1/0;for(const{series:h}of a){const p=h.points;p.length&&(c=Math.min(c,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(c)?Nx(c,d):"less than a minute"},[a]);return Object.keys(s).length?i.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:d})=>i.jsx(TD,{series:c,stepMs:d,now:s[c.key],span:l},c.key))}):null}function TD({series:e,stepMs:t,now:n,span:s}){var v;const{points:a,top:l,unit:c,warnAt:d,critAt:h}=e,p=jD(e),f=n??((v=a[a.length-1])==null?void 0:v.v),m=f==null?"":B2(f,d,h),y=Math.max(...a.map(N=>N.v));return i.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Ku(y,c)} over the last ${s}`,d!=null?`over ${Mu(d,c)} is uncomfortable`:"",h!=null?`over ${Mu(h,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[i.jsxs("div",{className:"pl-cell-head",children:[i.jsx("span",{className:"pl-cell-label",children:p}),i.jsx("span",{className:"pl-cell-now",children:f==null?"—":Ku(f,c)})]}),i.jsxs("svg",{className:"pl-spark",width:Fa,height:$r,viewBox:`0 0 ${Fa} ${$r}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:Fa,y1:$r-Vs.b,y2:$r-Vs.b}),i.jsx("path",{className:"pl-spark-area",d:F2(a,Fa,t,l,$r,Vs)}),d!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:Fa,y1:hr(d,l,$r,Vs),y2:hr(d,l,$r,Vs)}),h!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:Fa,y1:hr(h,l,$r,Vs),y2:hr(h,l,$r,Vs)}),i.jsx("path",{className:"pl-spark-line",d:q2(a,Fa,t,l,$r,Vs)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Ku(y,c)," over the last ",s,d!=null&&`, uncomfortable over ${Mu(d,c)}`,h!=null&&`, the machine acts over ${Mu(h,c)}`]})]})}const AD={key:"cpu",dir:"desc"};function RD(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function MD(e,t){const n=t.dir==="asc"?1:-1,s=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,a=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",f=c.user??"";return!p||!f?p===f?0:p?-1:1:n*p.localeCompare(f,void 0,{sensitivity:"base"})}const d=s(l),h=s(c);return d==null||h==null?d==null?h==null?0:1:-1:n*(d-h)};return[...e].sort((l,c)=>a(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function ID(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const $D=4e3;function OD(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};s();const a=window.setInterval(s,$D);return()=>{n=!1,window.clearInterval(a)}},[]),e}function PD(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 LD(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 DD({sys:e,onClose:t}){const n=Ut(t),[s,a]=x.useState(AD),l=OD(),c=l?MD(l.procs,s):null;return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[i.jsxs("div",{className:"modal-head",children:[i.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&i.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),i.jsxs("div",{className:"pl-split",children:[i.jsx("div",{className:"pl-body",children:c==null?i.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?i.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):i.jsxs("table",{className:"sd-procs pl-table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx(Qo,{col:"cpu",label:"cpu",sort:s,onSort:a}),i.jsx(Qo,{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}),i.jsx(Qo,{col:"threads",label:"threads",sort:s,onSort:a}),i.jsx(Qo,{col:"uptime",label:"up",sort:s,onSort:a}),i.jsx(Qo,{col:"user",label:"user",sort:s,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(Qo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),i.jsx("tbody",{children:c.map(d=>i.jsxs("tr",{children:[i.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),i.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:PD(d.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:LD(d.uptimeSec)}),i.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),i.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),i.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&i.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),i.jsx(CD,{sys:e})]})]})}),document.body)}function Qo({col:e,label:t,note:n,sort:s,onSort:a}){const l=ID(s,e);return i.jsx("th",{scope:"col","aria-sort":l,children:i.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
|
+
|
|
79
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(RD(s,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const qD=3e3;function FD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function BD(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}% ${zD(t.lastMs,n)}`:"running at full speed, and never held back"}}function zD(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 jl(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 UD(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 WD(){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 h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,qD))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",d),()=>{s=!1,c(),document.removeEventListener("visibilitychange",d)}},[]),e}function N1({usageOpen:e,leaving:t,sub:n,onClose:s,children:a}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[i.jsxs("div",{className:"sd-head",children:[i.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&i.jsx("span",{className:"sd-sub",children:n}),i.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),a]})}function HD({usageOpen:e,leaving:t,onClose:n}){const s=WD();if(!s||s.cpu==null||!s.memory)return i.jsx(N1,{usageOpen:e,leaving:t,onClose:n,children:i.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:d,cores:h,uptimeSec:p,platform:f,thermal:m}=s,y=a?a.total-a.available:0,v=f==="win32"?"Commit":"Swap",N=l&&l.total>0?l.used/l.total*100:0;return i.jsxs(N1,{usageOpen:e,leaving:t,sub:`up ${UD(p)} · ${h} cores`,onClose:n,children:[c&&c.length>0&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:i.jsx(Xu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:i.jsx("div",{className:"sd-cores",style:{"--n":c.length},children:c.map((_,S)=>i.jsx("span",{className:"sd-core",title:`core ${S+1}: ${_}%`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},S))})})}),i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Xu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&i.jsx(hd,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:jl(y)})," of ",jl(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${jl(a.available)} available`}),l&&l.total>0&&i.jsx(hd,{label:v,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:jl(l.used)})," of ",jl(l.total)]}),pct:N,tone:N>=90?"warn":"calm",note:N>=50?"paging to disk":void 0})]})}),d&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:i.jsxs(Xu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[i.jsx("div",{className:"sd-load",children:d.map((_,S)=>i.jsxs("span",{className:`sd-load-item${_>h?" over":""}`,children:[i.jsx("b",{children:_.toFixed(2)}),i.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),i.jsx("div",{className:"sd-note",children:d[0]>h?`${(d[0]/h).toFixed(1)}× more work queued than cores to run it`:`within ${h} cores`})]})}),i.jsx(GD,{thermal:m}),i.jsx(VD,{sys:s})]})}function Xu({group:e,title:t,action:n,label:s,children:a}){const[l,c]=x.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"sd-open",onClick:()=>c(!0),title:n,"aria-label":n,children:[i.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",i.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),l&&i.jsx(vD,{group:e,title:t,onClose:()=>c(!1)})]})}function GD({thermal:e}){if(!e)return null;const t=e.throttle?BD(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Xu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(hd,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:FD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&i.jsx(hd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function VD({sys:e}){const[t,n]=x.useState(!1);return i.jsxs("div",{className:"sd-section",children:[i.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:i.jsxs("span",{className:"sd-door-plate",children:[i.jsxs("span",{className:"sd-door-name",children:["Busiest processes",i.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&i.jsx(DD,{sys:e,onClose:()=>n(!1)})]})}function hd({label:e,value:t,pct:n,tone:s="calm",note:a}){return i.jsxs("div",{className:"sd-row",children:[i.jsxs("div",{className:"sd-row-head",children:[i.jsx("span",{className:"sd-row-label",children:e}),i.jsx("span",{className:"sd-row-val",children:t})]}),i.jsx("span",{className:"sd-track",children:i.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&i.jsx("div",{className:"sd-note",children:a})]})}const S1=18,YD=1100,Zo=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},KD=Array.from({length:S1},(e,t)=>{const n=-72+144*t/(S1-1)+(Zo(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Zo(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Zo(t,3)*260),delay:Math.round(Zo(t,4)*90),dur:760+Math.round(Zo(t,5)*260),scale:.8+Zo(t,6)*.45,hue:t%4,round:t%3===0}});function j1({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 l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const d=window.setTimeout(()=>n(null),YD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:vs.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:KD.map((l,c)=>i.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const z2=new Set(["awaiting_url","awaiting_code","registering"]);function XD(e){return e!=null&&z2.has(e)}function U2(e){return e!=null&&e!=="done"&&!z2.has(e)}const QD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",ZD="the sign-in did not complete";function JD({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?QD:ZD)}}const e6="done";function t6(){let e=!1;return{shouldAnnounce(t){return t!==e6?(e=!1,!1):e?!1:(e=!0,!0)}}}function Sx(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const n6={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 ${Xt}`,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"},r6={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"},s6=`claude-swap could not read the login keychain — start ${Xt} from a Terminal window rather than a background service`;function Dv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(mi(e)))return s6;const n=Sx(r6,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function mi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const a6={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"},o6="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 i6(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const l6="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",c6="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",u6=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),d6=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,h6=/[\\/]_npx[\\/]/i,f6=`the copy of ccusage ${Xt} installed for itself`;function p6(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function m6(e,t){const n=g6(e,t),s=p6(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 ${El(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${El(n)}`;case"managed":return`${f6} failed to run: ${El(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${El(n)}`:`the ccusage this deck found on your PATH failed to run: ${El(n)}`;default:return n}}const El=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function g6(e,t){const n=mi(e);if(u6(n)){if(h6.test(n))return c6;if(d6.test(n))return l6}if(i6(n))return o6;const s=Sx(a6,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function ri(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&U2(e.state))return e.error;const n=Sx(n6,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function y6(e,t,n){if(n<=0||vx(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 W2(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 w6(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}`,l=[];return n.alias&&s&&l.push(s),s&&(t.get(s.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function v6(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 x6(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 b6(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const l=n("healed");l&&s.push(`${l} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const d=n("present");d&&s.push(`${d} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const k6=1500,Iu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],E1="aa-panel",C1=e=>`aa-tab-${e}`;async function Cl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const qv=pe.forwardRef((e,t)=>i.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[i.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),i.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));qv.displayName="SuccessMark";function _6({onClose:e,onChanged:t}){const[n,s]=x.useState("login"),[a,l]=x.useState(null),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(!1),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),A=x.useRef(null),D=x.useRef(null),O=x.useRef(null),I=x.useRef(null),q=x.useRef([]),J=x.useRef(!1),Z=x.useCallback(()=>{T.current&&Cl({action:"login-cancel"}).catch(()=>{}),e()},[e]),$=Ut(Z,{focusRef:O}),K=x.useCallback(async()=>{if(!pr(R.current))return;R.current=!0,m(!0),v(null),T.current=!0;const U=await Cl({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){v(ri(U,"could not start the sign-in"));return}l(U)},[]);x.useEffect(()=>{if(!XD(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const ee=await fetch("/api/claude-accounts/login");ee.ok&&l(await ee.json())}catch{}},k6);return()=>window.clearInterval(U)},[a]);const G=x.useRef(t);G.current=t;const z=x.useState(t6)[0];x.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=A.current)==null||U.focus()),z.shouldAnnounce(a==null?void 0:a.state)&&G.current()},[a==null?void 0:a.state,z]),x.useEffect(()=>{var U;n==="paste"&&!J.current&&((U=D.current)==null||U.focus()),J.current=!1},[n]);const X=x.useCallback(U=>{var Y;const ee=y6(U,Iu.findIndex(se=>se.id===n),Iu.length);ee.kind!=="pass"&&(U.preventDefault(),J.current=!0,s(Iu[ee.index].id),(Y=q.current[ee.index])==null||Y.focus())},[n]),L=x.useCallback(async()=>{var ee;if(!pr(R.current))return;R.current=!0,m(!0),v(null);const U=await Cl({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){v(ri(U,"the code was not accepted")),U!=null&&U.state&&l(U),(ee=A.current)==null||ee.select();return}d(""),l(U)},[c,a]),W=x.useCallback(async()=>{if(!pr(R.current))return;R.current=!0,m(!0),v(null);const U=await Cl({action:"import",blob:h}).catch(()=>null);if(R.current=!1,m(!1),!(U!=null&&U.ok)){v(ri(U,"the import failed"));return}C.current=h,p(""),E(null),_(U.results??[]),t()},[h,t]),P=x.useCallback(async U=>{const ee=`${U.email}|${U.org??""}`;if(!pr(R.current)||!C.current)return;R.current=!0,m(!0),k(ee),E(null);const Y=await Cl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(R.current=!1,m(!1),k(null),!(Y!=null&&Y.ok)){E({key:ee,text:ri(Y,"that account could not be updated")});return}const se=(Y.results??[])[0];se&&_(me=>me&&me.map(ge=>`${ge.email}|${ge.org??""}`===ee?se:ge)),t()},[t]),V=(a==null?void 0:a.state)==="done"?a.account:null,he=U2(a==null?void 0:a.state)||!!(y&&T.current&&!f),H=JD({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:Z,role:"presentation",children:i.jsxs("div",{ref:$,className:"modal aa-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:X,children:Iu.map((U,ee)=>i.jsx("button",{type:"button",role:"tab",id:C1(U.id),ref:Y=>{q.current[ee]=Y},"aria-selected":n===U.id,"aria-controls":E1,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{J.current=!1,s(U.id)},children:U.label},U.id))})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:Z,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:E1,role:"tabpanel","aria-labelledby":C1(n),children:n==="login"?V?i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:I}),i.jsx(j1,{anchor:I}),i.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),i.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"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"1 · Approve in the browser"}),i.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),i.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),i.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."}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:A,type:"text",value:c,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!f&&L()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),i.jsx("button",{type:"button",className:"btn primary",...fr(f,!c.trim()||a.state==="registering"),onClick:L,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&i.jsx("p",{className:"aa-err",children:y??a.error}),i.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."})]})]}):he?i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:H.title}),i.jsx("p",{className:"aa-err",children:H.message}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),v(null),K()},children:"Try again"})]}):f||T.current?i.jsx("div",{className:"aa-step",children:i.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):i.jsxs("div",{className:"aa-step aa-primer",children:[i.jsx("h4",{children:"Sign in to Anthropic"}),i.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."}),i.jsx("div",{className:"aa-actions",children:i.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):N?(()=>{const U=N.filter(ee=>ee.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(qv,{ref:I}),U>0&&i.jsx(j1,{anchor:I}),i.jsx("h4",{children:b6(N)}),N.length>0&&i.jsx("ul",{className:"aa-results",children:N.map(ee=>{const Y=`${ee.email}|${ee.org??""}`;return i.jsxs("li",{className:`aa-result ${ee.state}`,children:[i.jsx("span",{className:"aa-result-who",children:ee.email||(ee.num?`slot ${ee.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:x6(ee.state)}),ee.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===Y,title:`Overwrite the stored login for ${ee.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(ee),children:S===Y?"updating…":"update anyway"}),(j==null?void 0:j.key)===Y&&i.jsx("span",{className:"aa-result-err",children:j.text})]},Y)})}),i.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",i.jsx("strong",{children:" update anyway"}),"."]}),i.jsxs("div",{className:"aa-actions",children:[i.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),i.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),_(null)},children:"Import another"})]})]})})():i.jsxs("div",{className:"aa-step",children:[i.jsx("h4",{children:"Paste an account shared from another deck"}),i.jsxs("div",{className:"aa-field",children:[i.jsx("input",{ref:D,type:"text",value:h,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&h.trim()&&!f&&W()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...fr(f,!h.trim()),onClick:W,children:f?"importing…":"Import"})]}),y&&i.jsx("p",{className:"aa-err",children:y}),i.jsxs("p",{className:"aa-note",children:["Use ",i.jsx("strong",{children:"share"})," on one account in the other deck, or ",i.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)}async function N6(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const S6=1800;function j6({accounts:e,onClose:t,copyText:n}){const[s,a]=x.useState([]),[l,c]=x.useState(null),[d,h]=x.useState(!1),[p,f]=x.useState(null),[m,y]=x.useState(!1),[v,N]=x.useState(()=>Math.floor(Date.now()/1e3)),_=x.useRef(null),S=x.useRef(!1),k=Ut(t,{focusRef:_});x.useEffect(()=>{if(!l)return;N(Math.floor(Date.now()/1e3));const I=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(I)},[l]);const j=w6(e),E=e.filter(I=>!s.includes(I.num)).map(I=>I.num),C=E.length===e.length,T=I=>a(q=>q.includes(I)?q.filter(J=>J!==I):[...q,I]),R=x.useCallback(async()=>{if(!pr(S.current)||!E.length)return;S.current=!0,h(!0),f(null),y(!1);const I=await N6({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,h(!1),!(I!=null&&I.ok)){f(ri(I,"the share could not be made"));return}c({blob:I.blob,expiresAt:I.expiresAt,shared:I.shared??[],failed:I.failed??[]})},[e,E]),A=l?W2(l.expiresAt,v):null,D=(A==null?void 0:A.tone)==="gone",O=(l==null?void 0:l.shared.length)??0;return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:k,className:"modal sa-modal",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("h3",{children:"Share accounts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body sa-body",children:l?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:D?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${D?" sa-dead":""}`,children:l.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",ref:_,onClick:async()=>{if(D){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),S6))},children:D?"make a new share":m?"copied":`copy ${O===1?"the share":"all "+O}`}),i.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:[i.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",i.jsx("span",{className:`ap-share-expiry ${A==null?void 0:A.tone}`,children:A==null?void 0:A.text})]})]}),l.failed.length>0&&i.jsxs("div",{className:"sa-failed",role:"alert",children:[i.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),i.jsx("ul",{className:"sa-list",children:l.failed.map(I=>{var J;const q=!!(I.email&&((J=I.detail)!=null&&J.includes(I.email)));return i.jsxs("li",{children:[!q&&i.jsx("span",{className:"sa-who",children:I.email||`account ${I.num}`}),i.jsx("span",{className:"sa-why",children:I.detail||"could not be exported"})]},`${I.num}-${I.email}`)})})]}),i.jsx("p",{className:"sa-note",children:D?i.jsx(i.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):i.jsxs(i.Fragment,{children:["Paste it into the other deck with ",i.jsx("strong",{children:"+"})," → ",i.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),i.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?i.jsxs("div",{className:"sa-step",children:[i.jsx("h4",{children:"Nothing to share"}),i.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",i.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),i.jsx("div",{className:"sa-actions",children:i.jsx("button",{type:"button",className:"btn primary",ref:_,onClick:t,children:"Close"})})]}):i.jsxs("div",{className:"sa-step",children:[i.jsxs("h4",{children:["Which accounts go to the other ",Xt,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:v6(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:j.map(I=>i.jsx("li",{children:i.jsxs("label",{className:"sa-row",children:[i.jsx("input",{type:"checkbox",checked:E.includes(I.num),onChange:()=>T(I.num)}),i.jsx("span",{className:"sa-who",children:I.label}),I.sub&&i.jsx("span",{className:"sa-sub",children:I.sub})]})},I.num))}),p&&i.jsx("p",{className:"aa-err",children:p}),i.jsxs("div",{className:"sa-actions",children:[i.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(I=>I.num):[]),children:C?"Clear all":"Select all"}),i.jsx("button",{type:"button",className:"btn primary",ref:_,...fr(d,!E.length),onClick:R,children:d?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function E6(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,l)=>a-l).map(a=>{const l=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:l,label:l==="here"?`slot ${a}`:`slot ${a} · ${l}`}})}function C6(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 T6(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function A6(e,t,n){var a;const s=((a=e.find(l=>l.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 R6(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 T1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function A1(e){const t=e.filter(d=>!T1(d)),n=e.filter(d=>T1(d)),s=t.length?t:n,a=t.length?n:[],l=s.reduce((d,h)=>d&&d.pct>=h.pct?d:h,null);let c=null;for(const d of a)l&&d.pct<=l.pct||(!c||d.pct>c.pct)&&(c=d);return{shown:s,rest:a,fuller:c,peak:c??l}}function M6(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function I6(e,t,n,s){const a=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,l=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${l}.`}const $6="\0";function jx(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}${$6}${n}`}function O6(e,t){const n=jx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function P6(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(jx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const L6=64;function D6(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const q6=Object.freeze({text:"couldn't reach the deck server",reload:!0}),F6=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function R1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function B6(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=mi(t.body);return{text:Dv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function M1(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 H2({title:e,steps:t,finish:n,aside:s,onClose:a}){const l=x.useRef(null),c=Ut(a,{focusRef:l}),[d,h]=x.useState(0),p=d===t.length-1,f=t[d],m=N=>h(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"?d+1:d-1))},v=()=>{if(!p){m(d+1);return}n?n.act():a()};return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:N=>N.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),i.jsxs("span",{className:"modal-tool-id",children:[d+1," / ",t.length]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("div",{className:"guide-stage",children:f.art},d),i.jsx("p",{className:"guide-line","aria-live":"polite",children:f.line}),i.jsx("p",{className:"guide-tip",children:f.tip??""}),i.jsxs("div",{className:"guide-foot",children:[i.jsx("div",{className:"guide-dots",children:t.map((N,_)=>i.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===d?"step":void 0,onClick:()=>m(_)},_))}),p&&s&&i.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),d>0&&i.jsx("button",{type:"button",className:"btn",onClick:()=>m(d-1),children:"Back"}),i.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:v,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Fv={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Gn({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Hn({x:e,y:t=34,w:n=176,h:s=132,label:a}){return i.jsxs(i.Fragment,{children:[a&&i.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),i.jsx("rect",{x:e,y:t,width:n,height:s,rx:10,className:"ga-screen"})]})}function gr({x:e,y:t,email:n,state:s,tone:a,bars:l}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Fv[a]}),i.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),i.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Fv[a]}`,children:s}),l==null?void 0:l.map((c,d)=>i.jsxs("g",{children:[i.jsx("text",{x:e,y:t+40+d*18,className:"ga-s",children:d?"7d":"5h"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:e+22,y:t+35+d*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),i.jsxs("text",{x:e+148,y:t+40+d*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},d))]})}function G2({x:e,y:t,on:n}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),i.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function $u({x:e,y:t,name:n,here:s=!0}){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:e+3,cy:t-4,r:3,className:s?"ga-ok":"ga-dim"}),i.jsx("text",{x:e+12,y:t,className:s?"ga-t":"ga-s",children:n})]})}function I1({x:e,y:t,on:n}){return n?i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),i.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):i.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function $1({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function Ex({x:e,y:t}){return i.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 Cx(){return i.jsxs(i.Fragment,{children:[i.jsx("circle",{r:9,className:"ga-key-bed"}),i.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[i.jsx("circle",{cx:4.6,cy:7,r:2.6}),i.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function si({x:e,y:t,w:n,title:s,sub:a,tone:l}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),i.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Fv[l]}),i.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:s}),i.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function li({x:e,y:t,label:n,live:s}){return i.jsxs(i.Fragment,{children:[i.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:s?"ga-chip-live":"ga-chip"}),i.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function fd({x:e,y:t}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),i.jsx(G2,{x:e+118,y:t-13,on:!0})]})}function z6(){return i.jsxs(Gn,{children:[i.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),i.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),i.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),i.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),i.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),i.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),i.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),i.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),i.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),i.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),i.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),i.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),i.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),i.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),i.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),i.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),i.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),i.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),i.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),i.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),i.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function U6(){return i.jsxs(Gn,{children:[i.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),i.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),i.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),i.jsx(si,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(si,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(si,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(si,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx(li,{x:326,y:28,label:"Read"}),i.jsx(li,{x:380,y:28,label:"Grep",live:!0}),i.jsx(li,{x:326,y:90,label:"Bash",live:!0})]})}function O1({x:e,y:t,label:n,pct:s,note:a}){return i.jsxs(i.Fragment,{children:[i.jsx("text",{x:e,y:t,className:"ga-s",children:n}),i.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[s,"%"]}),i.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:e,y:t+7,width:194*s/100,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function W6(){return i.jsxs(Gn,{children:[i.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),i.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),i.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),i.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),i.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),i.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),i.jsx(O1,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx(O1,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function H6(){return i.jsxs(Gn,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(si,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(Ex,{x:156,y:106}),i.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),i.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),i.jsx(Hn,{x:200,y:22,w:226,h:160}),i.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),i.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),i.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),i.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),i.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),i.jsx(li,{x:214,y:122,label:"Read"}),i.jsx(li,{x:266,y:122,label:"Edit"}),i.jsx(li,{x:318,y:122,label:"Bash",live:!0}),i.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),i.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function G6(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,y:20,w:412,h:160}),i.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),i.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),i.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),i.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>i.jsxs("g",{children:[i.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),i.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),i.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),i.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),i.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),i.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),i.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),i.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),i.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),i.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),i.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),i.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),i.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),i.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function V6(){return i.jsxs(Gn,{children:[i.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),i.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),i.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),i.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[i.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),i.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),i.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),i.jsx("path",{d:"M210 100H238",className:"ga-arc"}),i.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),i.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),i.jsx("g",{className:"ga-pop",children:i.jsx(si,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function Y6(){return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,y:16,w:232,h:170}),i.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),i.jsx($1,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx($1,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),i.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),i.jsx(gr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),i.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),i.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),i.jsx(gr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),i.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),i.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),i.jsx(Ex,{x:221,y:161}),i.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),i.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),i.jsx(Hn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(gr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function K6(){return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(gr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(gr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Hn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx(gr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),i.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:i.jsx(Cx,{})})]})}const X6=[{art:i.jsx(z6,{}),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:i.jsx(U6,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(H6,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(W6,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(G6,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(Y6,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:i.jsx(K6,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Local network is the last section of the Claude accounts panel."},{art:i.jsx(V6,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function Q6(){return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,label:"THIS MACHINE"}),i.jsx(gr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),i.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),i.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),i.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),i.jsx(Hn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(gr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function Z6(){return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,label:"THIS MACHINE"}),i.jsx(fd,{x:28,y:60}),i.jsx($u,{x:28,y:92,name:"Ana's MacBook"}),i.jsx($u,{x:28,y:114,name:"Dorin's PC"}),i.jsx(Hn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(fd,{x:264,y:60}),i.jsx($u,{x:264,y:92,name:"Your MacBook"}),i.jsx($u,{x:264,y:114,name:"Dorin's PC"}),i.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),i.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),i.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function J6(){return i.jsxs(Gn,{children:[i.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),i.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),i.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),i.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),i.jsx(I1,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(I1,{x:106,y:112}),i.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),i.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),i.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),i.jsx(G2,{x:304,y:157,on:!0}),i.jsx(Ex,{x:115,y:97})]})}function eq(){return i.jsxs(Gn,{children:[i.jsx(Hn,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(gr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(gr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(Hn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(gr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),i.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),i.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:i.jsx(Cx,{})})]})}const tq=[{art:i.jsx(Q6,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(Z6,{}),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:i.jsx(J6,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:i.jsx(eq,{}),line:"An expired login is copied from a paired machine within a minute."}];function nq(){return i.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[i.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),i.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),i.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),i.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),i.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),i.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),i.jsx("g",{transform:"translate(116 13)",children:i.jsx(Cx,{})})]})}async function Uf(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const rq={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."},sq={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function P1(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Lt(n,t)}function aq({status:e,manual:t,onClose:n,onChanged:s}){var z,X;const a=x.useRef(null),l=Ut(n,{focusRef:a}),[c,d]=x.useState(""),[h,p]=x.useState(""),[f,m]=x.useState(null),[y,v]=x.useState(null),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,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=>Td(T.current)?(T.current=L,_(L),!0):!1,[]),A=x.useCallback(()=>{T.current=null,C.current&&_(null)},[]),D=L=>{const W=Js(N,L);return{disabled:W.disabled,"aria-busy":W.busy}},O=L=>(f==null?void 0:f.field)===L?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},I=L=>m(W=>W&&W.field===L?null:W),q=x.useCallback(async()=>{const L=wq(c);if(!L){m({text:oq(c),field:"addr"});return}const W=`${L.addr}:${L.port}`,P=e.peers.find(V=>V.addr===L.addr&&V.port===L.port&&V.paired);if(P){m({text:`Already paired with ${P.name} at that address.`,field:"addr"});return}if(t.includes(W)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await Uf("/api/prefs",{lan:{manual:[...t,W]}});if(!C.current)return;V!=null&&V.ok?(m(null),d(""),s(),n()):m({text:Lt("add that address",V),field:"addr"})}catch{C.current&&m({text:Lt("add that address",null),field:"addr"})}finally{A()}},[c,t,e.peers,s,n,R,A]),J=x.useCallback(async L=>{if(!R(`invite:${L}`))return;const W=L==="make"?"make an invite":"cancel that invite";try{const P=await Uf("/api/lan/invite",{action:L});if(!C.current)return;P!=null&&P.ok?(m(null),v(null),s()):m({text:P1(sq,P,W)})}catch{C.current&&m({text:Lt(W,null)})}finally{A()}},[s,R,A]),Z=x.useCallback(async()=>{const L=h.trim();if(!(!L||!R("join"))){k(null);try{const W=await Uf("/api/lan/invite",{action:"join",token:L});if(!C.current)return;W!=null&&W.ok?(p(""),m(null),s(),n()):(W==null?void 0:W.reason)==="unreachable"&&Array.isArray(W.tried)&&W.tried.length?(k(W.tried),m(null)):(k(null),m({text:P1(rq,W,"use that invite"),field:"join"}))}catch{C.current&&m({text:Lt("use that invite",null),field:"join"})}finally{A()}}},[h,s,n,R,A]),$=x.useCallback(async(L,W)=>{try{await navigator.clipboard.writeText(L),v(W),window.setTimeout(()=>{C.current&&v(P=>P===W?null:P)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),K=e.invite&&e.invite.expiresAt>j?e.invite:null,G=((z=e.reach)==null?void 0:z.steps)??[];return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal lan-add",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((X=e.reach)==null?void 0:X.blocked)&&i.jsxs("div",{className:"ap-lan-reach",children:[i.jsx("p",{className:"lan-warn",children:e.reach.text}),i.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&&i.jsxs("details",{className:"ap-lan-reach-fix",children:[i.jsx("summary",{children:"or let them find this deck on their own"}),i.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",i.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&i.jsx(i.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),i.jsx("pre",{className:"ap-lan-cmd",children:i.jsx("code",{children:G.join(`
|
|
80
|
+
`)})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:fix"),onClick:()=>void $(G.join(`
|
|
81
|
+
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:y==="fix"?"copied":"copy command"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"By address"}),i.jsxs("div",{className:"ap-lan-row",children:[i.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,...O("addr"),onChange:L=>{d(L.target.value),I("addr")},onKeyDown:L=>{L.key==="Enter"&&q()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("add"),onClick:()=>void q(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),i.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:["With an invite",!K&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...D("invite:make"),onClick:()=>void J("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"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:h,placeholder:"paste one you were sent",spellCheck:!1,...O("join"),onChange:L=>{p(L.target.value),k(null),I("join")},onKeyDown:L=>{L.key==="Enter"&&Z()}}),h.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...D("join"),onClick:()=>void Z(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&i.jsxs("div",{className:"ap-lan-tried",children:[i.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(L=>i.jsxs("span",{className:"ap-lan-tried-row",children:[i.jsx("code",{className:"ap-lan-code",children:L.addr}),i.jsx("span",{className:"ap-lan-bad",children:L.why})]},L.addr))]}),K&&i.jsxs("div",{className:"ap-lan-invite",children:[i.jsxs("div",{className:"ap-lan-invite-head",children:[i.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),i.jsxs("span",{className:"ap-lan-invite-left",children:[xq(K.expiresAt,j)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:K.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D("copy:invite"),onClick:()=>void $(K.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D("invite:withdraw"),onClick:()=>void J("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),i.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function oq(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 iq=1e3;function lq(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=Lr(e,t);return`${n} · ${s==="now"?"just now":s}`}function L1(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function cq(){return i.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:[i.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),i.jsx("path",{d:"M8.4 3.6l2 2"})]})}function D1(){return i.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:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),i.jsx("path",{d:"M1 13h14"})]})}function Ou({dir:e,gate:t=!1}){const n=t?12:8;return i.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:i.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 uq={works:"works here",expired:"expired here",missing:"not on this deck"},dq={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function hq(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${uq[e.here]}, ${dq[e.there]}, ${t}.`}function fq({row:e,source:t,status:n,accounts:s,now:a,busy:l,onClose:c,onRename:d,onCheck:h,onVerb:p,onSettings:f,twins:m=[],onUnpair:y}){var Ye,ct,re,Ae;const v=x.useRef(null),N=Ut(c,{focusRef:v}),[_,S]=x.useState(null),[k,j]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,A]=x.useState(null),[D,O]=x.useState(!1),[I,q]=x.useState(0),J=x.useRef(null),Z=x.useRef(!0);x.useEffect(()=>()=>{Z.current=!1},[]);const $=_!=null;x.useEffect(()=>{var ae;$&&((ae=J.current)==null||ae.select())},[$]),x.useEffect(()=>{if(!E)return;const ae=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(ae)},[E]),x.useEffect(()=>{if(!R)return;const ae=window.setTimeout(()=>A(null),4e3);return()=>window.clearTimeout(ae)},[R]);const K=ae=>{const Ee=Js(l,ae);return{disabled:Ee.disabled,"aria-busy":Ee.busy}},G=async ae=>{const Ee=await ae();return Z.current&&j(Ee),Ee==null},{peer:z,stranger:X}=t,L=e.kind==="paired",W=e.self??e.name,P=e.kind!=="dialling",V=e.kind==="dialling"?null:e.fp,he=z?z.addr?`${z.addr}:${z.port}`:"":X?X.port?`${X.addr}:${X.port}`:X.addr:e.addr,H=(z==null?void 0:z.about)??null,U=((Ye=n.about)==null?void 0:Ye.version)??null,ee=async ae=>{const Ee=ae.trim()===W?"":ae;await G(()=>d(Ee))&&S(null)},Y=async()=>{if(V)try{if(await navigator.clipboard.writeText(V),!Z.current)return;O(!0),window.setTimeout(()=>{Z.current&&O(!1)},1600)}catch{Z.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},se=L?z!=null&&z.waiting?z.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":z!=null&&z.offers?"not said — it runs an older version":"not reached yet":"shown once paired",me=L1(n.about),ge=L1(H),Re=H!=null&&H.version&&U?Eq(H.version,U):null,Oe=z?V2(z.last,a):null,ce=(ct=z==null?void 0:z.last)!=null&&ct.error&&Oe&&Oe.text!==z.last.error?z.last.error:null,we=((re=z==null?void 0:z.last)==null?void 0:re.done)??[],be=!!Oe&&!!ce&&!e.quiet&&e.state.startsWith(Oe.text),Be=L||e.kind==="dialling",_e=z?z.waiting?null:z.manual?"added by address":"on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair",Ce=e.tone==="bad"?"bad":L?e.here?"up":"down":"loose",Ge=l===`check:${e.fp}`,tt=(z==null?void 0:z.offers)??null,Qe=L?Tq(z!=null&&z.waiting?null:(tt==null?void 0:tt.accounts)??null,s,n.shared??[]):[],Xe=Qe.filter(ae=>ae.in==null&&ae.out==="cut"),Ke=Qe.some(ae=>ae.in!=null),fe=Qe.some(ae=>ae.out!=null),dt=new Map(we.map(ae=>[ae.email,ae])),yt=we.filter(ae=>!Qe.some(Ee=>Ee.email===ae.email)),ot=L?z!=null&&z.waiting?"What that deck offers is not known. This deck never asks it — it calls in — so it only shows once this deck can reach it.":tt?tt.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:(Ae=z==null?void 0:z.last)!=null&&Ae.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,ye=tt&&(z!=null&&z.last)&&z.last.at-tt.at>iq?Lr(tt.at,a):null,je=[];L&&(z!=null&&z.pairedAt)?je.push({label:"Paired",value:lq(z.pairedAt,a),tone:"meta"}):e.kind==="declined"&&X&&je.push({label:"Paired",value:`no · you said no ${Rx(X.at,a)}`,tone:"meta"}),je.push({label:"Fingerprint",value:V?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:V}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void Y(),"aria-label":D?"Fingerprint copied":"Copy the fingerprint",children:D?"copied":"copy"})]}):"not known — nothing has answered there",tone:V?void 0:"quiet"});const Fe=m.length?[{row:e,peer:z??null},...m]:[];return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:N,className:"modal lan-peer","data-tone":e.tone,onClick:ae=>ae.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[i.jsxs("header",{className:"modal-head lan-peer-head",children:[i.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsxs("div",{className:"lan-peer-id",children:[$?i.jsxs("form",{className:"lan-peer-edit",onSubmit:ae=>{ae.preventDefault(),ee(_??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:J,className:"ap-manage-input lan-peer-input",value:_??"",maxLength:48,placeholder:W,"aria-label":"Name for this deck, shown on this deck only",onChange:ae=>S(ae.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...K(`alias:${e.fp}`),children:"save"}),i.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):i.jsxs("span",{className:"lan-peer-title",children:[i.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),P&&i.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:i.jsx(cq,{})})]}),i.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&i.jsxs(i.Fragment,{children:["calls itself ",i.jsx("span",{className:"lan-peer-self",children:e.self}),$&&i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...K(`alias:${e.fp}`),onClick:()=>void ee(""),children:"use this name"}),i.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&i.jsx("span",{"aria-hidden":!0,children:" · "})]}),i.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{ref:v,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body lan-peer-body",children:[k&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:k}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"lan-map","data-link":Ce,"data-asking":Ge||void 0,"data-bus":Qe.length>0||void 0,children:[i.jsxs("div",{className:"lan-ends",children:[i.jsxs("p",{className:"lan-end",children:[i.jsx("span",{className:"lan-end-name",children:"This deck"}),me&&i.jsx("span",{className:"lan-end-runs",children:me})]}),i.jsxs("p",{className:"lan-end","data-side":"there",children:[i.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&i.jsxs("span",{className:"lan-end-runs",children:[ge??(H?"not said":se),Re?` · ${Re<0?"older":"newer"}`:null]})]})]}),i.jsxs("div",{className:"lan-link",children:[i.jsx(D1,{}),i.jsxs("span",{className:"lan-span",children:[i.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[i.jsx("i",{className:"lan-glint","data-dir":"out"}),i.jsx("i",{className:"lan-glint","data-dir":"in"})]}),i.jsx("span",{className:"lan-link-label",children:he?i.jsx("code",{className:"ap-lan-code",children:he}):"none here — it calls this deck"})]}),i.jsx(D1,{}),(he&&_e||Be)&&i.jsxs("p",{className:"lan-link-sub",children:[he&&_e,he&&_e&&Be&&" · ",Be&&(Oe?be?i.jsx("code",{className:"ap-lan-code",children:ce}):i.jsx("span",{className:"lan-round","data-tone":Oe.tone,children:Oe.text.replace(/ · now$/," · just now")}):"not asked yet"),Be&&ce&&!be&&i.jsx("code",{className:"lan-fact-raw",children:ce})]}),yt.length>0&&i.jsx("ul",{className:"lan-done",children:yt.map(ae=>i.jsxs("li",{"data-ok":ae.ok,children:[ae.email," ",i.jsx("span",{className:"lan-done-what",children:ae.ok?"arrived":"did not arrive"})]},`${ae.email}:${ae.action}`))}),(z==null?void 0:z.waiting)&&i.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),Qe.length>0&&i.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:Qe.map((ae,Ee)=>{const De=dt.get(ae.email),mt=ae.out==="live"||ae.in!=null&&ae.in!=="cut";return i.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":ae.tone,"data-draw":ae.in&&ae.out?"both":ae.in?"in":"out",style:{"--i":Ee},children:[i.jsx("i",{className:"lan-pip","data-end":"here","data-state":ae.here,"aria-hidden":!0}),i.jsxs("span",{className:"lan-track",children:[i.jsxs("span",{className:"lan-wire","data-flow":mt?"live":"cut","aria-hidden":!0,children:[(ae.in==="live"||ae.in==="wait")&&i.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":ae.in}),ae.out==="live"&&i.jsx("i",{className:"lan-glint","data-dir":"out"})]}),ae.in&&ae.in!=="cut"&&i.jsx(Ou,{dir:"in",gate:ae.in==="blocked"}),ae.out==="live"&&i.jsx(Ou,{dir:"out"}),i.jsx("span",{className:"lan-lane-email",children:ae.email})]}),i.jsx("i",{className:"lan-pip","data-end":"there","data-state":ae.there,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:hq(ae)}),(ae.caption||De)&&i.jsxs("span",{className:"lan-lane-note",children:[ae.caption,ae.caption&&De&&" · ",De&&i.jsx("span",{className:"lan-lane-done","data-ok":De.ok,children:De.ok?"arrived last round":"did not arrive last round"})]})]},ae.key)})},I),L&&i.jsxs(i.Fragment,{children:[Xe.length>0&&i.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",Xe.length===1?Xe[0].email:"the expired ones"," until you sign in again here."]}),ot&&i.jsx("p",{className:"lan-empty",children:ot}),ye&&i.jsxs("p",{className:"lan-stale",children:["As of ",ye==="now"?"just now":ye,", when it last answered."]}),i.jsxs("div",{className:"lan-legend",children:[Ke&&i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:i.jsx(Ou,{dir:"in"})}),"from ",e.name]}),fe?i.jsxs("span",{className:"lan-key",children:[i.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:i.jsx(Ou,{dir:"out"})}),"from this deck, to every paired deck"]}):i.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),i.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:f,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),i.jsx("dl",{className:"lan-facts",children:je.map(ae=>i.jsxs("div",{className:"lan-fact","data-tone":ae.tone,children:[i.jsx("dt",{children:ae.label}),i.jsx("dd",{children:ae.value})]},ae.label))}),Fe.length>1&&i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:[Fe.length," decks on this machine"]}),i.jsx("ul",{className:"lan-twins",role:"list",children:Fe.map((ae,Ee)=>{var ht,wt,Wt,Fr;const De=(ht=ae.peer)!=null&&ht.addr?`${ae.peer.addr}:${ae.peer.port}`:ae.row.addr,mt=De||ae.row.fp,xt=(wt=ae.peer)!=null&&wt.pairedAt?Lr(ae.peer.pairedAt,a):null,Me=[(Fr=(Wt=ae.peer)==null?void 0:Wt.about)!=null&&Fr.version?`runs ${ae.peer.about.version}`:null,xt?`paired ${xt==="now"?"just now":xt}`:null,ae.row.state].filter(Boolean).join(" · "),Ze=ae.row.fp;return i.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":ae.row.tone,children:[i.jsx("i",{className:ae.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),De?i.jsx("code",{className:"ap-lan-code lan-twin-at",children:De}):i.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),i.jsx("code",{className:"ap-lan-code lan-twin-fp",children:Ze}),Ee>0&&y&&i.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===Ze?" armed":""}`,...K(`unpair:${Ze}`),onKeyDown:Kn=>{Kn.repeat&&Kn.preventDefault()},onClick:()=>{if(R!==Ze){A(Ze),T.current=Date.now();return}Date.now()-T.current<zv||(A(null),G(()=>y(Ze)))},"aria-label":R===Ze?`Confirm unpairing ${mt}`:`Unpair ${mt}`,title:R===Ze?"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:l===`unpair:${Ze}`?"unpairing…":R===Ze?"sure?":"unpair"}),i.jsx("span",{className:"lan-twin-meta",children:Ee===0?`${Me} · shown above`:Me})]},Ze)})})]})]}),i.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&i.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),L&&!(z!=null&&z.waiting)&&i.jsx("button",{type:"button",className:"btn",...K(`check:${e.fp}`),onClick:()=>void G(h).then(ae=>{ae&&Z.current&&q(Ee=>Ee+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&i.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...K(`unpair:${e.fp}`),onKeyDown:ae=>{ae.repeat&&ae.preventDefault()},onClick:()=>{if(!E){C(!0),T.current=Date.now();return}Date.now()-T.current<zv||(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:l===`unpair:${e.fp}`?"Unpairing…":E?"Unpair — sure?":"Unpair"}),e.kind==="nearby"&&i.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:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&i.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:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&i.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:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}async function Tx(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}function pq({status:e,accounts:t,onClose:n,onChanged:s}){const a=Ut(n),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(!1),[m,y]=x.useState(null),v=x.useRef(null),N=A=>{const D=Js(m,A);return{disabled:D.disabled,"aria-busy":D.busy}},_=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{_.current&&vq(_.current,e.shared??[])&&(_.current=null)},[e.shared]);const k=x.useCallback(async(A,D,O="write")=>{v.current=O,y(O);try{const q=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:A})})).json().catch(()=>null);return S.current?(q!=null&&q.ok?h(null):h(Lt(D,q)),s(),(q==null?void 0:q.ok)===!0):!1}catch{return S.current&&h(Lt(D,null)),!1}finally{v.current=null,S.current&&y(null)}},[s]),j=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await k({name:l},"save the name","name"))return;S.current&&c(null)}n()},[l,e.name,k,n]),E=async()=>{if(!e.fp)return;const A=await Tx(e.fp);if(S.current){if(!A){h("Could not copy it — select the fingerprint and copy it by hand.");return}f(!0),window.setTimeout(()=>{S.current&&f(!1)},1600)}},C=new Set(_.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1;return vs.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[d&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:d}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Name"}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"appear as"}),i.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:A=>c(A.target.value),onKeyDown:A=>{A.key!=="Enter"||l==null||(k({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&i.jsx("button",{type:"button",className:"ap-manage-btn",...N("name"),onClick:()=>{k({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),i.jsxs("div",{className:"ap-lan-row",children:[i.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:e.fp}),i.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"})]}):i.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Share these accounts"}),i.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&i.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(A=>i.jsxs("label",{className:"ap-lan-pick",title:A.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:[i.jsx("input",{type:"checkbox",checked:C.has(A.key),onChange:D=>{const O=new Set(_.current??e.shared??[]);D.target.checked?O.add(A.key):O.delete(A.key),_.current=[...O],k({shared:[...O]},D.target.checked?"share that account":"stop sharing that account")}}),i.jsx("span",{className:"ap-lan-pick-name",children:A.email}),!A.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},A.key))]})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Pairing"}),i.jsxs("div",{className:"lan-switches",children:[i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),i.jsx("button",{type:"button",className:`ap-auto-state${T?" live":""}`,role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...N("ask"),onClick:()=>void k({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."})]}),i.jsxs("div",{className:"lan-switch",children:[i.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),i.jsx("button",{type:"button",className:`ap-auto-state${R?" live":""}`,role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks",...N("accept"),onClick:()=>void k({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."})]})]}),R?null:T?i.jsx("p",{className:"lan-note",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."}):i.jsxs("p",{className:"lan-note",children:["Nothing pairs on its own. You press ",i.jsx("strong",{children:"ask"})," on a deck you find, and ",i.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})]})]}),i.jsxs("footer",{className:"lan-setup-foot",children:[i.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),i.jsx("button",{type:"button",className:"btn primary",...N("name"),onClick:()=>void j(),children:"Done"})]})]})}),document.body)}function Lr(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 Ax={"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"}},mq={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 gq(e){var s;const t=yq[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&mq[n]||e}const yq={"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 V2(e,t){if(!e)return null;if(e.error)return Ax[e.error]??{text:gq(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Lr(e.at,t)}`,tone:"idle"};const s=n.filter(l=>l.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Lr(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Lr(e.at,t)}`,tone:"bad"}}const Bv=5e3,Y2=6e4,zv=400;function wq(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 Lt(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 vq(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function xq(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function K2(e,t){var n,s;return(n=e.last)!=null&&n.error&&!Ax[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<pd||e.lastSeen!=null&&t-e.lastSeen<pd)}const pd=95e3;function bq(e,t){const n=[],s=[];for(const a of e??[])(K2(a,t)?n:s).push(a);return{online:n,offline:s}}function kq(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(v=>v.paired!==!1||v.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(v=>v.waiting),l=s.filter(v=>!v.waiting),c=a.filter(v=>{var N;return!((N=v.last)!=null&&N.error)&&v.lastSeen!=null&&t-v.lastSeen<pd}),{online:d,offline:h}=bq(l,t),p=[...h,...a.filter(v=>!c.includes(v))],f=d.length+c.length,m=d.filter(v=>{var N;return((N=v.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(f&&m.length===f)return{text:f===1?"1 deck found · waiting for them to accept":`${f} decks found · waiting for them to accept`,tone:"wait"};if(!f)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=f===1?"1 deck ready":`${f} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function _q(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Lr(e,t);return s==="now"?"checked just now":`checked ${s}`}function Rx(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 Nq(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<pd;return{text:n?"online · one-way, it calls in":`one-way · last online ${Lr(e,t)}`,here:n}}function q1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Lr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function Sq(e,t){var y,v,N,_,S;if(!e)return[];const n=[],s=new Set,a=(k,j)=>k.name.localeCompare(j.name,void 0,{numeric:!0}),l=e.aliases??{},c=(k,j)=>{const E=k?l[k]:void 0;return E&&E!==j?{name:E,self:j}:{name:j}};for(const k of e.pending??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);n.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"asks",state:`wants to pair · ${Rx(k.at,t)}`,tone:"wait",here:!0,hint:`${j.name} at ${k.addr} is waiting for an answer.`})}const d=[],h=[];for(const k of e.peers??[]){const j=k.peerFp??k.fp;if(!j||s.has(j))continue;s.add(j);const E=V2(k.last,t),C=K2(k,t),T=k.addr?`${k.addr}:${k.port}`:"";if(!k.paired&&k.manual&&!k.met){h.push({fp:T,name:T||k.name||j,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?Nq(k.lastSeen,t):null,A=R?R.here:C,D=!R&&E?A?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${q1(k,A,t)}`:R?R.text:q1(k,A,t),O=(v=k.last)!=null&&v.error?Ax[k.last.error]:null,I=!R&&A&&!((N=k.last)!=null&&N.error)&&!(((_=k.last)==null?void 0:_.done)??[]).length,q=k.manual&&!k.met?{name:T}:c(j,k.name||j);d.push({fp:j,name:q.name,...q.self?{self:q.self}:{},addr:k.addr??"",kind:"paired",state:D,quiet:I,tone:O?O.tone==="bad"?"bad":"wait":E?E.tone:A?"ok":"idle",here:R?R.here:C,hint:R?`${q.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 ${Lr(k.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${q.name}${T?` at ${T}`:""}${(S=k.last)!=null&&S.error?` — ${k.last.error}`:""}`})}n.push(...jq(d).sort(a),...h.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 j=c(k.fp,k.name||k.fp);p.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${j.name} at ${k.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const f=[];for(const k of e.declined??[]){if(!(k!=null&&k.fp)||s.has(k.fp))continue;s.add(k.fp);const j=c(k.fp,k.name||k.fp);f.push({fp:k.fp,name:j.name,...j.self?{self:j.self}:{},addr:k.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(...f.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 jq(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(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push(F1(s.filter(c=>c.addr===l)));n.push(...s.filter(l=>!l.addr))}else n.push(F1(s))}return n}function F1(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 B1(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function z1(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 Eq(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 l=Number(n[a])-Number(s[a]);if(l)return Math.sign(l)}return 0}function Cq(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 Tq(e,t,n){const s=new Map(t.map(d=>[d.key,d])),a=new Set(n),l=[],c=new Set;for(const d of e??[]){if(c.has(d.key))continue;c.add(d.key);const h=s.get(d.key)??null,p=a.has(d.key),f=Cq(d,h,p),m=h?h.alive?"works":"expired":"missing",y=!d.alive&&h&&!h.alive?f.note:[m==="works"?null:f.here,d.alive?null:f.there,f.note].filter(Boolean).join(" · ")||null;l.push({key:d.key,email:d.email,here:m,there:d.alive?"works":"broken",in:d.alive?f.tone==="wait"?"wait":f.tone==="bad"?"blocked":"live":"cut",out:p&&h?h.alive?"live":"cut":null,caption:y,tone:f.tone})}for(const d of n){const h=s.get(d);!h||c.has(d)||(c.add(d),l.push({key:d,email:h.email,here:h.alive?"works":"expired",there:"unknown",in:null,out:h.alive?"live":"cut",caption:h.alive?null:"expired here",tone:h.alive?"ok":"bad"}))}return l}async function Jo(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function Aq({accounts:e,onChanged:t}){const[n,s]=x.useState(null),[a,l]=x.useState([]),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),y=x.useRef(0),[v,N]=x.useState(!1),[_,S]=x.useState(!1),[k,j]=x.useState(!1),[E,C]=x.useState(null),T=x.useRef(null),R=x.useCallback(ce=>Td(T.current)?(T.current=ce,d(ce),!0):!1,[]),A=x.useCallback(()=>{T.current=null,q.current&&d(null)},[]),D=ce=>{const we=Js(c,ce);return{disabled:we.disabled,"aria-busy":we.busy}},[O,I]=x.useState(()=>Date.now()),q=x.useRef(!0),J=x.useRef(Bv),Z=x.useCallback(async()=>{var ce,we;try{const[be,Be]=await Promise.all([fetch("/api/lan").then(_e=>_e.json()),fetch("/api/prefs").then(_e=>_e.json())]);if(!q.current)return;be!=null&&be.ok&&s(be),Be!=null&&Be.ok&&l(Array.isArray((we=(ce=Be.prefs)==null?void 0:ce.lan)==null?void 0:we.manual)?Be.prefs.lan.manual:[]),J.current=(be==null?void 0:be.enabled)===!0?Bv:Y2}catch{}},[]);x.useEffect(()=>{q.current=!0;let ce=0;const we=async()=>{I(Date.now()),await Z(),q.current&&(ce=window.setTimeout(we,J.current))};return we(),()=>{q.current=!1,window.clearTimeout(ce)}},[Z]);const $=x.useCallback(async()=>{const ce=(n==null?void 0:n.enabled)===!0;if(R("switch"))try{const we=await Jo("/api/prefs",{lan:{enabled:!ce}});if(!q.current)return;we!=null&&we.ok?(C(null),ce||p(!0)):C(Lt(ce?"turn this off":"turn this on",we)),await Z()}catch{q.current&&C(Lt(ce?"turn this off":"turn this on",null))}finally{A()}},[n==null?void 0:n.enabled,Z,R,A]),K=x.useCallback(async(ce,we,be)=>{if(!R(`${ce}:${we}`))return null;let Be=null;try{const _e=await Jo("/api/lan/peer",{action:ce,fp:we});if(!q.current)return null;_e!=null&&_e.ok?(s(_e),C(null)):(Be=Lt(be,_e),C(Be)),await Z()}catch{Be=Lt(be,null),q.current&&C(Be)}finally{A()}return Be},[Z,R,A]),G=x.useCallback(async ce=>{if(!R(`drop:${ce}`))return null;let we=null;try{const be=await Jo("/api/prefs",{lan:{manual:a.filter(Be=>Be!==ce)}});if(!q.current)return null;be!=null&&be.ok?(C(null),t()):(we=Lt("stop dialling that address",be),C(we)),await Z()}catch{we=Lt("stop dialling that address",null),q.current&&C(we)}finally{A()}return we},[a,Z,t,R,A]),[z,X]=x.useState(null),L=x.useCallback(async(ce,we)=>{if(!R(`alias:${ce}`))return"Something else is still being saved. Try again in a moment.";try{const be=await Jo("/api/lan/peer",{action:"alias",fp:ce,name:we});return q.current?be!=null&&be.ok?(s(be),null):Lt("rename that deck",be):null}catch{return Lt("rename that deck",null)}finally{A()}},[R,A]),W=x.useCallback(async ce=>{if(!R(`check:${ce}`))return null;try{const we=await Jo("/api/lan/sync",{fp:ce});return q.current?we!=null&&we.ok?(s(we),t(),null):(we==null?void 0:we.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.":Lt("check that deck",we):null}catch{return Lt("check that deck",null)}finally{A()}},[R,A,t]),P=x.useCallback(async()=>{if(R("check"))try{const ce=await Jo("/api/lan/sync",{});if(!q.current)return;ce!=null&&ce.ok?(s(ce),C(null)):C(Lt("check the other decks",ce)),t()}catch{q.current&&C(Lt("check the other decks",null))}finally{A()}},[R,A,t]),V=(n==null?void 0:n.enabled)===!0,he=Sq(n,O),H=z?he.find(ce=>{var we;return ce.fp===z||((we=ce.twins)==null?void 0:we.some(be=>be.fp===z))})??null:null;x.useEffect(()=>{z&&n&&!H&&X(null)},[z,n,H]);const U=he.filter(ce=>ce.kind==="asks"),ee=he.filter(ce=>ce.kind!=="asks"),Y=ee.filter(ce=>ce.here),se=ee.filter(ce=>!ce.here),me=se.filter(ce=>ce.tone==="bad").length,ge=k||Y.length===0,Re=kq(n,O),Oe=ee.filter(ce=>ce.kind==="paired").length;return i.jsxs("div",{className:"ap-auto ap-lan",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Local network"}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>N(!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:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),V&&Oe>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...D("check"),onClick:()=>void P(),"aria-label":c==="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:i.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:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),V&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...D("setup"),onClick:()=>p(!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:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),i.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),i.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),i.jsx("button",{type:"button",className:`ap-auto-state${V?" live":""}`,role:"switch","aria-checked":V,"aria-label":"Local network sync",...D("switch"),onClick:()=>void $(),title:V?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins"})]}),!V&&i.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>S(!0),title:"Four pictures: what this does, and what to do on each machine",children:[i.jsx(nq,{}),i.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),i.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),i.jsx("p",{className:`ap-lan-status ${Re.tone}`,role:"status",children:Re.tone==="ok"?"":Re.text}),E&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:E}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>C(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),V&&i.jsxs(i.Fragment,{children:[U.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:U.map(ce=>i.jsxs("div",{className:"ap-lan-ask",children:[i.jsxs("span",{className:"ap-lan-ask-what",children:[i.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",i.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:ce.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`accept:${ce.fp}`),onClick:()=>void K("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"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...D(`dismiss:${ce.fp}`),onClick:()=>void K("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))}),(ge?[...Y,...se]:Y).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(ge?[...Y,...se]:Y).map((ce,we)=>i.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,children:[i.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ce.name}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${we}`,onClick:()=>X(ce.fp),children:i.jsxs("span",{className:"vis-hidden",children:[ce.name,", details"]})}),i.jsx("span",{id:`lan-who-state-${we}`,className:ce.quiet?"vis-hidden":"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`accept:${ce.fp}`),onClick:()=>void K("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"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${f===ce.fp?" armed":""}`,...D(`unpair:${ce.fp}`),onClick:()=>{if(f!==ce.fp){m(ce.fp),y.current=Date.now(),window.setTimeout(()=>m(be=>be===ce.fp?null:be),4e3);return}Date.now()-y.current<zv||(m(null),K("unpair",ce.fp,"unpair that deck"))},"aria-label":f===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:f===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:f===ce.fp?"sure?":"unpair"}),ce.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`drop:${ce.fp}`),onClick:()=>void G(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...D(`allow:${ce.fp}`),onClick:()=>void K("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}`))}),(Y.length>0&&se.length>0||V&&Oe>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[Y.length>0&&se.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":k,onClick:()=>j(ce=>!ce),title:k?"Show only the decks that are on":`Show the ${se.length} deck${se.length===1?"":"s"} that are not answering right now`,children:[i.jsx("span",{className:`ap-lan-chev${k?" open":""}`,"aria-hidden":!0,children:"›"}),k?"fewer":`${se.length} more`,!k&&me>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",me," not answering"]})]}),V&&Oe>0&&i.jsx("span",{className:"ap-lan-checked",children:_q(n==null?void 0:n.checkedAt,O,c==="check")})]}),ee.length===0&&U.length===0&&i.jsxs(i.Fragment,{children:[i.jsxs("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, ",i.jsx("strong",{children:"+"})," at the top of this section reaches one by address or by invite."]}),i.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>S(!0),children:"How it works"})]})]}),v&&n&&i.jsx(aq,{status:n,manual:a,onClose:()=>N(!1),onChanged:()=>{Z(),t()}}),_&&i.jsx(H2,{title:"How Local network works",steps:tq,finish:V?void 0:{label:"Turn it on",act:()=>{S(!1),$()}},onClose:()=>S(!1)}),h&&n&&i.jsx(pq,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{Z(),t()}}),H&&n&&i.jsx(fq,{row:H,source:z1(n,H),status:n,accounts:e,now:O,busy:c,onClose:()=>X(null),onRename:ce=>L(H.fp,ce),onCheck:()=>W(H.fp),onVerb:()=>{switch(H.kind){case"paired":return K("unpair",H.fp,"unpair that deck");case"nearby":return K("accept",H.fp,"reach that deck");case"declined":return K("allow",H.fp,"let that deck ask again");case"dialling":return G(H.fp);default:return Promise.resolve(null)}},onSettings:()=>{X(null),p(!0)},twins:(H.twins??[]).map(ce=>({row:ce,peer:z1(n,ce).peer??null})),onUnpair:ce=>K("unpair",ce,"unpair that deck")})]})}const U1=15e3,Rq=8e3,Wf=1800,Mq=3e4,Iq=[70,80,85,90,95];function W1(e,t){return $2(t-Math.floor(e/1e3))}function $q(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 Oq(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 Pq(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 H1(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 G1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",a=e.resetAt?O2(e.resetAt,t):null;return i.jsxs("div",{className:"ap-lane",children:[i.jsx("span",{className:"ap-lane-label",children:e.label}),i.jsx("div",{className:"ap-lane-track",children:i.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),i.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),i.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function V1(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 Lq({onClose:e,leaving:t}){var ye,je,Fe,Ye,ct;const[n,s]=x.useState(null),[a,l]=x.useState(null),[c,d]=x.useState(null),[h,p]=x.useState(!1),[f,m]=x.useState(null),[y,v]=x.useState(()=>Math.floor(Date.now()/1e3)),N=x.useRef(null),[_,S]=x.useState(null),[k,j]=x.useState(!1),[E,C]=x.useState(""),[T,R]=x.useState(null),[A,D]=x.useState(null),[O,I]=x.useState(null),[q,J]=x.useState(!1),[Z,$]=x.useState(!1),[K,G]=x.useState(null),[z,X]=x.useState(null),[L,W]=x.useState(null),[P,V]=x.useState(null),[he,H]=x.useState(!1),U=x.useRef(null),ee=x.useRef(null),[Y,se]=x.useState([]),me=x.useRef(null),ge=x.useCallback(re=>Td(me.current)?(me.current=re,d(re),!0):!1,[]),Re=x.useCallback(()=>{me.current=null,d(null)},[]),Oe=(re,Ae=!1)=>{const ae=Js(c,re);return{disabled:ae.disabled,"aria-busy":ae.busy||Ae}},ce=x.useCallback(re=>{window.requestAnimationFrame(()=>{var Ae;if(tD(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const ae of eD(re)){const Ee=document.querySelector(ae);if(Ee){Ee.focus();return}}})},[]),we=x.useCallback(async(re=!1)=>{re&&p(!0);const Ae=new AbortController,ae=window.setTimeout(()=>Ae.abort(),Mq);try{const[Ee,De]=await Promise.all([fetch(`/api/claude-accounts${re?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Ee.ok){const xt=await Ee.json();s(xt),se(Me=>P6(Me,xt.accounts))}De.ok&&l(await De.json());const mt=B6([await R1(Ee),await R1(De)]);m(xt=>M1(xt,mt))}catch{m(Ee=>M1(Ee,Ae.signal.aborted?F6:q6))}finally{window.clearTimeout(ae),re&&p(!1)}},[]),be=x.useCallback(async(re,Ae)=>{if(!ge(Ae))return null;m(null);try{const Ee=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ee!=null&&Ee.ok||m({text:Dv(Ee,"command failed"),raw:mi(Ee)}),Ee}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]),Be=x.useCallback(async(re,Ae)=>{if(!ge(Ae))return null;m(null);try{const Ee=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return Ee!=null&&Ee.ok||m({text:ri(Ee,"command failed")}),Ee}catch{return m({text:"server unreachable"}),null}finally{Re()}},[ge,Re]);x.useEffect(()=>(we(!0),N.current=window.setInterval(()=>we(!1),U1),()=>{N.current!=null&&window.clearInterval(N.current)}),[we]),x.useEffect(()=>{const re=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const _e=((ye=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:ye.value)??"90",Ce=P??_e,Ge=R6(Ce,_e),tt=(je=n==null?void 0:n.accounts)==null?void 0:je.find(re=>re.active),Qe=((Fe=A1((tt==null?void 0:tt.lanes)??[]).peak)==null?void 0:Fe.pct)??null,Xe=Qe!=null&&Qe>=Number(_e)-15,Ke=async re=>{if(ge(`switch-${re}`)){m(null);try{const ae=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:re})})).json().catch(()=>null);ae!=null&&ae.ok||m({text:Dv(ae,"the switch failed"),raw:mi(ae)}),await we(!0)}catch{m({text:"server unreachable"})}finally{Re(),ce(re)}}},fe=async(re,Ae)=>{const{commit:ae,alias:Ee}=D6(E,Ae);if(ae){const De=await Be({action:"alias",account:re,alias:Ee},`alias-${re}`);if(await we(!0),!(De!=null&&De.ok))return;C(Ee)}R(re),window.setTimeout(()=>R(De=>De===re?null:De),Wf)},dt=async(re,Ae)=>{const ae=await Be({action:"move",account:re,slot:Ae},`move-${re}`),Ee=C6({menuFor:_,shareFor:(O==null?void 0:O.num)??null},re,ae);if(await we(!0),Ee){S(Ee.menuFor),D(Ee.confirmRemove),Ee.shareFor==null&&(I(null),$(!1)),G(Ee.swapNote);const De=Ee.swapNote;De&&window.setTimeout(()=>G(mt=>mt===De?null:mt),Rq),X(null),ce(Ee.menuFor)}return ae},yt=async(re,Ae,ae)=>{if(ae.sends){const Ee=await dt(re,Ae);if(!(Ee!=null&&Ee.ok))return}W(re),window.setTimeout(()=>W(Ee=>Ee===re?null:Ee),Wf)},ot=async(re,Ae)=>{if(Ae.sends){const ae=await be({action:"setting",key:"autoswitch.threshold",value:re},"threshold");if(await we(!0),!(ae!=null&&ae.ok))return;V(null)}H(!0),window.setTimeout(()=>{var ae;document.activeElement===ee.current&&((ae=U.current)==null||ae.focus()),H(!1)},Wf)};return i.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[i.jsxs("div",{className:"ap-header",children:[i.jsx("h2",{children:"Claude accounts"}),i.jsxs("div",{className:"ap-header-right",children:[i.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>j(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((Ye=n==null?void 0:n.accounts)==null?void 0:Ye.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>J(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Xt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:i.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:[i.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),i.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),i.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>we(!0),...Oe("reload",h),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:i.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:[i.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),i.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})})]})]}),n==null?f?i.jsxs("div",{className:"ap-empty",role:"alert",children:[i.jsx("span",{title:f.raw||void 0,children:f.text}),i.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",U1/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:h,onClick:()=>we(!0),children:h?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"ap-list",children:(ct=n.accounts)==null?void 0:ct.map(re=>{const{shown:Ae,rest:ae,fuller:Ee,peak:De}=A1(re.lanes),mt=Y.includes(jx(re)),xt=M6(ae.length,mt,Ee);return i.jsxs("li",{className:`ap-account${re.active?" active":""}`,children:[i.jsxs("div",{className:"ap-account-head",children:[i.jsx("span",{className:"ap-num",children:re.num}),re.alias&&i.jsx("span",{className:"ap-alias",title:re.alias,children:re.alias}),i.jsx("span",{className:"ap-email",title:re.email??void 0,children:re.email}),i.jsx("button",{type:"button",id:`ap-more-${re.num}`,className:`ap-more${_===re.num?" on":""}`,"aria-label":`Manage account ${re.num}`,"aria-expanded":_===re.num,"aria-controls":_===re.num?`ap-manage-${re.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(_===re.num?null:re.num),C(re.alias??""),D(null),I(null),$(!1),G(null),R(null),X(null),W(null)},children:"⋯"}),re.active&&i.jsx("span",{className:"ap-badge-active",children:"active"}),re.disabled&&i.jsx("span",{className:"ap-badge-held",children:"held out"}),!re.active&&!re.disabled&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...Oe(`switch-${re.num}`),onClick:()=>Ke(re.num),title:`Switch to ${re.alias??re.email}`,children:c===`switch-${re.num}`?"…":"switch"})]}),i.jsx("div",{className:"ap-lanes",id:`ap-lanes-${re.num}`,children:Ae.length?i.jsxs(i.Fragment,{children:[Ae.map(Me=>i.jsx(G1,{lane:Me,nowSec:y},Me.id)),mt&&ae.map(Me=>i.jsx(G1,{lane:Me,nowSec:y},Me.id))]}):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsxs("div",{className:"ap-meta",children:[re.staleCopy&&(()=>{const Me=Oq(re.repair??null,y);return i.jsx("span",{className:"ap-stale-copy",title:Me.hint,children:Me.text})})(),re.stopped&&(()=>{const Me=H1(re.collector??null);return i.jsx("span",{className:"ap-stopped",title:(Me==null?void 0:Me.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.",children:(Me==null?void 0:Me.text)??"not collecting"})})(),re.stopped&&(()=>{var Ze;const Me=(Ze=H1(re.collector??null))==null?void 0:Ze.fix;return Me?i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account puts its login in this slot.",children:Me}):null})(),re.error&&(()=>{const Me=Pq(re.error);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"ap-err",title:Me.hint,children:Me.text}),Me.fixable&&i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>j(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),xt&&i.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":mt,"aria-controls":`ap-lanes-${re.num}`,title:I6(re.headroom,(De==null?void 0:De.label)??null,ae.length,mt),onClick:()=>se(Me=>O6(Me,re)),children:xt}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!re.active||re.disabled)&&i.jsx("button",{type:"button",className:"ap-rotate",...Oe(`rot-${re.num}`),onClick:()=>be({action:"account",account:re.num,enabled:re.disabled},`rot-${re.num}`).then(()=>we(!0)),title:re.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:re.disabled?"put back":"hold out"}),re.fetchedAt?i.jsxs("span",{className:`ap-age${re.stale&&!re.stopped&&!re.error?" 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 ",W1(re.fetchedAt,y),$q(re.nextAt,y)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),_===re.num&&i.jsxs("div",{className:"ap-manage",id:`ap-manage-${re.num}`,role:"group","aria-label":`Manage account ${re.num}`,children:[i.jsxs("div",{className:"ap-manage-name",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${re.num}`,children:"Alias"}),i.jsx("input",{id:`ap-alias-${re.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Me=>C(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"&&fe(re.num,re.alias)},maxLength:L6,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),i.jsx("button",{type:"button",className:"ap-manage-btn",...Oe(`alias-${re.num}`),onClick:()=>fe(re.num,re.alias),title:"A short name to show instead of the email",children:T===re.num?"saved":"save"})]}),(()=>{const Me=E6((n.accounts??[]).map(wt=>wt.num),re.num),Ze=T6(Me,z,re.num),ht=A6(Me,Ze,re.num);return i.jsxs("div",{className:"ap-manage-slot",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${re.num}`,children:"Slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${re.num}`,value:String(Ze),...Oe(`move-${re.num}`),onChange:wt=>X(Number(wt.target.value)),children:Me.map(wt=>i.jsx("option",{value:wt.slot,children:wt.label},wt.slot))})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...Oe(`move-${re.num}`),title:ht.title,onClick:()=>yt(re.num,Ze,ht),children:L===re.num?ht.done:ht.label})]})})(),i.jsxs("div",{className:"ap-manage-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...Oe(`share-${re.num}`),title:`Copy this account to another ${Xt}. 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:async()=>{$(!1);const Me=await Be({action:"share",account:re.num},`share-${re.num}`);Me!=null&&Me.ok&&I({num:re.num,blob:Me.blob,expiresAt:Me.expiresAt})},children:"share"}),i.jsx("button",{type:"button",className:`ap-manage-btn danger${A===re.num?" armed":""}`,...Oe(`rm-${re.num}`),title:A===re.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(A!==re.num){D(re.num),window.setTimeout(()=>D(Me=>Me===re.num?null:Me),4e3);return}D(null),Be({action:"remove",account:re.num},`rm-${re.num}`).then(()=>{S(null),we(!0),ce(null)})},children:A===re.num?"confirm":"remove"})]}),(K==null?void 0:K.at)===re.num&&(()=>{var ht;const Me=(ht=n.accounts)==null?void 0:ht.find(wt=>wt.num===K.displaced),Ze=(Me==null?void 0:Me.alias)??(Me==null?void 0:Me.email)??"the account that was there";return i.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${K.at} was taken, so the two accounts traded places: ${Ze} now holds slot ${K.displaced}.`,children:["swapped with slot ",K.displaced]})})(),(O==null?void 0:O.num)===re.num&&(()=>{const Me=W2(O.expiresAt,y),Ze=Me.tone==="gone";return i.jsxs("div",{className:`ap-share${Ze?" expired":""}`,children:[i.jsx("code",{className:"ap-share-blob",children:O.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...Oe(`share-${re.num}`),onClick:async()=>{if(Ze){$(!1);const ht=await Be({action:"share",account:re.num},`share-${re.num}`);ht!=null&&ht.ok&&I({num:re.num,blob:ht.blob,expiresAt:ht.expiresAt});return}await V1(O.blob)&&($(!0),window.setTimeout(()=>$(!1),1800))},children:Ze?"make a new share":Z?"copied":"copy"}),i.jsxs("span",{className:"ap-manage-hint",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:[i.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",i.jsx("span",{className:`ap-share-expiry ${Me.tone}`,children:Me.text})]})]})]})})()]})]},re.num)})}),i.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."}),(a==null?void 0:a.ok)&&i.jsxs("div",{className:"ap-auto",children:[i.jsxs("div",{className:"ap-auto-head",children:[i.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),i.jsx("button",{type:"button",className:`ap-auto-state${a.enabled?" live":""}`,role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...Oe("enable"),onClick:()=>be({action:"enable",enabled:!a.enabled},"enable").then(()=>we(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit"})]}),i.jsxs("div",{className:"ap-auto-ctl",children:[Qe!=null&&i.jsxs("span",{className:`ap-auto-now${Xe?" near":""}`,title:`The active account has used ${Math.round(Qe)}% of its limit. Auto-switch trips at ${_e}%.`,children:[Math.round(Qe),"%"]}),i.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:i.jsx("select",{ref:U,"aria-label":"Switch threshold",value:Ce,...Oe("threshold"),onChange:re=>V(re.target.value),children:Iq.map(re=>i.jsxs("option",{value:re,children:[re,"%"]},re))})}),(Ge.sends||he)&&i.jsx("button",{ref:ee,type:"button",className:"ap-manage-btn",...Oe("threshold"),title:Ge.title,onClick:()=>ot(Ce,Ge),children:he&&!Ge.sends?Ge.done:Ge.label})]}),a.external&&i.jsxs("p",{className:"ap-auto-note",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",i.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.":"."]}),a.lastTick&&i.jsx("div",{className:"ap-auto-foot",children:i.jsxs("span",{className:"ap-auto-result",children:["checked ",W1(a.lastTick.at,y)]})})]}),f&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:f.raw||void 0,children:f.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsx(Aq,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({key:`${String(re.email??"").trim().toLowerCase()}@@${re.orgUuid??""}`,email:re.email??"",alive:re.alive===!0})),onChanged:()=>we(!0)})]}):i.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"claude-swap isn't installed."}),i.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&&i.jsx("code",{className:"ap-cmd",children:n.hint}),i.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",i.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"No accounts added yet."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",i.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Couldn't read the account store."}),i.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&i.jsx(_6,{onClose:()=>j(!1),onChanged:()=>we(!0)}),q&&i.jsx(j6,{accounts:((n==null?void 0:n.accounts)??[]).map(re=>({num:re.num,email:re.email,alias:re.alias,org:re.org})),onClose:()=>J(!1),copyText:V1})]})}const Dq=3e4;function qq({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Fq({bundle:e,running:t,pending:n,lastTried:s}){return t?qq({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Bq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function zq({asked:e,reported:t}){return t?t!==e:!1}function X2(e){const t=e.thresholdMs??Dq;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 Uq(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 Wq(e,t){return e?t==null?"auto when idle":`auto in ${Uq(t)}`:"auto-restart off"}function Y1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Hq(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 Gq(e){const t=X2(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 Vq(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function Yq(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 Kq(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Xq(e,t){const n=Kq(e),s=n?`removes ${n} on the canvas`:null,a=d=>`This ${s?`${s} and ${d}`:d}`;if(!t)return{note:`${a("deletes 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. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${a("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const d=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${a("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const l=t.decks-1,c=l===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${a(`deletes the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${c} This cannot be undone.`,confirm:"Clear everything"}}function Qq({agentCount:e,onConfirm:t,onCancel:n}){const s=x.useRef(null),a=Ut(n,{focusRef:s,layer:a4}),[l,c]=x.useState(null);x.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||c(Yq(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:h}=Xq(e,l);return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"status-dot err","aria-hidden":!0}),i.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:d}),i.jsxs("div",{className:"cc-actions",children:[i.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),i.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const Zq="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",Jq=[{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:"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:"?",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 eF({onClose:e,onTour:t}){const n=Ut(e);return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal key-help",onClick:s=>s.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsx("div",{className:"modal-title",children:i.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:Zq}),t&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),i.jsx("div",{className:"shortcuts",children:Jq.map(s=>i.jsxs(x.Fragment,{children:[i.jsx("h3",{className:"kh-group",children:s.title}),s.rows.map(a=>i.jsxs("div",{className:"sc",children:[i.jsx("kbd",{children:a.cap}),i.jsx("span",{children:a.action})]},`${s.title}:${a.cap}:${a.action}`))]},s.title))})]})]})})}const tF=["done","needs-input"],nF=[{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}]}],rF=[{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}]}],Mx={done:nF,"needs-input":rF},gi="two";function Uv(e,t){const n=Mx[e];return n.find(s=>s.id===t)??n.find(s=>s.id===gi)??n[0]}function Q2(e,t){return Mx[e].some(s=>s.id===t)?t:gi}Uv("done",gi).notes,Uv("needs-input",gi).notes;const K1=.04,sF=.24,Qu=0,md=100,Wv=5,Gl=50;function Vl(e){if(!Number.isFinite(e))return Gl;const t=Math.round(e/Wv)*Wv;return Math.min(md,Math.max(Qu,t))}function aF(e){if(e==null)return Gl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Vl(Number(t)):Gl}function oF(e){const t=Vl(e),n=K1+(sF-K1)*(t/md);return Math.round(n*1e4)/1e4}function iF(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(oF(e)*s*1e4)/1e4}const lF=160,cF="agent-dag.soundLevel.done",uF="agent-dag.soundLevel.needs-input",dF="agent-dag.soundFigure.done",hF="agent-dag.soundFigure.needs-input",Z2={done:cF,"needs-input":uF},J2={done:dF,"needs-input":hF},Hv={done:{level:Gl,figure:gi},"needs-input":{level:Gl,figure:gi}};function fF(e){const t=n=>({level:aF(e(Z2[n])),figure:Q2(n,e(J2[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const pF={Stop:"done",Notification:"needs-input"};function mF(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:pF[n]??null}function gF(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",l=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,a())};function c(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(l,()=>{}),s=!0,l()}catch{}}function d(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Hv)[h]??Hv[h],m=Uv(h,f.figure),y=iF(f.level,m),v=n.currentTime;for(const _ of m.notes){const S=n.createOscillator(),k=n.createGain();S.type=m.type??"sine",S.frequency.value=_.hz;const j=v+_.at,E=j+_.ms/1e3;k.gain.setValueAtTime(1e-4,j),k.gain.exponentialRampToValueAtTime(y,j+.012),k.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(k).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:c,play:d,state:a,get context(){return n}}}const yF="Notify me when a session needs my attention.",wF="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",X1="Get notified when you're away from this tab.";function vF(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:X1};case"default":return{status:null,ask:!0,ok:!1,note:X1};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 Q1={done:"Turn finished","needs-input":"Claude is asking"},xF={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function bF({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:l,onPreview:c,openerRef:d,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:m,onAskNotify:y}){const v=vF(m),N=h&&!f,_=Ut(e),S=x.useRef(e);return S.current=e,x.useEffect(()=>{const k=j=>{var C,T;const E=j.target;E&&((C=_.current)!=null&&C.contains(E)||(T=d.current)!=null&&T.contains(E)||S.current())};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[_,d]),i.jsxs("div",{ref:_,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[i.jsxs("div",{className:"sm-switches",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),i.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsxs("div",{className:"sm-setting",children:[i.jsxs("label",{className:"sm-switch",children:[i.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),i.jsx("button",{type:"button",role:"switch","aria-checked":h,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:i.jsx("span",{className:"sm-toggle-knob"})})]}),i.jsx("p",{className:"sm-note",children:f?wF:yF})]})]}),N&&i.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[i.jsxs("div",{className:"sm-channel-head",children:[i.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),v.ask?i.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):i.jsxs("span",{className:"sm-channel-state","data-ok":v.ok||void 0,children:[v.ok&&i.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:i.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),v.status]})]}),i.jsx("p",{className:"sm-note",children:v.note})]}),!t&&i.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."}),i.jsx("div",{className:"sm-tones",children:tF.map(k=>{const j=s[k],E=`sm-level-${k}`,C=`sm-figure-${k}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${k}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${k}`,children:Q1[k]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(k),"aria-label":`Hear the ${Q1[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:[i.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:E,children:"Volume"}),i.jsx("input",{id:E,type:"range",min:Qu,max:md,step:Wv,value:j.level,onChange:T=>a(k,Number(T.target.value)),style:{"--sm-level":`${(j.level-Qu)/(md-Qu)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:C,children:"Tone"}),i.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:T=>l(k,T.target.value),children:Mx[k].map(T=>i.jsx("option",{value:T.id,children:T.label},T.id))})]}),i.jsx("p",{className:"sm-note",children:xF[k]})]},k)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const kF=15e3;function _F(e){return e.visibilityState==="visible"&&e.hasFocus()}function NF(e,t){return t||e===!0}function SF(){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 jF={"//":["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."],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
|
|
82
|
+
|
|
83
|
+
\`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
|
|
84
|
+
|
|
85
|
+
**Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
|
|
86
|
+
|
|
87
|
+
Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
88
|
+
|
|
89
|
+
The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
|
|
90
|
+
|
|
91
|
+
The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
|
|
92
|
+
|
|
93
|
+
A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
|
|
94
|
+
|
|
95
|
+
Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
|
|
96
|
+
|
|
97
|
+
Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
|
|
98
|
+
|
|
99
|
+
What you are reading is the first version that does not.
|
|
100
|
+
|
|
101
|
+
No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
|
|
102
|
+
|
|
103
|
+
The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
|
|
104
|
+
|
|
105
|
+
What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
|
|
106
|
+
|
|
107
|
+
Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
|
|
108
|
+
|
|
109
|
+
With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
110
|
+
|
|
111
|
+
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
112
|
+
|
|
113
|
+
**Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
|
|
114
|
+
|
|
115
|
+
There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
|
|
116
|
+
|
|
117
|
+
\`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
|
|
118
|
+
|
|
119
|
+
The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
|
|
120
|
+
|
|
121
|
+
**A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
|
|
122
|
+
|
|
123
|
+
**Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
|
|
124
|
+
|
|
125
|
+
**Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
|
|
126
|
+
|
|
127
|
+
**Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
|
|
128
|
+
|
|
129
|
+
**A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
|
|
130
|
+
|
|
131
|
+
**Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
|
|
132
|
+
|
|
133
|
+
The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
|
|
134
|
+
|
|
135
|
+
A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
|
|
136
|
+
|
|
137
|
+
When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
|
|
138
|
+
|
|
139
|
+
Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
|
|
140
|
+
|
|
141
|
+
The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
|
|
142
|
+
|
|
143
|
+
There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
|
|
144
|
+
|
|
145
|
+
It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
|
|
146
|
+
|
|
147
|
+
What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
|
|
148
|
+
|
|
149
|
+
Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
|
|
150
|
+
|
|
151
|
+
An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
|
|
152
|
+
|
|
153
|
+
Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
|
|
154
|
+
|
|
155
|
+
One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
|
|
156
|
+
|
|
157
|
+
Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
|
|
158
|
+
|
|
159
|
+
The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
|
|
160
|
+
|
|
161
|
+
The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
|
|
162
|
+
|
|
163
|
+
What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
|
|
164
|
+
|
|
165
|
+
So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
|
|
166
|
+
|
|
167
|
+
It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
|
|
168
|
+
|
|
169
|
+
Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
|
|
170
|
+
|
|
171
|
+
And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
|
|
172
|
+
|
|
173
|
+
What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
|
|
174
|
+
|
|
175
|
+
It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
|
|
176
|
+
|
|
177
|
+
It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
|
|
178
|
+
|
|
179
|
+
The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
|
|
180
|
+
|
|
181
|
+
One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
|
|
182
|
+
|
|
183
|
+
With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
|
|
184
|
+
|
|
185
|
+
The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
|
|
186
|
+
|
|
187
|
+
It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
|
|
188
|
+
|
|
189
|
+
Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
|
|
190
|
+
|
|
191
|
+
The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
|
|
192
|
+
|
|
193
|
+
It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
|
|
194
|
+
|
|
195
|
+
Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
|
|
196
|
+
|
|
197
|
+
One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
|
|
198
|
+
|
|
199
|
+
It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
|
|
200
|
+
|
|
201
|
+
The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
|
|
202
|
+
|
|
203
|
+
It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
|
|
204
|
+
|
|
205
|
+
The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
|
|
206
|
+
|
|
207
|
+
On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
|
|
208
|
+
|
|
209
|
+
A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
|
|
210
|
+
|
|
211
|
+
It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
|
|
212
|
+
|
|
213
|
+
And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
|
|
214
|
+
|
|
215
|
+
The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
|
|
216
|
+
|
|
217
|
+
Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
|
|
218
|
+
|
|
219
|
+
This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
|
|
220
|
+
|
|
221
|
+
It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
|
|
222
|
+
|
|
223
|
+
The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
|
|
224
|
+
|
|
225
|
+
Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
|
|
226
|
+
|
|
227
|
+
A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
|
|
228
|
+
|
|
229
|
+
Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
|
|
230
|
+
|
|
231
|
+
It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
|
|
232
|
+
|
|
233
|
+
When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
|
|
234
|
+
|
|
235
|
+
Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
|
|
236
|
+
|
|
237
|
+
The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
|
|
238
|
+
|
|
239
|
+
You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
|
|
240
|
+
|
|
241
|
+
It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
|
|
242
|
+
|
|
243
|
+
The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
|
|
244
|
+
|
|
245
|
+
M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
|
|
246
|
+
|
|
247
|
+
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
|
|
248
|
+
|
|
249
|
+
Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
|
|
250
|
+
|
|
251
|
+
The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
|
|
252
|
+
|
|
253
|
+
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
|
|
254
|
+
|
|
255
|
+
It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
|
|
256
|
+
|
|
257
|
+
While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
|
|
258
|
+
|
|
259
|
+
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.
|
|
260
|
+
|
|
261
|
+
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.`}]},Ix="agent-dag.releaseNotesSeen";function Z1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function yi(e,t){const n=Z1(e),s=Z1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const l=(n[a]??0)-(s[a]??0);if(l!==0)return l<0?-1:1}return 0}function wi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function EF(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 CF(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(EF);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>yi(s.version,n.version))}const J1=CF(jF);function eA(e,t,n){return e.filter(s=>yi(s.version,n)<=0&&(t===null||yi(s.version,t)>0))}function TF(e,t){return e.filter(n=>yi(n.version,t)===0)}function AF(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 RF({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 l=yi(a,t);return l<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.`:l>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 MF=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function IF(e){const t=MF.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function e_(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function $F(e){if(!e)return null;let t=null;try{t=e.getItem(Ix)}catch{return null}return wi(t)?t:null}function OF(e){if(!e)return!1;try{return e.getItem(Ix),!0}catch{return!1}}function PF(e,t){if(!e)return!1;try{return e.setItem(Ix,t),!0}catch{return!1}}const tA="agent-dag.tourSeen";function LF(e){if(!e)return!1;try{return e.getItem(tA)==="1"}catch{return!1}}function DF(e){if(!e)return!1;try{return e.setItem(tA,"1"),!0}catch{return!1}}function qF({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 FF({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=TF(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=yi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=eA(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function BF(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 nA(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){a(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=BF(e,l);if(c>0){a(),n.push({kind:"bold",kids:nA(e.slice(l+2,c),!1)}),l=c+2;continue}}s+=e[l],l+=1}return a(),n}function zF({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:l}){const c=Ut(a),d=AF(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal release-notes",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),d&&i.jsx("span",{className:"modal-tool-id",children:d})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsx("p",{className:"modal-note",children:RF({since:t,running:n,firstRun:s,entries:e})}),l&&i.jsxs("div",{className:"guide-door",children:[i.jsx("span",{children:"Eight pictures of what the deck shows."}),i.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),e.map(h=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",h.version]}),i.jsx("ul",{className:"rn-notes",children:h.notes.map((p,f)=>{const{icon:m,rest:y}=IF(p.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[m&&i.jsx("span",{className:"rn-note-icon",children:m}),y]}),i.jsx("p",{className:"rn-note-body",children:rA(nA(p.body))})]},f)})})]},h.version))]})]})})}function rA(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?i.jsx("code",{className:"rn-code",children:t.text},n):i.jsx("strong",{className:"rn-strong",children:rA(t.kids)},n))}function UF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function WF(e,t,n){var c;if(e.length===0)return null;const s=UF(e),a=t?s.findIndex(d=>d.id===t):-1,l=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((c=s[l])==null?void 0:c.id)??null}const HF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function GF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:HF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const VF=new Set(["","BODY","HTML","#DOCUMENT"]);function YF(e){return!e||bx(e)?!1:!VF.has(String(e.tagName??"").toUpperCase())}function Pu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function KF(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 XF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function QF(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 l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&s.has(c.parentId)&&!s.has(c.id)&&(s.add(c.id),l=!0)}return s}function ZF(e,t){const n=new Set;for(const s of t){const a=QF(e,s);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}function Gv(e,t,n){return!t.has(e)||n.has(e)}function JF(e,t,n,s){return!t.has(e)&&Gv(e,n,s)}function e8(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function t8(e,t,n,s){n.set(e,t),s.delete(e)}const n8=40,r8=120;function s8(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const l=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(h,p,f)=>{if(n!=null){if(s<=h)return;c()}const m=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(l,m)};return{live(h=n8){const p=t.now(),f=Math.max(a+h,p);if(f<=p){c(),l();return}d(f,p,h)},replay(h=r8){c(),s=t.now()+h,n=t.setTimeout(l,h)},flush(){c(),l()},cancel(){c()}}}const a8=1e3;function o8(e={}){const t=Math.max(1,Math.floor(e.limit??a8)),n=e.protect;let s=!1,a=[],l=new Set,c=0,d=0,h=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return d},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==h;y&&(h=m,d=0);const v=f!==null&&!y&&f<=d;if(f!==null&&f>d&&(d=f),!s)return!0;if(v)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let N=0;if(l.size<a.length)for(;l.has(a[N]);)N++;const[_]=a.splice(N,1);l.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const f=a;return a=[],l=new Set,c=0,f}}}const sA="agent-dag.theme";function i8(e){return e==="light"?"light":"dark"}function l8(){return i8(bi(sA))}function c8({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Xt}`:Xt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Lu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Du(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 u8=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Du(Lu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Du(Lu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Du(Lu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Du(Lu.idle,"idle"))}`}),d8="No sessions are waiting for you.";function h8(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 f8(e,t){return t!==""?t:e===""?"":d8}function p8(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function m8(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function g8(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const t_={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function $x(e){const t=e.toLowerCase();return Object.hasOwn(t_,t)?t_[t]:t?t[0].toUpperCase()+t.slice(1):""}function y8(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function w8(e,t=[]){const n=t.length?y8(t.map($x)):g8(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function v8(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 x8(e,t){const n=t.prefs??Hv,s=Vl(n.done.level),a=Vl(n["needs-input"].level),l=s===a?`${s}%`:`${s}% and ${a}%`,c=t.on?`Sound: on at ${l} — 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)",d=e.codex?`
|
|
262
|
+
|
|
263
|
+
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.`:"",h=t.on&&t.locked?`
|
|
264
|
+
|
|
265
|
+
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+d+h+`
|
|
266
|
+
|
|
267
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function aA(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const a=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};a.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,a.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,a)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function b8(e){const t=aA([{agents:e}]);return t.length<2?null:t.map(n=>`${$x(n.id)} ${rt(n.cost)}`).join(" · ")}function n_(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function k8(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function qu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const _8=[7,14,30,90];function N8(e){const[t,n]=x.useState(null),[s,a]=x.useState(!1),l=x.useState(p8)[0],c=x.useRef(!1),d=(h=!1)=>{if(h&&!pr(c.current))return;const p=l.begin();c.current=h;const f=e;a(!0);const y=`/api/ccusage?since=${Ov(f)}${h?"&refresh=1":""}`;fetch(y).then(v=>v.json()).then(v=>{p()&&n({range:f,resp:v})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(c.current=!1,a(!1))})};return x.useEffect(()=>(d(!1),()=>l.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function S8({onClose:e,providers:t}){var D;const[n,s]=x.useState(30),[a,l]=x.useState(null),{landed:c,loading:d,reload:h}=N8(n),p=x.useRef(null),f=Ut(e,{focusRef:p}),m=m8({loading:d,want:n,answer:c&&{range:c.range,ok:c.resp.ok===!0,days:((D=c.resp.days)==null?void 0:D.length)??0}}),y=m.phase==="chart"?c.resp.days??[]:[],v=x.useMemo(()=>y.reduce((O,I)=>Math.max(O,I.totalCost),0),[y]),N=x.useRef(null);x.useLayoutEffect(()=>{const O=N.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:S,inOut:k,cacheRead:j,modelCosts:E}=x.useMemo(()=>{let O=0,I=0,q=0,J=0;const Z=new Map;for(const $ of y){O+=$.totalCost,I+=$.totalTokens,q+=$.inputTokens+$.outputTokens,J+=$.cacheReadTokens;for(const K of $.modelBreakdowns)Z.set(K.modelName,(Z.get(K.modelName)??0)+K.cost)}return{totalCost:O,totalTok:I,inOut:q,cacheRead:J,modelCosts:Z}},[y]),C=x.useMemo(()=>Array.from(E.entries()).sort((O,I)=>I[1]-O[1]),[E]),T=x.useMemo(()=>aA(y),[y]),R=T.length>1,A=a?y.find(O=>O.period===a)??null:null;return i.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:f,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[i.jsxs("header",{className:"uh-head",children:[i.jsxs("div",{className:"uh-titlewrap",children:[i.jsx("div",{className:"uh-title",children:"Usage history"}),i.jsx("div",{className:"uh-sub",children:w8(t,T.map(O=>O.id))})]}),i.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:_8.map(O=>i.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),l(null)},children:[O,"d"]},O))}),i.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...fr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),i.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),m.phase==="busy"?i.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[i.jsx("span",{className:"uh-wait-word",children:c?"running ccusage…":"running ccusage… (first run downloads the package)"}),i.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):m.phase==="error"?i.jsxs("div",{className:"uh-status uh-err",title:mi(c.resp)||void 0,children:[m6(c.resp,"ccusage did not report usage"),i.jsx("div",{children:i.jsx("button",{className:"btn uh-retry",onClick:h,...fr(d),children:d?"trying…":"Try again"})})]}):m.phase==="empty"?i.jsx("div",{className:`uh-status${m.stale?" uh-stale":""}`,"aria-busy":m.stale||void 0,children:"no usage in this range"}):i.jsxs("div",{className:m.stale?"uh-stale":void 0,"aria-busy":m.stale||void 0,children:[i.jsxs("div",{className:"uh-totals",children:[i.jsx(Fu,{label:"total cost",val:rt(_),accent:!0}),i.jsx(Fu,{label:"tokens",val:Rt(S)}),i.jsx(Fu,{label:"input+output",val:Rt(k)}),i.jsx(Fu,{label:"cache reads",val:Rt(j)})]}),R&&i.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[i.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:T.map(O=>i.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:n_(O.id)}},O.id))}),i.jsx("div",{className:"uh-agent-keys",children:T.map(O=>i.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Rt(O.tokens)} tokens`,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:n_(O.id)}}),$x(O.id),i.jsx("span",{className:"uh-agent-cost",children:rt(O.cost)}),i.jsx("span",{className:"uh-agent-share",children:k8(O.cost,_)})]},O.id))})]}),i.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,I)=>{const q=v>0?O.totalCost/v*100:0,J=O.period===a,Z=`${O.period}, ${rt(O.totalCost)}`;return i.jsxs("button",{className:`uh-bar-col${J?" sel":""}`,onClick:()=>l(J?null:O.period),"aria-pressed":J,"aria-label":Z,title:`${O.period} · ${rt(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":I,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[i.jsx("div",{className:"uh-bar",style:{height:`${Math.max(q,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort(($,K)=>K.cost-$.cost).map($=>{const K=O.totalCost>0?$.cost/O.totalCost*100:0;return i.jsx("div",{className:"uh-bar-seg",style:{height:`${K}%`,background:qu($.modelName)}},$.modelName)})}),i.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),i.jsx("div",{className:"uh-legend",children:C.map(([O,I])=>i.jsxs("span",{className:"uh-legend-item",title:O,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O)}}),ws(O)," ",i.jsx("span",{className:"uh-legend-cost",children:rt(I)})]},O))}),A&&i.jsxs("div",{className:"uh-detail",children:[i.jsxs("div",{className:"uh-detail-head",children:[i.jsx("span",{className:"uh-detail-date",children:A.period}),i.jsx("span",{className:"uh-detail-cost",children:rt(A.totalCost)}),(()=>{var q,J;const I=b8(A.agents)??((J=(q=A.metadata)==null?void 0:q.agents)!=null&&J.length?A.metadata.agents.join(" · "):null);return I?i.jsx("span",{className:"uh-detail-agents",title:I,children:I}):null})()]}),i.jsxs("div",{className:"uh-detail-mini",children:[i.jsx(Bu,{label:"input",val:Rt(A.inputTokens)}),i.jsx(Bu,{label:"output",val:Rt(A.outputTokens)}),i.jsx(Bu,{label:"cache write",val:Rt(A.cacheCreationTokens)}),i.jsx(Bu,{label:"cache read",val:Rt(A.cacheReadTokens)})]}),i.jsx("div",{className:"uh-detail-models",children:A.modelBreakdowns.slice().sort((O,I)=>I.cost-O.cost).map(O=>{const I=A.totalCost>0?O.cost/A.totalCost*100:0;return i.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[i.jsxs("span",{className:"uh-model-name",children:[i.jsx("span",{className:"uh-legend-dot",style:{background:qu(O.modelName)}}),i.jsx("span",{className:"uh-model-label",children:ws(O.modelName)})]}),i.jsx("span",{className:"uh-model-bar",children:i.jsx("span",{className:"uh-model-bar-fill",style:{width:`${I}%`,background:qu(O.modelName)}})}),i.jsx("span",{className:"uh-model-cost",children:rt(O.cost)})]},O.modelName)})})]})]})]})})}function Fu({label:e,val:t,accent:n}){return i.jsxs("div",{className:"uh-stat",children:[i.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),i.jsx("span",{className:"uh-stat-label",children:e})]})}function Bu({label:e,val:t}){return i.jsxs("div",{className:"uh-ministat",children:[i.jsx("span",{className:"uh-ministat-val",children:t}),i.jsx("span",{className:"uh-ministat-label",children:e})]})}function j8(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(a=>{const l=a/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const r_=1e4,E8=12e3;function C8({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const l=x.useRef(null),c=x.useRef(null);return c.current={browsers:e,findings:t,watching:n},x.useEffect(()=>{var v;const d=l.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const p=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,m=!1;const y=()=>{var z;if(m)return;const N=c.current;if(!N)return;const{browsers:_,findings:S,watching:k}=N,j=s["--accent"]||"#7dd3fc",E=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",T=j8(s["--bg"]),R=T?42:26,A=T?.85:.65,D=a(),O=Math.min(window.devicePixelRatio||1,2),I=d.clientWidth,q=d.clientHeight;(d.width!==I*O||d.height!==q*O)&&(d.width=I*O,d.height=q*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,I,q);const J=I/2,Z=q/2,$=Math.min(I,q)/2-6;h.strokeStyle=E,h.lineWidth=1,h.globalAlpha=T?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(J,Z,$*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(J-$,Z),h.lineTo(J+$,Z),h.moveTo(J,Z-$),h.lineTo(J,Z+$),h.stroke(),h.globalAlpha=1;const G=(k&&!p?D%r_/r_:0)*Math.PI*2-Math.PI/2;if(k){const X=(z=h.createConicGradient)==null?void 0:z.call(h,G-.85,J,Z);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${j} ${R}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(J,Z),h.arc(J,Z,$,G-.85,G),h.closePath(),h.fill()),h.strokeStyle=j,h.globalAlpha=A,h.beginPath(),h.moveTo(J,Z),h.lineTo(J+Math.cos(G)*$,Z+Math.sin(G)*$),h.stroke(),h.globalAlpha=1}_.forEach((X,L)=>{const W=L/Math.max(_.length,1)*Math.PI*2-Math.PI/2,P=X.lastReadMs===null?1:Math.min(1,(D-X.lastReadMs)/12e4),V=$*(.42+P*.5),he=J+Math.cos(W)*V,H=Z+Math.sin(W)*V,U=Math.abs((G-W+Math.PI*3)%(Math.PI*2)-Math.PI),ee=k?Math.max(0,1-U/.55):0;h.beginPath(),h.arc(he,H,3+ee*1.6,0,Math.PI*2),h.fillStyle=X.running?j:C,h.globalAlpha=X.running?.55+ee*.45:.35,h.fill(),h.globalAlpha=1});for(const X of S){const L=(D-X.atMs)/E8;if(L<0||L>1)continue;const P=Math.max(0,_.findIndex(H=>H.key===X.browser))/Math.max(_.length,1)*Math.PI*2-Math.PI/2,V=J+Math.cos(P)*$*.6,he=Z+Math.sin(P)*$*.6;h.beginPath(),h.arc(V,he,4+L*22,0,Math.PI*2),h.strokeStyle=j,h.globalAlpha=(1-L)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{m=!0,cancelAnimationFrame(f)}},[a,s]),i.jsx("canvas",{ref:l,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const s_="agent-dag.browserWatch.seenMs";function T8(e,t){return e.filter(n=>n.startMs>t)}function A8(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function R8(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function oA(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function a_(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function M8(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function I8(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function $8(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=oA(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function O8(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function P8(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function o_(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function L8({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Ut(e),[l,c]=x.useState(null),[d,h]=x.useState(null),[p,f]=x.useState(null),[m,y]=x.useState(!1),v=x.useRef(!1),[N,_]=x.useState(null),[S,k]=x.useState(null),[j,E]=x.useState(!1),C=x.useRef(!1),[T,R]=x.useState(!1),[A,D]=x.useState(!1),[O,I]=x.useState(!1),[q,J]=x.useState(!1),[Z,$]=x.useState(!1),[K,G]=x.useState(()=>Date.now());x.useEffect(()=>{const Y=setInterval(()=>G(Date.now()),1e3);return()=>clearInterval(Y)},[]);const z=x.useCallback(async Y=>{var se,me;if(!(Y&&!pr(v.current))){v.current=Y,y(!0);try{const ge=await fetch(`/api/browser-watch${Y?"?refresh=1":""}`);if(!ge.ok)throw new Error(`the deck answered ${ge.status}`);const Re=await ge.json();c(Re),C.current||_(((se=Re==null?void 0:Re.settings)==null?void 0:se.quietMinutes)??15),n(((me=Re==null?void 0:Re.settings)==null?void 0:me.enabled)===!0),h(null)}catch(ge){h(ge instanceof Error?ge.message:String(ge))}finally{v.current=!1,y(!1)}}},[n]);x.useEffect(()=>{z(!1)},[z]),x.useEffect(()=>{const Y=setInterval(()=>{z(!1)},1e4);return()=>clearInterval(Y)},[z]);const X=x.useCallback(async Y=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Y.host,startMs:Y.startMs})})}finally{await z(!1)}},[z]),L=x.useCallback(async Y=>{C.current=!0,E(!0);try{const se=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});if(!se.ok)throw new Error(`the deck answered ${se.status}`);await z(!1),f(null)}catch(se){f(se instanceof Error?se.message:String(se))}finally{C.current=!1,E(!1)}},[z]),W=x.useRef(t);W.current=t,x.useEffect(()=>()=>W.current(Date.now()),[]);const P=x.useMemo(()=>{const Y=[];for(const se of(l==null?void 0:l.episodes)??[]){const me=P8(se.startMs),ge=Y[Y.length-1];ge&&ge.label===me?ge.episodes.push(se):Y.push({label:me,episodes:[se]})}return Y},[l]),V=oA(l==null?void 0:l.browsers),he=((l==null?void 0:l.browsers)??[]).filter(Y=>!(Y.installed&&Y.profiles>0)),H=l?$8(l):null,U=V.reduce((Y,se)=>Y+se.profiles,0),ee=l?A8(l.coverage.lastHumanMs,l.coverage.quietMs,K):null;return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal bw-modal",onClick:Y=>Y.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),i.jsx("span",{className:"modal-tool-id",children:l?`${U} ${U===1?"profile":"profiles"} · local only`:"local only"})]}),i.jsxs("div",{className:"modal-actions",children:[i.jsx("button",{className:"glyph-btn",onClick:()=>void z(!0),...fr(m),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:m?"…":"↻"}),i.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),i.jsxs("div",{className:"modal-body bw-body",children:[!l&&!d&&i.jsxs("div",{className:"bw-loading",children:[i.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),i.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&i.jsx("div",{className:"bw-state",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not read"}),i.jsx("span",{className:"bw-row-detail",children:d})]})}),l&&H&&i.jsx("p",{className:`bw-trouble ${H.kind}`,role:"status",children:H.text}),l&&i.jsxs("div",{className:"bw-work",children:[i.jsxs("aside",{className:"bw-side",children:[i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",i.jsx("button",{className:"bw-help",onClick:()=>I(Y=>!Y),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),i.jsxs("div",{className:"bw-glance",children:[i.jsx(C8,{browsers:V.map(Y=>{var se;return{key:Y.key,name:Y.name,running:Y.running,lastReadMs:((se=l.profiles.find(me=>me.browser===Y.key))==null?void 0:se.lastWrittenMs)??null}}),findings:l.episodes.slice(0,6).map(Y=>({browser:Y.browser??null,atMs:Y.endMs})),watching:l.settings.enabled,palette:s}),i.jsx("ul",{className:"bw-counts",children:M8(V,l.profiles).map(Y=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-count-n",children:Y.visits.toLocaleString("en-US")}),i.jsx("span",{className:"bw-count-of",children:Y.name})]},Y.key))})]}),i.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),l.coverage.checkedMs>0&&i.jsxs("p",{className:"bw-since",children:["Last checked ",I8(l.coverage.checkedMs,K),l.coverage.checks>0&&i.jsxs(i.Fragment,{children:[" · ",l.coverage.checks.toLocaleString("en-US")," ",l.coverage.checks===1?"check":"checks"]})]}),ee!==null&&i.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",R8(ee)]}),O&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Sweep"}),i.jsx("dd",{children:"one poll of every watched profile"}),i.jsx("dt",{children:"Dot"}),i.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),i.jsx("dt",{children:"Ring"}),i.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),i.jsxs("section",{className:"bw-sec",children:[i.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",i.jsx("button",{className:"bw-help",onClick:()=>J(Y=>!Y),"aria-expanded":q,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),q&&i.jsxs("dl",{className:"bw-key",children:[i.jsx("dt",{children:"Running"}),i.jsx("dd",{children:"the browser has a process on this machine right now"}),i.jsx("dt",{children:"Connected"}),i.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),i.jsx("ul",{className:"bw-profiles",children:V.map(Y=>i.jsxs("li",{children:[i.jsx("span",{className:`bw-prof-dot${Y.running?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-prof-name",children:Y.name}),i.jsx("span",{className:"bw-prof-state",children:Y.running?"running":"idle"}),Y.running&&Y.relay.state==="live"&&i.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Y.key))}),he.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>$(Y=>!Y),"aria-expanded":Z,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:Z?"▾":"▸"})," ",he.length," not watched"]}),Z&&i.jsxs("p",{className:"bw-rest",children:[he.map(Y=>Y.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),l.relay&&i.jsx(D8,{relay:l.relay})]}),i.jsxs("div",{className:"bw-main",children:[i.jsxs("section",{className:"bw-findings",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",l.episodes.length>0&&i.jsxs("span",{className:"bw-feed-count",children:[l.episodes.length," ",l.episodes.length===1?"episode":"episodes"]})]}),i.jsx("div",{className:"bw-eps",children:P.length===0?i.jsxs("div",{className:"bw-empty",children:[i.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),i.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",l.settings.quietMinutes," ",l.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!l.settings.enabled&&i.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):P.map(Y=>i.jsxs("div",{className:"bw-day",children:[i.jsx("h4",{className:"bw-sec-head",children:Y.label}),Y.episodes.map(se=>{const me=`${se.host}-${se.startMs}`,ge=S===me;return i.jsxs("div",{className:`bw-ep${ge?" open":""}`,children:[i.jsxs("div",{className:"bw-ep-row",children:[i.jsxs("button",{className:"bw-ep-head",onClick:()=>k(ge?null:me),"aria-expanded":ge,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ge?"▾":"▸"}),i.jsx("span",{className:"bw-ep-host",children:se.host}),i.jsxs("span",{className:"bw-ep-meta",children:[O8(se),o_(se)&&i.jsxs(i.Fragment,{children:[" · ",o_(se)]})]}),i.jsxs("span",{className:"bw-ep-count",children:[se.count," ",se.count===1?"page":"pages"]})]}),i.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void X(se),"aria-label":`Dismiss ${se.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ge&&i.jsx("ul",{className:"bw-urls",children:se.urls.map((Re,Oe)=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-url-time",children:new Date(Re.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),i.jsx("span",{className:"bw-url",children:Re.url})]},`${Re.url}-${Re.timeMs}-${Oe}`))})]},me)})]},Y.label))})]}),i.jsxs("section",{className:"bw-feed",children:[i.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",i.jsxs("span",{className:"bw-feed-count",children:[l.log.length," ",l.log.length===1?"event":"events"]})]}),i.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),i.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:l.log.length===0?i.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):l.log.map(Y=>i.jsxs("div",{className:`bw-log-line ${Y.level}${Y.parts?"":" sys"}`,children:[i.jsx("span",{className:"bw-log-time",children:new Date(Y.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Y.parts?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"bw-log-browser",children:Y.parts.browser}),i.jsx("span",{className:"bw-log-profile",title:Y.parts.profile,children:Y.parts.profile}),i.jsxs("span",{className:"bw-log-value",children:[Y.parts.value,Y.parts.flagged>0&&i.jsxs("span",{className:"bw-log-flag",children:[" · ",Y.parts.flagged," flagged"]})]})]}):i.jsx("span",{className:"bw-log-sys",children:Y.text})]},`${Y.atMs}-${Y.level}-${Y.text}`))})]})]})]}),l&&T&&i.jsxs("div",{className:"bw-settings",children:[i.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[i.jsx("span",{children:"Nobody browsing for"}),i.jsxs("select",{value:N??l.settings.quietMinutes,onChange:Y=>{_(Number(Y.target.value)),L({quietMinutes:Number(Y.target.value)})},children:[i.jsx("option",{value:1,children:"1 min"}),i.jsx("option",{value:5,children:"5 min"}),i.jsx("option",{value:15,children:"15 min"}),i.jsx("option",{value:30,children:"30 min"}),i.jsx("option",{value:60,children:"60 min"})]})]}),i.jsxs("label",{children:[i.jsx("span",{children:"When it finds one"}),i.jsx("select",{value:l.settings.reaction,onChange:Y=>void L({reaction:Y.target.value}),disabled:!l.settings.enabled,title:l.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(l.reactions??["notify"]).map(Y=>i.jsx("option",{value:Y,children:Y==="notify"?"notify me":Y==="close-tab"?"close the tab":"quit the browser"},Y))})]}),i.jsxs("div",{className:"bw-settings-note",children:[i.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",i.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),i.jsxs("button",{className:"bw-why",onClick:()=>D(Y=>!Y),"aria-expanded":A,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," What Browser Watch can access"]}),A&&i.jsxs("dl",{className:"bw-access",children:[i.jsx("dt",{children:"Reads"}),i.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(l.coverage.startedMs).toLocaleString(),"."]}),i.jsx("dt",{children:"Keeps"}),i.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",i.jsx("code",{className:"bw-path",children:l.coverage.logPath}),", with every address written in full so you can check it yourself."]}),i.jsx("dt",{children:"Sends"}),i.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),i.jsx("dt",{children:"Never reads"}),i.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&i.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:i.jsxs("div",{className:"bw-row err",children:[i.jsx("span",{className:"bw-dot","aria-hidden":!0}),i.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),i.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),i.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),l&&i.jsxs("footer",{className:"bw-status",children:[i.jsx("span",{className:`bw-mode-dot${l.settings.enabled?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-mode-word",children:a_(l,j).word},a_(l,j).kind),i.jsx("span",{className:"bw-status-text",children:l.coverage.archived===0?l.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${l.coverage.archived} ${l.coverage.archived===1?"episode":"episodes"} on disk`}),i.jsx("button",{className:`glyph-btn bw-gear${T?" on":""}`,onClick:()=>R(Y=>!Y),"aria-expanded":T,"aria-label":"Settings",title:"Settings",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),i.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),i.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[i.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),i.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":l.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void L({enabled:!l.settings.enabled}),title:l.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:i.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function D8({relay:e}){const[t,n]=x.useState(!1),[s,a]=x.useState(!1),l=e.killswitch.blocked?"unblock":"block",c=e.command[l],d=x.useCallback(async()=>{await Tx(c.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[c.command]),h=e.profiles.filter(f=>{var m;return(m=f.report)==null?void 0:m.present}),p=e.profiles.filter(f=>f.report===null);return i.jsxs("section",{className:"bw-sec",children:[i.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),i.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&i.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(f=>i.jsx("code",{className:"bw-path",children:f},f))]}),i.jsxs("button",{className:"bw-why",onClick:()=>n(f=>!f),"aria-expanded":t,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&i.jsxs("div",{className:"bw-rc-body",children:[h.length>0&&i.jsx("dl",{className:"bw-key",children:h.map(f=>i.jsxs(x.Fragment,{children:[i.jsxs("dt",{children:[f.name,f.profile==="Default"?"":` · ${f.profile}`]}),i.jsxs("dd",{children:[f.report.enabled?"enabled":"installed but switched off",f.report.allUrls?", can act on every site":", limited to the sites it was granted",f.report.sensitiveApis.length>0&&i.jsxs(i.Fragment,{children:[" — ",f.report.sensitiveApis.join(", ")]})]})]},`${f.browser}/${f.profile}`))}),p.length>0&&i.jsxs("p",{className:"bw-rc-note",children:[p.map(f=>f.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&i.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),h.some(f=>f.report.allUrls)&&i.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",i.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),i.jsxs("div",{className:"bw-rc-cmd",children:[i.jsx("code",{children:c.command}),i.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),i.jsx("p",{className:"bw-rc-note",children:c.note})]})]})}function q8(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,l)=>(a.at??0)-(l.at??0));return{request:s[0],waiting:s.length-1}}function F8({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:l,onLater:c}){const d=x.useRef(null),h=Ut(c,{focusRef:d}),p=Js(n,"accept"),f=Js(n,"dismiss");return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:h,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[i.jsxs("header",{className:"modal-head",children:[i.jsxs("div",{className:"modal-title",children:[i.jsx("i",{className:"ap-pulse","aria-hidden":!0}),i.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),i.jsx("div",{className:"modal-actions",children:i.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),i.jsxs("section",{className:"modal-body",children:[i.jsxs("p",{className:"lan-ask-who",children:[i.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",i.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Rx(e.at,s)]}),i.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."}),i.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",i.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&&i.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.`}),i.jsxs("div",{className:"lan-ask-acts",children:[i.jsx("button",{type:"button",ref:d,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),i.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 Ox(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 Hf,i_;function B8(){if(i_)return Hf;i_=1;function e(){this.__data__=[],this.size=0}return Hf=e,Hf}var Gf,l_;function ki(){if(l_)return Gf;l_=1;function e(t,n){return t===n||t!==t&&n!==n}return Gf=e,Gf}var Vf,c_;function Rd(){if(c_)return Vf;c_=1;var e=ki();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return Vf=t,Vf}var Yf,u_;function z8(){if(u_)return Yf;u_=1;var e=Rd(),t=Array.prototype,n=t.splice;function s(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():n.call(l,c,1),--this.size,!0}return Yf=s,Yf}var Kf,d_;function U8(){if(d_)return Kf;d_=1;var e=Rd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Kf=t,Kf}var Xf,h_;function W8(){if(h_)return Xf;h_=1;var e=Rd();function t(n){return e(this.__data__,n)>-1}return Xf=t,Xf}var Qf,f_;function H8(){if(f_)return Qf;f_=1;var e=Rd();function t(n,s){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,s])):a[l][1]=s,this}return Qf=t,Qf}var Zf,p_;function Md(){if(p_)return Zf;p_=1;var e=B8(),t=z8(),n=U8(),s=W8(),a=H8();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Zf=l,Zf}var Jf,m_;function G8(){if(m_)return Jf;m_=1;var e=Md();function t(){this.__data__=new e,this.size=0}return Jf=t,Jf}var ep,g_;function V8(){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 tp,y_;function Y8(){if(y_)return tp;y_=1;function e(t){return this.__data__.get(t)}return tp=e,tp}var np,w_;function K8(){if(w_)return np;w_=1;function e(t){return this.__data__.has(t)}return np=e,np}var rp,v_;function iA(){if(v_)return rp;v_=1;var e=typeof vu=="object"&&vu&&vu.Object===Object&&vu;return rp=e,rp}var sp,x_;function vr(){if(x_)return sp;x_=1;var e=iA(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return sp=n,sp}var ap,b_;function _i(){if(b_)return ap;b_=1;var e=vr(),t=e.Symbol;return ap=t,ap}var op,k_;function X8(){if(k_)return op;k_=1;var e=_i(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function l(c){var d=n.call(c,a),h=c[a];try{c[a]=void 0;var p=!0}catch{}var f=s.call(c);return p&&(d?c[a]=h:delete c[a]),f}return op=l,op}var ip,__;function Q8(){if(__)return ip;__=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return ip=n,ip}var lp,N_;function Xa(){if(N_)return lp;N_=1;var e=_i(),t=X8(),n=Q8(),s="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(d){return d==null?d===void 0?a:s:l&&l in Object(d)?t(d):n(d)}return lp=c,lp}var cp,S_;function Vn(){if(S_)return cp;S_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return cp=e,cp}var up,j_;function oc(){if(j_)return up;j_=1;var e=Xa(),t=Vn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(d){if(!t(d))return!1;var h=e(d);return h==s||h==a||h==n||h==l}return up=c,up}var dp,E_;function Z8(){if(E_)return dp;E_=1;var e=vr(),t=e["__core-js_shared__"];return dp=t,dp}var hp,C_;function J8(){if(C_)return hp;C_=1;var e=Z8(),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 hp=n,hp}var fp,T_;function lA(){if(T_)return fp;T_=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 pp,A_;function eB(){if(A_)return pp;A_=1;var e=oc(),t=J8(),n=Vn(),s=lA(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,d=Object.prototype,h=c.toString,p=d.hasOwnProperty,f=RegExp("^"+h.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var v=e(y)?f:l;return v.test(s(y))}return pp=m,pp}var mp,R_;function tB(){if(R_)return mp;R_=1;function e(t,n){return t==null?void 0:t[n]}return mp=e,mp}var gp,M_;function Qa(){if(M_)return gp;M_=1;var e=eB(),t=tB();function n(s,a){var l=t(s,a);return e(l)?l:void 0}return gp=n,gp}var yp,I_;function Px(){if(I_)return yp;I_=1;var e=Qa(),t=vr(),n=e(t,"Map");return yp=n,yp}var wp,$_;function Id(){if($_)return wp;$_=1;var e=Qa(),t=e(Object,"create");return wp=t,wp}var vp,O_;function nB(){if(O_)return vp;O_=1;var e=Id();function t(){this.__data__=e?e(null):{},this.size=0}return vp=t,vp}var xp,P_;function rB(){if(P_)return xp;P_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return xp=e,xp}var bp,L_;function sB(){if(L_)return bp;L_=1;var e=Id(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var d=c[l];return d===t?void 0:d}return s.call(c,l)?c[l]:void 0}return bp=a,bp}var kp,D_;function aB(){if(D_)return kp;D_=1;var e=Id(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return kp=s,kp}var _p,q_;function oB(){if(q_)return _p;q_=1;var e=Id(),t="__lodash_hash_undefined__";function n(s,a){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=e&&a===void 0?t:a,this}return _p=n,_p}var Np,F_;function iB(){if(F_)return Np;F_=1;var e=nB(),t=rB(),n=sB(),s=aB(),a=oB();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Np=l,Np}var Sp,B_;function lB(){if(B_)return Sp;B_=1;var e=iB(),t=Md(),n=Px();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Sp=s,Sp}var jp,z_;function cB(){if(z_)return jp;z_=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 Ep,U_;function $d(){if(U_)return Ep;U_=1;var e=cB();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return Ep=t,Ep}var Cp,W_;function uB(){if(W_)return Cp;W_=1;var e=$d();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Cp=t,Cp}var Tp,H_;function dB(){if(H_)return Tp;H_=1;var e=$d();function t(n){return e(this,n).get(n)}return Tp=t,Tp}var Ap,G_;function hB(){if(G_)return Ap;G_=1;var e=$d();function t(n){return e(this,n).has(n)}return Ap=t,Ap}var Rp,V_;function fB(){if(V_)return Rp;V_=1;var e=$d();function t(n,s){var a=e(this,n),l=a.size;return a.set(n,s),this.size+=a.size==l?0:1,this}return Rp=t,Rp}var Mp,Y_;function Lx(){if(Y_)return Mp;Y_=1;var e=lB(),t=uB(),n=dB(),s=hB(),a=fB();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++d<h;){var p=c[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Mp=l,Mp}var Ip,K_;function pB(){if(K_)return Ip;K_=1;var e=Md(),t=Px(),n=Lx(),s=200;function a(l,c){var d=this.__data__;if(d instanceof e){var h=d.__data__;if(!t||h.length<s-1)return h.push([l,c]),this.size=++d.size,this;d=this.__data__=new n(h)}return d.set(l,c),this.size=d.size,this}return Ip=a,Ip}var $p,X_;function Od(){if(X_)return $p;X_=1;var e=Md(),t=G8(),n=V8(),s=Y8(),a=K8(),l=pB();function c(d){var h=this.__data__=new e(d);this.size=h.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=l,$p=c,$p}var Op,Q_;function Dx(){if(Q_)return Op;Q_=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 Op=e,Op}var Pp,Z_;function cA(){if(Z_)return Pp;Z_=1;var e=Qa(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Pp=t,Pp}var Lp,J_;function Pd(){if(J_)return Lp;J_=1;var e=cA();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return Lp=t,Lp}var Dp,eN;function Ld(){if(eN)return Dp;eN=1;var e=Pd(),t=ki(),n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d){var h=l[c];(!(s.call(l,c)&&t(h,d))||d===void 0&&!(c in l))&&e(l,c,d)}return Dp=a,Dp}var qp,tN;function ic(){if(tN)return qp;tN=1;var e=Ld(),t=Pd();function n(s,a,l,c){var d=!l;l||(l={});for(var h=-1,p=a.length;++h<p;){var f=a[h],m=c?c(l[f],s[f],f,l,s):void 0;m===void 0&&(m=s[f]),d?t(l,f,m):e(l,f,m)}return l}return qp=n,qp}var Fp,nN;function mB(){if(nN)return Fp;nN=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return Fp=e,Fp}var Bp,rN;function qr(){if(rN)return Bp;rN=1;function e(t){return t!=null&&typeof t=="object"}return Bp=e,Bp}var zp,sN;function gB(){if(sN)return zp;sN=1;var e=Xa(),t=qr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return zp=s,zp}var Up,aN;function lc(){if(aN)return Up;aN=1;var e=gB(),t=qr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&s.call(c,"callee")&&!a.call(c,"callee")};return Up=l,Up}var Wp,oN;function It(){if(oN)return Wp;oN=1;var e=Array.isArray;return Wp=e,Wp}var Ml={exports:{}},Hp,iN;function yB(){if(iN)return Hp;iN=1;function e(){return!1}return Hp=e,Hp}Ml.exports;var lN;function Ni(){return lN||(lN=1,(function(e,t){var n=vr(),s=yB(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,d=c?n.Buffer:void 0,h=d?d.isBuffer:void 0,p=h||s;e.exports=p})(Ml,Ml.exports)),Ml.exports}var Gp,cN;function Dd(){if(cN)return Gp;cN=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var l=typeof s;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Gp=n,Gp}var Vp,uN;function qx(){if(uN)return Vp;uN=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Vp=t,Vp}var Yp,dN;function wB(){if(dN)return Yp;dN=1;var e=Xa(),t=qx(),n=qr(),s="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",m="[object Object]",y="[object RegExp]",v="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",k="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",D="[object Uint8ClampedArray]",O="[object Uint16Array]",I="[object Uint32Array]",q={};q[j]=q[E]=q[C]=q[T]=q[R]=q[A]=q[D]=q[O]=q[I]=!0,q[s]=q[a]=q[S]=q[l]=q[k]=q[c]=q[d]=q[h]=q[p]=q[f]=q[m]=q[y]=q[v]=q[N]=q[_]=!1;function J(Z){return n(Z)&&t(Z.length)&&!!q[e(Z)]}return Yp=J,Yp}var Kp,hN;function qd(){if(hN)return Kp;hN=1;function e(t){return function(n){return t(n)}}return Kp=e,Kp}var Il={exports:{}};Il.exports;var fN;function Fx(){return fN||(fN=1,(function(e,t){var n=iA(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l&&n.process,d=(function(){try{var h=a&&a.require&&a.require("util").types;return h||c&&c.binding&&c.binding("util")}catch{}})();e.exports=d})(Il,Il.exports)),Il.exports}var Xp,pN;function cc(){if(pN)return Xp;pN=1;var e=wB(),t=qd(),n=Fx(),s=n&&n.isTypedArray,a=s?t(s):e;return Xp=a,Xp}var Qp,mN;function uA(){if(mN)return Qp;mN=1;var e=mB(),t=lc(),n=It(),s=Ni(),a=Dd(),l=cc(),c=Object.prototype,d=c.hasOwnProperty;function h(p,f){var m=n(p),y=!m&&t(p),v=!m&&!y&&s(p),N=!m&&!y&&!v&&l(p),_=m||y||v||N,S=_?e(p.length,String):[],k=S.length;for(var j in p)(f||d.call(p,j))&&!(_&&(j=="length"||v&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,k)))&&S.push(j);return S}return Qp=h,Qp}var Zp,gN;function Fd(){if(gN)return Zp;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 Zp=t,Zp}var Jp,yN;function dA(){if(yN)return Jp;yN=1;function e(t,n){return function(s){return t(n(s))}}return Jp=e,Jp}var em,wN;function vB(){if(wN)return em;wN=1;var e=dA(),t=e(Object.keys,Object);return em=t,em}var tm,vN;function Bx(){if(vN)return tm;vN=1;var e=Fd(),t=vB(),n=Object.prototype,s=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var d in Object(l))s.call(l,d)&&d!="constructor"&&c.push(d);return c}return tm=a,tm}var nm,xN;function xs(){if(xN)return nm;xN=1;var e=oc(),t=qx();function n(s){return s!=null&&t(s.length)&&!e(s)}return nm=n,nm}var rm,bN;function ea(){if(bN)return rm;bN=1;var e=uA(),t=Bx(),n=xs();function s(a){return n(a)?e(a):t(a)}return rm=s,rm}var sm,kN;function xB(){if(kN)return sm;kN=1;var e=ic(),t=ea();function n(s,a){return s&&e(a,t(a),s)}return sm=n,sm}var am,_N;function bB(){if(_N)return am;_N=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return am=e,am}var om,NN;function kB(){if(NN)return om;NN=1;var e=Vn(),t=Fd(),n=bB(),s=Object.prototype,a=s.hasOwnProperty;function l(c){if(!e(c))return n(c);var d=t(c),h=[];for(var p in c)p=="constructor"&&(d||!a.call(c,p))||h.push(p);return h}return om=l,om}var im,SN;function Za(){if(SN)return im;SN=1;var e=uA(),t=kB(),n=xs();function s(a){return n(a)?e(a,!0):t(a)}return im=s,im}var lm,jN;function _B(){if(jN)return lm;jN=1;var e=ic(),t=Za();function n(s,a){return s&&e(a,t(a),s)}return lm=n,lm}var $l={exports:{}};$l.exports;var EN;function hA(){return EN||(EN=1,(function(e,t){var n=vr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l?n.Buffer:void 0,d=c?c.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var m=p.length,y=d?d(m):new p.constructor(m);return p.copy(y),y}e.exports=h})($l,$l.exports)),$l.exports}var cm,CN;function fA(){if(CN)return cm;CN=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 cm=e,cm}var um,TN;function pA(){if(TN)return um;TN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=0,c=[];++s<a;){var d=t[s];n(d,s,t)&&(c[l++]=d)}return c}return um=e,um}var dm,AN;function mA(){if(AN)return dm;AN=1;function e(){return[]}return dm=e,dm}var hm,RN;function zx(){if(RN)return hm;RN=1;var e=pA(),t=mA(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(d){return s.call(c,d)}))}:t;return hm=l,hm}var fm,MN;function NB(){if(MN)return fm;MN=1;var e=ic(),t=zx();function n(s,a){return e(s,t(s),a)}return fm=n,fm}var pm,IN;function Ux(){if(IN)return pm;IN=1;function e(t,n){for(var s=-1,a=n.length,l=t.length;++s<a;)t[l+s]=n[s];return t}return pm=e,pm}var mm,$N;function Bd(){if($N)return mm;$N=1;var e=dA(),t=e(Object.getPrototypeOf,Object);return mm=t,mm}var gm,ON;function gA(){if(ON)return gm;ON=1;var e=Ux(),t=Bd(),n=zx(),s=mA(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var d=[];c;)e(d,n(c)),c=t(c);return d}:s;return gm=l,gm}var ym,PN;function SB(){if(PN)return ym;PN=1;var e=ic(),t=gA();function n(s,a){return e(s,t(s),a)}return ym=n,ym}var wm,LN;function yA(){if(LN)return wm;LN=1;var e=Ux(),t=It();function n(s,a,l){var c=a(s);return t(s)?c:e(c,l(s))}return wm=n,wm}var vm,DN;function wA(){if(DN)return vm;DN=1;var e=yA(),t=zx(),n=ea();function s(a){return e(a,n,t)}return vm=s,vm}var xm,qN;function jB(){if(qN)return xm;qN=1;var e=yA(),t=gA(),n=Za();function s(a){return e(a,n,t)}return xm=s,xm}var bm,FN;function EB(){if(FN)return bm;FN=1;var e=Qa(),t=vr(),n=e(t,"DataView");return bm=n,bm}var km,BN;function CB(){if(BN)return km;BN=1;var e=Qa(),t=vr(),n=e(t,"Promise");return km=n,km}var _m,zN;function vA(){if(zN)return _m;zN=1;var e=Qa(),t=vr(),n=e(t,"Set");return _m=n,_m}var Nm,UN;function TB(){if(UN)return Nm;UN=1;var e=Qa(),t=vr(),n=e(t,"WeakMap");return Nm=n,Nm}var Sm,WN;function Si(){if(WN)return Sm;WN=1;var e=EB(),t=Px(),n=CB(),s=vA(),a=TB(),l=Xa(),c=lA(),d="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",m="[object WeakMap]",y="[object DataView]",v=c(e),N=c(t),_=c(n),S=c(s),k=c(a),j=l;return(e&&j(new e(new ArrayBuffer(1)))!=y||t&&j(new t)!=d||n&&j(n.resolve())!=p||s&&j(new s)!=f||a&&j(new a)!=m)&&(j=function(E){var C=l(E),T=C==h?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case v:return y;case N:return d;case _:return p;case S:return f;case k:return m}return C}),Sm=j,Sm}var jm,HN;function AB(){if(HN)return jm;HN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,l=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(l.index=s.index,l.input=s.input),l}return jm=n,jm}var Em,GN;function xA(){if(GN)return Em;GN=1;var e=vr(),t=e.Uint8Array;return Em=t,Em}var Cm,VN;function Wx(){if(VN)return Cm;VN=1;var e=xA();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Cm=t,Cm}var Tm,YN;function RB(){if(YN)return Tm;YN=1;var e=Wx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Tm=t,Tm}var Am,KN;function MB(){if(KN)return Am;KN=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Am=t,Am}var Rm,XN;function IB(){if(XN)return Rm;XN=1;var e=_i(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return Rm=s,Rm}var Mm,QN;function bA(){if(QN)return Mm;QN=1;var e=Wx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Mm=t,Mm}var Im,ZN;function $B(){if(ZN)return Im;ZN=1;var e=Wx(),t=RB(),n=MB(),s=IB(),a=bA(),l="[object Boolean]",c="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",m="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",k="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function D(O,I,q){var J=O.constructor;switch(I){case v:return e(O);case l:case c:return new J(+O);case N:return t(O,q);case _:case S:case k:case j:case E:case C:case T:case R:case A:return a(O,q);case d:return new J;case h:case m:return new J(O);case p:return n(O);case f:return new J;case y:return s(O)}}return Im=D,Im}var $m,JN;function kA(){if(JN)return $m;JN=1;var e=Vn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var l=new s;return s.prototype=void 0,l}})();return $m=n,$m}var Om,eS;function _A(){if(eS)return Om;eS=1;var e=kA(),t=Bd(),n=Fd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Om=s,Om}var Pm,tS;function OB(){if(tS)return Pm;tS=1;var e=Si(),t=qr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return Pm=s,Pm}var Lm,nS;function PB(){if(nS)return Lm;nS=1;var e=OB(),t=qd(),n=Fx(),s=n&&n.isMap,a=s?t(s):e;return Lm=a,Lm}var Dm,rS;function LB(){if(rS)return Dm;rS=1;var e=Si(),t=qr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return Dm=s,Dm}var qm,sS;function DB(){if(sS)return qm;sS=1;var e=LB(),t=qd(),n=Fx(),s=n&&n.isSet,a=s?t(s):e;return qm=a,qm}var Fm,aS;function NA(){if(aS)return Fm;aS=1;var e=Od(),t=Dx(),n=Ld(),s=xB(),a=_B(),l=hA(),c=fA(),d=NB(),h=SB(),p=wA(),f=jB(),m=Si(),y=AB(),v=$B(),N=_A(),_=It(),S=Ni(),k=PB(),j=Vn(),E=DB(),C=ea(),T=Za(),R=1,A=2,D=4,O="[object Arguments]",I="[object Array]",q="[object Boolean]",J="[object Date]",Z="[object Error]",$="[object Function]",K="[object GeneratorFunction]",G="[object Map]",z="[object Number]",X="[object Object]",L="[object RegExp]",W="[object Set]",P="[object String]",V="[object Symbol]",he="[object WeakMap]",H="[object ArrayBuffer]",U="[object DataView]",ee="[object Float32Array]",Y="[object Float64Array]",se="[object Int8Array]",me="[object Int16Array]",ge="[object Int32Array]",Re="[object Uint8Array]",Oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",we="[object Uint32Array]",be={};be[O]=be[I]=be[H]=be[U]=be[q]=be[J]=be[ee]=be[Y]=be[se]=be[me]=be[ge]=be[G]=be[z]=be[X]=be[L]=be[W]=be[P]=be[V]=be[Re]=be[Oe]=be[ce]=be[we]=!0,be[Z]=be[$]=be[he]=!1;function Be(_e,Ce,Ge,tt,Qe,Xe){var Ke,fe=Ce&R,dt=Ce&A,yt=Ce&D;if(Ge&&(Ke=Qe?Ge(_e,tt,Qe,Xe):Ge(_e)),Ke!==void 0)return Ke;if(!j(_e))return _e;var ot=_(_e);if(ot){if(Ke=y(_e),!fe)return c(_e,Ke)}else{var ye=m(_e),je=ye==$||ye==K;if(S(_e))return l(_e,fe);if(ye==X||ye==O||je&&!Qe){if(Ke=dt||je?{}:N(_e),!fe)return dt?h(_e,a(Ke,_e)):d(_e,s(Ke,_e))}else{if(!be[ye])return Qe?_e:{};Ke=v(_e,ye,fe)}}Xe||(Xe=new e);var Fe=Xe.get(_e);if(Fe)return Fe;Xe.set(_e,Ke),E(_e)?_e.forEach(function(re){Ke.add(Be(re,Ce,Ge,re,_e,Xe))}):k(_e)&&_e.forEach(function(re,Ae){Ke.set(Ae,Be(re,Ce,Ge,Ae,_e,Xe))});var Ye=yt?dt?f:p:dt?T:C,ct=ot?void 0:Ye(_e);return t(ct||_e,function(re,Ae){ct&&(Ae=re,re=_e[Ae]),n(Ke,Ae,Be(re,Ce,Ge,Ae,_e,Xe))}),Ke}return Fm=Be,Fm}var Bm,oS;function qB(){if(oS)return Bm;oS=1;var e=NA(),t=4;function n(s){return e(s,t)}return Bm=n,Bm}var zm,iS;function Hx(){if(iS)return zm;iS=1;function e(t){return function(){return t}}return zm=e,zm}var Um,lS;function FB(){if(lS)return Um;lS=1;function e(t){return function(n,s,a){for(var l=-1,c=Object(n),d=a(n),h=d.length;h--;){var p=d[t?h:++l];if(s(c[p],p,c)===!1)break}return n}}return Um=e,Um}var Wm,cS;function Gx(){if(cS)return Wm;cS=1;var e=FB(),t=e();return Wm=t,Wm}var Hm,uS;function Vx(){if(uS)return Hm;uS=1;var e=Gx(),t=ea();function n(s,a){return s&&e(s,a,t)}return Hm=n,Hm}var Gm,dS;function BB(){if(dS)return Gm;dS=1;var e=xs();function t(n,s){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,d=s?c:-1,h=Object(a);(s?d--:++d<c)&&l(h[d],d,h)!==!1;);return a}}return Gm=t,Gm}var Vm,hS;function zd(){if(hS)return Vm;hS=1;var e=Vx(),t=BB(),n=t(e);return Vm=n,Vm}var Ym,fS;function Ja(){if(fS)return Ym;fS=1;function e(t){return t}return Ym=e,Ym}var Km,pS;function SA(){if(pS)return Km;pS=1;var e=Ja();function t(n){return typeof n=="function"?n:e}return Km=t,Km}var Xm,mS;function jA(){if(mS)return Xm;mS=1;var e=Dx(),t=zd(),n=SA(),s=It();function a(l,c){var d=s(l)?e:t;return d(l,n(c))}return Xm=a,Xm}var Qm,gS;function EA(){return gS||(gS=1,Qm=jA()),Qm}var Zm,yS;function zB(){if(yS)return Zm;yS=1;var e=zd();function t(n,s){var a=[];return e(n,function(l,c,d){s(l,c,d)&&a.push(l)}),a}return Zm=t,Zm}var Jm,wS;function UB(){if(wS)return Jm;wS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Jm=t,Jm}var eg,vS;function WB(){if(vS)return eg;vS=1;function e(t){return this.__data__.has(t)}return eg=e,eg}var tg,xS;function CA(){if(xS)return tg;xS=1;var e=Lx(),t=UB(),n=WB();function s(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,tg=s,tg}var ng,bS;function HB(){if(bS)return ng;bS=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 ng=e,ng}var rg,kS;function TA(){if(kS)return rg;kS=1;function e(t,n){return t.has(n)}return rg=e,rg}var sg,_S;function AA(){if(_S)return sg;_S=1;var e=CA(),t=HB(),n=TA(),s=1,a=2;function l(c,d,h,p,f,m){var y=h&s,v=c.length,N=d.length;if(v!=N&&!(y&&N>v))return!1;var _=m.get(c),S=m.get(d);if(_&&S)return _==d&&S==c;var k=-1,j=!0,E=h&a?new e:void 0;for(m.set(c,d),m.set(d,c);++k<v;){var C=c[k],T=d[k];if(p)var R=y?p(T,C,k,d,c,m):p(C,T,k,c,d,m);if(R!==void 0){if(R)continue;j=!1;break}if(E){if(!t(d,function(A,D){if(!n(E,D)&&(C===A||f(C,A,h,p,m)))return E.push(D)})){j=!1;break}}else if(!(C===T||f(C,T,h,p,m))){j=!1;break}}return m.delete(c),m.delete(d),j}return sg=l,sg}var ag,NS;function GB(){if(NS)return ag;NS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,l){s[++n]=[l,a]}),s}return ag=e,ag}var og,SS;function Yx(){if(SS)return og;SS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return og=e,og}var ig,jS;function VB(){if(jS)return ig;jS=1;var e=_i(),t=xA(),n=ki(),s=AA(),a=GB(),l=Yx(),c=1,d=2,h="[object Boolean]",p="[object Date]",f="[object Error]",m="[object Map]",y="[object Number]",v="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",k="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,A,D,O,I,q,J){switch(D){case j:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case k:return!(R.byteLength!=A.byteLength||!q(new t(R),new t(A)));case h:case p:case y:return n(+R,+A);case f:return R.name==A.name&&R.message==A.message;case v:case _:return R==A+"";case m:var Z=a;case N:var $=O&c;if(Z||(Z=l),R.size!=A.size&&!$)return!1;var K=J.get(R);if(K)return K==A;O|=d,J.set(R,A);var G=s(Z(R),Z(A),O,I,q,J);return J.delete(R),G;case S:if(C)return C.call(R)==C.call(A)}return!1}return ig=T,ig}var lg,ES;function YB(){if(ES)return lg;ES=1;var e=wA(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(l,c,d,h,p,f){var m=d&t,y=e(l),v=y.length,N=e(c),_=N.length;if(v!=_&&!m)return!1;for(var S=v;S--;){var k=y[S];if(!(m?k in c:s.call(c,k)))return!1}var j=f.get(l),E=f.get(c);if(j&&E)return j==c&&E==l;var C=!0;f.set(l,c),f.set(c,l);for(var T=m;++S<v;){k=y[S];var R=l[k],A=c[k];if(h)var D=m?h(A,R,k,c,l,f):h(R,A,k,l,c,f);if(!(D===void 0?R===A||p(R,A,d,h,f):D)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var O=l.constructor,I=c.constructor;O!=I&&"constructor"in l&&"constructor"in c&&!(typeof O=="function"&&O instanceof O&&typeof I=="function"&&I instanceof I)&&(C=!1)}return f.delete(l),f.delete(c),C}return lg=a,lg}var cg,CS;function KB(){if(CS)return cg;CS=1;var e=Od(),t=AA(),n=VB(),s=YB(),a=Si(),l=It(),c=Ni(),d=cc(),h=1,p="[object Arguments]",f="[object Array]",m="[object Object]",y=Object.prototype,v=y.hasOwnProperty;function N(_,S,k,j,E,C){var T=l(_),R=l(S),A=T?f:a(_),D=R?f:a(S);A=A==p?m:A,D=D==p?m:D;var O=A==m,I=D==m,q=A==D;if(q&&c(_)){if(!c(S))return!1;T=!0,O=!1}if(q&&!O)return C||(C=new e),T||d(_)?t(_,S,k,j,E,C):n(_,S,A,k,j,E,C);if(!(k&h)){var J=O&&v.call(_,"__wrapped__"),Z=I&&v.call(S,"__wrapped__");if(J||Z){var $=J?_.value():_,K=Z?S.value():S;return C||(C=new e),E($,K,k,j,C)}}return q?(C||(C=new e),s(_,S,k,j,E,C)):!1}return cg=N,cg}var ug,TS;function RA(){if(TS)return ug;TS=1;var e=KB(),t=qr();function n(s,a,l,c,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,l,c,n,d)}return ug=n,ug}var dg,AS;function XB(){if(AS)return dg;AS=1;var e=Od(),t=RA(),n=1,s=2;function a(l,c,d,h){var p=d.length,f=p,m=!h;if(l==null)return!f;for(l=Object(l);p--;){var y=d[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<f;){y=d[p];var v=y[0],N=l[v],_=y[1];if(m&&y[2]){if(N===void 0&&!(v in l))return!1}else{var S=new e;if(h)var k=h(N,_,v,l,c,S);if(!(k===void 0?t(_,N,n|s,h,S):k))return!1}}return!0}return dg=a,dg}var hg,RS;function MA(){if(RS)return hg;RS=1;var e=Vn();function t(n){return n===n&&!e(n)}return hg=t,hg}var fg,MS;function QB(){if(MS)return fg;MS=1;var e=MA(),t=ea();function n(s){for(var a=t(s),l=a.length;l--;){var c=a[l],d=s[c];a[l]=[c,d,e(d)]}return a}return fg=n,fg}var pg,IS;function IA(){if(IS)return pg;IS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return pg=e,pg}var mg,$S;function ZB(){if($S)return mg;$S=1;var e=XB(),t=QB(),n=IA();function s(a){var l=t(a);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===a||e(c,a,l)}}return mg=s,mg}var gg,OS;function ji(){if(OS)return gg;OS=1;var e=Xa(),t=qr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return gg=s,gg}var yg,PS;function Kx(){if(PS)return yg;PS=1;var e=It(),t=ji(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(l,c){if(e(l))return!1;var d=typeof l;return d=="number"||d=="symbol"||d=="boolean"||l==null||t(l)?!0:s.test(l)||!n.test(l)||c!=null&&l in Object(c)}return yg=a,yg}var wg,LS;function JB(){if(LS)return wg;LS=1;var e=Lx(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var l=function(){var c=arguments,d=a?a.apply(this,c):c[0],h=l.cache;if(h.has(d))return h.get(d);var p=s.apply(this,c);return l.cache=h.set(d,p)||h,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,wg=n,wg}var vg,DS;function ez(){if(DS)return vg;DS=1;var e=JB(),t=500;function n(s){var a=e(s,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return vg=n,vg}var xg,qS;function tz(){if(qS)return xg;qS=1;var e=ez(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var l=[];return a.charCodeAt(0)===46&&l.push(""),a.replace(t,function(c,d,h,p){l.push(h?p.replace(n,"$1"):d||c)}),l});return xg=s,xg}var bg,FS;function Ud(){if(FS)return bg;FS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=Array(a);++s<a;)l[s]=n(t[s],s,t);return l}return bg=e,bg}var kg,BS;function nz(){if(BS)return kg;BS=1;var e=_i(),t=Ud(),n=It(),s=ji(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(d){if(typeof d=="string")return d;if(n(d))return t(d,c)+"";if(s(d))return l?l.call(d):"";var h=d+"";return h=="0"&&1/d==-1/0?"-0":h}return kg=c,kg}var _g,zS;function $A(){if(zS)return _g;zS=1;var e=nz();function t(n){return n==null?"":e(n)}return _g=t,_g}var Ng,US;function Wd(){if(US)return Ng;US=1;var e=It(),t=Kx(),n=tz(),s=$A();function a(l,c){return e(l)?l:t(l,c)?[l]:n(s(l))}return Ng=a,Ng}var Sg,WS;function uc(){if(WS)return Sg;WS=1;var e=ji();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Sg=t,Sg}var jg,HS;function Hd(){if(HS)return jg;HS=1;var e=Wd(),t=uc();function n(s,a){a=e(a,s);for(var l=0,c=a.length;s!=null&&l<c;)s=s[t(a[l++])];return l&&l==c?s:void 0}return jg=n,jg}var Eg,GS;function rz(){if(GS)return Eg;GS=1;var e=Hd();function t(n,s,a){var l=n==null?void 0:e(n,s);return l===void 0?a:l}return Eg=t,Eg}var Cg,VS;function sz(){if(VS)return Cg;VS=1;function e(t,n){return t!=null&&n in Object(t)}return Cg=e,Cg}var Tg,YS;function OA(){if(YS)return Tg;YS=1;var e=Wd(),t=lc(),n=It(),s=Dd(),a=qx(),l=uc();function c(d,h,p){h=e(h,d);for(var f=-1,m=h.length,y=!1;++f<m;){var v=l(h[f]);if(!(y=d!=null&&p(d,v)))break;d=d[v]}return y||++f!=m?y:(m=d==null?0:d.length,!!m&&a(m)&&s(v,m)&&(n(d)||t(d)))}return Tg=c,Tg}var Ag,KS;function PA(){if(KS)return Ag;KS=1;var e=sz(),t=OA();function n(s,a){return s!=null&&t(s,a,e)}return Ag=n,Ag}var Rg,XS;function az(){if(XS)return Rg;XS=1;var e=RA(),t=rz(),n=PA(),s=Kx(),a=MA(),l=IA(),c=uc(),d=1,h=2;function p(f,m){return s(f)&&a(m)?l(c(f),m):function(y){var v=t(y,f);return v===void 0&&v===m?n(y,f):e(m,v,d|h)}}return Rg=p,Rg}var Mg,QS;function LA(){if(QS)return Mg;QS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Mg=e,Mg}var Ig,ZS;function oz(){if(ZS)return Ig;ZS=1;var e=Hd();function t(n){return function(s){return e(s,n)}}return Ig=t,Ig}var $g,JS;function iz(){if(JS)return $g;JS=1;var e=LA(),t=oz(),n=Kx(),s=uc();function a(l){return n(l)?e(s(l)):t(l)}return $g=a,$g}var Og,ej;function bs(){if(ej)return Og;ej=1;var e=ZB(),t=az(),n=Ja(),s=It(),a=iz();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?s(c)?t(c[0],c[1]):e(c):a(c)}return Og=l,Og}var Pg,tj;function DA(){if(tj)return Pg;tj=1;var e=pA(),t=zB(),n=bs(),s=It();function a(l,c){var d=s(l)?e:t;return d(l,n(c,3))}return Pg=a,Pg}var Lg,nj;function lz(){if(nj)return Lg;nj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return Lg=n,Lg}var Dg,rj;function qA(){if(rj)return Dg;rj=1;var e=lz(),t=OA();function n(s,a){return s!=null&&t(s,a,e)}return Dg=n,Dg}var qg,sj;function cz(){if(sj)return qg;sj=1;var e=Bx(),t=Si(),n=lc(),s=It(),a=xs(),l=Ni(),c=Fd(),d=cc(),h="[object Map]",p="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function y(v){if(v==null)return!0;if(a(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||l(v)||d(v)||n(v)))return!v.length;var N=t(v);if(N==h||N==p)return!v.size;if(c(v))return!e(v).length;for(var _ in v)if(m.call(v,_))return!1;return!0}return qg=y,qg}var Fg,aj;function FA(){if(aj)return Fg;aj=1;function e(t){return t===void 0}return Fg=e,Fg}var Bg,oj;function BA(){if(oj)return Bg;oj=1;var e=zd(),t=xs();function n(s,a){var l=-1,c=t(s)?Array(s.length):[];return e(s,function(d,h,p){c[++l]=a(d,h,p)}),c}return Bg=n,Bg}var zg,ij;function zA(){if(ij)return zg;ij=1;var e=Ud(),t=bs(),n=BA(),s=It();function a(l,c){var d=s(l)?e:n;return d(l,t(c,3))}return zg=a,zg}var Ug,lj;function uz(){if(lj)return Ug;lj=1;function e(t,n,s,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(s=t[++l]);++l<c;)s=n(s,t[l],l,t);return s}return Ug=e,Ug}var Wg,cj;function dz(){if(cj)return Wg;cj=1;function e(t,n,s,a,l){return l(t,function(c,d,h){s=a?(a=!1,c):n(s,c,d,h)}),s}return Wg=e,Wg}var Hg,uj;function UA(){if(uj)return Hg;uj=1;var e=uz(),t=zd(),n=bs(),s=dz(),a=It();function l(c,d,h){var p=a(c)?e:s,f=arguments.length<3;return p(c,n(d,4),h,f,t)}return Hg=l,Hg}var Gg,dj;function hz(){if(dj)return Gg;dj=1;var e=Xa(),t=It(),n=qr(),s="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==s}return Gg=a,Gg}var Vg,hj;function fz(){if(hj)return Vg;hj=1;var e=LA(),t=e("length");return Vg=t,Vg}var Yg,fj;function pz(){if(fj)return Yg;fj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="\\u200d",d=RegExp("["+c+e+a+l+"]");function h(p){return d.test(p)}return Yg=h,Yg}var Kg,pj;function mz(){if(pj)return Kg;pj=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="["+e+"]",d="["+a+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+h+")",f="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+v+"(?:"+[f,m,y].join("|")+")"+_+N+")*",k=_+N+S,j="(?:"+[f+d+"?",d,m,y,c].join("|")+")",E=RegExp(h+"(?="+h+")|"+j+k,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return Kg=C,Kg}var Xg,mj;function gz(){if(mj)return Xg;mj=1;var e=fz(),t=pz(),n=mz();function s(a){return t(a)?n(a):e(a)}return Xg=s,Xg}var Qg,gj;function yz(){if(gj)return Qg;gj=1;var e=Bx(),t=Si(),n=xs(),s=hz(),a=gz(),l="[object Map]",c="[object Set]";function d(h){if(h==null)return 0;if(n(h))return s(h)?a(h):h.length;var p=t(h);return p==l||p==c?h.size:e(h).length}return Qg=d,Qg}var Zg,yj;function wz(){if(yj)return Zg;yj=1;var e=Dx(),t=kA(),n=Vx(),s=bs(),a=Bd(),l=It(),c=Ni(),d=oc(),h=Vn(),p=cc();function f(m,y,v){var N=l(m),_=N||c(m)||p(m);if(y=s(y,4),v==null){var S=m&&m.constructor;_?v=N?new S:[]:h(m)?v=d(S)?t(a(m)):{}:v={}}return(_?e:n)(m,function(k,j,E){return y(v,k,j,E)}),v}return Zg=f,Zg}var Jg,wj;function vz(){if(wj)return Jg;wj=1;var e=_i(),t=lc(),n=It(),s=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(s&&l&&l[s])}return Jg=a,Jg}var ey,vj;function Xx(){if(vj)return ey;vj=1;var e=Ux(),t=vz();function n(s,a,l,c,d){var h=-1,p=s.length;for(l||(l=t),d||(d=[]);++h<p;){var f=s[h];a>0&&l(f)?a>1?n(f,a-1,l,c,d):e(d,f):c||(d[d.length]=f)}return d}return ey=n,ey}var ty,xj;function xz(){if(xj)return ty;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 ty=e,ty}var ny,bj;function WA(){if(bj)return ny;bj=1;var e=xz(),t=Math.max;function n(s,a,l){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,d=-1,h=t(c.length-a,0),p=Array(h);++d<h;)p[d]=c[a+d];d=-1;for(var f=Array(a+1);++d<a;)f[d]=c[d];return f[a]=l(p),e(s,this,f)}}return ny=n,ny}var ry,kj;function bz(){if(kj)return ry;kj=1;var e=Hx(),t=cA(),n=Ja(),s=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return ry=s,ry}var sy,_j;function kz(){if(_j)return sy;_j=1;var e=800,t=16,n=Date.now;function s(a){var l=0,c=0;return function(){var d=n(),h=t-(d-c);if(c=d,h>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return sy=s,sy}var ay,Nj;function HA(){if(Nj)return ay;Nj=1;var e=bz(),t=kz(),n=t(e);return ay=n,ay}var oy,Sj;function Gd(){if(Sj)return oy;Sj=1;var e=Ja(),t=WA(),n=HA();function s(a,l){return n(t(a,l,e),a+"")}return oy=s,oy}var iy,jj;function GA(){if(jj)return iy;jj=1;function e(t,n,s,a){for(var l=t.length,c=s+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return iy=e,iy}var ly,Ej;function _z(){if(Ej)return ly;Ej=1;function e(t){return t!==t}return ly=e,ly}var cy,Cj;function Nz(){if(Cj)return cy;Cj=1;function e(t,n,s){for(var a=s-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return cy=e,cy}var uy,Tj;function Sz(){if(Tj)return uy;Tj=1;var e=GA(),t=_z(),n=Nz();function s(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return uy=s,uy}var dy,Aj;function jz(){if(Aj)return dy;Aj=1;var e=Sz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return dy=t,dy}var hy,Rj;function Ez(){if(Rj)return hy;Rj=1;function e(t,n,s){for(var a=-1,l=t==null?0:t.length;++a<l;)if(s(n,t[a]))return!0;return!1}return hy=e,hy}var fy,Mj;function Cz(){if(Mj)return fy;Mj=1;function e(){}return fy=e,fy}var py,Ij;function Tz(){if(Ij)return py;Ij=1;var e=vA(),t=Cz(),n=Yx(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(l){return new e(l)}:t;return py=a,py}var my,$j;function Az(){if($j)return my;$j=1;var e=CA(),t=jz(),n=Ez(),s=TA(),a=Tz(),l=Yx(),c=200;function d(h,p,f){var m=-1,y=t,v=h.length,N=!0,_=[],S=_;if(f)N=!1,y=n;else if(v>=c){var k=p?null:a(h);if(k)return l(k);N=!1,y=s,S=new e}else S=p?[]:_;e:for(;++m<v;){var j=h[m],E=p?p(j):j;if(j=f||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,f)||(S!==_&&S.push(E),_.push(j))}return _}return my=d,my}var gy,Oj;function VA(){if(Oj)return gy;Oj=1;var e=xs(),t=qr();function n(s){return t(s)&&e(s)}return gy=n,gy}var yy,Pj;function Rz(){if(Pj)return yy;Pj=1;var e=Xx(),t=Gd(),n=Az(),s=VA(),a=t(function(l){return n(e(l,1,s,!0))});return yy=a,yy}var wy,Lj;function Mz(){if(Lj)return wy;Lj=1;var e=Ud();function t(n,s){return e(s,function(a){return n[a]})}return wy=t,wy}var vy,Dj;function YA(){if(Dj)return vy;Dj=1;var e=Mz(),t=ea();function n(s){return s==null?[]:e(s,t(s))}return vy=n,vy}var xy,qj;function Yn(){if(qj)return xy;qj=1;var e;if(typeof Ox=="function")try{e={clone:qB(),constant:Hx(),each:EA(),filter:DA(),has:qA(),isArray:It(),isEmpty:cz(),isFunction:oc(),isUndefined:FA(),keys:ea(),map:zA(),reduce:UA(),size:yz(),transform:wz(),union:Rz(),values:YA()}}catch{}return e||(e=window._),xy=e,xy}var by,Fj;function Qx(){if(Fj)return by;Fj=1;var e=Yn();by=a;var t="\0",n="\0",s="";function a(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.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(f){return this._label=f,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._in[m])})},a.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(m){return e.isEmpty(f._out[m])})},a.prototype.setNodes=function(f,m){var y=arguments,v=this;return e.each(f,function(N){y.length>1?v.setNode(N,m):v.setNode(N)}),this},a.prototype.setNode=function(f,m){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},a.prototype.node=function(f){return this._nodes[f]},a.prototype.hasNode=function(f){return e.has(this._nodes,f)},a.prototype.removeNode=function(f){var m=this;if(e.has(this._nodes,f)){var y=function(v){m.removeEdge(m._edgeObjs[v])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(v){m.setParent(v)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},a.prototype.setParent=function(f,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===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},a.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},a.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},a.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return e.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},a.prototype.predecessors=function(f){var m=this._preds[f];if(m)return e.keys(m)},a.prototype.successors=function(f){var m=this._sucs[f];if(m)return e.keys(m)},a.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return e.union(m,this.successors(f))},a.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},a.prototype.filterNodes=function(f){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){f(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var v={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(v[_]=S,S):S in v?v[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},a.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(f,m){var y=this,v=arguments;return e.reduce(f,function(N,_){return v.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},a.prototype.setEdge=function(){var f,m,y,v,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(f=_.v,m=_.w,y=_.name,arguments.length===2&&(v=arguments[1],N=!0)):(f=_,m=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],N=!0)),f=""+f,m=""+m,e.isUndefined(y)||(y=""+y);var S=d(this._isDirected,f,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=v),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=N?v:this._defaultEdgeLabelFn(f,m,y);var k=h(this._isDirected,f,m,y);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,l(this._preds[m],f),l(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},a.prototype.edge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return this._edgeLabels[v]},a.prototype.hasEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y);return e.has(this._edgeLabels,v)},a.prototype.removeEdge=function(f,m,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,f,m,y),N=this._edgeObjs[v];return N&&(f=N.v,m=N.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[m],f),c(this._sucs[f],m),delete this._in[m][v],delete this._out[f][v],this._edgeCount--),this},a.prototype.inEdges=function(f,m){var y=this._in[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.v===m}):v}},a.prototype.outEdges=function(f,m){var y=this._out[f];if(y){var v=e.values(y);return m?e.filter(v,function(N){return N.w===m}):v}},a.prototype.nodeEdges=function(f,m){var y=this.inEdges(f,m);if(y)return y.concat(this.outEdges(f,m))};function l(f,m){f[m]?f[m]++:f[m]=1}function c(f,m){--f[m]||delete f[m]}function d(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}return N+s+_+s+(e.isUndefined(v)?t:v)}function h(f,m,y,v){var N=""+m,_=""+y;if(!f&&N>_){var S=N;N=_,_=S}var k={v:N,w:_};return v&&(k.name=v),k}function p(f,m){return d(f,m.v,m.w,m.name)}return by}var ky,Bj;function Iz(){return Bj||(Bj=1,ky="2.1.8"),ky}var _y,zj;function $z(){return zj||(zj=1,_y={Graph:Qx(),version:Iz()}),_y}var Ny,Uj;function Oz(){if(Uj)return Ny;Uj=1;var e=Yn(),t=Qx();Ny={write:n,read:l};function n(c){var d={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(d.value=e.clone(c.graph())),d}function s(c){return e.map(c.nodes(),function(d){var h=c.node(d),p=c.parent(d),f={v:d};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function a(c){return e.map(c.edges(),function(d){var h=c.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(h)||(p.value=h),p})}function l(c){var d=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(h){d.setNode(h.v,h.value),h.parent&&d.setParent(h.v,h.parent)}),e.each(c.edges,function(h){d.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),d}return Ny}var Sy,Wj;function Pz(){if(Wj)return Sy;Wj=1;var e=Yn();Sy=t;function t(n){var s={},a=[],l;function c(d){e.has(s,d)||(s[d]=!0,l.push(d),e.each(n.successors(d),c),e.each(n.predecessors(d),c))}return e.each(n.nodes(),function(d){l=[],c(d),l.length&&a.push(l)}),a}return Sy}var jy,Hj;function KA(){if(Hj)return jy;Hj=1;var e=Yn();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 l=this._arr,c=l.length;return a[n]=c,l.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,l=a+1,c=n;a<s.length&&(c=s[a].priority<s[c].priority?a:c,l<s.length&&(c=s[l].priority<s[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,l;n!==0&&(l=n>>1,!(s[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,s){var a=this._arr,l=this._keyIndices,c=a[n],d=a[s];a[n]=d,a[s]=c,l[d.key]=n,l[c.key]=s},jy}var Ey,Gj;function XA(){if(Gj)return Ey;Gj=1;var e=Yn(),t=KA();Ey=s;var n=e.constant(1);function s(l,c,d,h){return a(l,String(c),d||n,h||function(p){return l.outEdges(p)})}function a(l,c,d,h){var p={},f=new t,m,y,v=function(N){var _=N.v!==m?N.v:N.w,S=p[_],k=d(N),j=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);j<S.distance&&(S.distance=j,S.predecessor=m,f.decrease(_,j))};for(l.nodes().forEach(function(N){var _=N===c?0:Number.POSITIVE_INFINITY;p[N]={distance:_},f.add(N,_)});f.size()>0&&(m=f.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(v);return p}return Ey}var Cy,Vj;function Lz(){if(Vj)return Cy;Vj=1;var e=XA(),t=Yn();Cy=n;function n(s,a,l){return t.transform(s.nodes(),function(c,d){c[d]=e(s,d,a,l)},{})}return Cy}var Ty,Yj;function QA(){if(Yj)return Ty;Yj=1;var e=Yn();Ty=t;function t(n){var s=0,a=[],l={},c=[];function d(h){var p=l[h]={onStack:!0,lowlink:s,index:s++};if(a.push(h),n.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var f=[],m;do m=a.pop(),l[m].onStack=!1,f.push(m);while(h!==m);c.push(f)}}return n.nodes().forEach(function(h){e.has(l,h)||d(h)}),c}return Ty}var Ay,Kj;function Dz(){if(Kj)return Ay;Kj=1;var e=Yn(),t=QA();Ay=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 Ay}var Ry,Xj;function qz(){if(Xj)return Ry;Xj=1;var e=Yn();Ry=n;var t=e.constant(1);function n(a,l,c){return s(a,l||t,c||function(d){return a.outEdges(d)})}function s(a,l,c){var d={},h=a.nodes();return h.forEach(function(p){d[p]={},d[p][p]={distance:0},h.forEach(function(f){p!==f&&(d[p][f]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(f){var m=f.v===p?f.w:f.v,y=l(f);d[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=d[p];h.forEach(function(m){var y=d[m];h.forEach(function(v){var N=y[p],_=f[v],S=y[v],k=N.distance+_.distance;k<S.distance&&(S.distance=k,S.predecessor=_.predecessor)})})}),d}return Ry}var My,Qj;function ZA(){if(Qj)return My;Qj=1;var e=Yn();My=t,t.CycleException=n;function t(s){var a={},l={},c=[];function d(h){if(e.has(l,h))throw new n;e.has(a,h)||(l[h]=!0,a[h]=!0,e.each(s.predecessors(h),d),delete l[h],c.push(h))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,My}var Iy,Zj;function Fz(){if(Zj)return Iy;Zj=1;var e=ZA();Iy=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Iy}var $y,Jj;function JA(){if(Jj)return $y;Jj=1;var e=Yn();$y=t;function t(s,a,l){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],h={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,l==="post",h,c,d)}),d}function n(s,a,l,c,d,h){e.has(c,a)||(c[a]=!0,l||h.push(a),e.each(d(a),function(p){n(s,p,l,c,d,h)}),l&&h.push(a))}return $y}var Oy,eE;function Bz(){if(eE)return Oy;eE=1;var e=JA();Oy=t;function t(n,s){return e(n,s,"post")}return Oy}var Py,tE;function zz(){if(tE)return Py;tE=1;var e=JA();Py=t;function t(n,s){return e(n,s,"pre")}return Py}var Ly,nE;function Uz(){if(nE)return Ly;nE=1;var e=Yn(),t=Qx(),n=KA();Ly=s;function s(a,l){var c=new t,d={},h=new n,p;function f(y){var v=y.v===p?y.w:y.v,N=h.priority(v);if(N!==void 0){var _=l(y);_<N&&(d[v]=p,h.decrease(v,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),h.decrease(a.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(d,p))c.setEdge(p,d[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(f)}return c}return Ly}var Dy,rE;function Wz(){return rE||(rE=1,Dy={components:Pz(),dijkstra:XA(),dijkstraAll:Lz(),findCycles:Dz(),floydWarshall:qz(),isAcyclic:Fz(),postorder:Bz(),preorder:zz(),prim:Uz(),tarjan:QA(),topsort:ZA()}),Dy}var qy,sE;function Hz(){if(sE)return qy;sE=1;var e=$z();return qy={Graph:e.Graph,json:Oz(),alg:Wz(),version:e.version},qy}var Fy,aE;function yr(){if(aE)return Fy;aE=1;var e;if(typeof Ox=="function")try{e=Hz()}catch{}return e||(e=window.graphlib),Fy=e,Fy}var By,oE;function Gz(){if(oE)return By;oE=1;var e=NA(),t=1,n=4;function s(a){return e(a,t|n)}return By=s,By}var zy,iE;function Vd(){if(iE)return zy;iE=1;var e=ki(),t=xs(),n=Dd(),s=Vn();function a(l,c,d){if(!s(d))return!1;var h=typeof c;return(h=="number"?t(d)&&n(c,d.length):h=="string"&&c in d)?e(d[c],l):!1}return zy=a,zy}var Uy,lE;function Vz(){if(lE)return Uy;lE=1;var e=Gd(),t=ki(),n=Vd(),s=Za(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(d,h){d=Object(d);var p=-1,f=h.length,m=f>2?h[2]:void 0;for(m&&n(h[0],h[1],m)&&(f=1);++p<f;)for(var y=h[p],v=s(y),N=-1,_=v.length;++N<_;){var S=v[N],k=d[S];(k===void 0||t(k,a[S])&&!l.call(d,S))&&(d[S]=y[S])}return d});return Uy=c,Uy}var Wy,cE;function Yz(){if(cE)return Wy;cE=1;var e=bs(),t=xs(),n=ea();function s(a){return function(l,c,d){var h=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(h[m],m,h)}}var f=a(l,c,d);return f>-1?h[p?l[f]:f]:void 0}}return Wy=s,Wy}var Hy,uE;function Kz(){if(uE)return Hy;uE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Hy=t,Hy}var Gy,dE;function Xz(){if(dE)return Gy;dE=1;var e=Kz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Gy=n,Gy}var Vy,hE;function Qz(){if(hE)return Vy;hE=1;var e=Xz(),t=Vn(),n=ji(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?d(p.slice(2),m?2:8):a.test(p)?s:+p}return Vy=h,Vy}var Yy,fE;function eR(){if(fE)return Yy;fE=1;var e=Qz(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var l=a<0?-1:1;return l*n}return a===a?a:0}return Yy=s,Yy}var Ky,pE;function Zz(){if(pE)return Ky;pE=1;var e=eR();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Ky=t,Ky}var Xy,mE;function Jz(){if(mE)return Xy;mE=1;var e=GA(),t=bs(),n=Zz(),s=Math.max;function a(l,c,d){var h=l==null?0:l.length;if(!h)return-1;var p=d==null?0:n(d);return p<0&&(p=s(h+p,0)),e(l,t(c,3),p)}return Xy=a,Xy}var Qy,gE;function eU(){if(gE)return Qy;gE=1;var e=Yz(),t=Jz(),n=e(t);return Qy=n,Qy}var Zy,yE;function tR(){if(yE)return Zy;yE=1;var e=Xx();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Zy=t,Zy}var Jy,wE;function tU(){if(wE)return Jy;wE=1;var e=Gx(),t=SA(),n=Za();function s(a,l){return a==null?a:e(a,t(l),n)}return Jy=s,Jy}var ew,vE;function nU(){if(vE)return ew;vE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return ew=e,ew}var tw,xE;function rU(){if(xE)return tw;xE=1;var e=Pd(),t=Vx(),n=bs();function s(a,l){var c={};return l=n(l,3),t(a,function(d,h,p){e(c,h,l(d,h,p))}),c}return tw=s,tw}var nw,bE;function Zx(){if(bE)return nw;bE=1;var e=ji();function t(n,s,a){for(var l=-1,c=n.length;++l<c;){var d=n[l],h=s(d);if(h!=null&&(p===void 0?h===h&&!e(h):a(h,p)))var p=h,f=d}return f}return nw=t,nw}var rw,kE;function sU(){if(kE)return rw;kE=1;function e(t,n){return t>n}return rw=e,rw}var sw,_E;function aU(){if(_E)return sw;_E=1;var e=Zx(),t=sU(),n=Ja();function s(a){return a&&a.length?e(a,n,t):void 0}return sw=s,sw}var aw,NE;function nR(){if(NE)return aw;NE=1;var e=Pd(),t=ki();function n(s,a,l){(l!==void 0&&!t(s[a],l)||l===void 0&&!(a in s))&&e(s,a,l)}return aw=n,aw}var ow,SE;function oU(){if(SE)return ow;SE=1;var e=Xa(),t=Bd(),n=qr(),s="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,d=l.hasOwnProperty,h=c.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var m=t(f);if(m===null)return!0;var y=d.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==h}return ow=p,ow}var iw,jE;function rR(){if(jE)return iw;jE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return iw=e,iw}var lw,EE;function iU(){if(EE)return lw;EE=1;var e=ic(),t=Za();function n(s){return e(s,t(s))}return lw=n,lw}var cw,CE;function lU(){if(CE)return cw;CE=1;var e=nR(),t=hA(),n=bA(),s=fA(),a=_A(),l=lc(),c=It(),d=VA(),h=Ni(),p=oc(),f=Vn(),m=oU(),y=cc(),v=rR(),N=iU();function _(S,k,j,E,C,T,R){var A=v(S,j),D=v(k,j),O=R.get(D);if(O){e(S,j,O);return}var I=T?T(A,D,j+"",S,k,R):void 0,q=I===void 0;if(q){var J=c(D),Z=!J&&h(D),$=!J&&!Z&&y(D);I=D,J||Z||$?c(A)?I=A:d(A)?I=s(A):Z?(q=!1,I=t(D,!0)):$?(q=!1,I=n(D,!0)):I=[]:m(D)||l(D)?(I=A,l(A)?I=N(A):(!f(A)||p(A))&&(I=a(D))):q=!1}q&&(R.set(D,I),C(I,D,E,T,R),R.delete(D)),e(S,j,I)}return cw=_,cw}var uw,TE;function cU(){if(TE)return uw;TE=1;var e=Od(),t=nR(),n=Gx(),s=lU(),a=Vn(),l=Za(),c=rR();function d(h,p,f,m,y){h!==p&&n(p,function(v,N){if(y||(y=new e),a(v))s(h,p,N,f,d,m,y);else{var _=m?m(c(h,N),v,N+"",h,p,y):void 0;_===void 0&&(_=v),t(h,N,_)}},l)}return uw=d,uw}var dw,AE;function uU(){if(AE)return dw;AE=1;var e=Gd(),t=Vd();function n(s){return e(function(a,l){var c=-1,d=l.length,h=d>1?l[d-1]:void 0,p=d>2?l[2]:void 0;for(h=s.length>3&&typeof h=="function"?(d--,h):void 0,p&&t(l[0],l[1],p)&&(h=d<3?void 0:h,d=1),a=Object(a);++c<d;){var f=l[c];f&&s(a,f,c,h)}return a})}return dw=n,dw}var hw,RE;function dU(){if(RE)return hw;RE=1;var e=cU(),t=uU(),n=t(function(s,a,l){e(s,a,l)});return hw=n,hw}var fw,ME;function sR(){if(ME)return fw;ME=1;function e(t,n){return t<n}return fw=e,fw}var pw,IE;function hU(){if(IE)return pw;IE=1;var e=Zx(),t=sR(),n=Ja();function s(a){return a&&a.length?e(a,n,t):void 0}return pw=s,pw}var mw,$E;function fU(){if($E)return mw;$E=1;var e=Zx(),t=bs(),n=sR();function s(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return mw=s,mw}var gw,OE;function pU(){if(OE)return gw;OE=1;var e=vr(),t=function(){return e.Date.now()};return gw=t,gw}var yw,PE;function mU(){if(PE)return yw;PE=1;var e=Ld(),t=Wd(),n=Dd(),s=Vn(),a=uc();function l(c,d,h,p){if(!s(c))return c;d=t(d,c);for(var f=-1,m=d.length,y=m-1,v=c;v!=null&&++f<m;){var N=a(d[f]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return c;if(f!=y){var S=v[N];_=p?p(S,N,v):void 0,_===void 0&&(_=s(S)?S:n(d[f+1])?[]:{})}e(v,N,_),v=v[N]}return c}return yw=l,yw}var ww,LE;function gU(){if(LE)return ww;LE=1;var e=Hd(),t=mU(),n=Wd();function s(a,l,c){for(var d=-1,h=l.length,p={};++d<h;){var f=l[d],m=e(a,f);c(m,f)&&t(p,n(f,a),m)}return p}return ww=s,ww}var vw,DE;function yU(){if(DE)return vw;DE=1;var e=gU(),t=PA();function n(s,a){return e(s,a,function(l,c){return t(s,c)})}return vw=n,vw}var xw,qE;function wU(){if(qE)return xw;qE=1;var e=tR(),t=WA(),n=HA();function s(a){return n(t(a,void 0,e),a+"")}return xw=s,xw}var bw,FE;function vU(){if(FE)return bw;FE=1;var e=yU(),t=wU(),n=t(function(s,a){return s==null?{}:e(s,a)});return bw=n,bw}var kw,BE;function xU(){if(BE)return kw;BE=1;var e=Math.ceil,t=Math.max;function n(s,a,l,c){for(var d=-1,h=t(e((a-s)/(l||1)),0),p=Array(h);h--;)p[c?h:++d]=s,s+=l;return p}return kw=n,kw}var _w,zE;function bU(){if(zE)return _w;zE=1;var e=xU(),t=Vd(),n=eR();function s(a){return function(l,c,d){return d&&typeof d!="number"&&t(l,c,d)&&(c=d=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),d=d===void 0?l<c?1:-1:n(d),e(l,c,d,a)}}return _w=s,_w}var Nw,UE;function kU(){if(UE)return Nw;UE=1;var e=bU(),t=e();return Nw=t,Nw}var Sw,WE;function _U(){if(WE)return Sw;WE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Sw=e,Sw}var jw,HE;function NU(){if(HE)return jw;HE=1;var e=ji();function t(n,s){if(n!==s){var a=n!==void 0,l=n===null,c=n===n,d=e(n),h=s!==void 0,p=s===null,f=s===s,m=e(s);if(!p&&!m&&!d&&n>s||d&&h&&f&&!p&&!m||l&&h&&f||!a&&f||!c)return 1;if(!l&&!d&&!m&&n<s||m&&a&&c&&!l&&!d||p&&a&&c||!h&&c||!f)return-1}return 0}return jw=t,jw}var Ew,GE;function SU(){if(GE)return Ew;GE=1;var e=NU();function t(n,s,a){for(var l=-1,c=n.criteria,d=s.criteria,h=c.length,p=a.length;++l<h;){var f=e(c[l],d[l]);if(f){if(l>=p)return f;var m=a[l];return f*(m=="desc"?-1:1)}}return n.index-s.index}return Ew=t,Ew}var Cw,VE;function jU(){if(VE)return Cw;VE=1;var e=Ud(),t=Hd(),n=bs(),s=BA(),a=_U(),l=qd(),c=SU(),d=Ja(),h=It();function p(f,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return t(S,_.length===1?_[0]:_)}:_}):m=[d];var v=-1;m=e(m,l(n));var N=s(f,function(_,S,k){var j=e(m,function(E){return E(_)});return{criteria:j,index:++v,value:_}});return a(N,function(_,S){return c(_,S,y)})}return Cw=p,Cw}var Tw,YE;function EU(){if(YE)return Tw;YE=1;var e=Xx(),t=jU(),n=Gd(),s=Vd(),a=n(function(l,c){if(l==null)return[];var d=c.length;return d>1&&s(l,c[0],c[1])?c=[]:d>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return Tw=a,Tw}var Aw,KE;function CU(){if(KE)return Aw;KE=1;var e=$A(),t=0;function n(s){var a=++t;return e(s)+a}return Aw=n,Aw}var Rw,XE;function TU(){if(XE)return Rw;XE=1;function e(t,n,s){for(var a=-1,l=t.length,c=n.length,d={};++a<l;){var h=a<c?n[a]:void 0;s(d,t[a],h)}return d}return Rw=e,Rw}var Mw,QE;function AU(){if(QE)return Mw;QE=1;var e=Ld(),t=TU();function n(s,a){return t(s||[],a||[],e)}return Mw=n,Mw}var Iw,ZE;function kt(){if(ZE)return Iw;ZE=1;var e;if(typeof Ox=="function")try{e={cloneDeep:Gz(),constant:Hx(),defaults:Vz(),each:EA(),filter:DA(),find:eU(),flatten:tR(),forEach:jA(),forIn:tU(),has:qA(),isUndefined:FA(),last:nU(),map:zA(),mapValues:rU(),max:aU(),merge:dU(),min:hU(),minBy:fU(),now:pU(),pick:vU(),range:kU(),reduce:UA(),sortBy:EU(),uniqueId:CU(),values:YA(),zipObject:AU()}}catch{}return e||(e=window._),Iw=e,Iw}var $w,JE;function RU(){if(JE)return $w;JE=1,$w=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,l=a._prev;l!==a;)s.push(JSON.stringify(l,n)),l=l._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 $w}var Ow,eC;function MU(){if(eC)return Ow;eC=1;var e=kt(),t=yr().Graph,n=RU();Ow=a;var s=e.constant(1);function a(p,f){if(p.nodeCount()<=1)return[];var m=d(p,f||s),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(v){return p.outEdges(v.v,v.w)}),!0)}function l(p,f,m){for(var y=[],v=f[f.length-1],N=f[0],_;p.nodeCount();){for(;_=N.dequeue();)c(p,f,m,_);for(;_=v.dequeue();)c(p,f,m,_);if(p.nodeCount()){for(var S=f.length-2;S>0;--S)if(_=f[S].dequeue(),_){y=y.concat(c(p,f,m,_,!0));break}}}return y}function c(p,f,m,y,v){var N=v?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),k=p.node(_.v);v&&N.push({v:_.v,w:_.w}),k.out-=S,h(f,m,k)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),k=_.w,j=p.node(k);j.in-=S,h(f,m,j)}),p.removeNode(y.v),N}function d(p,f){var m=new t,y=0,v=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=f(S),E=k+j;m.setEdge(S.v,S.w,E),v=Math.max(v,m.node(S.v).out+=j),y=Math.max(y,m.node(S.w).in+=j)});var N=e.range(v+y+3).map(function(){return new n}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,f,m){m.out?m.in?p[m.out-m.in+f].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return Ow}var Pw,tC;function IU(){if(tC)return Pw;tC=1;var e=kt(),t=MU();Pw={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,d(l)):s(l);e.forEach(c,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function d(h){return function(p){return h.edge(p).weight}}}function s(l){var c=[],d={},h={};function p(f){e.has(h,f)||(h[f]=!0,d[f]=!0,e.forEach(l.outEdges(f),function(m){e.has(d,m.w)?c.push(m):p(m.w)}),delete d[f])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var d=l.edge(c);if(d.reversed){l.removeEdge(c);var h=d.forwardName;delete d.reversed,delete d.forwardName,l.setEdge(c.w,c.v,d,h)}})}return Pw}var Lw,nC;function _n(){if(nC)return Lw;nC=1;var e=kt(),t=yr().Graph;Lw={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:d,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:m,maxRank:y,partition:v,time:N,notime:_};function n(S,k,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=k,S.setNode(C,j),C}function s(S){var k=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=k.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);k.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),k}function a(S){var k=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function l(S){var k=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(),k)}function c(S){var k=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(),k)}function d(S,k){var j=S.x,E=S.y,C=k.x-j,T=k.y-E,R=S.width/2,A=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var D,O;return Math.abs(T)*R>Math.abs(C)*A?(T<0&&(A=-A),D=A*C/T,O=A):(C<0&&(R=-R),D=R,O=R*T/C),{x:j+D,y:E+O}}function h(S){var k=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)||(k[C][E.order]=j)}),k}function p(S){var k=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-=k)})}function f(S){var k=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-k;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(A){S.node(A).rank+=E})})}function m(S,k,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,k)}function y(S){return e.max(e.map(S.nodes(),function(k){var j=S.node(k).rank;if(!e.isUndefined(j))return j}))}function v(S,k){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){k(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,k){var j=e.now();try{return k()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function _(S,k){return k()}return Lw}var Dw,rC;function $U(){if(rC)return Dw;rC=1;var e=kt(),t=_n();Dw={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){s(l,c)})}function s(l,c){var d=c.v,h=l.node(d).rank,p=c.w,f=l.node(p).rank,m=c.name,y=l.edge(c),v=y.labelRank;if(f!==h+1){l.removeEdge(c);var N,_,S;for(S=0,++h;h<f;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:h},N=t.addDummyNode(l,"edge",_,"_d"),h===v&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(d,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),d=N;l.setEdge(d,p,{weight:y.weight},m)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var d=l.node(c),h=d.edgeLabel,p;for(l.setEdge(d.edgeObj,h);d.dummy;)p=l.successors(c)[0],l.removeNode(c),h.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(h.x=d.x,h.y=d.y,h.width=d.width,h.height=d.height),c=p,d=l.node(c)})}return Dw}var qw,sC;function gd(){if(sC)return qw;sC=1;var e=kt();qw={longestPath:t,slack:n};function t(s){var a={};function l(c){var d=s.node(c);if(e.has(a,c))return d.rank;a[c]=!0;var h=e.min(e.map(s.outEdges(c),function(p){return l(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),d.rank=h}e.forEach(s.sources(),l)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return qw}var Fw,aC;function aR(){if(aC)return Fw;aC=1;var e=kt(),t=yr().Graph,n=gd().slack;Fw=s;function s(d){var h=new t({directed:!1}),p=d.nodes()[0],f=d.nodeCount();h.setNode(p,{});for(var m,y;a(h,d)<f;)m=l(h,d),y=h.hasNode(m.v)?n(d,m):-n(d,m),c(h,d,y);return h}function a(d,h){function p(f){e.forEach(h.nodeEdges(f),function(m){var y=m.v,v=f===y?m.w:y;!d.hasNode(v)&&!n(h,m)&&(d.setNode(v,{}),d.setEdge(f,v,{}),p(v))})}return e.forEach(d.nodes(),p),d.nodeCount()}function l(d,h){return e.minBy(h.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(h,p)})}function c(d,h,p){e.forEach(d.nodes(),function(f){h.node(f).rank+=p})}return Fw}var Bw,oC;function OU(){if(oC)return Bw;oC=1;var e=kt(),t=aR(),n=gd().slack,s=gd().longestPath,a=yr().alg.preorder,l=yr().alg.postorder,c=_n().simplify;Bw=d,d.initLowLimValues=m,d.initCutValues=h,d.calcCutValue=f,d.leaveEdge=v,d.enterEdge=N,d.exchangeEdges=_;function d(E){E=c(E),s(E);var C=t(E);m(C),h(C,E);for(var T,R;T=v(C);)R=N(C,E,T),_(C,E,T,R)}function h(E,C){var T=l(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),A=R.parent;E.edge(T,A).cutvalue=f(E,C,T)}function f(E,C,T){var R=E.node(T),A=R.parent,D=!0,O=C.edge(T,A),I=0;return O||(D=!1,O=C.edge(A,T)),I=O.weight,e.forEach(C.nodeEdges(T),function(q){var J=q.v===T,Z=J?q.w:q.v;if(Z!==A){var $=J===D,K=C.edge(q).weight;if(I+=$?K:-K,k(E,T,Z)){var G=E.edge(T,Z).cutvalue;I+=$?-G:G}}}),I}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,A){var D=T,O=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(I){e.has(C,I)||(T=y(E,C,T,I,R))}),O.low=D,O.lim=T++,A?O.parent=A:delete O.parent,T}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,T){var R=T.v,A=T.w;C.hasEdge(R,A)||(R=T.w,A=T.v);var D=E.node(R),O=E.node(A),I=D,q=!1;D.lim>O.lim&&(I=O,q=!0);var J=e.filter(C.edges(),function(Z){return q===j(E,E.node(Z.v),I)&&q!==j(E,E.node(Z.w),I)});return e.minBy(J,function(Z){return n(C,Z)})}function _(E,C,T,R){var A=T.v,D=T.w;E.removeEdge(A,D),E.setEdge(R.v,R.w,{}),m(E),h(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function(A){return!C.node(A).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(A){var D=E.node(A).parent,O=C.edge(A,D),I=!1;O||(O=C.edge(D,A),I=!0),C.node(A).rank=C.node(D).rank+(I?O.minlen:-O.minlen)})}function k(E,C,T){return E.hasEdge(C,T)}function j(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Bw}var zw,iC;function PU(){if(iC)return zw;iC=1;var e=gd(),t=e.longestPath,n=aR(),s=OU();zw=a;function a(h){switch(h.graph().ranker){case"network-simplex":d(h);break;case"tight-tree":c(h);break;case"longest-path":l(h);break;default:d(h)}}var l=t;function c(h){t(h),n(h)}function d(h){s(h)}return zw}var Uw,lC;function LU(){if(lC)return Uw;lC=1;var e=kt();Uw=t;function t(a){var l=s(a);e.forEach(a.graph().dummyChains,function(c){for(var d=a.node(c),h=d.edgeObj,p=n(a,l,h.v,h.w),f=p.path,m=p.lca,y=0,v=f[y],N=!0;c!==h.w;){if(d=a.node(c),N){for(;(v=f[y])!==m&&a.node(v).maxRank<d.rank;)y++;v===m&&(N=!1)}if(!N){for(;y<f.length-1&&a.node(v=f[y+1]).minRank<=d.rank;)y++;v=f[y]}a.setParent(c,v),c=a.successors(c)[0]}})}function n(a,l,c,d){var h=[],p=[],f=Math.min(l[c].low,l[d].low),m=Math.max(l[c].lim,l[d].lim),y,v;y=c;do y=a.parent(y),h.push(y);while(y&&(l[y].low>f||m>l[y].lim));for(v=y,y=d;(y=a.parent(y))!==v;)p.push(y);return{path:h.concat(p.reverse()),lca:v}}function s(a){var l={},c=0;function d(h){var p=c;e.forEach(a.children(h),d),l[h]={low:p,lim:c++}}return e.forEach(a.children(),d),l}return Uw}var Ww,cC;function DU(){if(cC)return Ww;cC=1;var e=kt(),t=_n();Ww={run:n,cleanup:c};function n(d){var h=t.addDummyNode(d,"root",{},"_root"),p=a(d),f=e.max(e.values(p))-1,m=2*f+1;d.graph().nestingRoot=h,e.forEach(d.edges(),function(v){d.edge(v).minlen*=m});var y=l(d)+1;e.forEach(d.children(),function(v){s(d,h,m,y,f,p,v)}),d.graph().nodeRankFactor=m}function s(d,h,p,f,m,y,v){var N=d.children(v);if(!N.length){v!==h&&d.setEdge(h,v,{weight:0,minlen:p});return}var _=t.addBorderNode(d,"_bt"),S=t.addBorderNode(d,"_bb"),k=d.node(v);d.setParent(_,v),k.borderTop=_,d.setParent(S,v),k.borderBottom=S,e.forEach(N,function(j){s(d,h,p,f,m,y,j);var E=d.node(j),C=E.borderTop?E.borderTop:j,T=E.borderBottom?E.borderBottom:j,R=E.borderTop?f:2*f,A=C!==T?1:m-y[v]+1;d.setEdge(_,C,{weight:R,minlen:A,nestingEdge:!0}),d.setEdge(T,S,{weight:R,minlen:A,nestingEdge:!0})}),d.parent(v)||d.setEdge(h,_,{weight:0,minlen:m+y[v]})}function a(d){var h={};function p(f,m){var y=d.children(f);y&&y.length&&e.forEach(y,function(v){p(v,m+1)}),h[f]=m}return e.forEach(d.children(),function(f){p(f,1)}),h}function l(d){return e.reduce(d.edges(),function(h,p){return h+d.edge(p).weight},0)}function c(d){var h=d.graph();d.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(d.edges(),function(p){var f=d.edge(p);f.nestingEdge&&d.removeEdge(p)})}return Ww}var Hw,uC;function qU(){if(uC)return Hw;uC=1;var e=kt(),t=_n();Hw=n;function n(a){function l(c){var d=a.children(c),h=a.node(c);if(d.length&&e.forEach(d,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(a,"borderLeft","_bl",c,h,p),s(a,"borderRight","_br",c,h,p)}}e.forEach(a.children(),l)}function s(a,l,c,d,h,p){var f={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=t.addDummyNode(a,"border",f,c);h[l][p]=y,a.setParent(y,d),m&&a.setEdge(m,y,{weight:1})}return Hw}var Gw,dC;function FU(){if(dC)return Gw;dC=1;var e=kt();Gw={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&l(p),(f==="lr"||f==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){a(p.node(f))}),e.forEach(p.edges(),function(f){a(p.edge(f))})}function a(p){var f=p.width;p.width=p.height,p.height=f}function l(p){e.forEach(p.nodes(),function(f){c(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var m=p.edge(f);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Gw}var Vw,hC;function BU(){if(hC)return Vw;hC=1;var e=kt();Vw=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);c[f.rank].push(p),e.forEach(n.successors(p),d)}}var h=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(h,d),c}return Vw}var Yw,fC;function zU(){if(fC)return Yw;fC=1;var e=kt();Yw=t;function t(s,a){for(var l=0,c=1;c<a.length;++c)l+=n(s,a[c-1],a[c]);return l}function n(s,a,l){for(var c=e.zipObject(l,e.map(l,function(y,v){return v})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),function(v){return{pos:c[v.w],weight:s.edge(v).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(d.forEach(function(y){var v=y.pos+h;f[v]+=y.weight;for(var N=0;v>0;)v%2&&(N+=f[v+1]),v=v-1>>1,f[v]+=y.weight;m+=y.weight*N})),m}return Yw}var Kw,pC;function UU(){if(pC)return Kw;pC=1;var e=kt();Kw=t;function t(n,s){return e.map(s,function(a){var l=n.inEdges(a);if(l.length){var c=e.reduce(l,function(d,h){var p=n.edge(h),f=n.node(h.v);return{sum:d.sum+p.weight*f.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return Kw}var Xw,mC;function WU(){if(mC)return Xw;mC=1;var e=kt();Xw=t;function t(a,l){var c={};e.forEach(a,function(h,p){var f=c[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=c[h.v],f=c[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(c[h.w]))});var d=e.filter(c,function(h){return!h.indegree});return n(d)}function n(a){var l=[];function c(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function d(p){return function(f){f.in.push(p),--f.indegree===0&&a.push(f)}}for(;a.length;){var h=a.pop();l.push(h),e.forEach(h.in.reverse(),c(h)),e.forEach(h.out,d(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,l){var c=0,d=0;a.weight&&(c+=a.barycenter*a.weight,d+=a.weight),l.weight&&(c+=l.barycenter*l.weight,d+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/d,a.weight=d,a.i=Math.min(l.i,a.i),l.merged=!0}return Xw}var Qw,gC;function HU(){if(gC)return Qw;gC=1;var e=kt(),t=_n();Qw=n;function n(l,c){var d=t.partition(l,function(_){return e.has(_,"barycenter")}),h=d.lhs,p=e.sortBy(d.rhs,function(_){return-_.i}),f=[],m=0,y=0,v=0;h.sort(a(!!c)),v=s(f,p,v),e.forEach(h,function(_){v+=_.vs.length,f.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,v=s(f,p,v)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function s(l,c,d){for(var h;c.length&&(h=e.last(c)).i<=d;)c.pop(),l.push(h.vs),d++;return d}function a(l){return function(c,d){return c.barycenter<d.barycenter?-1:c.barycenter>d.barycenter?1:l?d.i-c.i:c.i-d.i}}return Qw}var Zw,yC;function GU(){if(yC)return Zw;yC=1;var e=kt(),t=UU(),n=WU(),s=HU();Zw=a;function a(d,h,p,f){var m=d.children(h),y=d.node(h),v=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};v&&(m=e.filter(m,function(T){return T!==v&&T!==N}));var S=t(d,m);e.forEach(S,function(T){if(d.children(T.v).length){var R=a(d,T.v,p,f);_[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var k=n(S,p);l(k,_);var j=s(k,f);if(v&&(j.vs=e.flatten([v,j.vs,N],!0),d.predecessors(v).length)){var E=d.node(d.predecessors(v)[0]),C=d.node(d.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 l(d,h){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function c(d,h){e.isUndefined(d.barycenter)?(d.barycenter=h.barycenter,d.weight=h.weight):(d.barycenter=(d.barycenter*d.weight+h.barycenter*h.weight)/(d.weight+h.weight),d.weight+=h.weight)}return Zw}var Jw,wC;function VU(){if(wC)return Jw;wC=1;var e=kt(),t=yr().Graph;Jw=n;function n(a,l,c){var d=s(a),h=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var f=a.node(p),m=a.parent(p);(f.rank===l||f.minRank<=l&&l<=f.maxRank)&&(h.setNode(p),h.setParent(p,m||d),e.forEach(a[c](p),function(y){var v=y.v===p?y.w:y.v,N=h.edge(v,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(v,p,{weight:a.edge(y).weight+_})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[l],borderRight:f.borderRight[l]}))}),h}function s(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return Jw}var ev,vC;function YU(){if(vC)return ev;vC=1;var e=kt();ev=t;function t(n,s,a){var l={},c;e.forEach(a,function(d){for(var h=n.parent(d),p,f;h;){if(p=n.parent(h),p?(f=l[p],l[p]=h):(f=c,c=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return ev}var tv,xC;function KU(){if(xC)return tv;xC=1;var e=kt(),t=BU(),n=zU(),s=GU(),a=VU(),l=YU(),c=yr().Graph,d=_n();tv=h;function h(y){var v=d.maxRank(y),N=p(y,e.range(1,v+1),"inEdges"),_=p(y,e.range(v-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var k=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){f(E%2?N:_,E%4>=2),S=d.buildLayerMatrix(y);var T=n(y,S);T<k&&(C=0,j=e.cloneDeep(S),k=T)}m(y,j)}function p(y,v,N){return e.map(v,function(_){return a(y,_,N)})}function f(y,v){var N=new c;e.forEach(y,function(_){var S=_.graph().root,k=s(_,S,N,v);e.forEach(k.vs,function(j,E){_.node(j).order=E}),l(_,N,k.vs)})}function m(y,v){e.forEach(v,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return tv}var nv,bC;function XU(){if(bC)return nv;bC=1;var e=kt(),t=yr().Graph,n=_n();nv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:d,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:v};function s(k,j){var E={};function C(T,R){var A=0,D=0,O=T.length,I=e.last(R);return e.forEach(R,function(q,J){var Z=l(k,q),$=Z?k.node(Z).order:O;(Z||q===I)&&(e.forEach(R.slice(D,J+1),function(K){e.forEach(k.predecessors(K),function(G){var z=k.node(G),X=z.order;(X<A||$<X)&&!(z.dummy&&k.node(K).dummy)&&c(E,G,K)})}),D=J+1,A=$)}),R}return e.reduce(j,C),E}function a(k,j){var E={};function C(R,A,D,O,I){var q;e.forEach(e.range(A,D),function(J){q=R[J],k.node(q).dummy&&e.forEach(k.predecessors(q),function(Z){var $=k.node(Z);$.dummy&&($.order<O||$.order>I)&&c(E,Z,q)})})}function T(R,A){var D=-1,O,I=0;return e.forEach(A,function(q,J){if(k.node(q).dummy==="border"){var Z=k.predecessors(q);Z.length&&(O=k.node(Z[0]).order,C(A,I,J,D,O),I=J,D=O)}C(A,I,A.length,O,R.length)}),A}return e.reduce(j,T),E}function l(k,j){if(k.node(j).dummy)return e.find(k.predecessors(j),function(E){return k.node(E).dummy})}function c(k,j,E){if(j>E){var C=j;j=E,E=C}var T=k[j];T||(k[j]=T={}),T[E]=!0}function d(k,j,E){if(j>E){var C=j;j=E,E=C}return e.has(k[j],E)}function h(k,j,E,C){var T={},R={},A={};return e.forEach(j,function(D){e.forEach(D,function(O,I){T[O]=O,R[O]=O,A[O]=I})}),e.forEach(j,function(D){var O=-1;e.forEach(D,function(I){var q=C(I);if(q.length){q=e.sortBy(q,function(G){return A[G]});for(var J=(q.length-1)/2,Z=Math.floor(J),$=Math.ceil(J);Z<=$;++Z){var K=q[Z];R[I]===I&&O<A[K]&&!d(E,I,K)&&(R[K]=I,R[I]=T[I]=T[K],O=A[K])}}})}),{root:T,align:R}}function p(k,j,E,C,T){var R={},A=f(k,j,E,T),D=T?"borderLeft":"borderRight";function O(J,Z){for(var $=A.nodes(),K=$.pop(),G={};K;)G[K]?J(K):(G[K]=!0,$.push(K),$=$.concat(Z(K))),K=$.pop()}function I(J){R[J]=A.inEdges(J).reduce(function(Z,$){return Math.max(Z,R[$.v]+A.edge($))},0)}function q(J){var Z=A.outEdges(J).reduce(function(K,G){return Math.min(K,R[G.w]-A.edge(G))},Number.POSITIVE_INFINITY),$=k.node(J);Z!==Number.POSITIVE_INFINITY&&$.borderType!==D&&(R[J]=Math.max(R[J],Z))}return O(I,A.predecessors.bind(A)),O(q,A.successors.bind(A)),e.forEach(C,function(J){R[J]=R[E[J]]}),R}function f(k,j,E,C){var T=new t,R=k.graph(),A=_(R.nodesep,R.edgesep,C);return e.forEach(j,function(D){var O;e.forEach(D,function(I){var q=E[I];if(T.setNode(q),O){var J=E[O],Z=T.edge(J,q);T.setEdge(J,q,Math.max(A(k,I,O),Z||0))}O=I})}),T}function m(k,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,A){var D=S(k,A)/2;C=Math.max(R+D,C),T=Math.min(R-D,T)}),C-T})}function y(k,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(A){var D=R+A,O=k[D],I;if(O!==j){var q=e.values(O);I=A==="l"?C-e.min(q):T-e.max(q),I&&(k[D]=e.mapValues(O,function(J){return J+I}))}})})}function v(k,j){return e.mapValues(k.ul,function(E,C){if(j)return k[j.toLowerCase()][C];var T=e.sortBy(e.map(k,C));return(T[1]+T[2])/2})}function N(k){var j=n.buildLayerMatrix(k),E=e.merge(s(k,j),a(k,j)),C={},T;e.forEach(["u","d"],function(A){T=A==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(T=e.map(T,function(J){return e.values(J).reverse()}));var O=(A==="u"?k.predecessors:k.successors).bind(k),I=h(k,T,E,O),q=p(k,T,I.root,I.align,D==="r");D==="r"&&(q=e.mapValues(q,function(J){return-J})),C[A+D]=q})});var R=m(k,C);return y(C,R),v(C,k.graph().align)}function _(k,j,E){return function(C,T,R){var A=C.node(T),D=C.node(R),O=0,I;if(O+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":I=-A.width/2;break;case"r":I=A.width/2;break}if(I&&(O+=E?I:-I),I=0,O+=(A.dummy?j:k)/2,O+=(D.dummy?j:k)/2,O+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":I=D.width/2;break;case"r":I=-D.width/2;break}return I&&(O+=E?I:-I),I=0,O}}function S(k,j){return k.node(j).width}return nv}var rv,kC;function QU(){if(kC)return rv;kC=1;var e=kt(),t=_n(),n=XU().positionX;rv=s;function s(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,d){l.node(d).x=c})}function a(l){var c=t.buildLayerMatrix(l),d=l.graph().ranksep,h=0;e.forEach(c,function(p){var f=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+f/2}),h+=f+d})}return rv}var sv,_C;function ZU(){if(_C)return sv;_C=1;var e=kt(),t=IU(),n=$U(),s=PU(),a=_n().normalizeRanks,l=LU(),c=_n().removeEmptyRanks,d=DU(),h=qU(),p=FU(),f=KU(),m=QU(),y=_n(),v=yr().Graph;sv=N;function N(H,U){var ee=U&&U.debugTiming?y.time:y.notime;ee("layout",function(){var Y=ee(" buildLayoutGraph",function(){return O(H)});ee(" runLayout",function(){_(Y,ee)}),ee(" updateInputGraph",function(){S(H,Y)})})}function _(H,U){U(" makeSpaceForEdgeLabels",function(){I(H)}),U(" removeSelfEdges",function(){L(H)}),U(" acyclic",function(){t.run(H)}),U(" nestingGraph.run",function(){d.run(H)}),U(" rank",function(){s(y.asNonCompoundGraph(H))}),U(" injectEdgeLabelProxies",function(){q(H)}),U(" removeEmptyRanks",function(){c(H)}),U(" nestingGraph.cleanup",function(){d.cleanup(H)}),U(" normalizeRanks",function(){a(H)}),U(" assignRankMinMax",function(){J(H)}),U(" removeEdgeLabelProxies",function(){Z(H)}),U(" normalize.run",function(){n.run(H)}),U(" parentDummyChains",function(){l(H)}),U(" addBorderSegments",function(){h(H)}),U(" order",function(){f(H)}),U(" insertSelfEdges",function(){W(H)}),U(" adjustCoordinateSystem",function(){p.adjust(H)}),U(" position",function(){m(H)}),U(" positionSelfEdges",function(){P(H)}),U(" removeBorderNodes",function(){X(H)}),U(" normalize.undo",function(){n.undo(H)}),U(" fixupEdgeLabelCoords",function(){G(H)}),U(" undoCoordinateSystem",function(){p.undo(H)}),U(" translateGraph",function(){$(H)}),U(" assignNodeIntersects",function(){K(H)}),U(" reversePoints",function(){z(H)}),U(" acyclic.undo",function(){t.undo(H)})}function S(H,U){e.forEach(H.nodes(),function(ee){var Y=H.node(ee),se=U.node(ee);Y&&(Y.x=se.x,Y.y=se.y,U.children(ee).length&&(Y.width=se.width,Y.height=se.height))}),e.forEach(H.edges(),function(ee){var Y=H.edge(ee),se=U.edge(ee);Y.points=se.points,e.has(se,"x")&&(Y.x=se.x,Y.y=se.y)}),H.graph().width=U.graph().width,H.graph().height=U.graph().height}var k=["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"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function O(H){var U=new v({multigraph:!0,compound:!0}),ee=he(H.graph());return U.setGraph(e.merge({},j,V(ee,k),e.pick(ee,E))),e.forEach(H.nodes(),function(Y){var se=he(H.node(Y));U.setNode(Y,e.defaults(V(se,C),T)),U.setParent(Y,H.parent(Y))}),e.forEach(H.edges(),function(Y){var se=he(H.edge(Y));U.setEdge(Y,e.merge({},A,V(se,R),e.pick(se,D)))}),U}function I(H){var U=H.graph();U.ranksep/=2,e.forEach(H.edges(),function(ee){var Y=H.edge(ee);Y.minlen*=2,Y.labelpos.toLowerCase()!=="c"&&(U.rankdir==="TB"||U.rankdir==="BT"?Y.width+=Y.labeloffset:Y.height+=Y.labeloffset)})}function q(H){e.forEach(H.edges(),function(U){var ee=H.edge(U);if(ee.width&&ee.height){var Y=H.node(U.v),se=H.node(U.w),me={rank:(se.rank-Y.rank)/2+Y.rank,e:U};y.addDummyNode(H,"edge-proxy",me,"_ep")}})}function J(H){var U=0;e.forEach(H.nodes(),function(ee){var Y=H.node(ee);Y.borderTop&&(Y.minRank=H.node(Y.borderTop).rank,Y.maxRank=H.node(Y.borderBottom).rank,U=e.max(U,Y.maxRank))}),H.graph().maxRank=U}function Z(H){e.forEach(H.nodes(),function(U){var ee=H.node(U);ee.dummy==="edge-proxy"&&(H.edge(ee.e).labelRank=ee.rank,H.removeNode(U))})}function $(H){var U=Number.POSITIVE_INFINITY,ee=0,Y=Number.POSITIVE_INFINITY,se=0,me=H.graph(),ge=me.marginx||0,Re=me.marginy||0;function Oe(ce){var we=ce.x,be=ce.y,Be=ce.width,_e=ce.height;U=Math.min(U,we-Be/2),ee=Math.max(ee,we+Be/2),Y=Math.min(Y,be-_e/2),se=Math.max(se,be+_e/2)}e.forEach(H.nodes(),function(ce){Oe(H.node(ce))}),e.forEach(H.edges(),function(ce){var we=H.edge(ce);e.has(we,"x")&&Oe(we)}),U-=ge,Y-=Re,e.forEach(H.nodes(),function(ce){var we=H.node(ce);we.x-=U,we.y-=Y}),e.forEach(H.edges(),function(ce){var we=H.edge(ce);e.forEach(we.points,function(be){be.x-=U,be.y-=Y}),e.has(we,"x")&&(we.x-=U),e.has(we,"y")&&(we.y-=Y)}),me.width=ee-U+ge,me.height=se-Y+Re}function K(H){e.forEach(H.edges(),function(U){var ee=H.edge(U),Y=H.node(U.v),se=H.node(U.w),me,ge;ee.points?(me=ee.points[0],ge=ee.points[ee.points.length-1]):(ee.points=[],me=se,ge=Y),ee.points.unshift(y.intersectRect(Y,me)),ee.points.push(y.intersectRect(se,ge))})}function G(H){e.forEach(H.edges(),function(U){var ee=H.edge(U);if(e.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function z(H){e.forEach(H.edges(),function(U){var ee=H.edge(U);ee.reversed&&ee.points.reverse()})}function X(H){e.forEach(H.nodes(),function(U){if(H.children(U).length){var ee=H.node(U),Y=H.node(ee.borderTop),se=H.node(ee.borderBottom),me=H.node(e.last(ee.borderLeft)),ge=H.node(e.last(ee.borderRight));ee.width=Math.abs(ge.x-me.x),ee.height=Math.abs(se.y-Y.y),ee.x=me.x+ee.width/2,ee.y=Y.y+ee.height/2}}),e.forEach(H.nodes(),function(U){H.node(U).dummy==="border"&&H.removeNode(U)})}function L(H){e.forEach(H.edges(),function(U){if(U.v===U.w){var ee=H.node(U.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:U,label:H.edge(U)}),H.removeEdge(U)}})}function W(H){var U=y.buildLayerMatrix(H);e.forEach(U,function(ee){var Y=0;e.forEach(ee,function(se,me){var ge=H.node(se);ge.order=me+Y,e.forEach(ge.selfEdges,function(Re){y.addDummyNode(H,"selfedge",{width:Re.label.width,height:Re.label.height,rank:ge.rank,order:me+ ++Y,e:Re.e,label:Re.label},"_se")}),delete ge.selfEdges})})}function P(H){e.forEach(H.nodes(),function(U){var ee=H.node(U);if(ee.dummy==="selfedge"){var Y=H.node(ee.e.v),se=Y.x+Y.width/2,me=Y.y,ge=ee.x-se,Re=Y.height/2;H.setEdge(ee.e,ee.label),H.removeNode(U),ee.label.points=[{x:se+2*ge/3,y:me-Re},{x:se+5*ge/6,y:me-Re},{x:se+ge,y:me},{x:se+5*ge/6,y:me+Re},{x:se+2*ge/3,y:me+Re}],ee.label.x=ee.x,ee.label.y=ee.y}})}function V(H,U){return e.mapValues(e.pick(H,U),Number)}function he(H){var U={};return e.forEach(H,function(ee,Y){U[Y.toLowerCase()]=ee}),U}return sv}var av,NC;function JU(){if(NC)return av;NC=1;var e=kt(),t=_n(),n=yr().Graph;av={debugOrdering:s};function s(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){c.setNode(d,{label:d}),c.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){c.setEdge(d.v,d.w,{},d.name)}),e.forEach(l,function(d,h){var p="layer"+h;c.setNode(p,{rank:"same"}),e.reduce(d,function(f,m){return c.setEdge(f,m,{style:"invis"}),m})}),c}return av}var ov,SC;function eW(){return SC||(SC=1,ov="0.8.5"),ov}var iv,jC;function tW(){return jC||(jC=1,iv={graphlib:yr(),layout:ZU(),debug:JU(),util:{time:_n().time,notime:_n().notime},version:eW()}),iv}var nW=tW();const EC=Qv(nW),Ya=240,Yl=130,ci=74,Yd=72,Tl=ci+Yd;function oR(e,t){var s;let n=Ya;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??Ya);return n}const yd=420,iR=1;function rW(e,t,n,s){return Math.min(iR,n/Math.max(1,e),s/Math.max(1,t))}function Ka(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function sW(e,t){return((t==null?void 0:t.get(e))??0)>0?yd:0}function aW(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Kl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Ya)+sW(e,n),h:Math.max((s==null?void 0:s.height)??Yl,aW(e,n))}}function oW(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function iW(e,t,n,s,a,l){const c=new EC.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(k=>!a.has(k)),h=new Set(d);for(const k of d){const{w:j,h:E}=Kl(k,s,l);c.setNode(k,{width:j,height:E})}for(const k of t)h.has(k.source)&&h.has(k.target)&&c.setEdge(k.source,k.target);EC.layout(c);const p=new Map;let f=1/0,m=1/0,y=-1/0,v=-1/0;for(const k of d){const j=c.node(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ya,T=(E==null?void 0:E.height)??Yl,R=Kl(k,s,l),A=j.x-R.w/2,D=j.y-R.h/2;p.set(k,{x:A,y:D}),A<f&&(f=A),D<m&&(m=D),A+C>y&&(y=A+C),D+T>v&&(v=D+T)}if(Number.isFinite(f)&&Number.isFinite(m))for(const[k,j]of p)p.set(k,{x:j.x-f,y:j.y-m});const N=Number.isFinite(y)?y-f:0,_=Number.isFinite(v)?v-m:0;let S=null;for(const k of e){const j=a.get(k);if(!j)continue;const E=s.get(k),C=(E==null?void 0:E.width)??Ya,T=(E==null?void 0:E.height)??Yl;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 lW(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,d=new Map;for(const T of e){const R=Ka(T),A=d.get(R);A?A.push(T.id):d.set(R,[T.id])}const p=Array.from(d.keys()).sort().map(T=>({sid:T,...iW(d.get(T),t,s,l,a,c)})),f=oR(e,l),m=T=>T.reduce((R,A)=>Math.max(R,A.width),0)+yd,y=T=>T.reduce((R,A)=>R+A.height,0)+Tl*Math.max(0,T.length-1),v=T=>{const R=[[]];let A=0;for(const D of p)A>0&&A+D.height>T&&(R.push([]),A=0),R[R.length-1].push(D),A+=D.height+Tl;return R},N=[];for(let T=0;T<p.length;T++){let R=-Tl;for(let A=T;A<p.length;A++)N.push(R+=p[A].height+Tl)}N.sort((T,R)=>T-R);const _=T=>{let R=0,A=N.length-1;for(;R<A;){const D=R+A>>1;v(N[D]).length<=T?A=D:R=D+1}return v(N[R])};let S=[p];const k=n.availableWidth??0,j=n.availableHeight??0;if(k>0&&j>0){const T=A=>rW(A.reduce((D,O)=>D+m(O),0)+f*(A.length-1),Math.max(...A.map(y)),k,j);let R=T(S);for(let A=2;A<=p.length;A++){const D=_(A),O=T(D);O>R+1e-9&&(R=O,S=D)}}const E=new Map;let C=0;for(const T of S){const R=m(T);let A=0;for(const{positions:D,height:O,pinnedBox:I}of T){for(const[J,Z]of D)E.set(J,{x:Z.x+C,y:Z.y+A});let q=A+O;I&&I.maxY>q&&I.minX<C+R&&C<I.maxX&&(q=I.maxY),A=q+Tl}C+=R+f}return e.map(T=>{const R=a.get(T.id);if(R)return{...T,position:R};const A=E.get(T.id);return A?{...T,position:A}:T})}function cW(e,t,n,s,a){const c=ci+Yd,d=60,h=v=>Kl(v,s,a),p=new Map(e.map(v=>[v.id,Ka(v)])),f=[],m=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,N)=>v.pos.y-N.pos.y||v.pos.x-N.pos.x||v.id.localeCompare(N.id)),y=[];for(const{id:v,pos:N}of m){const{w:_,h:S}=h(v),k=p.get(v)??"_default";if(n.has(v)){f.push({x:N.x,y:N.y,w:_,h:S,sid:k});continue}let j=N.y;for(let E=0;E<f.length+1;E++){const C=f.find(T=>{const R=T.sid===k?24:d,A=T.sid===k?24:c;return N.x<T.x+T.w+R&&T.x<N.x+_+R&&j<T.y+T.h+A&&T.y<j+S+A});if(!C)break;j=C.y+C.h+(C.sid===k?24:c)}j!==N.y&&(t.set(v,{x:N.x,y:j}),y.push(v)),f.push({x:N.x,y:j,w:_,h:S,sid:k})}return y}function uW(e,t,n,s,a,l,c){const d=E=>Kl(E,s,l),h=E=>n.get(E)??t.get(E),p=E=>{const C=s.get(E);return{cw:(C==null?void 0:C.width)??Ya,ch:(C==null?void 0:C.height)??Yl}},f=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!h(E.id))continue;const C=Ka(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 v=new Map,N=[];for(const E of e){const C=h(E.id);if(!C)continue;const{w:T,h:R}=d(E.id),A=Ka(E);y.has(A)?(v.get(A)??v.set(A,[]).get(A)).push(E):N.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(v.size===0||f&&N.length===0)return[];const _=ci+Yd,S=(E,C,T,R)=>N.some(A=>E<A.x+A.w+ci&&A.x<E+T+ci&&C<A.y+A.h+_&&A.y<C+R+_),k=oR(e,s),j=[];for(const E of[...v.keys()].sort()){const C=v.get(E);let T=1/0,R=1/0,A=-1/0,D=-1/0,O=-1/0,I=-1/0;for(const z of C){const X=h(z.id),{w:L,h:W}=d(z.id),{cw:P,ch:V}=p(z.id);T=Math.min(T,X.x),R=Math.min(R,X.y),A=Math.max(A,X.x+L),D=Math.max(D,X.y+W),O=Math.max(O,X.x+P),I=Math.max(I,X.y+V)}const q=A-T,J=D-R,Z=[...new Set(N.map(z=>Math.round(z.x)))].sort((z,X)=>z-X),$=Z.length?Z:[T],K=[0,...N.map(z=>z.y+z.h+_)].sort((z,X)=>z-X);let G=null;if(f){let z=1/0,X=1/0,L=-1/0,W=-1/0;for(const ee of N)z=Math.min(z,ee.x),X=Math.min(X,ee.y),L=Math.max(L,ee.x+ee.cw),W=Math.max(W,ee.y+ee.ch);const P=(ee,Y)=>{const se=c.width/(Math.max(L,ee+O-T)-Math.min(z,ee)+yd),me=c.height/(Math.max(W,Y+I-R)-Math.min(X,Y));return[Math.min(iR,se,me),Math.min(se,me),Math.max(se,me)]},V=(ee,Y)=>{for(let se=0;se<ee.length;se++){if(ee[se]>Y[se]+1e-9)return!0;if(ee[se]<Y[se]-1e-9)return!1}return!1},he=Math.round(L+yd+k),H=[...new Set([...K,X])].sort((ee,Y)=>ee-Y);let U=null;for(const ee of[...$,he])for(const Y of H){if(S(ee,Y,q,J))continue;const se=P(ee,Y);(U===null||V(se,U))&&(U=se,G={x:ee,y:Y})}G&&G.x===T&&G.y===R&&(G=null)}else e:for(const z of $)for(const X of K){if(X>=R)break;if(!S(z,X,q,J)){G={x:z,y:X};break e}}if(G){const z=G.x-T,X=G.y-R;for(const L of C){const W=h(L.id);t.set(L.id,{x:W.x+z,y:W.y+X})}j.push(E)}for(const z of C){const X=h(z.id),{w:L,h:W}=d(z.id);N.push({x:X.x,y:X.y,w:L,h:W,...p(z.id)})}}return j}function dW(e,t,n){const s=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=Ka(a);(s.get(l)??s.set(l,[]).get(l)).push(a)}if(s.size===0)return e;for(const a of s.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=s.get(Ka(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,d=l.find(f=>f.id===c)??l[0],h=n(d.id);return{...a,position:{x:a.position.x+h.x-d.position.x,y:a.position.y+h.y-d.position.y}}})}function hW(e,t,n,s,a,l=!1,c){const p=ci+Yd+1,f=8,m=1.75,y=200,v=.7,N=.01,_=I=>Kl(I,s,c),S=I=>n.get(I)??t.get(I),k=new Map;for(const I of e){if(!S(I.id))continue;const q=Ka(I),J=k.get(q);J?J.push(I):k.set(q,[I])}const j=[],E=new Set,C=new Set,T=a.size===0;for(const I of[...k.keys()].sort()){const q=k.get(I);let J=1/0,Z=1/0,$=-1/0,K=-1/0,G=!1;for(const W of q){const P=S(W.id),{w:V,h:he}=_(W.id);J=Math.min(J,P.x),Z=Math.min(Z,P.y),$=Math.max($,P.x+V),K=Math.max(K,P.y+he),n.has(W.id)&&(G=!0)}const z=$-J,X=K-Z;C.add(I);const L=a.get(I);L&&(z>L.w+f||X>L.h+f)&&E.add(I),a.set(I,{w:z,h:X}),j.push({sid:I,members:q.map(W=>W.id),x:J,y:Z,w:z,h:X,anchored:G,mass:1})}for(const I of[...a.keys()])C.has(I)||a.delete(I);if(l||T)return[];let R=!1;for(let I=0;I<j.length&&!R;I++)for(let q=I+1;q<j.length;q++){const J=j[I],Z=j[q];if(!(J.anchored&&Z.anchored)&&Math.abs(J.x+J.w/2-(Z.x+Z.w/2))<(J.w+Z.w)/2+61&&Math.abs(J.y+J.h/2-(Z.y+Z.h/2))<(J.h+Z.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const I of j)E.has(I.sid)&&(I.mass=8);else for(const I of j)I.mass=Math.max(1,I.w*I.h/(Ya*Yl));const A=new Map(j.map(I=>[I.sid,I.x])),D=new Map(j.map(I=>[I.sid,I.y]));for(let I=0;I<y;I++){const q=new Map,J=new Map;let Z=0;for(let $=0;$<j.length;$++)for(let K=$+1;K<j.length;K++){const G=j[$],z=j[K];if(G.anchored&&z.anchored)continue;const X=G.x+G.w/2,L=G.y+G.h/2,W=z.x+z.w/2,P=z.y+z.h/2,V=(G.w+z.w)/2+61-Math.abs(X-W),he=(G.h+z.h)/2+p-Math.abs(L-P);if(V<=0||he<=0)continue;const H=(Ke,fe)=>!Ke.anchored&&!(fe<0&&Ke.x<=0),U=(Ke,fe)=>!Ke.anchored&&!(fe<0&&Ke.y<=0),ee=(Ke,fe,dt)=>{const yt=Ke===fe,ot=yt?G.sid<z.sid?-1:1:Math.sign(Ke-fe);return dt(G,ot)||dt(z,-ot)?ot:yt&&(dt(G,-ot)||dt(z,ot))?-ot:0},Y=ee(X,W,H),se=ee(L,P,U),me=Y!==0,ge=se!==0;if(!me&&!ge)continue;const Re=me&&(!ge||V*m<he),[Oe,ce,we,be]=Re?[Y,V,q,H]:[se,he,J,U],Be=be(G,Oe),_e=be(z,-Oe),Ce=G.mass,Ge=z.mass,tt=Be?_e?Ge/(Ce+Ge):1:0,Qe=_e?Be?Ce/(Ce+Ge):1:0,Xe=ce*v;we.set(G.sid,(we.get(G.sid)??0)+Oe*Xe*tt),we.set(z.sid,(we.get(z.sid)??0)-Oe*Xe*Qe),Z+=Xe}for(const $ of j)$.anchored||($.x=Math.max(0,$.x+(q.get($.sid)??0)),$.y=Math.max(0,$.y+(J.get($.sid)??0)));if(Z<N)break}const O=[];for(const I of j){const q=I.x-A.get(I.sid),J=I.y-D.get(I.sid);if(!(Math.abs(q)<1&&Math.abs(J)<1)){for(const Z of I.members){if(n.has(Z))continue;const $=t.get(Z);$&&t.set(Z,{x:$.x+q,y:$.y+J})}O.push(I.sid)}}return O}const fW=600;function Vv(e,t){return!(e.exitAt!=null&&t-e.exitAt>fW||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function pW(e,t){const n=new Set;for(const s of e.agents.values())Vv(s,t)&&n.add(s.id);return n}function mW(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 gW(e,t,n=0){if(!e)return!1;for(const s of t)if(mW(e,s,n))return!0;return!1}const lR="sessionGroup";function yW(e,t){var s;if(e.type===lR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const cR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function CC(e){const t={};for(const n of cR)t[n]=e(n);return t}function wW(e){return t=>e[t]??""}function vW(e,t){return cR.every(n=>e[n]===t[n])}function xW(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&s.set(a,l);return{positions:n,pinned:s}}const bW=1200,kW=1e3;function TC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<bW?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<kW}function Zu({durationMs:e,documentHidden:t,reducedMotion:n=_W()}){return t||n?!1:Number.isFinite(e)&&e>0}function _W(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function lv(e){const t=typeof document<"u"&&document.hidden;return Zu({durationMs:e,documentHidden:t})?e:0}function NW(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&s<n.width&&c>0&&a<n.height}function SW({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,NW(a,t,e))return!1;return s}const jW="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",cv="click for what's new";function EW(e){if(e.checkDisabled)return`${jW} · ${cv}`;if(e.checking)return`Asking npm for the newest release… · ${cv}`;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.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${cv}, and to check npm now`}function CW(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`:`${t} and check npm for a newer release`}function TW(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 AW(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 Yv={kind:"assumed",claude:!0,codex:!0};function RW(e){if(!e||typeof e!="object")return Yv;const t=e.providers;if(!t||typeof t!="object")return Yv;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function wd(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const AC=99;function MW(e){const t=Math.max(0,Math.floor(e));return t>AC?`${AC}+`:String(t)}const IW="Pause the canvas";function $W(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 OW(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 uR="paused · full",PW=(e,t)=>t>0?uR:e>0?`paused · ${MW(e)}`:"paused";function LW(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:PW(e.held,t),widest:uR,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"}}function RC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const DW={agent:S4,sessionGroup:U4},dR="react-flow__node";function MC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,dR))===!0}const uv=80,dv=.86;function IC(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 qW(e){try{const t=document.querySelector(`.${dR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const FW=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),BW=420;function zW(e){return e<.35?"far":e<.55?"mid":"full"}const zu=18,UW=200,WW=5*6e4,HW=6,GW=2*6e4,$C=400,Jx="agent-dag.layout",e0="agent-dag.viewport",hR="agent-dag.summariesDismissed",fR="agent-dag.sessionListOpen",pR="agent-dag.detailOpen",mR="agent-dag.usagePanelOpen",gR="agent-dag.systemPanelOpen",OC="agent-dag.accountsPanelOpen",hv="agent-dag.versionNoticeDismissed",PC="agent-dag.oldNameNoticeDismissed",VW=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:"},Uu="agent-dag.autoRestart",LC="agent-dag.bundleReloadedFor";function YW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(fR)==="1"}catch{return!1}}function KW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fR,e?"1":"0")}catch{}}function XW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(pR)==="1"}catch{return!1}}function QW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(pR,e?"1":"0")}catch{}}function ZW(){const e=bi(mR);return e===null?!0:e==="1"}function JW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(mR,e?"1":"0")}catch{}}function eH(){const e=bi(gR);return e===null?!0:e==="1"}function tH(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gR,e?"1":"0")}catch{}}function nH(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(hR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function DC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(hR,JSON.stringify(n))}catch{}}function rH(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Jx);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:a,pins:a.map(([l])=>l)}}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 pv(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(Jx,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function sH(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(e0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function aH(e){if(!(typeof window>"u"))try{window.localStorage.setItem(e0,JSON.stringify(e))}catch{}}function qC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Jx)}catch{}try{window.localStorage.removeItem(e0)}catch{}}}function oH(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);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(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.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}))}))},l=JSON.stringify(a,null,2),c=new Blob([l],{type:"application/json"}),d=URL.createObjectURL(c),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=d,h.download=`${Xt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Kv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Xv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},yR=N2;function iH(e,t,n,s,a,l,c,d,h,p,f,m,y,v,N,_,S,k){const j=[],E=[];for(const I of e.agents.values()){if(!S.has(I.id))continue;const q=I.exitAt!=null,J=_!=null&&!_.has(I.id),Z=[q?"rf-exiting":"",J?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,$=l.get(I.id);if(j.push({id:I.id,type:"agent",position:{x:0,y:0},data:{...I,now:t,onOpenContext:k},className:Z,ariaLabel:E4(I,t),...$?{width:$.width,height:$.height}:null}),I.parentId&&S.has(I.parentId)){const K=gx(I.sessionId),G=q,z=N.size>0&&(N.has(I.id)||N.has(I.parentId)),X=_!=null&&!_.has(I.id)&&!_.has(I.parentId),L=I.state==="active"?2:1.5,W=z?L+1.5:L,P=G?.2:X?.12:1,V=["sess-edge",I.state==="active"?"sess-live":"sess-idle",G?"rf-edge-exiting":"",z?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${I.parentId}->${I.id}`,source:I.parentId,target:I.id,animated:(I.state==="active"||z)&&!G,type:"smoothstep",style:{"--session-hue":K,strokeWidth:W,opacity:P,transition:"var(--edge-transition)"},className:V})}}const C=new Map;for(const I of e.agents.values())I.tools.length>0&&C.set(I.id,Math.min(4,I.tools.length));const T=`${y}#lanes:${oW(C)}`,R=j.filter(I=>JF(I.id,a,f,m));if(R.length>0||T!==v.current){if(R.length>0){const I=dW(lW(j,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:s,lanes:C}),a,q=>Gv(q,f,m)?void 0:f.get(q));for(const q of I)Gv(q.id,f,m)&&t8(q.id,q.position,f,m);uW(j,f,a,l,new Set(R.map(q=>q.id)),C,{width:n,height:s})}cW(j,f,a,l,C),v.current=T}const A=hW(j,f,a,l,c,!h||p,C);A.length>0&&d(A),Pu(f,e.agents),Pu(m,e.agents),Pu(a,e.agents),Pu(l,XF(e.agents.values()));const D=[];let O=!1;for(const I of j){let q=a.get(I.id)??f.get(I.id);q||(q=e8(I.id,f,m),O=!0),D.push({...I,position:q})}return O&&(v.current=""),{nodes:D,edges:E}}function lH(){return i.jsx(px,{children:i.jsx(cH,{})})}function cH(){var rr,jo,Eo,Mc;const e=ec(),t=Mt(),n=x.useState(Rv)[0],s=x.useRef(n),[,a]=x.useState(0),l=x.useCallback(()=>a(F=>F+1),[]),[c,d]=x.useState(XW);x.useEffect(()=>{QW(c)},[c]);const[h,p]=x.useState(()=>new Set),[f,m]=x.useState(null),[y,v]=x.useState(null),N=x.useCallback((F,B)=>{p(oe=>{if(!B)return new Set([F]);const ie=new Set(oe);return ie.has(F)?ie.delete(F):ie.add(F),ie}),m(oe=>B&&oe===F?oe:F),B||d(!0)},[]),_=x.useCallback(()=>{p(new Set),m(null)},[]),[S,k]=x.useState(null),[j,E]=x.useState(null),C=x.useCallback(F=>E(F),[]),[T,R]=x.useState(!1),[A,D]=x.useState(!1),[O,I]=x.useState(!1),q=x.useRef(null),J=x.useState(nH)[0],[Z,$]=x.useState(YW);x.useEffect(()=>{KW(Z)},[Z]);const[K,G]=x.useState(ZW);x.useEffect(()=>{JW(K)},[K]);const[z,X]=x.useState(eH);x.useEffect(()=>{tH(z)},[z]);const[L,W]=x.useState(()=>{try{const F=window.localStorage.getItem(OC);return F===null?!0:F==="1"}catch{return!0}});x.useEffect(()=>{try{window.localStorage.setItem(OC,L?"1":"0")}catch{}},[L]);const P=Bf(L,200),V=Bf(K,130),he=Bf(z,130),[H,U]=x.useState(null);x.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}U(F===null?!0:F==="on")},[]);const ee=x.useCallback(()=>{U(F=>{var oe;const B=F!==!0;try{localStorage.setItem("agent-dag.sound",B?"on":"off")}catch{}return B&&((oe=Ge.current)==null||oe.unlock()),B})},[]),Y=x.useCallback(F=>{ee()},[ee]),se=x.useRef(Y);se.current=Y;const me=x.useRef(H);me.current=H;const[ge,Re]=x.useState(()=>fF(bi)),Oe=x.useRef(ge);Oe.current=ge;const ce=x.useRef(null),we=x.useCallback((F,B=!1)=>{var oe,ie;if((oe=Ge.current)==null||oe.unlock(),ce.current!==null&&clearTimeout(ce.current),ce.current=null,!B){(ie=Ge.current)==null||ie.play(F,!0);return}ce.current=setTimeout(()=>{var Te;ce.current=null,(Te=Ge.current)==null||Te.play(F,!0)},lF)},[]),be=x.useCallback((F,B)=>{Re(oe=>{const ie={level:Vl(B.level??oe[F].level),figure:Q2(F,B.figure??oe[F].figure)};try{localStorage.setItem(Z2[F],String(ie.level)),localStorage.setItem(J2[F],ie.figure)}catch{}return{...oe,[F]:ie}}),we(F,!0)},[we]);x.useEffect(()=>()=>{ce.current!==null&&clearTimeout(ce.current)},[]);const[Be,_e]=x.useState(!1),Ce=x.useRef(null),Ge=x.useRef(null),[tt,Qe]=x.useState("locked");x.useEffect(()=>{const F=gF({enabled:()=>me.current===!0,prefs:()=>Oe.current,onState:Qe});Ge.current=F,Qe(F.state());const B=()=>F.unlock();return window.addEventListener("pointerdown",B,{once:!0,capture:!0}),window.addEventListener("keydown",B,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",B,{capture:!0}),window.removeEventListener("keydown",B,{capture:!0})}},[]);const[Xe,Ke]=x.useState(!1),[fe,dt]=x.useState(null),[yt,ot]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(hv)??""}catch{return""}}),[ye,je]=x.useState(!1),Fe=x.useRef(0),[Ye,ct]=x.useState(!1),re=x.useCallback((F=!1)=>(F&&(Fe.current=Date.now(),ct(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(B=>B.ok?B.json():null).then(B=>{B&&dt(B)}).catch(()=>{}).finally(()=>{F&&ct(!1)})),[]),Ae=x.useCallback(()=>{re(Date.now()-Fe.current>=VW)},[re]);x.useEffect(()=>{re();const F=window.setInterval(Ae,5*6e4),B=()=>{document.visibilityState==="visible"&&Ae()};return document.addEventListener("visibilitychange",B),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",B)}},[re,Ae]),x.useEffect(()=>{Xe&&re()},[Xe,re]),x.useEffect(()=>{const F=SF();let B=null;const oe=Ue=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:F,looking:Ue}),keepalive:!0}).catch(()=>{})},ie=()=>{const Ue=_F(document);NF(B,Ue)&&oe(Ue),B=Ue},Te=()=>{B&&oe(!1),B=!1};ie();const Ne=window.setInterval(ie,kF);return window.addEventListener("focus",ie),window.addEventListener("blur",ie),document.addEventListener("visibilitychange",ie),window.addEventListener("pagehide",Te),()=>{window.clearInterval(Ne),window.removeEventListener("focus",ie),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",ie),window.removeEventListener("pagehide",Te),Te()}},[]);const ae=(fe==null?void 0:fe.notice)??null,[Ee,De]=x.useState(null),mt=x.useRef(!1);x.useEffect(()=>{if(mt.current)return;const F=e_(),B=$F(F),oe=FF({stored:B,running:(fe==null?void 0:fe.running)??null,notes:J1,remembers:OF(F)});if(oe.reason==="no-version")return;mt.current=!0,oe.record&&PF(F,oe.record);const ie=qF({tourSeen:LF(F),decision:oe}),Te=oe.show.length?{entries:oe.show,since:B,firstRun:!1}:null;ie.tour&&I(!0),ie.notes==="now"?De(Te):ie.notes==="after"&&(q.current=Te)},[fe==null?void 0:fe.running]);const xt=(fe==null?void 0:fe.running)??"3.22.14",Me=x.useMemo(()=>eA(J1,null,xt),[xt]),Ze=x.useCallback(()=>{De({entries:Me,since:null,firstRun:!1})},[Me]),[ht,wt]=x.useState(null),[Wt,Fr]=x.useState(Yv);x.useEffect(()=>{let F=!1;return fetch("/api/health").then(B=>B.ok?B.json():null).then(B=>{F||(Fr(RW(B)),!(!B||typeof B.workspace!="string")&&wt(B.workspace))}).catch(()=>{}),()=>{F=!0}},[Xe]);const Kn=x.useRef(Wt);Kn.current=Wt;const Br=ae?`${ae.kind}:${ae.to}`:"",Xn=ae!=null&&yt!==Br,eo=x.useCallback(()=>{ot("");try{window.localStorage.setItem(hv,"")}catch{}},[]),zr=x.useCallback(()=>{if(ae){ot(Br);try{window.localStorage.setItem(hv,Br)}catch{}}},[ae,Br]),[ta,Ur]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(PC)??""}catch{return""}}),Rn=fe!=null&&fe.invokedAs&&fe.invokedAs!==Xt?fe.invokedAs:null,Wr=Rn!=null&&ta!==Rn,ks=x.useCallback(()=>{if(Rn){Ur(Rn);try{window.localStorage.setItem(PC,Rn)}catch{}}},[Rn]),qt=((rr=fe==null?void 0:fe.upgrade)==null?void 0:rr.state)??"idle",xr=Bq(fe==null?void 0:fe.upgrade),na=x.useRef(!1),Ei=x.useCallback(async()=>{if(pr(na.current||qt==="running")){na.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await re(),na.current=!1}},[qt,re]);x.useEffect(()=>{if(qt!=="running")return;const F=window.setInterval(re,3e3);return()=>window.clearInterval(F)},[qt,re]);const to=x.useCallback(async()=>{const F=fe==null?void 0:fe.command;!F||!await Tx(F)||(je(!0),window.setTimeout(()=>je(!1),1600))},[fe==null?void 0:fe.command]),Mn=x.useCallback(()=>{$(F=>(F||W(!1),!F))},[]),ra=x.useCallback(()=>{W(F=>(F||$(!1),!F))},[]),[sa,aa]=x.useState(!1),[oa,ia]=x.useState(!1),[la,no]=x.useState(()=>{try{return Number(localStorage.getItem(s_))||0}catch{return 0}}),[ca,Ci]=x.useState([]),[ft,ro]=x.useState(!1);x.useEffect(()=>{let F=!0;const B=()=>{fetch("/api/browser-watch?live=0").then(ie=>ie.ok?ie.json():null).then(ie=>{var Te;!F||!(ie!=null&&ie.ok)||(Ci(ie.episodes??[]),ro(((Te=ie.settings)==null?void 0:Te.enabled)===!0))}).catch(()=>{})};B();const oe=setInterval(B,5*6e4);return()=>{F=!1,clearInterval(oe)}},[]);const[ua,Hr]=x.useState([]),Gr=x.useRef(new Set),[Vr,da]=x.useState(null);x.useEffect(()=>{let F=!0,B=0;const oe=()=>{fetch("/api/lan").then(ie=>ie.ok?ie.json():null).then(ie=>F?(ie!=null&&ie.ok&&Hr(B1(Array.isArray(ie.pending)?ie.pending:[],ie.aliases)),ie):null).catch(()=>null).then(ie=>{F&&(B=window.setTimeout(oe,(ie==null?void 0:ie.enabled)===!0?Bv:Y2))})};return oe(),()=>{F=!1,window.clearTimeout(B)}},[]);const Yr=x.useCallback(async(F,B)=>{if(!Vr){da(F);try{const ie=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:F,fp:B})})).json().catch(()=>null);ie&&Array.isArray(ie.pending)?Hr(B1(ie.pending,ie.aliases)):Hr(Te=>Te.filter(Ne=>Ne.fp!==B))}catch{}finally{da(null)}}},[Vr]),$t=x.useMemo(()=>T8(ca,la).length,[ca,la]),[ha,hn]=x.useState(0),dc=x.useRef(null),[Kd,hc]=x.useState(!1),br=x.useRef(null),[so,_s]=x.useState(0),Zt=x.useState(()=>o8({protect:F=>AL(s.current,F)}))[0],[ao,Xd]=x.useState(!1),fa=x.useCallback(()=>{const F=Zt.paused&&Zt.dropped>0,B=Zt.setPaused(!Zt.paused);F&&RL(s.current);for(const oe of B)s.current=zk(s.current,oe);Xd(Zt.paused)},[Zt]),[Tt,Ti]=x.useState(Date.now()),[ln,oo]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Uu)!=="0"}catch{return!0}}),io=x.useRef(!1),lt=x.useCallback(()=>{const F=!ln;io.current=!0;try{window.localStorage.removeItem(Uu)}catch{}oo(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(B=>B.ok?B.json():null).then(B=>{var oe;B!=null&&B.ok&&oo(((oe=B.prefs)==null?void 0:oe.autoUpdate)!==!1)}).catch(()=>{})},[ln]),[Qn,pa]=x.useState(!1),[Ai,fc]=x.useState("restart"),[Ri,Mi]=x.useState(null),kr=x.useRef(!1),ma=x.useRef(null),Zn=x.useRef(0),Nn=x.useCallback(async F=>{if(!pr(kr.current))return;const B=(F==null?void 0:F.upgrade)===!0;kr.current=!0,ma.current=xr;const oe=++Zn.current;fc(B?"npx":"restart"),pa(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ae==null?void 0:ae.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:B})})}catch{}window.setTimeout(()=>{if(Zn.current===oe&&kr.current){kr.current=!1,pa(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[ae==null?void 0:ae.to,xr]),In=x.useRef(null);x.useEffect(()=>{const F=Y1(s.current.agents.values())>0,B=Gq({enabled:ln,kind:ae==null?void 0:ae.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Xn,visible:document.visibilityState==="visible",busy:F,idleSince:In.current,now:Tt});In.current=B.idleSince,B.restart&&Nn()},[ln,ae==null?void 0:ae.kind,fe==null?void 0:fe.canRestart,Xn,Tt,Nn]);const Ns=Y1(s.current.agents.values()),Ss=Hq(Ns),Jn=X2({enabled:ln,kind:ae==null?void 0:ae.kind,canRestart:(fe==null?void 0:fe.canRestart)===!0,noticeOpen:Xn,visible:document.visibilityState==="visible",busy:Ns>0,idleSince:In.current,now:Tt});x.useEffect(()=>{const F=fe==null?void 0:fe.running;let B=null,oe=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(LC)}catch{return}const ie=Fq({bundle:"3.22.14",running:F,pending:B,lastTried:oe});if(ie==="reload"){try{window.sessionStorage.setItem(LC,F??"")}catch{return}window.location.reload();return}if(ie!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}kr.current=!1,pa(!1),Mi(F??null);const Te=window.setTimeout(()=>Mi(null),6e3);return()=>window.clearTimeout(Te)},[fe==null?void 0:fe.running]),x.useEffect(()=>{if(Qn&&zq({asked:ma.current,reported:xr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}kr.current=!1,pa(!1)}},[Qn,xr]);const pc=x.useState(()=>xW(rH()))[0],Jt=x.useRef(pc.pinned),_r=x.useRef(null),lo=x.useState(()=>sH())[0],[co,uo]=x.useState(()=>new Set),[Kr,mc]=x.useState(l8),[fn,ga]=x.useState(()=>CC(RC)),Xr=x.useMemo(()=>wW(fn),[fn]),ho=x.useCallback(F=>yW(F,Xr),[Xr]),Qd=x.useMemo(()=>({background:fn["--panel"],border:`1px solid ${fn["--line"]}`,borderRadius:8}),[fn]),[gc,Ii]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Kr;try{window.localStorage.setItem(sA,Kr)}catch{}ga(F=>{const B=CC(RC);return vW(F,B)?F:B})},[Kr]);const $n=x.useCallback((F,B)=>{if(Zu({durationMs:B,documentHidden:document.hidden})){e.setViewport(F,{duration:B});return}const{d3Zoom:oe,d3Selection:ie}=t.getState(),Te=ie==null?void 0:ie.property("__zoom");if(oe&&ie&&Te&&Te.k>0&&F.zoom>0){oe.transform(ie,Te.scale(F.zoom/Te.k).translate((F.x-Te.x)/F.zoom,(F.y-Te.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Qr=x.useRef(null);x.useEffect(()=>{if(!lo)return;const F=window.setTimeout(()=>{try{$n(lo,0)}catch{}On.current=Date.now()},60);return()=>window.clearTimeout(F)},[$n,lo]);const $i=x.useRef(!0),[Nr,fo]=x.useState(null);x.useEffect(()=>{const F=new EventSource("/events"),B=s8(l,{now:()=>Date.now(),setTimeout:(oe,ie)=>window.setTimeout(oe,ie),clearTimeout:oe=>window.clearTimeout(oe)});return F.addEventListener("open",()=>{Ke(!0),Ii(!0)}),F.addEventListener("error",()=>{Ke(!1),fo(null)}),F.addEventListener("replay-end",()=>{$i.current=!1,B.flush(),fo(Date.now())}),F.addEventListener("hook",oe=>{var ie;try{const Te=JSON.parse(oe.data);if(!Zt.accept(Te))return;s.current=zk(s.current,Te);const Ne=Te.replay===!0||$i.current||Date.now()-Te.receivedAt>3e4;Ne?B.replay():B.live();const Ue=mF(Te,Ne);Ue&&((ie=Ge.current)==null||ie.play(Ue))}catch{}}),()=>{F.close(),B.cancel()}},[l]),x.useEffect(()=>{const F=setInterval(()=>{const B=Date.now();Ti(B);let oe=ML(s.current,B,Bk);IL(s.current,B,Bk)&&(oe=!0),CL(s.current,B,UW,WW)&&(oe=!0),TL(s.current,B,HW,GW)&&(oe=!0),p(ie=>KF(ie,s.current.agents)),m(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),E(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),k(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),oe&&l()},250);return()=>clearInterval(F)},[l]);const js=x.useRef(null),On=x.useRef(0),po=420,cn=x.useCallback((F=500)=>{const B=uv,oe=1,ie=.2,Te=dv;try{const Ne=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(St=>St.offsetWidth>0);if(!Ne||Ue.length===0)return;const nt=Ne.getBoundingClientRect(),pt=e.getViewport();if(!Number.isFinite(pt.zoom)||pt.zoom<=0)return;const st=St=>(St-nt.left-pt.x)/pt.zoom,nn=St=>(St-nt.top-pt.y)/pt.zoom,Er=Ue.map(St=>St.getBoundingClientRect()),ja=Math.min(...Er.map(St=>st(St.left))),Ms=Math.max(...Er.map(St=>st(St.right))),nl=Math.min(...Er.map(St=>nn(St.top))),dh=Math.max(...Er.map(St=>nn(St.bottom))),Ic=Ms-ja,Co=dh-nl;if(!(Ic>0&&Co>0))return;const Cr=Math.max(ie,Math.min(oe,(nt.width-IC(Ne)-B*2)/(Ic+po)*Te,(nt.height-B*2)/Co*Te)),Tr={x:B-ja*Cr,y:Math.max(B,(nt.height-Co*Cr)/2)-nl*Cr,zoom:Cr};$n(Tr,F),On.current=Date.now(),Qr.current=Zu({durationMs:F,documentHidden:document.hidden})?{target:Tr,until:Date.now()+F+60}:null,window.setTimeout(()=>{var St;try{((St=Qr.current)==null?void 0:St.target)===Tr&&(Qr.current=null);const To=e.getViewport();(Math.abs(To.zoom-Cr)>.01||Math.abs(To.x-Tr.x)>2)&&$n(Tr,0)}catch{}},F+60)}catch{}},[e,$n]);x.useEffect(()=>{const F=()=>{if(!document.hidden)return;const B=Qr.current;if(Qr.current=null,!(!B||Date.now()>B.until)){try{$n(B.target,0)}catch{}On.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[$n]);const mo=x.useRef(""),Ht=x.useRef(null),Zr=x.useRef(0),Es=x.useCallback(()=>{Zr.current=Date.now()},[]),Jr=x.useRef(null),yc=x.useRef(0),ya=x.useCallback(()=>{yc.current=Date.now()},[]),go=x.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:On.current,lastCanvasInputAt:yc.current}),[]),es="agent-dag.autoFitDisabled",wa=x.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(es)==="1"}catch{return!1}})[0],ts=x.useRef(wa),[wc,vc]=x.useState(wa),Oi=x.useCallback(()=>{if(!ts.current){ts.current=!0,vc(!0);try{window.localStorage.setItem(es,"1")}catch{}}},[]),Pi=x.useCallback(()=>{ts.current=!1,vc(!1);try{window.localStorage.removeItem(es)}catch{}cn(400)},[e,cn]);x.useEffect(()=>{const F=setInterval(()=>{if(ts.current||Date.now()-Zr.current<800)return;const B=s.current,oe=Date.now(),ie=[];for(const Ne of B.agents.values())Vv(Ne,oe)&&ie.push({id:Ne.id});if(ie.length===0)return;const Te=[];for(const{id:Ne}of ie){const Ue=Cs.current.get(Ne),nt=Jt.current.get(Ne)??pn.current.get(Ne);!Ue||!nt||Te.push({x:nt.x,y:nt.y,width:Ue.width,height:Ue.height})}SW({pane:Jr.current,viewport:e.getViewport(),boxes:Te})&&cn(600)},1500);return()=>clearInterval(F)},[e]);const Li=x.useRef(!1),Cs=x.useRef(new Map),xc=x.useRef(0),Zd=x.useCallback(F=>{const B=Cs.current;let oe=!1;for(const ie of F.nodeInternals.values()){const Te=ie.width,Ne=ie.height;if(Te==null||Ne==null)continue;const Ue=B.get(ie.id);Ue?(Math.abs(Ue.height-Ne)>4||Math.abs(Ue.width-Te)>4)&&(B.set(ie.id,{width:Te,height:Ne}),oe=!0):(B.set(ie.id,{width:Te,height:Ne}),oe=!0)}return oe&&(xc.current+=1),xc.current},[]),bc=ut(Zd),[Di,Jd]=x.useState(0);x.useEffect(()=>{let F=0;const B=()=>{const ie=Cs.current;let Te=!1;for(const Ne of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Ne.getAttribute("data-id");if(!Ue)continue;const nt=Ne.offsetWidth,pt=Ne.offsetHeight;if(!nt||!pt)continue;const st=ie.get(Ue);(!st||Math.abs(st.width-nt)>4||Math.abs(st.height-pt)>4)&&(ie.set(Ue,{width:nt,height:pt}),Te=!0)}Te&&Jd(Ne=>Ne+1)};if(Li.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(B,32):F=requestAnimationFrame(B),()=>{cancelAnimationFrame(F),window.clearTimeout(oe)}});const pn=x.useRef(pc.positions),eh=x.useRef(new Set),qi=x.useRef(""),Sr=x.useMemo(()=>{const F=[];for(const B of s.current.agents.values())Vv(B,Tt)&&F.push(B.id+(B.parentId?`>${B.parentId}`:""));return F.sort(),`${F.join("|")}#sv${bc}.${Di}`},[s.current,s.current.revision,Tt,bc,Di]),va=x.useRef(null);x.useEffect(()=>(va.current!=null&&window.clearTimeout(va.current),va.current=window.setTimeout(()=>{pv(pn.current,Jt.current)},1500),()=>{va.current!=null&&window.clearTimeout(va.current)}),[Sr]),x.useEffect(()=>{if(mo.current===Sr)return;const F=mo.current;if(mo.current=Sr,!F||ts.current)return;Date.now()-On.current>1200&&cn(400),js.current&&window.clearTimeout(js.current),js.current=window.setTimeout(()=>{ts.current||cn(500)},280)},[Sr,e,cn]);const Fi=x.useMemo(()=>ZF(s.current,h),[s.current,s.current.revision,h]),Bi=x.useMemo(()=>pW(s.current,Tt),[s.current,s.current.revision,Tt]),yo=x.useRef(null),[wo,kc]=x.useState({w:0,h:0});x.useEffect(()=>{const F=yo.current;if(!F||typeof ResizeObserver>"u")return;const B=new ResizeObserver(oe=>{var Te;const ie=(Te=oe[0])==null?void 0:Te.contentRect;ie&&(Jr.current={width:ie.width,height:ie.height},kc(Ne=>Math.abs(Ne.w-ie.width)>40||Math.abs(Ne.h-ie.height)>40?{w:ie.width,h:ie.height}:Ne))});return B.observe(F),Jr.current={width:F.clientWidth,height:F.clientHeight},kc({w:F.clientWidth,h:F.clientHeight}),()=>B.disconnect()},[]);const th=x.useCallback(F=>{var oe,ie;const B=F.target;!(B!=null&&B.closest)||B.closest(FW)!==F.currentTarget||(F.preventDefault(),(ie=(oe=document.activeElement)==null?void 0:oe.blur)==null||ie.call(oe))},[]),nh=x.useRef(new Map),[_c,rh]=x.useState(!1);x.useEffect(()=>{const F=window.setTimeout(()=>rh(!0),2500);return()=>window.clearTimeout(F)},[]);const[sh,xa]=x.useState(!1),mn=x.useRef(null),[zi,Ui]=x.useState(!1),[Nc,Sc]=x.useState("full"),Wi=x.useRef("full"),jc=x.useCallback(()=>{mn.current&&(window.clearTimeout(mn.current),mn.current=null),xa(!1)},[]),Ts=x.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{xa(!0),mn.current&&window.clearTimeout(mn.current),mn.current=window.setTimeout(()=>xa(!1),BW+80)})},[]);x.useEffect(()=>()=>{mn.current&&window.clearTimeout(mn.current)},[]);const[ah,oh]=x.useState(0);x.useEffect(()=>{const F=IC(yo.current);oh(B=>Math.abs(B-F)>40?F:B)});const Ec=wo.w>0?Math.max(0,(wo.w-ah-uv*2)*dv):0,Hi=wo.h>0?Math.max(0,(wo.h-uv*2)*dv):0,{nodes:er,edges:ba}=x.useMemo(()=>iH(s.current,Tt,Ec,Hi,Jt.current,Cs.current,nh.current,Ts,_c,zi,pn.current,eh.current,Sr,qi,h,Fi,Bi,C),[s.current,s.current.revision,Tt,Ec,Hi,_c,zi,Sr,h,Fi,Bi,C,ha]),As=x.useMemo(()=>{const F=new Map;for(const oe of er){const ie=oe.data;if(!(ie!=null&&ie.sessionId)||ie.exitAt!=null)continue;const Te=oe.width,Ne=oe.height;if(Te==null||Ne==null)continue;const Ue=oe.position.x,nt=oe.position.y,pt=Ue+Te,st=nt+Ne,nn=F.get(ie.sessionId);nn?(nn.minX=Math.min(nn.minX,Ue),nn.minY=Math.min(nn.minY,nt),nn.maxX=Math.max(nn.maxX,pt),nn.maxY=Math.max(nn.maxY,st)):F.set(ie.sessionId,{minX:Ue,minY:nt,maxX:pt,maxY:st})}const B=[];for(const[oe,ie]of F){const Te=ie.maxX-ie.minX+zu*2,Ne=ie.maxY-ie.minY+zu*2;B.push({id:`group:${oe}`,type:lR,position:{x:ie.minX-zu,y:ie.minY-zu},data:{sessionId:oe,w:Te,h:Ne},width:Te,height:Ne,style:{width:Te,height:Ne},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return B},[er,Tt]),ih=x.useMemo(()=>{const F=[...As,...er],B=br.current;return!B||B.size===0?F:F.map(oe=>{const ie=B.get(oe.id);return ie?{...oe,position:ie}:oe})},[As,er,so]),ns=x.useMemo(()=>{const F=new Set;for(const B of s.current.agents.values())for(const oe of B.tools)F.add(yR(oe.name));return Object.keys(Kv).filter(B=>F.has(B))},[s.current,s.current.revision]);x.useEffect(()=>{if(ns.length<=1){hc(!1);return}let F=0;const B=()=>{const oe=dc.current;if(oe&&!document.hidden){const ie=oe.getBoundingClientRect(),Te=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Ne=gW(ie,Te,8);hc(Ue=>Ue===Ne?Ue:Ne)}F=window.setTimeout(B,300)};return B(),()=>window.clearTimeout(F)},[ns.length]);const lh=x.useCallback(F=>{uo(B=>{const oe=new Set(B);return oe.has(F)?oe.delete(F):oe.add(F),oe})},[]),en=f?s.current.agents.get(f):null,ka=y?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===y)??null:null,vo=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Rv(),Jt.current.clear(),Cs.current.clear(),pn.current.clear(),qi.current="",qC(),_(),l()},[l,_]),Gi=x.useRef(T);Gi.current=T;const Vi=x.useRef(A);Vi.current=A;const xo=x.useRef(!1);xo.current=ka!=null||sa||j!=null||O||S!=null||oa||A||Ee!=null;const bo=x.useCallback(F=>{const B=Vq(F,{confirmOpen:Gi.current,modalOpen:xo.current});B==="confirm"?R(!0):B==="clear"&&(R(!1),vo())},[vo]),Yi=x.useCallback(()=>{Jt.current.clear(),pn.current.clear(),qi.current="",qC(),l(),window.setTimeout(()=>cn(500),80)},[l,e,cn]),Cc=x.useCallback(()=>cn(500),[cn]),ko=x.useRef(er);ko.current=er;const Ki=x.useRef(f);Ki.current=f;const tn=x.useCallback(F=>{const B=ko.current,oe=WF(B.map(Ne=>({id:Ne.id,x:Ne.position.x,y:Ne.position.y})),Ki.current,F),ie=oe?B.find(Ne=>Ne.id===oe):void 0;if(!ie)return;const Te=MC(document.activeElement);N(ie.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:lv(350),nodes:[ie]})}catch{}On.current=Date.now(),Te&&qW(ie.id)},30)},[N,e]),tr=x.useCallback(F=>{N(F,!1),window.setTimeout(()=>{try{const B=ko.current.find(oe=>oe.id===F);B&&e.fitView({padding:.3,duration:lv(500),nodes:[B]}),On.current=Date.now()}catch{}},60)},[N,e]),Xi=x.useRef(null);x.useEffect(()=>{let F=-1/0;const B=()=>{F=performance.now()},oe=ie=>{Xi.current=performance.now()-F<250?ie.target:null};return window.addEventListener("pointerdown",B,!0),window.addEventListener("focusin",oe,!0),()=>{window.removeEventListener("pointerdown",B,!0),window.removeEventListener("focusin",oe,!0)}},[]),x.useEffect(()=>{const F=B=>{var nt,pt;const oe=B.target,ie={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(nt=oe==null?void 0:oe.getAttribute)==null?void 0:nt.call(oe,"role"),type:oe==null?void 0:oe.type,pointerFocused:oe!=null&&oe===Xi.current};if(B.key==="Escape"){const st=i4({overlayOpen:dd.depth()>0,typing:bx(ie)});st==="dismiss"?dd.dismissTop():st==="blur"?oe==null||oe.blur():(YF(ie)&&(oe==null||oe.blur()),_());return}if(vx(B))return;const Te=MC(oe)?(pt=oe==null?void 0:oe.getAttribute)==null?void 0:pt.call(oe,"data-id"):null,Ne=Te&&ko.current.some(st=>st.id===Te)?Te:null,Ue=GF(B,Ne);if(Ue.kind==="activate"){B.preventDefault(),N(Ue.nodeId,Ue.additive);return}if(Ue.kind!=="node"&&!(Ue.nodeId==null&&g4(ie,B.key))&&!y4({key:B.key,modalOpen:xo.current,sheetOpen:Vi.current})){if(B.key===" "&&(B.preventDefault(),fa()),(B.key==="c"||B.key==="C")&&bo("shortcut"),(B.key==="r"||B.key==="R")&&Yi(),(B.key==="f"||B.key==="F")&&Cc(),(B.key==="l"||B.key==="L")&&Mn(),B.key==="d"||B.key==="D")if(Ki.current)d(st=>!st);else{const st=Gk(s.current.agents.values());st.length>0?tr(st[0].id):tn(1)}(B.key==="h"||B.key==="H")&&aa(st=>!st),(B.key==="u"||B.key==="U")&&G(st=>!st),(B.key==="a"||B.key==="A")&&Kn.current.claude&&ra(),(B.key==="j"||B.key==="J")&&tn(1),(B.key==="k"||B.key==="K")&&tn(-1),(B.key==="t"||B.key==="T")&&mc(st=>st==="dark"?"light":"dark"),(B.key==="m"||B.key==="M")&&Kn.current.claude&&me.current!==null&&se.current(B.shiftKey),B.key==="?"&&D(st=>!st)}};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[bo,Yi,Cc,_,N,tn,tr,fa]);const Qi=s.current.agents.size,Gt=x.useMemo(()=>Gk(s.current.agents.values()),[s.current,s.current.revision]),Zi=x.useMemo(()=>e4(s.current.agents.values()),[s.current,s.current.revision]),_o=x.useRef(null);x.useEffect(()=>{const F=c8({waiting:Gt.length,running:Zi,connected:Xe}),B=_o.current;if(_o.current=F,(B==null?void 0:B.title)!==F.title&&(document.title=F.title),(B==null?void 0:B.icon)!==F.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=u8[F.icon])}},[Gt.length,Zi,Xe]);const[ch,uh]=x.useState(""),rs=h8(Gt);x.useEffect(()=>{uh(F=>f8(F,rs))},[rs]);const[Rs,_a]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[nr,No]=x.useState(null),[ss,jr]=x.useState(!1),[Ji,el]=x.useState(!1);x.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(B=>B.ok?B.json():null).then(B=>{var oe,ie,Te;if(!(!F||!(B!=null&&B.ok))){if(!io.current){let Ne=!1;try{Ne=window.localStorage.getItem(Uu)==="0",window.localStorage.removeItem(Uu)}catch{}Ne&&((oe=B.prefs)==null?void 0:oe.autoUpdate)!==!1?(oo(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):oo(((ie=B.prefs)==null?void 0:ie.autoUpdate)!==!1)}jr(((Te=B.prefs)==null?void 0:Te.notifications)===!0),el(B.notificationsVetoed===!0)}}).catch(()=>{}),()=>{F=!1}},[]);const Na=x.useRef(()=>{}),Tc=x.useCallback(()=>{const F=!ss;jr(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&Na.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(B=>B.ok?B.json():null).then(B=>{var oe;B!=null&&B.ok&&(jr(((oe=B.prefs)==null?void 0:oe.notifications)===!0),el(B.notificationsVetoed===!0))}).catch(()=>{})},[ss]),Ac=typeof Notification<"u";x.useEffect(()=>{if(!nr)return;const B=setTimeout(()=>No(null),nr==="blocked"?8e3:4e3);return()=>clearTimeout(B)},[nr]);const tl=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const B=F;_a(B),B==="granted"?No("on"):B==="denied"&&No("blocked")})},[]);Na.current=tl;const Sa=x.useRef(new Set),So=x.useRef(null),Rc=Gt.map(F=>Ed(F.id,F.waiting)).join("|");return x.useEffect(()=>{s4(So.current,Rs)&&(So.current=Rs,Sa.current=Vk(Gt))},[Rs]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||So.current===null)return;const F=typeof document>"u"||!document.hidden,B=n4(Gt,Sa.current,F,ss);for(const oe of B)try{const ie=new Notification(oe.title,{body:oe.body,tag:oe.key});ie.onclick=()=>{window.focus(),tr(oe.sessionId),ie.close()}}catch{}Sa.current=F?Vk(Gt):r4(Gt,B,Sa.current)},[Rc]),i.jsxs("div",{className:"app",children:[i.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),i.jsxs("header",{className:"topbar",children:[i.jsxs("div",{className:"readout",children:[i.jsxs("div",{className:"brand",children:[i.jsx("span",{className:"logo"}),i.jsx("h1",{children:Xt}),ae?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ze(),eo()},"aria-haspopup":"dialog","aria-label":TW({...ae,open:Xn}),title:ae.kind==="restart"?`Running v${ae.from}; v${ae.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ae.from}; v${ae.to} is on npm · click for what's new`,children:["v",ae.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:xt,latest:fe==null?void 0:fe.latest,latestPending:fe==null?void 0:fe.latestPending,checkedAgo:fe!=null&&fe.checkedAt?Pv(Tt-fe.checkedAt):null,checkDisabled:fe==null?void 0:fe.checkDisabled,checking:Ye};return i.jsxs("button",{type:"button",className:Ye?"v checking":"v",onClick:()=>{Ze(),re(!0)},"aria-busy":Ye||void 0,"aria-haspopup":"dialog","aria-label":CW(F),title:EW(F),children:["v",F.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const F=LW({connected:Xe,paused:ao,held:Zt.size,dropped:Zt.dropped});return F.resting?null:i.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:i.jsxs("span",{className:"pill-box",children:[i.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),i.jsx("span",{className:"pill-label",children:F.label})]})})})()}),i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ch}),Gt.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>tr(Gt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
268
|
+
${Gt.map(F=>` ${F.label}: ${pi(F.waiting)} (${Pv(Tt-F.waiting.since)})`).join(`
|
|
269
|
+
`)}`,"aria-label":`${Gt.length} session${Gt.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:Gt.length})," waiting"]}),nr&&i.jsx("span",{className:nr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:nr==="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:nr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const F=An(en),B=Math.max(0,((en.endedAt??Tt)-en.startedAt)/1e3),oe=en.state==="active"?wx(F.total,B):null,ie=h.size-1;return i.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const Te=er.find(Ne=>Ne.id===en.id);Te&&e.fitView({padding:.35,duration:lv(500),nodes:[Te]}),On.current=Date.now()}catch{}},children:[i.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),i.jsx("span",{className:"selected-label",children:en.label}),F.total>0&&i.jsxs("span",{className:"selected-cost",children:[rt(F.total),oe?i.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),ie>0&&i.jsxs("span",{className:"selected-extra",children:["+",ie]}),i.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Te=>{Te.stopPropagation(),_()},children:"×"})]})})(),i.jsxs("div",{className:"actions",children:[i.jsxs("div",{className:"action-run",children:[i.jsx("button",{className:"btn icon-btn",onClick:Mn,title:`${Z?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":Z,"aria-controls":Z?"session-list":void 0,children:"☰"}),i.jsx("button",{className:"btn icon-btn",onClick:()=>G(F=>!F),title:`${K?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":K,"aria-controls":K?"usage-panel":void 0,children:"$"}),Wt.claude&&i.jsx("button",{className:"btn icon-btn",onClick:ra,title:`${L?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":L,"aria-controls":L?"accounts-panel":void 0,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),i.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),i.jsx("button",{className:"btn icon-btn",onClick:()=>X(F=>!F),title:`${z?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":z,"aria-controls":z?"system-panel":void 0,children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),i.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"})]})}),i.jsx("button",{className:"btn icon-btn",onClick:()=>aa(F=>!F),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[i.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),i.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),i.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),i.jsxs("button",{className:`btn icon-btn bw-btn${$t>0?" has-findings":ft?" watching":""}`,onClick:()=>ia(F=>!F),title:ft?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${ft?"watching":"not watching"}`+($t>0?`, ${$t} unread`:""),"aria-haspopup":"dialog",children:[i.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[i.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"}),ft||$t>0?i.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):i.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),$t>0&&i.jsx("span",{className:"bw-badge","aria-hidden":!0,children:$t})]})]}),i.jsxs("div",{className:"action-run",children:[Wt.claude&&H!==null&&i.jsxs("div",{className:"sound-slot",children:[i.jsx("button",{ref:Ce,className:"btn icon-btn",onClick:()=>_e(F=>!F),...fr(!1),title:x8(Wt,{on:H===!0,locked:tt==="locked",prefs:ge}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":Be,"aria-controls":Be?"sound-menu":void 0,children:i.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:[i.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),H?i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),i.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M10 5.6l2.6 2.8"}),i.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),Be&&i.jsx(bF,{onClose:()=>_e(!1),soundOn:H===!0,onToggleSound:ee,prefs:ge,onLevel:(F,B)=>be(F,{level:B}),onFigure:(F,B)=>be(F,{figure:B}),onPreview:F=>we(F),notifyOn:ss,onToggleNotify:Tc,notifyVetoed:Ji,notifyPermission:Ac?Rs:"unsupported",onAskNotify:tl,openerRef:Ce})]}),i.jsx("button",{className:"btn icon-btn",onClick:()=>mc(F=>F==="dark"?"light":"dark"),title:`Switch to ${Kr==="dark"?"light":"dark"} mode (T)`,"aria-label":`Switch to ${Kr==="dark"?"light":"dark"} mode`,children:Kr==="dark"?"☀":"☾"})]})]})]}),Ri?i.jsxs("div",{className:"ver-banner done",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:["Restarted — now running v",Ri,"."]}),i.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):gc&&!Xe?i.jsxs("div",{className:"conn-banner",role:"alert",children:[i.jsx("span",{className:"conn-dot"}),Qn?Ai==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Xt}…`:(()=>{const F=OW({connected:Xe,paused:ao});return i.jsxs(i.Fragment,{children:[`Lost connection to the ${Xt} server. Reconnecting…`,F&&i.jsx("span",{className:"conn-sub",children:F})]})})()]}):Xn&&ae?i.jsxs("div",{className:`ver-banner ${ae.kind}`,role:"status",children:[i.jsx("span",{className:`ver-dot${Jn==null?"":" armed"}`}),ae.kind==="restart"?i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:["v",ae.to," is installed — this deck still runs v",ae.from,"."]}),fe!=null&&fe.canRestart?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Nn(),...fr(Qn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
270
|
+
|
|
271
|
+
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:Qn?"restarting…":Ss.label}),!Qn&&i.jsx("span",{className:"ver-sub",children:Ss.clause}),i.jsxs("button",{type:"button",className:`ver-auto${ln?" on":""}`,role:"switch","aria-checked":ln,onClick:lt,"aria-label":"Auto-restart when idle",title:ln?"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:[i.jsx("i",{"aria-hidden":!0}),i.jsx("span",{"aria-hidden":!0,children:Wq(ln,Jn)})]})]}):i.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."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[Xt," v",ae.to," is out — you are on v",ae.from,"."]}),(fe==null?void 0:fe.upgradeMode)==="install"&&qt!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:Ei,...fr(qt==="running",qt==="done"),title:`Runs ${((jo=fe==null?void 0:fe.upgrade)==null?void 0:jo.command)??(fe==null?void 0:fe.command)??"npm i -g"} here, then restarts once nothing is running.`,children:qt==="running"?"installing…":qt==="done"?"installed":"Update now"}),(fe==null?void 0:fe.upgradeMode)==="npx"&&(fe==null?void 0:fe.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>Nn({upgrade:!0}),...fr(Qn),title:`Runs ${fe==null?void 0:fe.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Qn?"fetching…":qt==="failed"?"Retry update":"Update & restart"}),qt==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((Eo=fe==null?void 0:fe.upgrade)==null?void 0:Eo.error)??"",children:[(fe==null?void 0:fe.upgradeMode)==="npx"?"update failed":"install failed",": ",((Mc=fe==null?void 0:fe.upgrade)==null?void 0:Mc.error)??"unknown error"," — run it yourself:"]}):(fe==null?void 0:fe.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:fe!=null&&fe.canRestart?"npx cannot upgrade in place, so the deck re-runs:":fv.npx}):fe!=null&&fe.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(fv,fe.upgradeBlocked)?fv[fe.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:to,title:"Copy to clipboard",children:[i.jsx("code",{children:fe==null?void 0:fe.command}),i.jsx("span",{className:"ver-cmd-hint",children:ye?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zr,children:"×"})]}):Wr&&Rn?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[Rn," still works — the deck is called ",Xt," now."]}),fe!=null&&fe.renameFix?i.jsx("span",{className:"ver-sub",children:fe.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ks,children:"×"})]}):null,Ff(P)&&Wt.claude&&i.jsx(Lq,{leaving:P==="leaving",onClose:()=>W(!1)}),Z&&i.jsx(R5,{state:s.current,now:Tt,selectedIds:h,onSelect:tr,onClose:()=>$(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${sh?" bubbling":""}${zi?" dragging-any":""}`,"data-detail":Nc,ref:yo,onMouseDownCapture:th,onPointerDownCapture:ya,onPointerUpCapture:ya,onWheelCapture:ya,children:[Qi===0&&i.jsx(uH,{live:Xe,everConnected:gc,providers:Wt,workspace:ht,onTour:()=>I(!0)}),(ns.length>1||co.size>0)&&i.jsx("div",{ref:dc,className:`cat-filter-bar${Kd?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:ns.map(F=>{const B=co.has(F);return i.jsxs("button",{type:"button",className:`cat-filter${B?" off":""}`,onClick:()=>lh(F),"aria-pressed":!B,title:`${B?"Show":"Hide"} ${Xv[F]} tools`,children:[i.jsx("span",{className:"cat-emoji",children:Kv[F]}),i.jsx("span",{className:"cat-name",children:Xv[F]})]},F)})}),i.jsxs(s2,{nodes:ih,edges:ba,nodeTypes:DW,fitView:!lo,fitViewOptions:{padding:.25,duration:Zu({durationMs:$C,documentHidden:document.hidden})?$C:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(F,B)=>{if(B.type==="sessionGroup"){_();return}N(B.id,F.shiftKey)},onPaneClick:()=>_(),onMoveStart:F=>{TC(go(F))&&Oi()},onMove:(F,B)=>{Es(),TC(go(F))&&Oi();const oe=zW(B.zoom);oe!==Wi.current&&(Wi.current=oe,Sc(oe)),Ht.current&&window.clearTimeout(Ht.current),Ht.current=window.setTimeout(()=>aH(B),250)},onNodeDragStart:(F,B)=>{var oe;if(jc(),Li.current=!0,br.current=new Map,Ui(!0),Es(),Oi(),B.type==="sessionGroup"){const ie=(oe=B.data)==null?void 0:oe.sessionId,Te=new Map;if(ie)for(const Ne of er){const Ue=Ne.data;(Ue==null?void 0:Ue.sessionId)===ie&&Te.set(Ne.id,{x:Ne.position.x,y:Ne.position.y})}_r.current={start:{x:B.position.x,y:B.position.y},members:Te};return}Jt.current.set(B.id,{x:B.position.x,y:B.position.y})},onNodeDrag:(F,B)=>{var oe;if(Es(),B.type==="sessionGroup"){const ie=_r.current;if(!ie)return;const Te=B.position.x-ie.start.x,Ne=B.position.y-ie.start.y;for(const[nt,pt]of ie.members){const st={x:pt.x+Te,y:pt.y+Ne};Jt.current.set(nt,st),pn.current.set(nt,st)}const Ue=br.current;if(Ue){for(const[nt,pt]of ie.members)Ue.set(nt,{x:pt.x+Te,y:pt.y+Ne});Ue.set(B.id,{x:B.position.x,y:B.position.y})}_s(nt=>nt+1);return}Jt.current.set(B.id,{x:B.position.x,y:B.position.y}),pn.current.set(B.id,{x:B.position.x,y:B.position.y}),(oe=br.current)==null||oe.set(B.id,{x:B.position.x,y:B.position.y}),_s(ie=>ie+1)},onNodeDragStop:(F,B)=>{if(Es(),Li.current=!1,br.current=null,Ui(!1),hn(oe=>oe+1),B.type==="sessionGroup"){const oe=_r.current;if(oe){const ie=B.position.x-oe.start.x,Te=B.position.y-oe.start.y;for(const[Ne,Ue]of oe.members){const nt={x:Ue.x+ie,y:Ue.y+Te};Jt.current.set(Ne,nt),pn.current.set(Ne,nt)}}_r.current=null,pv(pn.current,Jt.current),hn(ie=>ie+1);return}Jt.current.set(B.id,{x:B.position.x,y:B.position.y}),pn.current.set(B.id,{x:B.position.x,y:B.position.y}),pv(pn.current,Jt.current)},children:[i.jsx(hL,{gap:28,size:1,color:fn["--grid-line"]}),i.jsx(B4,{onFit:()=>{On.current=Date.now()}}),i.jsx(_5,{agents:s.current.agents,visibleAgentIds:Bi,positions:pn.current,pinned:Jt.current,measured:Cs.current,spotlight:Fi,hiddenCategories:co,now:Tt,onOpenTool:v}),i.jsxs(oL,{showInteractive:!1,children:[i.jsx(Or,{onClick:Pi,title:wc?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:wc?{color:"var(--accent)"}:void 0,children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:fa,title:$W({paused:ao,held:Zt.size,dropped:Zt.dropped}),"aria-label":IW,"aria-pressed":ao,children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:i.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),i.jsx(Or,{onClick:Yi,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),i.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>bo("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),i.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"}),i.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"}),i.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),i.jsx(Or,{onClick:()=>D(F=>!F),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[i.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"}),i.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),i.jsx(J3,{zoomable:!0,pannable:!0,nodeColor:ho,nodeStrokeWidth:2,maskColor:fn["--minimap-mask"],style:Qd})]})]}),Ff(V)&&i.jsx(mD,{state:s.current,now:Tt,providers:Wt,liveSince:Nr,leaving:V==="leaving",onClose:()=>G(!1)}),Ff(he)&&i.jsx(HD,{usageOpen:K,leaving:he==="leaving",onClose:()=>X(!1)}),c&&en?i.jsxs("aside",{className:"detail","aria-label":"Detail",children:[i.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>d(!1),children:"×"}),i.jsx(hH,{agent:en,now:Tt,onOpenTool:v,onShowSummary:F=>{J.has(F)&&(J.delete(F),DC(J)),k(F)},onExportSession:F=>oH(s.current,F)})]}):null,ka&&i.jsx(I4,{tool:ka,onClose:()=>v(null)}),sa&&i.jsx(S8,{providers:Wt,onClose:()=>aa(!1)}),oa&&i.jsx(L8,{onClose:()=>ia(!1),onSeen:F=>{no(F);try{localStorage.setItem(s_,String(F))}catch{}},onWatching:ro,palette:fn}),j&&(()=>{const F=s.current.agents.get(j);return F?i.jsx(_4,{agent:F,onClose:()=>E(null)}):null})(),S&&i.jsx(C5,{state:s.current,sessionId:S,onClose:()=>{J.add(S),DC(J),k(null)}}),Ee&&i.jsx(zF,{entries:Ee.entries,since:Ee.since,firstRun:Ee.firstRun,running:xt,onClose:()=>De(null),onTour:()=>{De(null),I(!0)}}),(()=>{const{request:F,waiting:B}=q8(ua,Gr.current);return F?i.jsx(F8,{request:F,waiting:B,busy:Vr,now:Date.now(),onAccept:()=>void Yr("accept",F.fp),onDecline:()=>void Yr("dismiss",F.fp),onLater:()=>{Vr||(Gr.current.add(F.fp),Hr(oe=>[...oe]))}}):null})(),A&&i.jsx(eF,{onClose:()=>D(!1),onTour:()=>{D(!1),I(!0)}}),O&&i.jsx(H2,{title:"What the deck shows you",steps:X6,onClose:()=>{I(!1),DF(e_());const F=q.current;q.current=null,F&&De(F)}}),T&&i.jsx(Qq,{agentCount:Qi,onConfirm:()=>bo("confirmation"),onCancel:()=>R(!1)})]})}function uH({live:e,everConnected:t,providers:n,workspace:s,onTour:a}){const l=!e;return i.jsxs("div",{className:"empty-hero",children:[i.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[i.jsx("div",{className:"core"}),i.jsxs("div",{className:"orbit r1",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r2",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]}),i.jsxs("div",{className:"orbit r3",children:[i.jsx("span",{className:"dot"}),i.jsx("span",{className:"dot b"})]})]}),l?i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),i.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",i.jsx("code",{children:Xt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):dH(n,s),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function dH(e,t){const n=AW(t);return i.jsxs(i.Fragment,{children:[i.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?i.jsxs("p",{children:[n.lead," ",i.jsx("code",{children:n.workspace}),n.tail]}):i.jsxs("p",{children:["Run ",i.jsx("code",{children:"claude"})," or ",i.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."]}),v8(e).map(s=>i.jsx("p",{className:"hint-row",children:s.spans.map((a,l)=>a.code?i.jsx("code",{children:a.text},l):i.jsx("span",{children:a.text},l))},s.provider))]})}function hH({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const l=`${e.synthetic?"≥ ":""}${ud(e.startedAt,e.endedAt,t)}`,c=An(e),d=c.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const _=yR(N.name);p.set(_,(p.get(_)??0)+1)}const f=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]),v=p.has("mcp")?w5(e.tools.map(N=>N.name)):null;return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"detail-hero",children:[i.jsxs("div",{className:"hero-line",children:[i.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),i.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),i.jsxs("div",{className:"hero-meta",children:[i.jsx("span",{className:"hero-meta-item",children:e.kind}),i.jsx("span",{className:"hero-sep",children:"·"}),i.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const N=v2(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:N.length>0?`${e.model}
|
|
272
|
+
spend on this panel also covers:
|
|
273
|
+
${N.join(`
|
|
274
|
+
`)}`:e.model,children:[ws(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&i.jsxs("div",{className:"hero-cost",children:[i.jsxs("div",{className:"hero-cost-headline",children:[i.jsx("span",{className:"hero-cost-value",children:rt(c.total)}),i.jsx("span",{className:"hero-cost-label",children:"spend"})]}),i.jsx(_x,{cost:c})]}),i.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&i.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&&i.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Activity"}),i.jsxs("div",{className:"activity-row",children:[i.jsxs("div",{className:"activity-counters",children:[i.jsxs("span",{className:"ac-item",children:[i.jsx("b",{children:e.toolCount})," calls"]}),m>0&&i.jsxs("span",{className:"ac-item ac-live",children:[i.jsx("b",{children:m})," live"]}),f>0&&i.jsxs("span",{className:"ac-item ac-err",children:[i.jsx("b",{children:f})," err"]})]}),i.jsx("div",{className:"cat-strip",children:y.map(([N,_])=>{const S=N==="mcp"?v:null,k=S==null?void 0:S.hue,j=`${_} ${Xv[N]} call${_===1?"":"s"}`;return i.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[i.jsx("span",{className:"cat-emoji",children:Kv[N]}),i.jsx("span",{className:"cat-count",children:_}),S&&i.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),h>0&&i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Tokens"}),i.jsxs("div",{className:"tokens-grid",children:[i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"in"}),i.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"out"}),i.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache r"}),i.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),i.jsxs("div",{children:[i.jsx("span",{className:"k",children:"cache c"}),i.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),i.jsxs("section",{className:"detail-section",children:[i.jsx("h3",{children:"Identity"}),i.jsxs("div",{children:[e.cwd&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"cwd"}),i.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"session"}),i.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&i.jsxs("div",{className:"row",children:[i.jsx("span",{className:"k",children:"parent"}),i.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Prompts ",i.jsx("span",{className:"section-count",children:e.prompts.length})]}),i.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,_)=>{const S=J5(N.at,t);return i.jsxs("div",{className:"prompt-entry",children:[i.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),i.jsx("div",{className:"prompt-text",children:N.text})]},_)})})]}),i.jsxs("section",{className:"detail-section",children:[i.jsxs("h3",{children:["Tool calls ",i.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&i.jsx("div",{className:"empty",children:"No tool calls yet."}),i.jsx("div",{children:e.tools.slice().reverse().map(N=>i.jsx(pH,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const fH={inflight:"in-flight",done:"done",err:"error"};function pH({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=b2(e,"…");return i.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[i.jsxs("span",{className:"name",children:[i.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:fH[n]}),e.name]}),i.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Q5(window.localStorage)}catch{}const mH=dM.createRoot(document.getElementById("root"));mH.render(i.jsx(lH,{}));
|