agent-dag 3.22.0 → 3.22.1
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.
|
@@ -1,266 +0,0 @@
|
|
|
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 du=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var uf={exports:{}},ml={},df={exports:{}},Qe={};/**
|
|
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 bb;function zR(){if(bb)return Qe;bb=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"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,_={};function j(P,G,he){this.props=P,this.context=G,this.refs=_,this.updater=he||v}j.prototype.isReactComponent={},j.prototype.setState=function(P,G){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,G,"setState")},j.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function x(){}x.prototype=j.prototype;function N(P,G,he){this.props=P,this.context=G,this.refs=_,this.updater=he||v}var E=N.prototype=new x;E.constructor=N,S(E,j.prototype),E.isPureReactComponent=!0;var C=Array.isArray,R=Object.prototype.hasOwnProperty,I={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function B(P,G,he){var H,U={},Z=null,V=null;if(G!=null)for(H in G.ref!==void 0&&(V=G.ref),G.key!==void 0&&(Z=""+G.key),G)R.call(G,H)&&!$.hasOwnProperty(H)&&(U[H]=G[H]);var le=arguments.length-2;if(le===1)U.children=he;else if(1<le){for(var pe=Array(le),me=0;me<le;me++)pe[me]=arguments[me+2];U.children=pe}if(P&&P.defaultProps)for(H in le=P.defaultProps,le)U[H]===void 0&&(U[H]=le[H]);return{$$typeof:e,type:P,key:Z,ref:V,props:U,_owner:I.current}}function O(P,G){return{$$typeof:e,type:P.type,key:G,ref:P.ref,props:P.props,_owner:P._owner}}function M(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function L(P){var G={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(he){return G[he]})}var Y=/\/+/g;function D(P,G){return typeof P=="object"&&P!==null&&P.key!=null?L(""+P.key):G.toString(36)}function A(P,G,he,H,U){var Z=typeof P;(Z==="undefined"||Z==="boolean")&&(P=null);var V=!1;if(P===null)V=!0;else switch(Z){case"string":case"number":V=!0;break;case"object":switch(P.$$typeof){case e:case t:V=!0}}if(V)return V=P,U=U(V),P=H===""?"."+D(V,0):H,C(U)?(he="",P!=null&&(he=P.replace(Y,"$&/")+"/"),A(U,G,he,"",function(me){return me})):U!=null&&(M(U)&&(U=O(U,he+(!U.key||V&&V.key===U.key?"":(""+U.key).replace(Y,"$&/")+"/")+P)),G.push(U)),1;if(V=0,H=H===""?".":H+":",C(P))for(var le=0;le<P.length;le++){Z=P[le];var pe=H+D(Z,le);V+=A(Z,G,he,pe,U)}else if(pe=y(P),typeof pe=="function")for(P=pe.call(P),le=0;!(Z=P.next()).done;)Z=Z.value,pe=H+D(Z,le++),V+=A(Z,G,he,pe,U);else if(Z==="object")throw G=String(P),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return V}function Q(P,G,he){if(P==null)return P;var H=[],U=0;return A(P,H,"","",function(Z){return G.call(he,Z,U++)}),H}function z(P){if(P._status===-1){var G=P._result;G=G(),G.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=G)}if(P._status===1)return P._result.default;throw P._result}var te={current:null},J={transition:null},q={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:J,ReactCurrentOwner:I};function K(){throw Error("act(...) is not supported in production builds of React.")}return Qe.Children={map:Q,forEach:function(P,G,he){Q(P,function(){G.apply(this,arguments)},he)},count:function(P){var G=0;return Q(P,function(){G++}),G},toArray:function(P){return Q(P,function(G){return G})||[]},only:function(P){if(!M(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Qe.Component=j,Qe.Fragment=n,Qe.Profiler=a,Qe.PureComponent=N,Qe.StrictMode=s,Qe.Suspense=f,Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,Qe.act=K,Qe.cloneElement=function(P,G,he){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var H=S({},P.props),U=P.key,Z=P.ref,V=P._owner;if(G!=null){if(G.ref!==void 0&&(Z=G.ref,V=I.current),G.key!==void 0&&(U=""+G.key),P.type&&P.type.defaultProps)var le=P.type.defaultProps;for(pe in G)R.call(G,pe)&&!$.hasOwnProperty(pe)&&(H[pe]=G[pe]===void 0&&le!==void 0?le[pe]:G[pe])}var pe=arguments.length-2;if(pe===1)H.children=he;else if(1<pe){le=Array(pe);for(var me=0;me<pe;me++)le[me]=arguments[me+2];H.children=le}return{$$typeof:e,type:P.type,key:U,ref:Z,props:H,_owner:V}},Qe.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},Qe.createElement=B,Qe.createFactory=function(P){var G=B.bind(null,P);return G.type=P,G},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(P){return{$$typeof:u,render:P}},Qe.isValidElement=M,Qe.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:z}},Qe.memo=function(P,G){return{$$typeof:p,type:P,compare:G===void 0?null:G}},Qe.startTransition=function(P){var G=J.transition;J.transition={};try{P()}finally{J.transition=G}},Qe.unstable_act=K,Qe.useCallback=function(P,G){return te.current.useCallback(P,G)},Qe.useContext=function(P){return te.current.useContext(P)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(P){return te.current.useDeferredValue(P)},Qe.useEffect=function(P,G){return te.current.useEffect(P,G)},Qe.useId=function(){return te.current.useId()},Qe.useImperativeHandle=function(P,G,he){return te.current.useImperativeHandle(P,G,he)},Qe.useInsertionEffect=function(P,G){return te.current.useInsertionEffect(P,G)},Qe.useLayoutEffect=function(P,G){return te.current.useLayoutEffect(P,G)},Qe.useMemo=function(P,G){return te.current.useMemo(P,G)},Qe.useReducer=function(P,G,he){return te.current.useReducer(P,G,he)},Qe.useRef=function(P){return te.current.useRef(P)},Qe.useState=function(P){return te.current.useState(P)},Qe.useSyncExternalStore=function(P,G,he){return te.current.useSyncExternalStore(P,G,he)},Qe.useTransition=function(){return te.current.useTransition()},Qe.version="18.3.1",Qe}var kb;function Hl(){return kb||(kb=1,df.exports=zR()),df.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 _b;function UR(){if(_b)return ml;_b=1;var e=Hl(),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(u,f,p){var h,g={},y=null,v=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(v=f.ref);for(h in f)s.call(f,h)&&!l.hasOwnProperty(h)&&(g[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:v,props:g,_owner:a.current}}return ml.Fragment=n,ml.jsx=c,ml.jsxs=c,ml}var Nb;function WR(){return Nb||(Nb=1,uf.exports=UR()),uf.exports}var i=WR(),hu={},hf={exports:{}},yn={},ff={exports:{}},pf={};/**
|
|
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 Sb;function HR(){return Sb||(Sb=1,(function(e){function t(J,q){var K=J.length;J.push(q);e:for(;0<K;){var P=K-1>>>1,G=J[P];if(0<a(G,q))J[P]=q,J[K]=G,K=P;else break e}}function n(J){return J.length===0?null:J[0]}function s(J){if(J.length===0)return null;var q=J[0],K=J.pop();if(K!==q){J[0]=K;e:for(var P=0,G=J.length,he=G>>>1;P<he;){var H=2*(P+1)-1,U=J[H],Z=H+1,V=J[Z];if(0>a(U,K))Z<G&&0>a(V,U)?(J[P]=V,J[Z]=K,P=Z):(J[P]=U,J[H]=K,P=H);else if(Z<G&&0>a(V,K))J[P]=V,J[Z]=K,P=Z;else break e}}return q}function a(J,q){var K=J.sortIndex-q.sortIndex;return K!==0?K:J.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,g=null,y=3,v=!1,S=!1,_=!1,j=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,N=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(J){for(var q=n(p);q!==null;){if(q.callback===null)s(p);else if(q.startTime<=J)s(p),q.sortIndex=q.expirationTime,t(f,q);else break;q=n(p)}}function C(J){if(_=!1,E(J),!S)if(n(f)!==null)S=!0,z(R);else{var q=n(p);q!==null&&te(C,q.startTime-J)}}function R(J,q){S=!1,_&&(_=!1,x(B),B=-1),v=!0;var K=y;try{for(E(q),g=n(f);g!==null&&(!(g.expirationTime>q)||J&&!L());){var P=g.callback;if(typeof P=="function"){g.callback=null,y=g.priorityLevel;var G=P(g.expirationTime<=q);q=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(f)&&s(f),E(q)}else s(f);g=n(f)}if(g!==null)var he=!0;else{var H=n(p);H!==null&&te(C,H.startTime-q),he=!1}return he}finally{g=null,y=K,v=!1}}var I=!1,$=null,B=-1,O=5,M=-1;function L(){return!(e.unstable_now()-M<O)}function Y(){if($!==null){var J=e.unstable_now();M=J;var q=!0;try{q=$(!0,J)}finally{q?D():(I=!1,$=null)}}else I=!1}var D;if(typeof N=="function")D=function(){N(Y)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,Q=A.port2;A.port1.onmessage=Y,D=function(){Q.postMessage(null)}}else D=function(){j(Y,0)};function z(J){$=J,I||(I=!0,D())}function te(J,q){B=j(function(){J(e.unstable_now())},q)}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(J){J.callback=null},e.unstable_continueExecution=function(){S||v||(S=!0,z(R))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var q=3;break;default:q=y}var K=y;y=q;try{return J()}finally{y=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,q){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var K=y;y=J;try{return q()}finally{y=K}},e.unstable_scheduleCallback=function(J,q,K){var P=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?P+K:P):K=P,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=K+G,J={id:h++,callback:q,priorityLevel:J,startTime:K,expirationTime:G,sortIndex:-1},K>P?(J.sortIndex=K,t(p,J),n(f)===null&&J===n(p)&&(_?(x(B),B=-1):_=!0,te(C,K-P))):(J.sortIndex=G,t(f,J),S||v||(S=!0,z(R))),J},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(J){var q=y;return function(){var K=y;y=q;try{return J.apply(this,arguments)}finally{y=K}}}})(pf)),pf}var jb;function GR(){return jb||(jb=1,ff.exports=HR()),ff.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 Eb;function VR(){if(Eb)return yn;Eb=1;var e=Hl(),t=GR();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function 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 u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(r){return f.call(g,r)?!0:f.call(h,r)?!1:p.test(r)?g[r]=!0:(h[r]=!0,!1)}function v(r,o,d,m){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function S(r,o,d,m){if(o===null||typeof o>"u"||v(r,o,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function _(r,o,d,m,w,k,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=w,this.mustUseProperty=d,this.propertyName=r,this.type=o,this.sanitizeURL=k,this.removeEmptyString=T}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){j[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];j[o]=new _(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){j[r]=new _(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){j[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){j[r]=new _(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){j[r]=new _(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){j[r]=new _(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){j[r]=new _(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){j[r]=new _(r,5,!1,r.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function N(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(x,N);j[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(x,N);j[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(x,N);j[o]=new _(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){j[r]=new _(r,1,!1,r.toLowerCase(),null,!1,!1)}),j.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){j[r]=new _(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,o,d,m){var w=j.hasOwnProperty(o)?j[o]:null;(w!==null?w.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(S(o,d,w,m)&&(d=null),m||w===null?y(o)&&(d===null?r.removeAttribute(o):r.setAttribute(o,""+d)):w.mustUseProperty?r[w.propertyName]=d===null?w.type===3?!1:"":d:(o=w.attributeName,m=w.attributeNamespace,d===null?r.removeAttribute(o):(w=w.type,d=w===3||w===4&&d===!0?"":""+d,m?r.setAttributeNS(m,o,d):r.setAttribute(o,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,R=Symbol.for("react.element"),I=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),L=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),J=Symbol.iterator;function q(r){return r===null||typeof r!="object"?null:(r=J&&r[J]||r["@@iterator"],typeof r=="function"?r:null)}var K=Object.assign,P;function G(r){if(P===void 0)try{throw Error()}catch(d){var o=d.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 d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(de){var m=de}Reflect.construct(r,[],o)}else{try{o.call()}catch(de){m=de}r.call(o.prototype)}else{try{throw Error()}catch(de){m=de}r()}}catch(de){if(de&&m&&typeof de.stack=="string"){for(var w=de.stack.split(`
|
|
35
|
-
`),k=m.stack.split(`
|
|
36
|
-
`),T=w.length-1,X=k.length-1;1<=T&&0<=X&&w[T]!==k[X];)X--;for(;1<=T&&0<=X;T--,X--)if(w[T]!==k[X]){if(T!==1||X!==1)do if(T--,X--,0>X||w[T]!==k[X]){var ee=`
|
|
37
|
-
`+w[T].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=T&&0<=X);break}}}finally{he=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?G(r):""}function U(r){switch(r.tag){case 5:return G(r.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("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 Z(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case I:return"Portal";case O:return"Profiler";case B:return"StrictMode";case D:return"Suspense";case A:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case L:return(r.displayName||"Context")+".Consumer";case M:return(r._context.displayName||"Context")+".Provider";case Y:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Q:return o=r.displayName||null,o!==null?o:Z(r.type)||"Memo";case z:o=r._payload,r=r._init;try{return Z(r(o))}catch{}}return null}function V(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Z(o);case 8:return o===B?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function me(r){var o=pe(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var w=d.get,k=d.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return w.call(this)},set:function(T){m=""+T,k.call(this,T)}}),Object.defineProperty(r,o,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ce(r){r._valueTracker||(r._valueTracker=me(r))}function Ue(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var d=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==d?(o.setValue(r),!0):!1}function ue(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 xe(r,o){var d=o.checked;return K({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function ye(r,o){var d=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;d=le(o.value!=null?o.value:d),r._wrapperState={initialChecked:m,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function De(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function ke(r,o){De(r,o);var d=le(o.value),m=o.type;if(d!=null)m==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ge(r,o.type,d):o.hasOwnProperty("defaultValue")&&Ge(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function Ee(r,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,d||o===r.value||(r.value=o),r.defaultValue=o}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function Ge(r,o,d){(o!=="number"||ue(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var ot=Array.isArray;function re(r,o,d,m){if(r=r.options,o){o={};for(var w=0;w<d.length;w++)o["$"+d[w]]=!0;for(d=0;d<r.length;d++)w=o.hasOwnProperty("$"+r[d].value),r[d].selected!==w&&(r[d].selected=w),w&&m&&(r[d].defaultSelected=!0)}else{for(d=""+le(d),o=null,w=0;w<r.length;w++){if(r[w].value===d){r[w].selected=!0,m&&(r[w].defaultSelected=!0);return}o!==null||r[w].disabled||(o=r[w])}o!==null&&(o.selected=!0)}}function Ye(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return K({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ke(r,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(ot(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}r._wrapperState={initialValue:le(d)}}function ge(r,o){var d=le(o.value),m=le(o.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),o.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),m!=null&&(r.defaultValue=""+m)}function _e(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Fe(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 Xe(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Fe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var at,pt=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,m,w){MSApp.execUnsafeLocalFunction(function(){return r(o,d,m,w)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(at=at||document.createElement("div"),at.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=at.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=o;return}}r.textContent=o}var Ae={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},Se=["Webkit","ms","Moz","O"];Object.keys(Ae).forEach(function(r){Se.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Ae[o]=Ae[r]})});function Te(r,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||Ae.hasOwnProperty(r)&&Ae[r]?(""+o).trim():o+"px"}function Be(r,o){r=r.style;for(var d in o)if(o.hasOwnProperty(d)){var m=d.indexOf("--")===0,w=Te(d,o[d],m);d==="float"&&(d="cssFloat"),m?r.setProperty(d,w):r[d]=w}}var kt=K({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 ut(r,o){if(o){if(kt[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 Re(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 ht=null;function wt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var St=null,Et=null,Gn=null;function ln(r){if(r=el(r)){if(typeof St!="function")throw Error(n(280));var o=r.stateNode;o&&(o=jc(o),St(r.stateNode,r.type,o))}}function Rr(r){Et?Gn?Gn.push(r):Gn=[r]:Et=r}function mr(){if(Et){var r=Et,o=Gn;if(Gn=Et=null,ln(r),o)for(r=0;r<o.length;r++)ln(o[r])}}function Za(r,o){return r(o)}function Ja(){}var ta=!1;function eo(r,o,d){if(ta)return r(o,d);ta=!0;try{return Za(r,o,d)}finally{ta=!1,(Et!==null||Gn!==null)&&(Ja(),mr())}}function Kt(r,o){var d=r.stateNode;if(d===null)return null;var m=jc(d);if(m===null)return null;d=m[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":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var na=!1;if(u)try{var Mr={};Object.defineProperty(Mr,"passive",{get:function(){na=!0}}),window.addEventListener("test",Mr,Mr),window.removeEventListener("test",Mr,Mr)}catch{na=!1}function rn(r,o,d,m,w,k,T,X,ee){var de=Array.prototype.slice.call(arguments,3);try{o.apply(d,de)}catch(ve){this.onError(ve)}}var Mn=!1,gr=null,ds=!1,ra=null,to={onError:function(r){Mn=!0,gr=r}};function no(r,o,d,m,w,k,T,X,ee){Mn=!1,gr=null,rn.apply(to,arguments)}function sa(r,o,d,m,w,k,T,X,ee){if(no.apply(this,arguments),Mn){if(Mn){var de=gr;Mn=!1,gr=null}else throw Error(n(198));ds||(ds=!0,ra=de)}}function xn(r){var o=r,d=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(d=o.return),r=o.return;while(r)}return o.tag===3?d:null}function aa(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 oa(r){if(xn(r)!==r)throw Error(n(188))}function ro(r){var o=r.alternate;if(!o){if(o=xn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var d=r,m=o;;){var w=d.return;if(w===null)break;var k=w.alternate;if(k===null){if(m=w.return,m!==null){d=m;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===d)return oa(w),r;if(k===m)return oa(w),o;k=k.sibling}throw Error(n(188))}if(d.return!==m.return)d=w,m=k;else{for(var T=!1,X=w.child;X;){if(X===d){T=!0,d=w,m=k;break}if(X===m){T=!0,m=w,d=k;break}X=X.sibling}if(!T){for(X=k.child;X;){if(X===d){T=!0,d=k,m=w;break}if(X===m){T=!0,m=k,d=w;break}X=X.sibling}if(!T)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?r:o}function so(r){return r=ro(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 ao=t.unstable_scheduleCallback,Ir=t.unstable_cancelCallback,la=t.unstable_shouldYield,Ci=t.unstable_requestPaint,lt=t.unstable_now,oo=t.unstable_getCurrentPriorityLevel,yr=t.unstable_ImmediatePriority,ca=t.unstable_UserBlockingPriority,$r=t.unstable_NormalPriority,Vn=t.unstable_LowPriority,io=t.unstable_IdlePriority,Or=null,sn=null;function ua(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(Or,r,void 0,(r.current.flags&128)===128)}catch{}}var cn=Math.clz32?Math.clz32:ic,da=Math.log,qd=Math.LN2;function ic(r){return r>>>=0,r===0?32:31-(da(r)/qd|0)|0}var Xt=64,Pr=4194304;function ha(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 hs(r,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,w=r.suspendedLanes,k=r.pingedLanes,T=d&268435455;if(T!==0){var X=T&~w;X!==0?m=ha(X):(k&=T,k!==0&&(m=ha(k)))}else T=d&~w,T!==0?m=ha(T):k!==0&&(m=ha(k));if(m===0)return 0;if(o!==0&&o!==m&&(o&w)===0&&(w=m&-m,k=o&-o,w>=k||w===16&&(k&4194240)!==0))return o;if((m&4)!==0&&(m|=d&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)d=31-cn(o),w=1<<d,m|=r[d],o&=~w;return m}function Mt(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 Fd(r,o){for(var d=r.suspendedLanes,m=r.pingedLanes,w=r.expirationTimes,k=r.pendingLanes;0<k;){var T=31-cn(k),X=1<<T,ee=w[T];ee===-1?((X&d)===0||(X&m)!==0)&&(w[T]=Mt(X,o)):ee<=o&&(r.expiredLanes|=X),k&=~X}}function bn(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function fa(){var r=Xt;return Xt<<=1,(Xt&4194240)===0&&(Xt=64),r}function lo(r){for(var o=[],d=0;31>d;d++)o.push(r);return o}function pa(r,o,d){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-cn(o),r[o]=d}function wr(r,o){var d=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<d;){var w=31-cn(d),k=1<<w;o[w]=0,m[w]=-1,r[w]=-1,d&=~k}}function fs(r,o){var d=r.entangledLanes|=o;for(r=r.entanglements;d;){var m=31-cn(d),w=1<<m;w&o|r[m]&o&&(r[m]|=o),d&=~w}}var st=0;function lc(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Ti,co,Lr,Ai,Ri,ps=!1,ms=[],Yn=null,Kn=null,Xn=null,gs=new Map,It=new Map,kn=[],uo="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 ho(r,o){switch(r){case"focusin":case"focusout":Yn=null;break;case"dragenter":case"dragleave":Kn=null;break;case"mouseover":case"mouseout":Xn=null;break;case"pointerover":case"pointerout":gs.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":It.delete(o.pointerId)}}function ma(r,o,d,m,w,k){return r===null||r.nativeEvent!==k?(r={blockedOn:o,domEventName:d,eventSystemFlags:m,nativeEvent:k,targetContainers:[w]},o!==null&&(o=el(o),o!==null&&co(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,w!==null&&o.indexOf(w)===-1&&o.push(w),r)}function ga(r,o,d,m,w){switch(o){case"focusin":return Yn=ma(Yn,r,o,d,m,w),!0;case"dragenter":return Kn=ma(Kn,r,o,d,m,w),!0;case"mouseover":return Xn=ma(Xn,r,o,d,m,w),!0;case"pointerover":var k=w.pointerId;return gs.set(k,ma(gs.get(k)||null,r,o,d,m,w)),!0;case"gotpointercapture":return k=w.pointerId,It.set(k,ma(It.get(k)||null,r,o,d,m,w)),!0}return!1}function Mi(r){var o=Ea(r.target);if(o!==null){var d=xn(o);if(d!==null){if(o=d.tag,o===13){if(o=aa(d),o!==null){r.blockedOn=o,Ri(r.priority,function(){Lr(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function _n(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var d=Nn(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var m=new d.constructor(d.type,d);ht=m,d.target.dispatchEvent(m),ht=null}else return o=el(d),o!==null&&co(o),r.blockedOn=d,!1;o.shift()}return!0}function cc(r,o,d){_n(r)&&d.delete(o)}function uc(){ps=!1,Yn!==null&&_n(Yn)&&(Yn=null),Kn!==null&&_n(Kn)&&(Kn=null),Xn!==null&&_n(Xn)&&(Xn=null),gs.forEach(cc),It.forEach(cc)}function ya(r,o){r.blockedOn===o&&(r.blockedOn=null,ps||(ps=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,uc)))}function wa(r){function o(w){return ya(w,r)}if(0<ms.length){ya(ms[0],r);for(var d=1;d<ms.length;d++){var m=ms[d];m.blockedOn===r&&(m.blockedOn=null)}}for(Yn!==null&&ya(Yn,r),Kn!==null&&ya(Kn,r),Xn!==null&&ya(Xn,r),gs.forEach(o),It.forEach(o),d=0;d<kn.length;d++)m=kn[d],m.blockedOn===r&&(m.blockedOn=null);for(;0<kn.length&&(d=kn[0],d.blockedOn===null);)Mi(d),d.blockedOn===null&&kn.shift()}var Dr=C.ReactCurrentBatchConfig,fo=!0;function qr(r,o,d,m){var w=st,k=Dr.transition;Dr.transition=null;try{st=1,po(r,o,d,m)}finally{st=w,Dr.transition=k}}function va(r,o,d,m){var w=st,k=Dr.transition;Dr.transition=null;try{st=4,po(r,o,d,m)}finally{st=w,Dr.transition=k}}function po(r,o,d,m){if(fo){var w=Nn(r,o,d,m);if(w===null)Vr(r,o,m,ys,d),ho(r,m);else if(ga(w,r,o,d,m))m.stopPropagation();else if(ho(r,m),o&4&&-1<uo.indexOf(r)){for(;w!==null;){var k=el(w);if(k!==null&&Ti(k),k=Nn(r,o,d,m),k===null&&Vr(r,o,m,ys,d),k===w)break;w=k}w!==null&&m.stopPropagation()}else Vr(r,o,m,null,d)}}var ys=null;function Nn(r,o,d,m){if(ys=null,r=wt(m),r=Ea(r),r!==null)if(o=xn(r),o===null)r=null;else if(d=o.tag,d===13){if(r=aa(o),r!==null)return r;r=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return ys=r,null}function dc(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(oo()){case yr:return 1;case ca:return 4;case $r:case Vn:return 16;case io:return 536870912;default:return 16}default:return 16}}var $t=null,xa=null,ws=null;function Ii(){if(ws)return ws;var r,o=xa,d=o.length,m,w="value"in $t?$t.value:$t.textContent,k=w.length;for(r=0;r<d&&o[r]===w[r];r++);var T=d-r;for(m=1;m<=T&&o[d-m]===w[k-m];m++);return ws=w.slice(r,1<m?1-m:void 0)}function Fr(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 vs(){return!0}function $i(){return!1}function Wt(r){function o(d,m,w,k,T){this._reactName=d,this._targetInst=w,this.type=m,this.nativeEvent=k,this.target=T,this.currentTarget=null;for(var X in r)r.hasOwnProperty(X)&&(d=r[X],this[X]=d?d(k):k[X]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?vs:$i,this.isPropagationStopped=$i,this}return K(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=vs)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=vs)},persist:function(){},isPersistent:vs}),o}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ba=Wt(Br),xs=K({},Br,{view:0,detail:0}),bs=Wt(xs),mo,go,zr,yo=K({},xs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_s,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!==zr&&(zr&&r.type==="mousemove"?(mo=r.screenX-zr.screenX,go=r.screenY-zr.screenY):go=mo=0,zr=r),mo)},movementY:function(r){return"movementY"in r?r.movementY:go}}),wo=Wt(yo),ks=K({},yo,{dataTransfer:0}),hc=Wt(ks),Bd=K({},xs,{relatedTarget:0}),vo=Wt(Bd),fc=K({},Br,{animationName:0,elapsedTime:0,pseudoElement:0}),zd=Wt(fc),un=K({},Br,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Ud=Wt(un),Oi=K({},Br,{data:0}),Ur=Wt(Oi),ka={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pi={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"},Li={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pc(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Li[r])?!!o[r]:!1}function _s(){return pc}var mc=K({},xs,{key:function(r){if(r.key){var o=ka[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Fr(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Pi[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_s,charCode:function(r){return r.type==="keypress"?Fr(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Fr(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Wd=Wt(mc),Hd=K({},yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Di=Wt(Hd),Gd=K({},xs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_s}),Vd=Wt(Gd),qi=K({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0}),vr=Wt(qi),Fi=K({},yo,{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}),gc=Wt(Fi),Yd=[9,13,27,32],Bi=u&&"CompositionEvent"in window,Ns=null;u&&"documentMode"in document&&(Ns=document.documentMode);var Kd=u&&"TextEvent"in window&&!Ns,yc=u&&(!Bi||Ns&&8<Ns&&11>=Ns),zi=" ",Ui=!1;function Qn(r,o){switch(r){case"keyup":return Yd.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wc(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Wr=!1;function Xd(r,o){switch(r){case"compositionend":return wc(o);case"keypress":return o.which!==32?null:(Ui=!0,zi);case"textInput":return r=o.data,r===zi&&Ui?null:r;default:return null}}function xo(r,o){if(Wr)return r==="compositionend"||!Bi&&Qn(r,o)?(r=Ii(),ws=xa=$t=null,Wr=!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 yc&&o.locale!=="ko"?null:o.data;default:return null}}var Qd={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 Qt(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Qd[r.type]:o==="textarea"}function bo(r,o,d,m){Rr(m),o=vt(o,"onChange"),0<o.length&&(d=new ba("onChange","change",null,d,m),r.push({event:d,listeners:o}))}var Ss=null,js=null;function vc(r){Zi(r,0)}function Es(r){var o=Io(r);if(Ue(o))return r}function ko(r,o){if(r==="change")return o}var _o=!1;if(u){var No;if(u){var Cs="oninput"in document;if(!Cs){var Wi=document.createElement("div");Wi.setAttribute("oninput","return;"),Cs=typeof Wi.oninput=="function"}No=Cs}else No=!1;_o=No&&(!document.documentMode||9<document.documentMode)}function So(){Ss&&(Ss.detachEvent("onpropertychange",jo),js=Ss=null)}function jo(r){if(r.propertyName==="value"&&Es(js)){var o=[];bo(o,js,r,wt(r)),eo(vc,o)}}function xc(r,o,d){r==="focusin"?(So(),Ss=o,js=d,Ss.attachEvent("onpropertychange",jo)):r==="focusout"&&So()}function Zt(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Es(js)}function bc(r,o){if(r==="click")return Es(o)}function kc(r,o){if(r==="input"||r==="change")return Es(o)}function Zd(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Sn=typeof Object.is=="function"?Object.is:Zd;function Ts(r,o){if(Sn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var d=Object.keys(r),m=Object.keys(o);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var w=d[m];if(!f.call(o,w)||!Sn(r[w],o[w]))return!1}return!0}function _a(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function _c(r,o){var d=_a(r);r=0;for(var m;d;){if(d.nodeType===3){if(m=r+d.textContent.length,r<=o&&m>=o)return{node:d,offset:o-r};r=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=_a(d)}}function xr(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?xr(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Eo(){for(var r=window,o=ue();o instanceof r.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)r=o.contentWindow;else break;o=ue(r.document)}return o}function As(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 Hi(r){var o=Eo(),d=r.focusedElem,m=r.selectionRange;if(o!==d&&d&&d.ownerDocument&&xr(d.ownerDocument.documentElement,d)){if(m!==null&&As(d)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(r,d.value.length);else if(r=(o=d.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var w=d.textContent.length,k=Math.min(m.start,w);m=m.end===void 0?k:Math.min(m.end,w),!r.extend&&k>m&&(w=m,m=k,k=w),w=_c(d,k);var T=_c(d,m);w&&T&&(r.rangeCount!==1||r.anchorNode!==w.node||r.anchorOffset!==w.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(w.node,w.offset),r.removeAllRanges(),k>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=d;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)r=o[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Jd=u&&"documentMode"in document&&11>=document.documentMode,Hr=null,Co=null,Na=null,Gi=!1;function Vi(r,o,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Gi||Hr==null||Hr!==ue(m)||(m=Hr,"selectionStart"in m&&As(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Na&&Ts(Na,m)||(Na=m,m=vt(Co,"onSelect"),0<m.length&&(o=new ba("onSelect","select",null,o,d),r.push({event:o,listeners:m}),o.target=Hr)))}function Gr(r,o){var d={};return d[r.toLowerCase()]=o.toLowerCase(),d["Webkit"+r]="webkit"+o,d["Moz"+r]="moz"+o,d}var br={animationend:Gr("Animation","AnimationEnd"),animationiteration:Gr("Animation","AnimationIteration"),animationstart:Gr("Animation","AnimationStart"),transitionend:Gr("Transition","TransitionEnd")},Yi={},Ki={};u&&(Ki=document.createElement("div").style,"AnimationEvent"in window||(delete br.animationend.animation,delete br.animationiteration.animation,delete br.animationstart.animation),"TransitionEvent"in window||delete br.transitionend.transition);function Sa(r){if(Yi[r])return Yi[r];if(!br[r])return r;var o=br[r],d;for(d in o)if(o.hasOwnProperty(d)&&d in Ki)return Yi[r]=o[d];return r}var Xi=Sa("animationend"),Qi=Sa("animationiteration"),F=Sa("animationstart"),W=Sa("transitionend"),ae=new Map,ie="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 je(r,o){ae.set(r,o),l(o,[r])}for(var Ie=0;Ie<ie.length;Ie++){var ze=ie[Ie],nt=ze.toLowerCase(),mt=ze[0].toUpperCase()+ze.slice(1);je(nt,"on"+mt)}je(Xi,"onAnimationEnd"),je(Qi,"onAnimationIteration"),je(F,"onAnimationStart"),je("dblclick","onDoubleClick"),je("focusin","onFocus"),je("focusout","onBlur"),je(W,"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 et="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(" "),dn=new Set("cancel close invalid load scroll toggle".split(" ").concat(et));function ja(r,o,d){var m=r.type||"unknown-event";r.currentTarget=d,sa(m,o,void 0,r),r.currentTarget=null}function Zi(r,o){o=(o&4)!==0;for(var d=0;d<r.length;d++){var m=r[d],w=m.event;m=m.listeners;e:{var k=void 0;if(o)for(var T=m.length-1;0<=T;T--){var X=m[T],ee=X.instance,de=X.currentTarget;if(X=X.listener,ee!==k&&w.isPropagationStopped())break e;ja(w,X,de),k=ee}else for(T=0;T<m.length;T++){if(X=m[T],ee=X.instance,de=X.currentTarget,X=X.listener,ee!==k&&w.isPropagationStopped())break e;ja(w,X,de),k=ee}}}if(ds)throw r=ra,ds=!1,ra=null,r}function ct(r,o){var d=o[ah];d===void 0&&(d=o[ah]=new Set);var m=r+"__bubble";d.has(m)||(Ro(o,r,2,!1),d.add(m))}function To(r,o,d){var m=0;o&&(m|=4),Ro(d,r,m,o)}var Ao="_reactListening"+Math.random().toString(36).slice(2);function Rs(r){if(!r[Ao]){r[Ao]=!0,s.forEach(function(d){d!=="selectionchange"&&(dn.has(d)||To(d,!1,r),To(d,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Ao]||(o[Ao]=!0,To("selectionchange",!1,o))}}function Ro(r,o,d,m){switch(dc(o)){case 1:var w=qr;break;case 4:w=va;break;default:w=po}d=w.bind(null,o,d,r),w=void 0,!na||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(w=!0),m?w!==void 0?r.addEventListener(o,d,{capture:!0,passive:w}):r.addEventListener(o,d,!0):w!==void 0?r.addEventListener(o,d,{passive:w}):r.addEventListener(o,d,!1)}function Vr(r,o,d,m,w){var k=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var X=m.stateNode.containerInfo;if(X===w||X.nodeType===8&&X.parentNode===w)break;if(T===4)for(T=m.return;T!==null;){var ee=T.tag;if((ee===3||ee===4)&&(ee=T.stateNode.containerInfo,ee===w||ee.nodeType===8&&ee.parentNode===w))return;T=T.return}for(;X!==null;){if(T=Ea(X),T===null)return;if(ee=T.tag,ee===5||ee===6){m=k=T;continue e}X=X.parentNode}}m=m.return}eo(function(){var de=k,ve=wt(d),be=[];e:{var we=ae.get(r);if(we!==void 0){var Me=ba,Oe=r;switch(r){case"keypress":if(Fr(d)===0)break e;case"keydown":case"keyup":Me=Wd;break;case"focusin":Oe="focus",Me=vo;break;case"focusout":Oe="blur",Me=vo;break;case"beforeblur":case"afterblur":Me=vo;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Me=wo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Me=hc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Me=Vd;break;case Xi:case Qi:case F:Me=zd;break;case W:Me=vr;break;case"scroll":Me=bs;break;case"wheel":Me=gc;break;case"copy":case"cut":case"paste":Me=Ud;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Me=Di}var Pe=(o&4)!==0,jt=!Pe&&r==="scroll",oe=Pe?we!==null?we+"Capture":null:we;Pe=[];for(var ne=de,ce;ne!==null;){ce=ne;var Ne=ce.stateNode;if(ce.tag===5&&Ne!==null&&(ce=Ne,oe!==null&&(Ne=Kt(ne,oe),Ne!=null&&Pe.push(Zn(ne,Ne,ce)))),jt)break;ne=ne.return}0<Pe.length&&(we=new Me(we,Oe,null,d,ve),be.push({event:we,listeners:Pe}))}}if((o&7)===0){e:{if(we=r==="mouseover"||r==="pointerover",Me=r==="mouseout"||r==="pointerout",we&&d!==ht&&(Oe=d.relatedTarget||d.fromElement)&&(Ea(Oe)||Oe[Kr]))break e;if((Me||we)&&(we=ve.window===ve?ve:(we=ve.ownerDocument)?we.defaultView||we.parentWindow:window,Me?(Oe=d.relatedTarget||d.toElement,Me=de,Oe=Oe?Ea(Oe):null,Oe!==null&&(jt=xn(Oe),Oe!==jt||Oe.tag!==5&&Oe.tag!==6)&&(Oe=null)):(Me=null,Oe=de),Me!==Oe)){if(Pe=wo,Ne="onMouseLeave",oe="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Pe=Di,Ne="onPointerLeave",oe="onPointerEnter",ne="pointer"),jt=Me==null?we:Io(Me),ce=Oe==null?we:Io(Oe),we=new Pe(Ne,ne+"leave",Me,d,ve),we.target=jt,we.relatedTarget=ce,Ne=null,Ea(ve)===de&&(Pe=new Pe(oe,ne+"enter",Oe,d,ve),Pe.target=ce,Pe.relatedTarget=jt,Ne=Pe),jt=Ne,Me&&Oe)t:{for(Pe=Me,oe=Oe,ne=0,ce=Pe;ce;ce=Yr(ce))ne++;for(ce=0,Ne=oe;Ne;Ne=Yr(Ne))ce++;for(;0<ne-ce;)Pe=Yr(Pe),ne--;for(;0<ce-ne;)oe=Yr(oe),ce--;for(;ne--;){if(Pe===oe||oe!==null&&Pe===oe.alternate)break t;Pe=Yr(Pe),oe=Yr(oe)}Pe=null}else Pe=null;Me!==null&&qx(be,we,Me,Pe,!1),Oe!==null&&jt!==null&&qx(be,jt,Oe,Pe,!0)}}e:{if(we=de?Io(de):window,Me=we.nodeName&&we.nodeName.toLowerCase(),Me==="select"||Me==="input"&&we.type==="file")var Le=ko;else if(Qt(we))if(_o)Le=kc;else{Le=Zt;var We=xc}else(Me=we.nodeName)&&Me.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Le=bc);if(Le&&(Le=Le(r,de))){bo(be,Le,d,ve);break e}We&&We(r,we,de),r==="focusout"&&(We=we._wrapperState)&&We.controlled&&we.type==="number"&&Ge(we,"number",we.value)}switch(We=de?Io(de):window,r){case"focusin":(Qt(We)||We.contentEditable==="true")&&(Hr=We,Co=de,Na=null);break;case"focusout":Na=Co=Hr=null;break;case"mousedown":Gi=!0;break;case"contextmenu":case"mouseup":case"dragend":Gi=!1,Vi(be,d,ve);break;case"selectionchange":if(Jd)break;case"keydown":case"keyup":Vi(be,d,ve)}var He;if(Bi)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 Wr?Qn(r,d)&&(Ve="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Ve="onCompositionStart");Ve&&(yc&&d.locale!=="ko"&&(Wr||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Wr&&(He=Ii()):($t=ve,xa="value"in $t?$t.value:$t.textContent,Wr=!0)),We=vt(de,Ve),0<We.length&&(Ve=new Ur(Ve,r,null,d,ve),be.push({event:Ve,listeners:We}),He?Ve.data=He:(He=wc(d),He!==null&&(Ve.data=He)))),(He=Kd?Xd(r,d):xo(r,d))&&(de=vt(de,"onBeforeInput"),0<de.length&&(ve=new Ur("onBeforeInput","beforeinput",null,d,ve),be.push({event:ve,listeners:de}),ve.data=He))}Zi(be,o)})}function Zn(r,o,d){return{instance:r,listener:o,currentTarget:d}}function vt(r,o){for(var d=o+"Capture",m=[];r!==null;){var w=r,k=w.stateNode;w.tag===5&&k!==null&&(w=k,k=Kt(r,d),k!=null&&m.unshift(Zn(r,k,w)),k=Kt(r,o),k!=null&&m.push(Zn(r,k,w))),r=r.return}return m}function Yr(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function qx(r,o,d,m,w){for(var k=o._reactName,T=[];d!==null&&d!==m;){var X=d,ee=X.alternate,de=X.stateNode;if(ee!==null&&ee===m)break;X.tag===5&&de!==null&&(X=de,w?(ee=Kt(d,k),ee!=null&&T.unshift(Zn(d,ee,X))):w||(ee=Kt(d,k),ee!=null&&T.push(Zn(d,ee,X)))),d=d.return}T.length!==0&&r.push({event:o,listeners:T})}var eR=/\r\n?/g,tR=/\u0000|\uFFFD/g;function Fx(r){return(typeof r=="string"?r:""+r).replace(eR,`
|
|
38
|
-
`).replace(tR,"")}function Nc(r,o,d){if(o=Fx(o),Fx(r)!==o&&d)throw Error(n(425))}function Sc(){}var eh=null,th=null;function nh(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 rh=typeof setTimeout=="function"?setTimeout:void 0,nR=typeof clearTimeout=="function"?clearTimeout:void 0,Bx=typeof Promise=="function"?Promise:void 0,rR=typeof queueMicrotask=="function"?queueMicrotask:typeof Bx<"u"?function(r){return Bx.resolve(null).then(r).catch(sR)}:rh;function sR(r){setTimeout(function(){throw r})}function sh(r,o){var d=o,m=0;do{var w=d.nextSibling;if(r.removeChild(d),w&&w.nodeType===8)if(d=w.data,d==="/$"){if(m===0){r.removeChild(w),wa(o);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=w}while(d);wa(o)}function Ms(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 zx(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return r;o--}else d==="/$"&&o++}r=r.previousSibling}return null}var Mo=Math.random().toString(36).slice(2),kr="__reactFiber$"+Mo,Ji="__reactProps$"+Mo,Kr="__reactContainer$"+Mo,ah="__reactEvents$"+Mo,aR="__reactListeners$"+Mo,oR="__reactHandles$"+Mo;function Ea(r){var o=r[kr];if(o)return o;for(var d=r.parentNode;d;){if(o=d[Kr]||d[kr]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(r=zx(r);r!==null;){if(d=r[kr])return d;r=zx(r)}return o}r=d,d=r.parentNode}return null}function el(r){return r=r[kr]||r[Kr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Io(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function jc(r){return r[Ji]||null}var oh=[],$o=-1;function Is(r){return{current:r}}function ft(r){0>$o||(r.current=oh[$o],oh[$o]=null,$o--)}function dt(r,o){$o++,oh[$o]=r.current,r.current=o}var $s={},Jt=Is($s),hn=Is(!1),Ca=$s;function Oo(r,o){var d=r.type.contextTypes;if(!d)return $s;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var w={},k;for(k in d)w[k]=o[k];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=w),w}function fn(r){return r=r.childContextTypes,r!=null}function Ec(){ft(hn),ft(Jt)}function Ux(r,o,d){if(Jt.current!==$s)throw Error(n(168));dt(Jt,o),dt(hn,d)}function Wx(r,o,d){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var w in m)if(!(w in o))throw Error(n(108,V(r)||"Unknown",w));return K({},d,m)}function Cc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||$s,Ca=Jt.current,dt(Jt,r),dt(hn,hn.current),!0}function Hx(r,o,d){var m=r.stateNode;if(!m)throw Error(n(169));d?(r=Wx(r,o,Ca),m.__reactInternalMemoizedMergedChildContext=r,ft(hn),ft(Jt),dt(Jt,r)):ft(hn),dt(hn,d)}var Xr=null,Tc=!1,ih=!1;function Gx(r){Xr===null?Xr=[r]:Xr.push(r)}function iR(r){Tc=!0,Gx(r)}function Os(){if(!ih&&Xr!==null){ih=!0;var r=0,o=st;try{var d=Xr;for(st=1;r<d.length;r++){var m=d[r];do m=m(!0);while(m!==null)}Xr=null,Tc=!1}catch(w){throw Xr!==null&&(Xr=Xr.slice(r+1)),ao(yr,Os),w}finally{st=o,ih=!1}}return null}var Po=[],Lo=0,Ac=null,Rc=0,In=[],$n=0,Ta=null,Qr=1,Zr="";function Aa(r,o){Po[Lo++]=Rc,Po[Lo++]=Ac,Ac=r,Rc=o}function Vx(r,o,d){In[$n++]=Qr,In[$n++]=Zr,In[$n++]=Ta,Ta=r;var m=Qr;r=Zr;var w=32-cn(m)-1;m&=~(1<<w),d+=1;var k=32-cn(o)+w;if(30<k){var T=w-w%5;k=(m&(1<<T)-1).toString(32),m>>=T,w-=T,Qr=1<<32-cn(o)+w|d<<w|m,Zr=k+r}else Qr=1<<k|d<<w|m,Zr=r}function lh(r){r.return!==null&&(Aa(r,1),Vx(r,1,0))}function ch(r){for(;r===Ac;)Ac=Po[--Lo],Po[Lo]=null,Rc=Po[--Lo],Po[Lo]=null;for(;r===Ta;)Ta=In[--$n],In[$n]=null,Zr=In[--$n],In[$n]=null,Qr=In[--$n],In[$n]=null}var jn=null,En=null,gt=!1,Jn=null;function Yx(r,o){var d=Dn(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=r,o=r.deletions,o===null?(r.deletions=[d],r.flags|=16):o.push(d)}function Kx(r,o){switch(r.tag){case 5:var d=r.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jn=r,En=Ms(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,En=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Ta!==null?{id:Qr,overflow:Zr}:null,r.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=Dn(18,null,null,0),d.stateNode=o,d.return=r,r.child=d,jn=r,En=null,!0):!1;default:return!1}}function uh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function dh(r){if(gt){var o=En;if(o){var d=o;if(!Kx(r,o)){if(uh(r))throw Error(n(418));o=Ms(d.nextSibling);var m=jn;o&&Kx(r,o)?Yx(m,d):(r.flags=r.flags&-4097|2,gt=!1,jn=r)}}else{if(uh(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,jn=r}}}function Xx(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function Mc(r){if(r!==jn)return!1;if(!gt)return Xx(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!nh(r.type,r.memoizedProps)),o&&(o=En)){if(uh(r))throw Qx(),Error(n(418));for(;o;)Yx(r,o),o=Ms(o.nextSibling)}if(Xx(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(o===0){En=Ms(r.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}r=r.nextSibling}En=null}}else En=jn?Ms(r.stateNode.nextSibling):null;return!0}function Qx(){for(var r=En;r;)r=Ms(r.nextSibling)}function Do(){En=jn=null,gt=!1}function hh(r){Jn===null?Jn=[r]:Jn.push(r)}var lR=C.ReactCurrentBatchConfig;function tl(r,o,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,r));var w=m,k=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===k?o.ref:(o=function(T){var X=w.refs;T===null?delete X[k]:X[k]=T},o._stringRef=k,o)}if(typeof r!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,r))}return r}function Ic(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function Zx(r){var o=r._init;return o(r._payload)}function Jx(r){function o(oe,ne){if(r){var ce=oe.deletions;ce===null?(oe.deletions=[ne],oe.flags|=16):ce.push(ne)}}function d(oe,ne){if(!r)return null;for(;ne!==null;)o(oe,ne),ne=ne.sibling;return null}function m(oe,ne){for(oe=new Map;ne!==null;)ne.key!==null?oe.set(ne.key,ne):oe.set(ne.index,ne),ne=ne.sibling;return oe}function w(oe,ne){return oe=Us(oe,ne),oe.index=0,oe.sibling=null,oe}function k(oe,ne,ce){return oe.index=ce,r?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<ne?(oe.flags|=2,ne):ce):(oe.flags|=2,ne)):(oe.flags|=1048576,ne)}function T(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function X(oe,ne,ce,Ne){return ne===null||ne.tag!==6?(ne=rf(ce,oe.mode,Ne),ne.return=oe,ne):(ne=w(ne,ce),ne.return=oe,ne)}function ee(oe,ne,ce,Ne){var Le=ce.type;return Le===$?ve(oe,ne,ce.props.children,Ne,ce.key):ne!==null&&(ne.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===z&&Zx(Le)===ne.type)?(Ne=w(ne,ce.props),Ne.ref=tl(oe,ne,ce),Ne.return=oe,Ne):(Ne=ru(ce.type,ce.key,ce.props,null,oe.mode,Ne),Ne.ref=tl(oe,ne,ce),Ne.return=oe,Ne)}function de(oe,ne,ce,Ne){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ce.containerInfo||ne.stateNode.implementation!==ce.implementation?(ne=sf(ce,oe.mode,Ne),ne.return=oe,ne):(ne=w(ne,ce.children||[]),ne.return=oe,ne)}function ve(oe,ne,ce,Ne,Le){return ne===null||ne.tag!==7?(ne=Da(ce,oe.mode,Ne,Le),ne.return=oe,ne):(ne=w(ne,ce),ne.return=oe,ne)}function be(oe,ne,ce){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=rf(""+ne,oe.mode,ce),ne.return=oe,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case R:return ce=ru(ne.type,ne.key,ne.props,null,oe.mode,ce),ce.ref=tl(oe,null,ne),ce.return=oe,ce;case I:return ne=sf(ne,oe.mode,ce),ne.return=oe,ne;case z:var Ne=ne._init;return be(oe,Ne(ne._payload),ce)}if(ot(ne)||q(ne))return ne=Da(ne,oe.mode,ce,null),ne.return=oe,ne;Ic(oe,ne)}return null}function we(oe,ne,ce,Ne){var Le=ne!==null?ne.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Le!==null?null:X(oe,ne,""+ce,Ne);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case R:return ce.key===Le?ee(oe,ne,ce,Ne):null;case I:return ce.key===Le?de(oe,ne,ce,Ne):null;case z:return Le=ce._init,we(oe,ne,Le(ce._payload),Ne)}if(ot(ce)||q(ce))return Le!==null?null:ve(oe,ne,ce,Ne,null);Ic(oe,ce)}return null}function Me(oe,ne,ce,Ne,Le){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return oe=oe.get(ce)||null,X(ne,oe,""+Ne,Le);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case R:return oe=oe.get(Ne.key===null?ce:Ne.key)||null,ee(ne,oe,Ne,Le);case I:return oe=oe.get(Ne.key===null?ce:Ne.key)||null,de(ne,oe,Ne,Le);case z:var We=Ne._init;return Me(oe,ne,ce,We(Ne._payload),Le)}if(ot(Ne)||q(Ne))return oe=oe.get(ce)||null,ve(ne,oe,Ne,Le,null);Ic(ne,Ne)}return null}function Oe(oe,ne,ce,Ne){for(var Le=null,We=null,He=ne,Ve=ne=0,Bt=null;He!==null&&Ve<ce.length;Ve++){He.index>Ve?(Bt=He,He=null):Bt=He.sibling;var rt=we(oe,He,ce[Ve],Ne);if(rt===null){He===null&&(He=Bt);break}r&&He&&rt.alternate===null&&o(oe,He),ne=k(rt,ne,Ve),We===null?Le=rt:We.sibling=rt,We=rt,He=Bt}if(Ve===ce.length)return d(oe,He),gt&&Aa(oe,Ve),Le;if(He===null){for(;Ve<ce.length;Ve++)He=be(oe,ce[Ve],Ne),He!==null&&(ne=k(He,ne,Ve),We===null?Le=He:We.sibling=He,We=He);return gt&&Aa(oe,Ve),Le}for(He=m(oe,He);Ve<ce.length;Ve++)Bt=Me(He,oe,Ve,ce[Ve],Ne),Bt!==null&&(r&&Bt.alternate!==null&&He.delete(Bt.key===null?Ve:Bt.key),ne=k(Bt,ne,Ve),We===null?Le=Bt:We.sibling=Bt,We=Bt);return r&&He.forEach(function(Ws){return o(oe,Ws)}),gt&&Aa(oe,Ve),Le}function Pe(oe,ne,ce,Ne){var Le=q(ce);if(typeof Le!="function")throw Error(n(150));if(ce=Le.call(ce),ce==null)throw Error(n(151));for(var We=Le=null,He=ne,Ve=ne=0,Bt=null,rt=ce.next();He!==null&&!rt.done;Ve++,rt=ce.next()){He.index>Ve?(Bt=He,He=null):Bt=He.sibling;var Ws=we(oe,He,rt.value,Ne);if(Ws===null){He===null&&(He=Bt);break}r&&He&&Ws.alternate===null&&o(oe,He),ne=k(Ws,ne,Ve),We===null?Le=Ws:We.sibling=Ws,We=Ws,He=Bt}if(rt.done)return d(oe,He),gt&&Aa(oe,Ve),Le;if(He===null){for(;!rt.done;Ve++,rt=ce.next())rt=be(oe,rt.value,Ne),rt!==null&&(ne=k(rt,ne,Ve),We===null?Le=rt:We.sibling=rt,We=rt);return gt&&Aa(oe,Ve),Le}for(He=m(oe,He);!rt.done;Ve++,rt=ce.next())rt=Me(He,oe,Ve,rt.value,Ne),rt!==null&&(r&&rt.alternate!==null&&He.delete(rt.key===null?Ve:rt.key),ne=k(rt,ne,Ve),We===null?Le=rt:We.sibling=rt,We=rt);return r&&He.forEach(function(BR){return o(oe,BR)}),gt&&Aa(oe,Ve),Le}function jt(oe,ne,ce,Ne){if(typeof ce=="object"&&ce!==null&&ce.type===$&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case R:e:{for(var Le=ce.key,We=ne;We!==null;){if(We.key===Le){if(Le=ce.type,Le===$){if(We.tag===7){d(oe,We.sibling),ne=w(We,ce.props.children),ne.return=oe,oe=ne;break e}}else if(We.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===z&&Zx(Le)===We.type){d(oe,We.sibling),ne=w(We,ce.props),ne.ref=tl(oe,We,ce),ne.return=oe,oe=ne;break e}d(oe,We);break}else o(oe,We);We=We.sibling}ce.type===$?(ne=Da(ce.props.children,oe.mode,Ne,ce.key),ne.return=oe,oe=ne):(Ne=ru(ce.type,ce.key,ce.props,null,oe.mode,Ne),Ne.ref=tl(oe,ne,ce),Ne.return=oe,oe=Ne)}return T(oe);case I:e:{for(We=ce.key;ne!==null;){if(ne.key===We)if(ne.tag===4&&ne.stateNode.containerInfo===ce.containerInfo&&ne.stateNode.implementation===ce.implementation){d(oe,ne.sibling),ne=w(ne,ce.children||[]),ne.return=oe,oe=ne;break e}else{d(oe,ne);break}else o(oe,ne);ne=ne.sibling}ne=sf(ce,oe.mode,Ne),ne.return=oe,oe=ne}return T(oe);case z:return We=ce._init,jt(oe,ne,We(ce._payload),Ne)}if(ot(ce))return Oe(oe,ne,ce,Ne);if(q(ce))return Pe(oe,ne,ce,Ne);Ic(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ne!==null&&ne.tag===6?(d(oe,ne.sibling),ne=w(ne,ce),ne.return=oe,oe=ne):(d(oe,ne),ne=rf(ce,oe.mode,Ne),ne.return=oe,oe=ne),T(oe)):d(oe,ne)}return jt}var qo=Jx(!0),e0=Jx(!1),$c=Is(null),Oc=null,Fo=null,fh=null;function ph(){fh=Fo=Oc=null}function mh(r){var o=$c.current;ft($c),r._currentValue=o}function gh(r,o,d){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===d)break;r=r.return}}function Bo(r,o){Oc=r,fh=Fo=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(pn=!0),r.firstContext=null)}function On(r){var o=r._currentValue;if(fh!==r)if(r={context:r,memoizedValue:o,next:null},Fo===null){if(Oc===null)throw Error(n(308));Fo=r,Oc.dependencies={lanes:0,firstContext:r}}else Fo=Fo.next=r;return o}var Ra=null;function yh(r){Ra===null?Ra=[r]:Ra.push(r)}function t0(r,o,d,m){var w=o.interleaved;return w===null?(d.next=d,yh(o)):(d.next=w.next,w.next=d),o.interleaved=d,Jr(r,m)}function Jr(r,o){r.lanes|=o;var d=r.alternate;for(d!==null&&(d.lanes|=o),d=r,r=r.return;r!==null;)r.childLanes|=o,d=r.alternate,d!==null&&(d.childLanes|=o),d=r,r=r.return;return d.tag===3?d.stateNode:null}var Ps=!1;function wh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function n0(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 es(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ls(r,o,d){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var w=m.pending;return w===null?o.next=o:(o.next=w.next,w.next=o),m.pending=o,Jr(r,d)}return w=m.interleaved,w===null?(o.next=o,yh(m)):(o.next=w.next,w.next=o),m.interleaved=o,Jr(r,d)}function Pc(r,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,d|=m,o.lanes=d,fs(r,d)}}function r0(r,o){var d=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var w=null,k=null;if(d=d.firstBaseUpdate,d!==null){do{var T={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};k===null?w=k=T:k=k.next=T,d=d.next}while(d!==null);k===null?w=k=o:k=k.next=o}else w=k=o;d={baseState:m.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:m.shared,effects:m.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=o:r.next=o,d.lastBaseUpdate=o}function Lc(r,o,d,m){var w=r.updateQueue;Ps=!1;var k=w.firstBaseUpdate,T=w.lastBaseUpdate,X=w.shared.pending;if(X!==null){w.shared.pending=null;var ee=X,de=ee.next;ee.next=null,T===null?k=de:T.next=de,T=ee;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,X=ve.lastBaseUpdate,X!==T&&(X===null?ve.firstBaseUpdate=de:X.next=de,ve.lastBaseUpdate=ee))}if(k!==null){var be=w.baseState;T=0,ve=de=ee=null,X=k;do{var we=X.lane,Me=X.eventTime;if((m&we)===we){ve!==null&&(ve=ve.next={eventTime:Me,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Oe=r,Pe=X;switch(we=o,Me=d,Pe.tag){case 1:if(Oe=Pe.payload,typeof Oe=="function"){be=Oe.call(Me,be,we);break e}be=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Pe.payload,we=typeof Oe=="function"?Oe.call(Me,be,we):Oe,we==null)break e;be=K({},be,we);break e;case 2:Ps=!0}}X.callback!==null&&X.lane!==0&&(r.flags|=64,we=w.effects,we===null?w.effects=[X]:we.push(X))}else Me={eventTime:Me,lane:we,tag:X.tag,payload:X.payload,callback:X.callback,next:null},ve===null?(de=ve=Me,ee=be):ve=ve.next=Me,T|=we;if(X=X.next,X===null){if(X=w.shared.pending,X===null)break;we=X,X=we.next,we.next=null,w.lastBaseUpdate=we,w.shared.pending=null}}while(!0);if(ve===null&&(ee=be),w.baseState=ee,w.firstBaseUpdate=de,w.lastBaseUpdate=ve,o=w.shared.interleaved,o!==null){w=o;do T|=w.lane,w=w.next;while(w!==o)}else k===null&&(w.shared.lanes=0);$a|=T,r.lanes=T,r.memoizedState=be}}function s0(r,o,d){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],w=m.callback;if(w!==null){if(m.callback=null,m=d,typeof w!="function")throw Error(n(191,w));w.call(m)}}}var nl={},_r=Is(nl),rl=Is(nl),sl=Is(nl);function Ma(r){if(r===nl)throw Error(n(174));return r}function vh(r,o){switch(dt(sl,o),dt(rl,r),dt(_r,nl),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Xe(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Xe(o,r)}ft(_r),dt(_r,o)}function zo(){ft(_r),ft(rl),ft(sl)}function a0(r){Ma(sl.current);var o=Ma(_r.current),d=Xe(o,r.type);o!==d&&(dt(rl,r),dt(_r,d))}function xh(r){rl.current===r&&(ft(_r),ft(rl))}var xt=Is(0);function Dc(r){for(var o=r;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var bh=[];function kh(){for(var r=0;r<bh.length;r++)bh[r]._workInProgressVersionPrimary=null;bh.length=0}var qc=C.ReactCurrentDispatcher,_h=C.ReactCurrentBatchConfig,Ia=0,bt=null,Ot=null,qt=null,Fc=!1,al=!1,ol=0,cR=0;function en(){throw Error(n(321))}function Nh(r,o){if(o===null)return!1;for(var d=0;d<o.length&&d<r.length;d++)if(!Sn(r[d],o[d]))return!1;return!0}function Sh(r,o,d,m,w,k){if(Ia=k,bt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,qc.current=r===null||r.memoizedState===null?fR:pR,r=d(m,w),al){k=0;do{if(al=!1,ol=0,25<=k)throw Error(n(301));k+=1,qt=Ot=null,o.updateQueue=null,qc.current=mR,r=d(m,w)}while(al)}if(qc.current=Uc,o=Ot!==null&&Ot.next!==null,Ia=0,qt=Ot=bt=null,Fc=!1,o)throw Error(n(300));return r}function jh(){var r=ol!==0;return ol=0,r}function Nr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?bt.memoizedState=qt=r:qt=qt.next=r,qt}function Pn(){if(Ot===null){var r=bt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=qt===null?bt.memoizedState:qt.next;if(o!==null)qt=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},qt===null?bt.memoizedState=qt=r:qt=qt.next=r}return qt}function il(r,o){return typeof o=="function"?o(r):o}function Eh(r){var o=Pn(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var m=Ot,w=m.baseQueue,k=d.pending;if(k!==null){if(w!==null){var T=w.next;w.next=k.next,k.next=T}m.baseQueue=w=k,d.pending=null}if(w!==null){k=w.next,m=m.baseState;var X=T=null,ee=null,de=k;do{var ve=de.lane;if((Ia&ve)===ve)ee!==null&&(ee=ee.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),m=de.hasEagerState?de.eagerState:r(m,de.action);else{var be={lane:ve,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};ee===null?(X=ee=be,T=m):ee=ee.next=be,bt.lanes|=ve,$a|=ve}de=de.next}while(de!==null&&de!==k);ee===null?T=m:ee.next=X,Sn(m,o.memoizedState)||(pn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=ee,d.lastRenderedState=m}if(r=d.interleaved,r!==null){w=r;do k=w.lane,bt.lanes|=k,$a|=k,w=w.next;while(w!==r)}else w===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function Ch(r){var o=Pn(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var m=d.dispatch,w=d.pending,k=o.memoizedState;if(w!==null){d.pending=null;var T=w=w.next;do k=r(k,T.action),T=T.next;while(T!==w);Sn(k,o.memoizedState)||(pn=!0),o.memoizedState=k,o.baseQueue===null&&(o.baseState=k),d.lastRenderedState=k}return[k,m]}function o0(){}function i0(r,o){var d=bt,m=Pn(),w=o(),k=!Sn(m.memoizedState,w);if(k&&(m.memoizedState=w,pn=!0),m=m.queue,Th(u0.bind(null,d,m,r),[r]),m.getSnapshot!==o||k||qt!==null&&qt.memoizedState.tag&1){if(d.flags|=2048,ll(9,c0.bind(null,d,m,w,o),void 0,null),Ft===null)throw Error(n(349));(Ia&30)!==0||l0(d,o,w)}return w}function l0(r,o,d){r.flags|=16384,r={getSnapshot:o,value:d},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.stores=[r]):(d=o.stores,d===null?o.stores=[r]:d.push(r))}function c0(r,o,d,m){o.value=d,o.getSnapshot=m,d0(o)&&h0(r)}function u0(r,o,d){return d(function(){d0(o)&&h0(r)})}function d0(r){var o=r.getSnapshot;r=r.value;try{var d=o();return!Sn(r,d)}catch{return!0}}function h0(r){var o=Jr(r,1);o!==null&&rr(o,r,1,-1)}function f0(r){var o=Nr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:il,lastRenderedState:r},o.queue=r,r=r.dispatch=hR.bind(null,bt,r),[o.memoizedState,r]}function ll(r,o,d,m){return r={tag:r,create:o,destroy:d,deps:m,next:null},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.lastEffect=r.next=r):(d=o.lastEffect,d===null?o.lastEffect=r.next=r:(m=d.next,d.next=r,r.next=m,o.lastEffect=r)),r}function p0(){return Pn().memoizedState}function Bc(r,o,d,m){var w=Nr();bt.flags|=r,w.memoizedState=ll(1|o,d,void 0,m===void 0?null:m)}function zc(r,o,d,m){var w=Pn();m=m===void 0?null:m;var k=void 0;if(Ot!==null){var T=Ot.memoizedState;if(k=T.destroy,m!==null&&Nh(m,T.deps)){w.memoizedState=ll(o,d,k,m);return}}bt.flags|=r,w.memoizedState=ll(1|o,d,k,m)}function m0(r,o){return Bc(8390656,8,r,o)}function Th(r,o){return zc(2048,8,r,o)}function g0(r,o){return zc(4,2,r,o)}function y0(r,o){return zc(4,4,r,o)}function w0(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 v0(r,o,d){return d=d!=null?d.concat([r]):null,zc(4,4,w0.bind(null,o,r),d)}function Ah(){}function x0(r,o){var d=Pn();o=o===void 0?null:o;var m=d.memoizedState;return m!==null&&o!==null&&Nh(o,m[1])?m[0]:(d.memoizedState=[r,o],r)}function b0(r,o){var d=Pn();o=o===void 0?null:o;var m=d.memoizedState;return m!==null&&o!==null&&Nh(o,m[1])?m[0]:(r=r(),d.memoizedState=[r,o],r)}function k0(r,o,d){return(Ia&21)===0?(r.baseState&&(r.baseState=!1,pn=!0),r.memoizedState=d):(Sn(d,o)||(d=fa(),bt.lanes|=d,$a|=d,r.baseState=!0),o)}function uR(r,o){var d=st;st=d!==0&&4>d?d:4,r(!0);var m=_h.transition;_h.transition={};try{r(!1),o()}finally{st=d,_h.transition=m}}function _0(){return Pn().memoizedState}function dR(r,o,d){var m=Bs(r);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},N0(r))S0(o,d);else if(d=t0(r,o,d,m),d!==null){var w=on();rr(d,r,m,w),j0(d,o,m)}}function hR(r,o,d){var m=Bs(r),w={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(N0(r))S0(o,w);else{var k=r.alternate;if(r.lanes===0&&(k===null||k.lanes===0)&&(k=o.lastRenderedReducer,k!==null))try{var T=o.lastRenderedState,X=k(T,d);if(w.hasEagerState=!0,w.eagerState=X,Sn(X,T)){var ee=o.interleaved;ee===null?(w.next=w,yh(o)):(w.next=ee.next,ee.next=w),o.interleaved=w;return}}catch{}finally{}d=t0(r,o,w,m),d!==null&&(w=on(),rr(d,r,m,w),j0(d,o,m))}}function N0(r){var o=r.alternate;return r===bt||o!==null&&o===bt}function S0(r,o){al=Fc=!0;var d=r.pending;d===null?o.next=o:(o.next=d.next,d.next=o),r.pending=o}function j0(r,o,d){if((d&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,d|=m,o.lanes=d,fs(r,d)}}var Uc={readContext:On,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useInsertionEffect:en,useLayoutEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useMutableSource:en,useSyncExternalStore:en,useId:en,unstable_isNewReconciler:!1},fR={readContext:On,useCallback:function(r,o){return Nr().memoizedState=[r,o===void 0?null:o],r},useContext:On,useEffect:m0,useImperativeHandle:function(r,o,d){return d=d!=null?d.concat([r]):null,Bc(4194308,4,w0.bind(null,o,r),d)},useLayoutEffect:function(r,o){return Bc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Bc(4,2,r,o)},useMemo:function(r,o){var d=Nr();return o=o===void 0?null:o,r=r(),d.memoizedState=[r,o],r},useReducer:function(r,o,d){var m=Nr();return o=d!==void 0?d(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=dR.bind(null,bt,r),[m.memoizedState,r]},useRef:function(r){var o=Nr();return r={current:r},o.memoizedState=r},useState:f0,useDebugValue:Ah,useDeferredValue:function(r){return Nr().memoizedState=r},useTransition:function(){var r=f0(!1),o=r[0];return r=uR.bind(null,r[1]),Nr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,d){var m=bt,w=Nr();if(gt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),Ft===null)throw Error(n(349));(Ia&30)!==0||l0(m,o,d)}w.memoizedState=d;var k={value:d,getSnapshot:o};return w.queue=k,m0(u0.bind(null,m,k,r),[r]),m.flags|=2048,ll(9,c0.bind(null,m,k,d,o),void 0,null),d},useId:function(){var r=Nr(),o=Ft.identifierPrefix;if(gt){var d=Zr,m=Qr;d=(m&~(1<<32-cn(m)-1)).toString(32)+d,o=":"+o+"R"+d,d=ol++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=cR++,o=":"+o+"r"+d.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},pR={readContext:On,useCallback:x0,useContext:On,useEffect:Th,useImperativeHandle:v0,useInsertionEffect:g0,useLayoutEffect:y0,useMemo:b0,useReducer:Eh,useRef:p0,useState:function(){return Eh(il)},useDebugValue:Ah,useDeferredValue:function(r){var o=Pn();return k0(o,Ot.memoizedState,r)},useTransition:function(){var r=Eh(il)[0],o=Pn().memoizedState;return[r,o]},useMutableSource:o0,useSyncExternalStore:i0,useId:_0,unstable_isNewReconciler:!1},mR={readContext:On,useCallback:x0,useContext:On,useEffect:Th,useImperativeHandle:v0,useInsertionEffect:g0,useLayoutEffect:y0,useMemo:b0,useReducer:Ch,useRef:p0,useState:function(){return Ch(il)},useDebugValue:Ah,useDeferredValue:function(r){var o=Pn();return Ot===null?o.memoizedState=r:k0(o,Ot.memoizedState,r)},useTransition:function(){var r=Ch(il)[0],o=Pn().memoizedState;return[r,o]},useMutableSource:o0,useSyncExternalStore:i0,useId:_0,unstable_isNewReconciler:!1};function er(r,o){if(r&&r.defaultProps){o=K({},o),r=r.defaultProps;for(var d in r)o[d]===void 0&&(o[d]=r[d]);return o}return o}function Rh(r,o,d,m){o=r.memoizedState,d=d(m,o),d=d==null?o:K({},o,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var Wc={isMounted:function(r){return(r=r._reactInternals)?xn(r)===r:!1},enqueueSetState:function(r,o,d){r=r._reactInternals;var m=on(),w=Bs(r),k=es(m,w);k.payload=o,d!=null&&(k.callback=d),o=Ls(r,k,w),o!==null&&(rr(o,r,w,m),Pc(o,r,w))},enqueueReplaceState:function(r,o,d){r=r._reactInternals;var m=on(),w=Bs(r),k=es(m,w);k.tag=1,k.payload=o,d!=null&&(k.callback=d),o=Ls(r,k,w),o!==null&&(rr(o,r,w,m),Pc(o,r,w))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var d=on(),m=Bs(r),w=es(d,m);w.tag=2,o!=null&&(w.callback=o),o=Ls(r,w,m),o!==null&&(rr(o,r,m,d),Pc(o,r,m))}};function E0(r,o,d,m,w,k,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,k,T):o.prototype&&o.prototype.isPureReactComponent?!Ts(d,m)||!Ts(w,k):!0}function C0(r,o,d){var m=!1,w=$s,k=o.contextType;return typeof k=="object"&&k!==null?k=On(k):(w=fn(o)?Ca:Jt.current,m=o.contextTypes,k=(m=m!=null)?Oo(r,w):$s),o=new o(d,k),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Wc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=w,r.__reactInternalMemoizedMaskedChildContext=k),o}function T0(r,o,d,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,m),o.state!==r&&Wc.enqueueReplaceState(o,o.state,null)}function Mh(r,o,d,m){var w=r.stateNode;w.props=d,w.state=r.memoizedState,w.refs={},wh(r);var k=o.contextType;typeof k=="object"&&k!==null?w.context=On(k):(k=fn(o)?Ca:Jt.current,w.context=Oo(r,k)),w.state=r.memoizedState,k=o.getDerivedStateFromProps,typeof k=="function"&&(Rh(r,o,k,d),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&&Wc.enqueueReplaceState(w,w.state,null),Lc(r,d,w,m),w.state=r.memoizedState),typeof w.componentDidMount=="function"&&(r.flags|=4194308)}function Uo(r,o){try{var d="",m=o;do d+=U(m),m=m.return;while(m);var w=d}catch(k){w=`
|
|
39
|
-
Error generating stack: `+k.message+`
|
|
40
|
-
`+k.stack}return{value:r,source:o,stack:w,digest:null}}function Ih(r,o,d){return{value:r,source:null,stack:d??null,digest:o??null}}function $h(r,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var gR=typeof WeakMap=="function"?WeakMap:Map;function A0(r,o,d){d=es(-1,d),d.tag=3,d.payload={element:null};var m=o.value;return d.callback=function(){Qc||(Qc=!0,Kh=m),$h(r,o)},d}function R0(r,o,d){d=es(-1,d),d.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var w=o.value;d.payload=function(){return m(w)},d.callback=function(){$h(r,o)}}var k=r.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(d.callback=function(){$h(r,o),typeof m!="function"&&(qs===null?qs=new Set([this]):qs.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),d}function M0(r,o,d){var m=r.pingCache;if(m===null){m=r.pingCache=new gR;var w=new Set;m.set(o,w)}else w=m.get(o),w===void 0&&(w=new Set,m.set(o,w));w.has(d)||(w.add(d),r=AR.bind(null,r,o,d),o.then(r,r))}function I0(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 $0(r,o,d,m,w){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=es(-1,1),o.tag=2,Ls(d,o,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=w,r)}var yR=C.ReactCurrentOwner,pn=!1;function an(r,o,d,m){o.child=r===null?e0(o,null,d,m):qo(o,r.child,d,m)}function O0(r,o,d,m,w){d=d.render;var k=o.ref;return Bo(o,w),m=Sh(r,o,d,m,k,w),d=jh(),r!==null&&!pn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ts(r,o,w)):(gt&&d&&lh(o),o.flags|=1,an(r,o,m,w),o.child)}function P0(r,o,d,m,w){if(r===null){var k=d.type;return typeof k=="function"&&!nf(k)&&k.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=k,L0(r,o,k,m,w)):(r=ru(d.type,null,m,o,o.mode,w),r.ref=o.ref,r.return=o,o.child=r)}if(k=r.child,(r.lanes&w)===0){var T=k.memoizedProps;if(d=d.compare,d=d!==null?d:Ts,d(T,m)&&r.ref===o.ref)return ts(r,o,w)}return o.flags|=1,r=Us(k,m),r.ref=o.ref,r.return=o,o.child=r}function L0(r,o,d,m,w){if(r!==null){var k=r.memoizedProps;if(Ts(k,m)&&r.ref===o.ref)if(pn=!1,o.pendingProps=m=k,(r.lanes&w)!==0)(r.flags&131072)!==0&&(pn=!0);else return o.lanes=r.lanes,ts(r,o,w)}return Oh(r,o,d,m,w)}function D0(r,o,d){var m=o.pendingProps,w=m.children,k=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(Ho,Cn),Cn|=d;else{if((d&1073741824)===0)return r=k!==null?k.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,dt(Ho,Cn),Cn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=k!==null?k.baseLanes:d,dt(Ho,Cn),Cn|=m}else k!==null?(m=k.baseLanes|d,o.memoizedState=null):m=d,dt(Ho,Cn),Cn|=m;return an(r,o,w,d),o.child}function q0(r,o){var d=o.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function Oh(r,o,d,m,w){var k=fn(d)?Ca:Jt.current;return k=Oo(o,k),Bo(o,w),d=Sh(r,o,d,m,k,w),m=jh(),r!==null&&!pn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~w,ts(r,o,w)):(gt&&m&&lh(o),o.flags|=1,an(r,o,d,w),o.child)}function F0(r,o,d,m,w){if(fn(d)){var k=!0;Cc(o)}else k=!1;if(Bo(o,w),o.stateNode===null)Gc(r,o),C0(o,d,m),Mh(o,d,m,w),m=!0;else if(r===null){var T=o.stateNode,X=o.memoizedProps;T.props=X;var ee=T.context,de=d.contextType;typeof de=="object"&&de!==null?de=On(de):(de=fn(d)?Ca:Jt.current,de=Oo(o,de));var ve=d.getDerivedStateFromProps,be=typeof ve=="function"||typeof T.getSnapshotBeforeUpdate=="function";be||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(X!==m||ee!==de)&&T0(o,T,m,de),Ps=!1;var we=o.memoizedState;T.state=we,Lc(o,m,T,w),ee=o.memoizedState,X!==m||we!==ee||hn.current||Ps?(typeof ve=="function"&&(Rh(o,d,ve,m),ee=o.memoizedState),(X=Ps||E0(o,d,X,m,we,ee,de))?(be||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),T.props=m,T.state=ee,T.context=de,m=X):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,n0(r,o),X=o.memoizedProps,de=o.type===o.elementType?X:er(o.type,X),T.props=de,be=o.pendingProps,we=T.context,ee=d.contextType,typeof ee=="object"&&ee!==null?ee=On(ee):(ee=fn(d)?Ca:Jt.current,ee=Oo(o,ee));var Me=d.getDerivedStateFromProps;(ve=typeof Me=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(X!==be||we!==ee)&&T0(o,T,m,ee),Ps=!1,we=o.memoizedState,T.state=we,Lc(o,m,T,w);var Oe=o.memoizedState;X!==be||we!==Oe||hn.current||Ps?(typeof Me=="function"&&(Rh(o,d,Me,m),Oe=o.memoizedState),(de=Ps||E0(o,d,de,m,we,Oe,ee)||!1)?(ve||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Oe,ee),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Oe,ee)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||X===r.memoizedProps&&we===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&we===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Oe),T.props=m,T.state=Oe,T.context=ee,m=de):(typeof T.componentDidUpdate!="function"||X===r.memoizedProps&&we===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||X===r.memoizedProps&&we===r.memoizedState||(o.flags|=1024),m=!1)}return Ph(r,o,d,m,k,w)}function Ph(r,o,d,m,w,k){q0(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return w&&Hx(o,d,!1),ts(r,o,k);m=o.stateNode,yR.current=o;var X=T&&typeof d.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=qo(o,r.child,null,k),o.child=qo(o,null,X,k)):an(r,o,X,k),o.memoizedState=m.state,w&&Hx(o,d,!0),o.child}function B0(r){var o=r.stateNode;o.pendingContext?Ux(r,o.pendingContext,o.pendingContext!==o.context):o.context&&Ux(r,o.context,!1),vh(r,o.containerInfo)}function z0(r,o,d,m,w){return Do(),hh(w),o.flags|=256,an(r,o,d,m),o.child}var Lh={dehydrated:null,treeContext:null,retryLane:0};function Dh(r){return{baseLanes:r,cachePool:null,transitions:null}}function U0(r,o,d){var m=o.pendingProps,w=xt.current,k=!1,T=(o.flags&128)!==0,X;if((X=T)||(X=r!==null&&r.memoizedState===null?!1:(w&2)!==0),X?(k=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(w|=1),dt(xt,w&1),r===null)return dh(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):(T=m.children,r=m.fallback,k?(m=o.mode,k=o.child,T={mode:"hidden",children:T},(m&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=T):k=su(T,m,0,null),r=Da(r,m,d,null),k.return=o,r.return=o,k.sibling=r,o.child=k,o.child.memoizedState=Dh(d),o.memoizedState=Lh,r):qh(o,T));if(w=r.memoizedState,w!==null&&(X=w.dehydrated,X!==null))return wR(r,o,T,m,X,w,d);if(k){k=m.fallback,T=o.mode,w=r.child,X=w.sibling;var ee={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==w?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Us(w,ee),m.subtreeFlags=w.subtreeFlags&14680064),X!==null?k=Us(X,k):(k=Da(k,T,d,null),k.flags|=2),k.return=o,m.return=o,m.sibling=k,o.child=m,m=k,k=o.child,T=r.child.memoizedState,T=T===null?Dh(d):{baseLanes:T.baseLanes|d,cachePool:null,transitions:T.transitions},k.memoizedState=T,k.childLanes=r.childLanes&~d,o.memoizedState=Lh,m}return k=r.child,r=k.sibling,m=Us(k,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=d),m.return=o,m.sibling=null,r!==null&&(d=o.deletions,d===null?(o.deletions=[r],o.flags|=16):d.push(r)),o.child=m,o.memoizedState=null,m}function qh(r,o){return o=su({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Hc(r,o,d,m){return m!==null&&hh(m),qo(o,r.child,null,d),r=qh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function wR(r,o,d,m,w,k,T){if(d)return o.flags&256?(o.flags&=-257,m=Ih(Error(n(422))),Hc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(k=m.fallback,w=o.mode,m=su({mode:"visible",children:m.children},w,0,null),k=Da(k,w,T,null),k.flags|=2,m.return=o,k.return=o,m.sibling=k,o.child=m,(o.mode&1)!==0&&qo(o,r.child,null,T),o.child.memoizedState=Dh(T),o.memoizedState=Lh,k);if((o.mode&1)===0)return Hc(r,o,T,null);if(w.data==="$!"){if(m=w.nextSibling&&w.nextSibling.dataset,m)var X=m.dgst;return m=X,k=Error(n(419)),m=Ih(k,m,void 0),Hc(r,o,T,m)}if(X=(T&r.childLanes)!==0,pn||X){if(m=Ft,m!==null){switch(T&-T){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&(m.suspendedLanes|T))!==0?0:w,w!==0&&w!==k.retryLane&&(k.retryLane=w,Jr(r,w),rr(m,r,w,-1))}return tf(),m=Ih(Error(n(421))),Hc(r,o,T,m)}return w.data==="$?"?(o.flags|=128,o.child=r.child,o=RR.bind(null,r),w._reactRetry=o,null):(r=k.treeContext,En=Ms(w.nextSibling),jn=o,gt=!0,Jn=null,r!==null&&(In[$n++]=Qr,In[$n++]=Zr,In[$n++]=Ta,Qr=r.id,Zr=r.overflow,Ta=o),o=qh(o,m.children),o.flags|=4096,o)}function W0(r,o,d){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),gh(r.return,o,d)}function Fh(r,o,d,m,w){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:w}:(k.isBackwards=o,k.rendering=null,k.renderingStartTime=0,k.last=m,k.tail=d,k.tailMode=w)}function H0(r,o,d){var m=o.pendingProps,w=m.revealOrder,k=m.tail;if(an(r,o,m.children,d),m=xt.current,(m&2)!==0)m=m&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&&W0(r,d,o);else if(r.tag===19)W0(r,d,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(dt(xt,m),(o.mode&1)===0)o.memoizedState=null;else switch(w){case"forwards":for(d=o.child,w=null;d!==null;)r=d.alternate,r!==null&&Dc(r)===null&&(w=d),d=d.sibling;d=w,d===null?(w=o.child,o.child=null):(w=d.sibling,d.sibling=null),Fh(o,!1,w,d,k);break;case"backwards":for(d=null,w=o.child,o.child=null;w!==null;){if(r=w.alternate,r!==null&&Dc(r)===null){o.child=w;break}r=w.sibling,w.sibling=d,d=w,w=r}Fh(o,!0,d,null,k);break;case"together":Fh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Gc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function ts(r,o,d){if(r!==null&&(o.dependencies=r.dependencies),$a|=o.lanes,(d&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,d=Us(r,r.pendingProps),o.child=d,d.return=o;r.sibling!==null;)r=r.sibling,d=d.sibling=Us(r,r.pendingProps),d.return=o;d.sibling=null}return o.child}function vR(r,o,d){switch(o.tag){case 3:B0(o),Do();break;case 5:a0(o);break;case 1:fn(o.type)&&Cc(o);break;case 4:vh(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,w=o.memoizedProps.value;dt($c,m._currentValue),m._currentValue=w;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(dt(xt,xt.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?U0(r,o,d):(dt(xt,xt.current&1),r=ts(r,o,d),r!==null?r.sibling:null);dt(xt,xt.current&1);break;case 19:if(m=(d&o.childLanes)!==0,(r.flags&128)!==0){if(m)return H0(r,o,d);o.flags|=128}if(w=o.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),dt(xt,xt.current),m)break;return null;case 22:case 23:return o.lanes=0,D0(r,o,d)}return ts(r,o,d)}var G0,Bh,V0,Y0;G0=function(r,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Bh=function(){},V0=function(r,o,d,m){var w=r.memoizedProps;if(w!==m){r=o.stateNode,Ma(_r.current);var k=null;switch(d){case"input":w=xe(r,w),m=xe(r,m),k=[];break;case"select":w=K({},w,{value:void 0}),m=K({},m,{value:void 0}),k=[];break;case"textarea":w=Ye(r,w),m=Ye(r,m),k=[];break;default:typeof w.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=Sc)}ut(d,m);var T;d=null;for(de in w)if(!m.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var X=w[de];for(T in X)X.hasOwnProperty(T)&&(d||(d={}),d[T]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?k||(k=[]):(k=k||[]).push(de,null));for(de in m){var ee=m[de];if(X=w!=null?w[de]:void 0,m.hasOwnProperty(de)&&ee!==X&&(ee!=null||X!=null))if(de==="style")if(X){for(T in X)!X.hasOwnProperty(T)||ee&&ee.hasOwnProperty(T)||(d||(d={}),d[T]="");for(T in ee)ee.hasOwnProperty(T)&&X[T]!==ee[T]&&(d||(d={}),d[T]=ee[T])}else d||(k||(k=[]),k.push(de,d)),d=ee;else de==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,X=X?X.__html:void 0,ee!=null&&X!==ee&&(k=k||[]).push(de,ee)):de==="children"?typeof ee!="string"&&typeof ee!="number"||(k=k||[]).push(de,""+ee):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(ee!=null&&de==="onScroll"&&ct("scroll",r),k||X===ee||(k=[])):(k=k||[]).push(de,ee))}d&&(k=k||[]).push("style",d);var de=k;(o.updateQueue=de)&&(o.flags|=4)}},Y0=function(r,o,d,m){d!==m&&(o.flags|=4)};function cl(r,o){if(!gt)switch(r.tailMode){case"hidden":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function tn(r){var o=r.alternate!==null&&r.alternate.child===r.child,d=0,m=0;if(o)for(var w=r.child;w!==null;)d|=w.lanes|w.childLanes,m|=w.subtreeFlags&14680064,m|=w.flags&14680064,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)d|=w.lanes|w.childLanes,m|=w.subtreeFlags,m|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=m,r.childLanes=d,o}function xR(r,o,d){var m=o.pendingProps;switch(ch(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(o),null;case 1:return fn(o.type)&&Ec(),tn(o),null;case 3:return m=o.stateNode,zo(),ft(hn),ft(Jt),kh(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Mc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Jn!==null&&(Zh(Jn),Jn=null))),Bh(r,o),tn(o),null;case 5:xh(o);var w=Ma(sl.current);if(d=o.type,r!==null&&o.stateNode!=null)V0(r,o,d,m,w),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return tn(o),null}if(r=Ma(_r.current),Mc(o)){m=o.stateNode,d=o.type;var k=o.memoizedProps;switch(m[kr]=o,m[Ji]=k,r=(o.mode&1)!==0,d){case"dialog":ct("cancel",m),ct("close",m);break;case"iframe":case"object":case"embed":ct("load",m);break;case"video":case"audio":for(w=0;w<et.length;w++)ct(et[w],m);break;case"source":ct("error",m);break;case"img":case"image":case"link":ct("error",m),ct("load",m);break;case"details":ct("toggle",m);break;case"input":ye(m,k),ct("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!k.multiple},ct("invalid",m);break;case"textarea":Ke(m,k),ct("invalid",m)}ut(d,k),w=null;for(var T in k)if(k.hasOwnProperty(T)){var X=k[T];T==="children"?typeof X=="string"?m.textContent!==X&&(k.suppressHydrationWarning!==!0&&Nc(m.textContent,X,r),w=["children",X]):typeof X=="number"&&m.textContent!==""+X&&(k.suppressHydrationWarning!==!0&&Nc(m.textContent,X,r),w=["children",""+X]):a.hasOwnProperty(T)&&X!=null&&T==="onScroll"&&ct("scroll",m)}switch(d){case"input":Ce(m),Ee(m,k,!0);break;case"textarea":Ce(m),_e(m);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(m.onclick=Sc)}m=w,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=w.nodeType===9?w:w.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Fe(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(d,{is:m.is}):(r=T.createElement(d),d==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,d),r[kr]=o,r[Ji]=m,G0(r,o,!1,!1),o.stateNode=r;e:{switch(T=Re(d,m),d){case"dialog":ct("cancel",r),ct("close",r),w=m;break;case"iframe":case"object":case"embed":ct("load",r),w=m;break;case"video":case"audio":for(w=0;w<et.length;w++)ct(et[w],r);w=m;break;case"source":ct("error",r),w=m;break;case"img":case"image":case"link":ct("error",r),ct("load",r),w=m;break;case"details":ct("toggle",r),w=m;break;case"input":ye(r,m),w=xe(r,m),ct("invalid",r);break;case"option":w=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},w=K({},m,{value:void 0}),ct("invalid",r);break;case"textarea":Ke(r,m),w=Ye(r,m),ct("invalid",r);break;default:w=m}ut(d,w),X=w;for(k in X)if(X.hasOwnProperty(k)){var ee=X[k];k==="style"?Be(r,ee):k==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&pt(r,ee)):k==="children"?typeof ee=="string"?(d!=="textarea"||ee!=="")&&se(r,ee):typeof ee=="number"&&se(r,""+ee):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(a.hasOwnProperty(k)?ee!=null&&k==="onScroll"&&ct("scroll",r):ee!=null&&E(r,k,ee,T))}switch(d){case"input":Ce(r),Ee(r,m,!1);break;case"textarea":Ce(r),_e(r);break;case"option":m.value!=null&&r.setAttribute("value",""+le(m.value));break;case"select":r.multiple=!!m.multiple,k=m.value,k!=null?re(r,!!m.multiple,k,!1):m.defaultValue!=null&&re(r,!!m.multiple,m.defaultValue,!0);break;default:typeof w.onClick=="function"&&(r.onclick=Sc)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return tn(o),null;case 6:if(r&&o.stateNode!=null)Y0(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(d=Ma(sl.current),Ma(_r.current),Mc(o)){if(m=o.stateNode,d=o.memoizedProps,m[kr]=o,(k=m.nodeValue!==d)&&(r=jn,r!==null))switch(r.tag){case 3:Nc(m.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Nc(m.nodeValue,d,(r.mode&1)!==0)}k&&(o.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[kr]=o,o.stateNode=m}return tn(o),null;case 13:if(ft(xt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&En!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Qx(),Do(),o.flags|=98560,k=!1;else if(k=Mc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!k)throw Error(n(318));if(k=o.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[kr]=o}else Do(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;tn(o),k=!1}else Jn!==null&&(Zh(Jn),Jn=null),k=!0;if(!k)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(xt.current&1)!==0?Pt===0&&(Pt=3):tf())),o.updateQueue!==null&&(o.flags|=4),tn(o),null);case 4:return zo(),Bh(r,o),r===null&&Rs(o.stateNode.containerInfo),tn(o),null;case 10:return mh(o.type._context),tn(o),null;case 17:return fn(o.type)&&Ec(),tn(o),null;case 19:if(ft(xt),k=o.memoizedState,k===null)return tn(o),null;if(m=(o.flags&128)!==0,T=k.rendering,T===null)if(m)cl(k,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Dc(r),T!==null){for(o.flags|=128,cl(k,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=d,d=o.child;d!==null;)k=d,r=m,k.flags&=14680066,T=k.alternate,T===null?(k.childLanes=0,k.lanes=r,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=T.childLanes,k.lanes=T.lanes,k.child=T.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=T.memoizedProps,k.memoizedState=T.memoizedState,k.updateQueue=T.updateQueue,k.type=T.type,r=T.dependencies,k.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return dt(xt,xt.current&1|2),o.child}r=r.sibling}k.tail!==null&<()>Go&&(o.flags|=128,m=!0,cl(k,!1),o.lanes=4194304)}else{if(!m)if(r=Dc(T),r!==null){if(o.flags|=128,m=!0,d=r.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),cl(k,!0),k.tail===null&&k.tailMode==="hidden"&&!T.alternate&&!gt)return tn(o),null}else 2*lt()-k.renderingStartTime>Go&&d!==1073741824&&(o.flags|=128,m=!0,cl(k,!1),o.lanes=4194304);k.isBackwards?(T.sibling=o.child,o.child=T):(d=k.last,d!==null?d.sibling=T:o.child=T,k.last=T)}return k.tail!==null?(o=k.tail,k.rendering=o,k.tail=o.sibling,k.renderingStartTime=lt(),o.sibling=null,d=xt.current,dt(xt,m?d&1|2:d&1),o):(tn(o),null);case 22:case 23:return ef(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Cn&1073741824)!==0&&(tn(o),o.subtreeFlags&6&&(o.flags|=8192)):tn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function bR(r,o){switch(ch(o),o.tag){case 1:return fn(o.type)&&Ec(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return zo(),ft(hn),ft(Jt),kh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return xh(o),null;case 13:if(ft(xt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Do()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return ft(xt),null;case 4:return zo(),null;case 10:return mh(o.type._context),null;case 22:case 23:return ef(),null;case 24:return null;default:return null}}var Vc=!1,nn=!1,kR=typeof WeakSet=="function"?WeakSet:Set,$e=null;function Wo(r,o){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){_t(r,o,m)}else d.current=null}function zh(r,o,d){try{d()}catch(m){_t(r,o,m)}}var K0=!1;function _R(r,o){if(eh=fo,r=Eo(),As(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var w=m.anchorOffset,k=m.focusNode;m=m.focusOffset;try{d.nodeType,k.nodeType}catch{d=null;break e}var T=0,X=-1,ee=-1,de=0,ve=0,be=r,we=null;t:for(;;){for(var Me;be!==d||w!==0&&be.nodeType!==3||(X=T+w),be!==k||m!==0&&be.nodeType!==3||(ee=T+m),be.nodeType===3&&(T+=be.nodeValue.length),(Me=be.firstChild)!==null;)we=be,be=Me;for(;;){if(be===r)break t;if(we===d&&++de===w&&(X=T),we===k&&++ve===m&&(ee=T),(Me=be.nextSibling)!==null)break;be=we,we=be.parentNode}be=Me}d=X===-1||ee===-1?null:{start:X,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(th={focusedElem:r,selectionRange:d},fo=!1,$e=o;$e!==null;)if(o=$e,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,$e=r;else for(;$e!==null;){o=$e;try{var Oe=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var Pe=Oe.memoizedProps,jt=Oe.memoizedState,oe=o.stateNode,ne=oe.getSnapshotBeforeUpdate(o.elementType===o.type?Pe:er(o.type,Pe),jt);oe.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ce=o.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){_t(o,o.return,Ne)}if(r=o.sibling,r!==null){r.return=o.return,$e=r;break}$e=o.return}return Oe=K0,K0=!1,Oe}function ul(r,o,d){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var w=m=m.next;do{if((w.tag&r)===r){var k=w.destroy;w.destroy=void 0,k!==void 0&&zh(o,d,k)}w=w.next}while(w!==m)}}function Yc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&r)===r){var m=d.create;d.destroy=m()}d=d.next}while(d!==o)}}function Uh(r){var o=r.ref;if(o!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof o=="function"?o(r):o.current=r}}function X0(r){var o=r.alternate;o!==null&&(r.alternate=null,X0(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[kr],delete o[Ji],delete o[ah],delete o[aR],delete o[oR])),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 Q0(r){return r.tag===5||r.tag===3||r.tag===4}function Z0(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Q0(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 Wh(r,o,d){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(r,o):d.insertBefore(r,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(r,d)):(o=d,o.appendChild(r)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Sc));else if(m!==4&&(r=r.child,r!==null))for(Wh(r,o,d),r=r.sibling;r!==null;)Wh(r,o,d),r=r.sibling}function Hh(r,o,d){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?d.insertBefore(r,o):d.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(Hh(r,o,d),r=r.sibling;r!==null;)Hh(r,o,d),r=r.sibling}var Ht=null,tr=!1;function Ds(r,o,d){for(d=d.child;d!==null;)J0(r,o,d),d=d.sibling}function J0(r,o,d){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(Or,d)}catch{}switch(d.tag){case 5:nn||Wo(d,o);case 6:var m=Ht,w=tr;Ht=null,Ds(r,o,d),Ht=m,tr=w,Ht!==null&&(tr?(r=Ht,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):Ht.removeChild(d.stateNode));break;case 18:Ht!==null&&(tr?(r=Ht,d=d.stateNode,r.nodeType===8?sh(r.parentNode,d):r.nodeType===1&&sh(r,d),wa(r)):sh(Ht,d.stateNode));break;case 4:m=Ht,w=tr,Ht=d.stateNode.containerInfo,tr=!0,Ds(r,o,d),Ht=m,tr=w;break;case 0:case 11:case 14:case 15:if(!nn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){w=m=m.next;do{var k=w,T=k.destroy;k=k.tag,T!==void 0&&((k&2)!==0||(k&4)!==0)&&zh(d,o,T),w=w.next}while(w!==m)}Ds(r,o,d);break;case 1:if(!nn&&(Wo(d,o),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(X){_t(d,o,X)}Ds(r,o,d);break;case 21:Ds(r,o,d);break;case 22:d.mode&1?(nn=(m=nn)||d.memoizedState!==null,Ds(r,o,d),nn=m):Ds(r,o,d);break;default:Ds(r,o,d)}}function eb(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new kR),o.forEach(function(m){var w=MR.bind(null,r,m);d.has(m)||(d.add(m),m.then(w,w))})}}function nr(r,o){var d=o.deletions;if(d!==null)for(var m=0;m<d.length;m++){var w=d[m];try{var k=r,T=o,X=T;e:for(;X!==null;){switch(X.tag){case 5:Ht=X.stateNode,tr=!1;break e;case 3:Ht=X.stateNode.containerInfo,tr=!0;break e;case 4:Ht=X.stateNode.containerInfo,tr=!0;break e}X=X.return}if(Ht===null)throw Error(n(160));J0(k,T,w),Ht=null,tr=!1;var ee=w.alternate;ee!==null&&(ee.return=null),w.return=null}catch(de){_t(w,o,de)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)tb(o,r),o=o.sibling}function tb(r,o){var d=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(nr(o,r),Sr(r),m&4){try{ul(3,r,r.return),Yc(3,r)}catch(Pe){_t(r,r.return,Pe)}try{ul(5,r,r.return)}catch(Pe){_t(r,r.return,Pe)}}break;case 1:nr(o,r),Sr(r),m&512&&d!==null&&Wo(d,d.return);break;case 5:if(nr(o,r),Sr(r),m&512&&d!==null&&Wo(d,d.return),r.flags&32){var w=r.stateNode;try{se(w,"")}catch(Pe){_t(r,r.return,Pe)}}if(m&4&&(w=r.stateNode,w!=null)){var k=r.memoizedProps,T=d!==null?d.memoizedProps:k,X=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{X==="input"&&k.type==="radio"&&k.name!=null&&De(w,k),Re(X,T);var de=Re(X,k);for(T=0;T<ee.length;T+=2){var ve=ee[T],be=ee[T+1];ve==="style"?Be(w,be):ve==="dangerouslySetInnerHTML"?pt(w,be):ve==="children"?se(w,be):E(w,ve,be,de)}switch(X){case"input":ke(w,k);break;case"textarea":ge(w,k);break;case"select":var we=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!k.multiple;var Me=k.value;Me!=null?re(w,!!k.multiple,Me,!1):we!==!!k.multiple&&(k.defaultValue!=null?re(w,!!k.multiple,k.defaultValue,!0):re(w,!!k.multiple,k.multiple?[]:"",!1))}w[Ji]=k}catch(Pe){_t(r,r.return,Pe)}}break;case 6:if(nr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));w=r.stateNode,k=r.memoizedProps;try{w.nodeValue=k}catch(Pe){_t(r,r.return,Pe)}}break;case 3:if(nr(o,r),Sr(r),m&4&&d!==null&&d.memoizedState.isDehydrated)try{wa(o.containerInfo)}catch(Pe){_t(r,r.return,Pe)}break;case 4:nr(o,r),Sr(r);break;case 13:nr(o,r),Sr(r),w=r.child,w.flags&8192&&(k=w.memoizedState!==null,w.stateNode.isHidden=k,!k||w.alternate!==null&&w.alternate.memoizedState!==null||(Yh=lt())),m&4&&eb(r);break;case 22:if(ve=d!==null&&d.memoizedState!==null,r.mode&1?(nn=(de=nn)||ve,nr(o,r),nn=de):nr(o,r),Sr(r),m&8192){if(de=r.memoizedState!==null,(r.stateNode.isHidden=de)&&!ve&&(r.mode&1)!==0)for($e=r,ve=r.child;ve!==null;){for(be=$e=ve;$e!==null;){switch(we=$e,Me=we.child,we.tag){case 0:case 11:case 14:case 15:ul(4,we,we.return);break;case 1:Wo(we,we.return);var Oe=we.stateNode;if(typeof Oe.componentWillUnmount=="function"){m=we,d=we.return;try{o=m,Oe.props=o.memoizedProps,Oe.state=o.memoizedState,Oe.componentWillUnmount()}catch(Pe){_t(m,d,Pe)}}break;case 5:Wo(we,we.return);break;case 22:if(we.memoizedState!==null){sb(be);continue}}Me!==null?(Me.return=we,$e=Me):sb(be)}ve=ve.sibling}e:for(ve=null,be=r;;){if(be.tag===5){if(ve===null){ve=be;try{w=be.stateNode,de?(k=w.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(X=be.stateNode,ee=be.memoizedProps.style,T=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,X.style.display=Te("display",T))}catch(Pe){_t(r,r.return,Pe)}}}else if(be.tag===6){if(ve===null)try{be.stateNode.nodeValue=de?"":be.memoizedProps}catch(Pe){_t(r,r.return,Pe)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===r)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===r)break e;for(;be.sibling===null;){if(be.return===null||be.return===r)break e;ve===be&&(ve=null),be=be.return}ve===be&&(ve=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:nr(o,r),Sr(r),m&4&&eb(r);break;case 21:break;default:nr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var d=r.return;d!==null;){if(Q0(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var w=m.stateNode;m.flags&32&&(se(w,""),m.flags&=-33);var k=Z0(r);Hh(r,k,w);break;case 3:case 4:var T=m.stateNode.containerInfo,X=Z0(r);Wh(r,X,T);break;default:throw Error(n(161))}}catch(ee){_t(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function NR(r,o,d){$e=r,nb(r)}function nb(r,o,d){for(var m=(r.mode&1)!==0;$e!==null;){var w=$e,k=w.child;if(w.tag===22&&m){var T=w.memoizedState!==null||Vc;if(!T){var X=w.alternate,ee=X!==null&&X.memoizedState!==null||nn;X=Vc;var de=nn;if(Vc=T,(nn=ee)&&!de)for($e=w;$e!==null;)T=$e,ee=T.child,T.tag===22&&T.memoizedState!==null?ab(w):ee!==null?(ee.return=T,$e=ee):ab(w);for(;k!==null;)$e=k,nb(k),k=k.sibling;$e=w,Vc=X,nn=de}rb(r)}else(w.subtreeFlags&8772)!==0&&k!==null?(k.return=w,$e=k):rb(r)}}function rb(r){for(;$e!==null;){var o=$e;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:nn||Yc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!nn)if(d===null)m.componentDidMount();else{var w=o.elementType===o.type?d.memoizedProps:er(o.type,d.memoizedProps);m.componentDidUpdate(w,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var k=o.updateQueue;k!==null&&s0(o,k,m);break;case 3:var T=o.updateQueue;if(T!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}s0(o,T,d)}break;case 5:var X=o.stateNode;if(d===null&&o.flags&4){d=X;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&d.focus();break;case"img":ee.src&&(d.src=ee.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 ve=de.memoizedState;if(ve!==null){var be=ve.dehydrated;be!==null&&wa(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}nn||o.flags&512&&Uh(o)}catch(we){_t(o,o.return,we)}}if(o===r){$e=null;break}if(d=o.sibling,d!==null){d.return=o.return,$e=d;break}$e=o.return}}function sb(r){for(;$e!==null;){var o=$e;if(o===r){$e=null;break}var d=o.sibling;if(d!==null){d.return=o.return,$e=d;break}$e=o.return}}function ab(r){for(;$e!==null;){var o=$e;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Yc(4,o)}catch(ee){_t(o,d,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var w=o.return;try{m.componentDidMount()}catch(ee){_t(o,w,ee)}}var k=o.return;try{Uh(o)}catch(ee){_t(o,k,ee)}break;case 5:var T=o.return;try{Uh(o)}catch(ee){_t(o,T,ee)}}}catch(ee){_t(o,o.return,ee)}if(o===r){$e=null;break}var X=o.sibling;if(X!==null){X.return=o.return,$e=X;break}$e=o.return}}var SR=Math.ceil,Kc=C.ReactCurrentDispatcher,Gh=C.ReactCurrentOwner,Ln=C.ReactCurrentBatchConfig,tt=0,Ft=null,Ct=null,Gt=0,Cn=0,Ho=Is(0),Pt=0,dl=null,$a=0,Xc=0,Vh=0,hl=null,mn=null,Yh=0,Go=1/0,ns=null,Qc=!1,Kh=null,qs=null,Zc=!1,Fs=null,Jc=0,fl=0,Xh=null,eu=-1,tu=0;function on(){return(tt&6)!==0?lt():eu!==-1?eu:eu=lt()}function Bs(r){return(r.mode&1)===0?1:(tt&2)!==0&&Gt!==0?Gt&-Gt:lR.transition!==null?(tu===0&&(tu=fa()),tu):(r=st,r!==0||(r=window.event,r=r===void 0?16:dc(r.type)),r)}function rr(r,o,d,m){if(50<fl)throw fl=0,Xh=null,Error(n(185));pa(r,d,m),((tt&2)===0||r!==Ft)&&(r===Ft&&((tt&2)===0&&(Xc|=d),Pt===4&&zs(r,Gt)),gn(r,m),d===1&&tt===0&&(o.mode&1)===0&&(Go=lt()+500,Tc&&Os()))}function gn(r,o){var d=r.callbackNode;Fd(r,o);var m=hs(r,r===Ft?Gt:0);if(m===0)d!==null&&Ir(d),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(d!=null&&Ir(d),o===1)r.tag===0?iR(ib.bind(null,r)):Gx(ib.bind(null,r)),rR(function(){(tt&6)===0&&Os()}),d=null;else{switch(lc(m)){case 1:d=yr;break;case 4:d=ca;break;case 16:d=$r;break;case 536870912:d=io;break;default:d=$r}d=mb(d,ob.bind(null,r))}r.callbackPriority=o,r.callbackNode=d}}function ob(r,o){if(eu=-1,tu=0,(tt&6)!==0)throw Error(n(327));var d=r.callbackNode;if(Vo()&&r.callbackNode!==d)return null;var m=hs(r,r===Ft?Gt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=nu(r,m);else{o=m;var w=tt;tt|=2;var k=cb();(Ft!==r||Gt!==o)&&(ns=null,Go=lt()+500,Pa(r,o));do try{CR();break}catch(X){lb(r,X)}while(!0);ph(),Kc.current=k,tt=w,Ct!==null?o=0:(Ft=null,Gt=0,o=Pt)}if(o!==0){if(o===2&&(w=bn(r),w!==0&&(m=w,o=Qh(r,w))),o===1)throw d=dl,Pa(r,0),zs(r,m),gn(r,lt()),d;if(o===6)zs(r,m);else{if(w=r.current.alternate,(m&30)===0&&!jR(w)&&(o=nu(r,m),o===2&&(k=bn(r),k!==0&&(m=k,o=Qh(r,k))),o===1))throw d=dl,Pa(r,0),zs(r,m),gn(r,lt()),d;switch(r.finishedWork=w,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:La(r,mn,ns);break;case 3:if(zs(r,m),(m&130023424)===m&&(o=Yh+500-lt(),10<o)){if(hs(r,0)!==0)break;if(w=r.suspendedLanes,(w&m)!==m){on(),r.pingedLanes|=r.suspendedLanes&w;break}r.timeoutHandle=rh(La.bind(null,r,mn,ns),o);break}La(r,mn,ns);break;case 4:if(zs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,w=-1;0<m;){var T=31-cn(m);k=1<<T,T=o[T],T>w&&(w=T),m&=~k}if(m=w,m=lt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*SR(m/1960))-m,10<m){r.timeoutHandle=rh(La.bind(null,r,mn,ns),m);break}La(r,mn,ns);break;case 5:La(r,mn,ns);break;default:throw Error(n(329))}}}return gn(r,lt()),r.callbackNode===d?ob.bind(null,r):null}function Qh(r,o){var d=hl;return r.current.memoizedState.isDehydrated&&(Pa(r,o).flags|=256),r=nu(r,o),r!==2&&(o=mn,mn=d,o!==null&&Zh(o)),r}function Zh(r){mn===null?mn=r:mn.push.apply(mn,r)}function jR(r){for(var o=r;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var w=d[m],k=w.getSnapshot;w=w.value;try{if(!Sn(k(),w))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function zs(r,o){for(o&=~Vh,o&=~Xc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var d=31-cn(o),m=1<<d;r[d]=-1,o&=~m}}function ib(r){if((tt&6)!==0)throw Error(n(327));Vo();var o=hs(r,0);if((o&1)===0)return gn(r,lt()),null;var d=nu(r,o);if(r.tag!==0&&d===2){var m=bn(r);m!==0&&(o=m,d=Qh(r,m))}if(d===1)throw d=dl,Pa(r,0),zs(r,o),gn(r,lt()),d;if(d===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,La(r,mn,ns),gn(r,lt()),null}function Jh(r,o){var d=tt;tt|=1;try{return r(o)}finally{tt=d,tt===0&&(Go=lt()+500,Tc&&Os())}}function Oa(r){Fs!==null&&Fs.tag===0&&(tt&6)===0&&Vo();var o=tt;tt|=1;var d=Ln.transition,m=st;try{if(Ln.transition=null,st=1,r)return r()}finally{st=m,Ln.transition=d,tt=o,(tt&6)===0&&Os()}}function ef(){Cn=Ho.current,ft(Ho)}function Pa(r,o){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,nR(d)),Ct!==null)for(d=Ct.return;d!==null;){var m=d;switch(ch(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Ec();break;case 3:zo(),ft(hn),ft(Jt),kh();break;case 5:xh(m);break;case 4:zo();break;case 13:ft(xt);break;case 19:ft(xt);break;case 10:mh(m.type._context);break;case 22:case 23:ef()}d=d.return}if(Ft=r,Ct=r=Us(r.current,null),Gt=Cn=o,Pt=0,dl=null,Vh=Xc=$a=0,mn=hl=null,Ra!==null){for(o=0;o<Ra.length;o++)if(d=Ra[o],m=d.interleaved,m!==null){d.interleaved=null;var w=m.next,k=d.pending;if(k!==null){var T=k.next;k.next=w,m.next=T}d.pending=m}Ra=null}return r}function lb(r,o){do{var d=Ct;try{if(ph(),qc.current=Uc,Fc){for(var m=bt.memoizedState;m!==null;){var w=m.queue;w!==null&&(w.pending=null),m=m.next}Fc=!1}if(Ia=0,qt=Ot=bt=null,al=!1,ol=0,Gh.current=null,d===null||d.return===null){Pt=1,dl=o,Ct=null;break}e:{var k=r,T=d.return,X=d,ee=o;if(o=Gt,X.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var de=ee,ve=X,be=ve.tag;if((ve.mode&1)===0&&(be===0||be===11||be===15)){var we=ve.alternate;we?(ve.updateQueue=we.updateQueue,ve.memoizedState=we.memoizedState,ve.lanes=we.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Me=I0(T);if(Me!==null){Me.flags&=-257,$0(Me,T,X,k,o),Me.mode&1&&M0(k,de,o),o=Me,ee=de;var Oe=o.updateQueue;if(Oe===null){var Pe=new Set;Pe.add(ee),o.updateQueue=Pe}else Oe.add(ee);break e}else{if((o&1)===0){M0(k,de,o),tf();break e}ee=Error(n(426))}}else if(gt&&X.mode&1){var jt=I0(T);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),$0(jt,T,X,k,o),hh(Uo(ee,X));break e}}k=ee=Uo(ee,X),Pt!==4&&(Pt=2),hl===null?hl=[k]:hl.push(k),k=T;do{switch(k.tag){case 3:k.flags|=65536,o&=-o,k.lanes|=o;var oe=A0(k,ee,o);r0(k,oe);break e;case 1:X=ee;var ne=k.type,ce=k.stateNode;if((k.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(qs===null||!qs.has(ce)))){k.flags|=65536,o&=-o,k.lanes|=o;var Ne=R0(k,X,o);r0(k,Ne);break e}}k=k.return}while(k!==null)}db(d)}catch(Le){o=Le,Ct===d&&d!==null&&(Ct=d=d.return);continue}break}while(!0)}function cb(){var r=Kc.current;return Kc.current=Uc,r===null?Uc:r}function tf(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Ft===null||($a&268435455)===0&&(Xc&268435455)===0||zs(Ft,Gt)}function nu(r,o){var d=tt;tt|=2;var m=cb();(Ft!==r||Gt!==o)&&(ns=null,Pa(r,o));do try{ER();break}catch(w){lb(r,w)}while(!0);if(ph(),tt=d,Kc.current=m,Ct!==null)throw Error(n(261));return Ft=null,Gt=0,Pt}function ER(){for(;Ct!==null;)ub(Ct)}function CR(){for(;Ct!==null&&!la();)ub(Ct)}function ub(r){var o=pb(r.alternate,r,Cn);r.memoizedProps=r.pendingProps,o===null?db(r):Ct=o,Gh.current=null}function db(r){var o=r;do{var d=o.alternate;if(r=o.return,(o.flags&32768)===0){if(d=xR(d,o,Cn),d!==null){Ct=d;return}}else{if(d=bR(d,o),d!==null){d.flags&=32767,Ct=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,Ct=null;return}}if(o=o.sibling,o!==null){Ct=o;return}Ct=o=r}while(o!==null);Pt===0&&(Pt=5)}function La(r,o,d){var m=st,w=Ln.transition;try{Ln.transition=null,st=1,TR(r,o,d,m)}finally{Ln.transition=w,st=m}return null}function TR(r,o,d,m){do Vo();while(Fs!==null);if((tt&6)!==0)throw Error(n(327));d=r.finishedWork;var w=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var k=d.lanes|d.childLanes;if(wr(r,k),r===Ft&&(Ct=Ft=null,Gt=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Zc||(Zc=!0,mb($r,function(){return Vo(),null})),k=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||k){k=Ln.transition,Ln.transition=null;var T=st;st=1;var X=tt;tt|=4,Gh.current=null,_R(r,d),tb(d,r),Hi(th),fo=!!eh,th=eh=null,r.current=d,NR(d),Ci(),tt=X,st=T,Ln.transition=k}else r.current=d;if(Zc&&(Zc=!1,Fs=r,Jc=w),k=r.pendingLanes,k===0&&(qs=null),ua(d.stateNode),gn(r,lt()),o!==null)for(m=r.onRecoverableError,d=0;d<o.length;d++)w=o[d],m(w.value,{componentStack:w.stack,digest:w.digest});if(Qc)throw Qc=!1,r=Kh,Kh=null,r;return(Jc&1)!==0&&r.tag!==0&&Vo(),k=r.pendingLanes,(k&1)!==0?r===Xh?fl++:(fl=0,Xh=r):fl=0,Os(),null}function Vo(){if(Fs!==null){var r=lc(Jc),o=Ln.transition,d=st;try{if(Ln.transition=null,st=16>r?16:r,Fs===null)var m=!1;else{if(r=Fs,Fs=null,Jc=0,(tt&6)!==0)throw Error(n(331));var w=tt;for(tt|=4,$e=r.current;$e!==null;){var k=$e,T=k.child;if(($e.flags&16)!==0){var X=k.deletions;if(X!==null){for(var ee=0;ee<X.length;ee++){var de=X[ee];for($e=de;$e!==null;){var ve=$e;switch(ve.tag){case 0:case 11:case 15:ul(8,ve,k)}var be=ve.child;if(be!==null)be.return=ve,$e=be;else for(;$e!==null;){ve=$e;var we=ve.sibling,Me=ve.return;if(X0(ve),ve===de){$e=null;break}if(we!==null){we.return=Me,$e=we;break}$e=Me}}}var Oe=k.alternate;if(Oe!==null){var Pe=Oe.child;if(Pe!==null){Oe.child=null;do{var jt=Pe.sibling;Pe.sibling=null,Pe=jt}while(Pe!==null)}}$e=k}}if((k.subtreeFlags&2064)!==0&&T!==null)T.return=k,$e=T;else e:for(;$e!==null;){if(k=$e,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:ul(9,k,k.return)}var oe=k.sibling;if(oe!==null){oe.return=k.return,$e=oe;break e}$e=k.return}}var ne=r.current;for($e=ne;$e!==null;){T=$e;var ce=T.child;if((T.subtreeFlags&2064)!==0&&ce!==null)ce.return=T,$e=ce;else e:for(T=ne;$e!==null;){if(X=$e,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Yc(9,X)}}catch(Le){_t(X,X.return,Le)}if(X===T){$e=null;break e}var Ne=X.sibling;if(Ne!==null){Ne.return=X.return,$e=Ne;break e}$e=X.return}}if(tt=w,Os(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(Or,r)}catch{}m=!0}return m}finally{st=d,Ln.transition=o}}return!1}function hb(r,o,d){o=Uo(d,o),o=A0(r,o,1),r=Ls(r,o,1),o=on(),r!==null&&(pa(r,1,o),gn(r,o))}function _t(r,o,d){if(r.tag===3)hb(r,r,d);else for(;o!==null;){if(o.tag===3){hb(o,r,d);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(qs===null||!qs.has(m))){r=Uo(d,r),r=R0(o,r,1),o=Ls(o,r,1),r=on(),o!==null&&(pa(o,1,r),gn(o,r));break}}o=o.return}}function AR(r,o,d){var m=r.pingCache;m!==null&&m.delete(o),o=on(),r.pingedLanes|=r.suspendedLanes&d,Ft===r&&(Gt&d)===d&&(Pt===4||Pt===3&&(Gt&130023424)===Gt&&500>lt()-Yh?Pa(r,0):Vh|=d),gn(r,o)}function fb(r,o){o===0&&((r.mode&1)===0?o=1:(o=Pr,Pr<<=1,(Pr&130023424)===0&&(Pr=4194304)));var d=on();r=Jr(r,o),r!==null&&(pa(r,o,d),gn(r,d))}function RR(r){var o=r.memoizedState,d=0;o!==null&&(d=o.retryLane),fb(r,d)}function MR(r,o){var d=0;switch(r.tag){case 13:var m=r.stateNode,w=r.memoizedState;w!==null&&(d=w.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),fb(r,d)}var pb;pb=function(r,o,d){if(r!==null)if(r.memoizedProps!==o.pendingProps||hn.current)pn=!0;else{if((r.lanes&d)===0&&(o.flags&128)===0)return pn=!1,vR(r,o,d);pn=(r.flags&131072)!==0}else pn=!1,gt&&(o.flags&1048576)!==0&&Vx(o,Rc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Gc(r,o),r=o.pendingProps;var w=Oo(o,Jt.current);Bo(o,d),w=Sh(null,o,m,r,w,d);var k=jh();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,fn(m)?(k=!0,Cc(o)):k=!1,o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,wh(o),w.updater=Wc,o.stateNode=w,w._reactInternals=o,Mh(o,m,r,d),o=Ph(null,o,m,!0,k,d)):(o.tag=0,gt&&k&&lh(o),an(null,o,w,d),o=o.child),o;case 16:m=o.elementType;e:{switch(Gc(r,o),r=o.pendingProps,w=m._init,m=w(m._payload),o.type=m,w=o.tag=$R(m),r=er(m,r),w){case 0:o=Oh(null,o,m,r,d);break e;case 1:o=F0(null,o,m,r,d);break e;case 11:o=O0(null,o,m,r,d);break e;case 14:o=P0(null,o,m,er(m.type,r),d);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:er(m,w),Oh(r,o,m,w,d);case 1:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:er(m,w),F0(r,o,m,w,d);case 3:e:{if(B0(o),r===null)throw Error(n(387));m=o.pendingProps,k=o.memoizedState,w=k.element,n0(r,o),Lc(o,m,null,d);var T=o.memoizedState;if(m=T.element,k.isDehydrated)if(k={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=k,o.memoizedState=k,o.flags&256){w=Uo(Error(n(423)),o),o=z0(r,o,m,d,w);break e}else if(m!==w){w=Uo(Error(n(424)),o),o=z0(r,o,m,d,w);break e}else for(En=Ms(o.stateNode.containerInfo.firstChild),jn=o,gt=!0,Jn=null,d=e0(o,null,m,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Do(),m===w){o=ts(r,o,d);break e}an(r,o,m,d)}o=o.child}return o;case 5:return a0(o),r===null&&dh(o),m=o.type,w=o.pendingProps,k=r!==null?r.memoizedProps:null,T=w.children,nh(m,w)?T=null:k!==null&&nh(m,k)&&(o.flags|=32),q0(r,o),an(r,o,T,d),o.child;case 6:return r===null&&dh(o),null;case 13:return U0(r,o,d);case 4:return vh(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=qo(o,null,m,d):an(r,o,m,d),o.child;case 11:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:er(m,w),O0(r,o,m,w,d);case 7:return an(r,o,o.pendingProps,d),o.child;case 8:return an(r,o,o.pendingProps.children,d),o.child;case 12:return an(r,o,o.pendingProps.children,d),o.child;case 10:e:{if(m=o.type._context,w=o.pendingProps,k=o.memoizedProps,T=w.value,dt($c,m._currentValue),m._currentValue=T,k!==null)if(Sn(k.value,T)){if(k.children===w.children&&!hn.current){o=ts(r,o,d);break e}}else for(k=o.child,k!==null&&(k.return=o);k!==null;){var X=k.dependencies;if(X!==null){T=k.child;for(var ee=X.firstContext;ee!==null;){if(ee.context===m){if(k.tag===1){ee=es(-1,d&-d),ee.tag=2;var de=k.updateQueue;if(de!==null){de=de.shared;var ve=de.pending;ve===null?ee.next=ee:(ee.next=ve.next,ve.next=ee),de.pending=ee}}k.lanes|=d,ee=k.alternate,ee!==null&&(ee.lanes|=d),gh(k.return,d,o),X.lanes|=d;break}ee=ee.next}}else if(k.tag===10)T=k.type===o.type?null:k.child;else if(k.tag===18){if(T=k.return,T===null)throw Error(n(341));T.lanes|=d,X=T.alternate,X!==null&&(X.lanes|=d),gh(T,d,o),T=k.sibling}else T=k.child;if(T!==null)T.return=k;else for(T=k;T!==null;){if(T===o){T=null;break}if(k=T.sibling,k!==null){k.return=T.return,T=k;break}T=T.return}k=T}an(r,o,w.children,d),o=o.child}return o;case 9:return w=o.type,m=o.pendingProps.children,Bo(o,d),w=On(w),m=m(w),o.flags|=1,an(r,o,m,d),o.child;case 14:return m=o.type,w=er(m,o.pendingProps),w=er(m.type,w),P0(r,o,m,w,d);case 15:return L0(r,o,o.type,o.pendingProps,d);case 17:return m=o.type,w=o.pendingProps,w=o.elementType===m?w:er(m,w),Gc(r,o),o.tag=1,fn(m)?(r=!0,Cc(o)):r=!1,Bo(o,d),C0(o,m,w),Mh(o,m,w,d),Ph(null,o,m,!0,r,d);case 19:return H0(r,o,d);case 22:return D0(r,o,d)}throw Error(n(156,o.tag))};function mb(r,o){return ao(r,o)}function IR(r,o,d,m){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(r,o,d,m){return new IR(r,o,d,m)}function nf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function $R(r){if(typeof r=="function")return nf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===Y)return 11;if(r===Q)return 14}return 2}function Us(r,o){var d=r.alternate;return d===null?(d=Dn(r.tag,o,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=o,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,o=r.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function ru(r,o,d,m,w,k){var T=2;if(m=r,typeof r=="function")nf(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case $:return Da(d.children,w,k,o);case B:T=8,w|=8;break;case O:return r=Dn(12,d,o,w|2),r.elementType=O,r.lanes=k,r;case D:return r=Dn(13,d,o,w),r.elementType=D,r.lanes=k,r;case A:return r=Dn(19,d,o,w),r.elementType=A,r.lanes=k,r;case te:return su(d,w,k,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case M:T=10;break e;case L:T=9;break e;case Y:T=11;break e;case Q:T=14;break e;case z:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Dn(T,d,o,w),o.elementType=r,o.type=m,o.lanes=k,o}function Da(r,o,d,m){return r=Dn(7,r,m,o),r.lanes=d,r}function su(r,o,d,m){return r=Dn(22,r,m,o),r.elementType=te,r.lanes=d,r.stateNode={isHidden:!1},r}function rf(r,o,d){return r=Dn(6,r,null,o),r.lanes=d,r}function sf(r,o,d){return o=Dn(4,r.children!==null?r.children:[],r.key,o),o.lanes=d,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function OR(r,o,d,m,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=lo(0),this.expirationTimes=lo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lo(0),this.identifierPrefix=m,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function af(r,o,d,m,w,k,T,X,ee){return r=new OR(r,o,d,X,ee),o===1?(o=1,k===!0&&(o|=8)):o=0,k=Dn(3,null,null,o),r.current=k,k.stateNode=r,k.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},wh(k),r}function PR(r,o,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:m==null?null:""+m,children:r,containerInfo:o,implementation:d}}function gb(r){if(!r)return $s;r=r._reactInternals;e:{if(xn(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(fn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var d=r.type;if(fn(d))return Wx(r,d,o)}return o}function yb(r,o,d,m,w,k,T,X,ee){return r=af(d,m,!0,r,w,k,T,X,ee),r.context=gb(null),d=r.current,m=on(),w=Bs(d),k=es(m,w),k.callback=o??null,Ls(d,k,w),r.current.lanes=w,pa(r,w,m),gn(r,m),r}function au(r,o,d,m){var w=o.current,k=on(),T=Bs(w);return d=gb(d),o.context===null?o.context=d:o.pendingContext=d,o=es(k,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=Ls(w,o,T),r!==null&&(rr(r,w,T,k),Pc(r,w,T)),T}function ou(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 wb(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<o?d:o}}function of(r,o){wb(r,o),(r=r.alternate)&&wb(r,o)}function LR(){return null}var vb=typeof reportError=="function"?reportError:function(r){console.error(r)};function lf(r){this._internalRoot=r}iu.prototype.render=lf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));au(r,o,null,null)},iu.prototype.unmount=lf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Oa(function(){au(null,r,null,null)}),o[Kr]=null}};function iu(r){this._internalRoot=r}iu.prototype.unstable_scheduleHydration=function(r){if(r){var o=Ai();r={blockedOn:null,target:r,priority:o};for(var d=0;d<kn.length&&o!==0&&o<kn[d].priority;d++);kn.splice(d,0,r),d===0&&Mi(r)}};function cf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function lu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function xb(){}function DR(r,o,d,m,w){if(w){if(typeof m=="function"){var k=m;m=function(){var de=ou(T);k.call(de)}}var T=yb(o,m,r,0,null,!1,!1,"",xb);return r._reactRootContainer=T,r[Kr]=T.current,Rs(r.nodeType===8?r.parentNode:r),Oa(),T}for(;w=r.lastChild;)r.removeChild(w);if(typeof m=="function"){var X=m;m=function(){var de=ou(ee);X.call(de)}}var ee=af(r,0,!1,null,null,!1,!1,"",xb);return r._reactRootContainer=ee,r[Kr]=ee.current,Rs(r.nodeType===8?r.parentNode:r),Oa(function(){au(o,ee,d,m)}),ee}function cu(r,o,d,m,w){var k=d._reactRootContainer;if(k){var T=k;if(typeof w=="function"){var X=w;w=function(){var ee=ou(T);X.call(ee)}}au(o,T,r,w)}else T=DR(d,o,r,w,m);return ou(T)}Ti=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var d=ha(o.pendingLanes);d!==0&&(fs(o,d|1),gn(o,lt()),(tt&6)===0&&(Go=lt()+500,Os()))}break;case 13:Oa(function(){var m=Jr(r,1);if(m!==null){var w=on();rr(m,r,1,w)}}),of(r,1)}},co=function(r){if(r.tag===13){var o=Jr(r,134217728);if(o!==null){var d=on();rr(o,r,134217728,d)}of(r,134217728)}},Lr=function(r){if(r.tag===13){var o=Bs(r),d=Jr(r,o);if(d!==null){var m=on();rr(d,r,o,m)}of(r,o)}},Ai=function(){return st},Ri=function(r,o){var d=st;try{return st=r,o()}finally{st=d}},St=function(r,o,d){switch(o){case"input":if(ke(r,d),o=d.name,d.type==="radio"&&o!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var m=d[o];if(m!==r&&m.form===r.form){var w=jc(m);if(!w)throw Error(n(90));Ue(m),ke(m,w)}}}break;case"textarea":ge(r,d);break;case"select":o=d.value,o!=null&&re(r,!!d.multiple,o,!1)}},Za=Jh,Ja=Oa;var qR={usingClientEntryPoint:!1,Events:[el,Io,jc,Rr,mr,Jh]},pl={findFiberByHostInstance:Ea,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},FR={bundleType:pl.bundleType,version:pl.version,rendererPackageName:pl.rendererPackageName,rendererConfig:pl.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=so(r),r===null?null:r.stateNode},findFiberByHostInstance:pl.findFiberByHostInstance||LR,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 uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Or=uu.inject(FR),sn=uu}catch{}}return yn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qR,yn.createPortal=function(r,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cf(o))throw Error(n(200));return PR(r,o,null,d)},yn.createRoot=function(r,o){if(!cf(r))throw Error(n(299));var d=!1,m="",w=vb;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),o=af(r,1,!1,null,null,d,!1,m,w),r[Kr]=o.current,Rs(r.nodeType===8?r.parentNode:r),new lf(o)},yn.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=so(o),r=r===null?null:r.stateNode,r},yn.flushSync=function(r){return Oa(r)},yn.hydrate=function(r,o,d){if(!lu(o))throw Error(n(200));return cu(null,r,o,!0,d)},yn.hydrateRoot=function(r,o,d){if(!cf(r))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,w=!1,k="",T=vb;if(d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(k=d.identifierPrefix),d.onRecoverableError!==void 0&&(T=d.onRecoverableError)),o=yb(o,null,r,1,d??null,w,!1,k,T),r[Kr]=o.current,Rs(r),m)for(r=0;r<m.length;r++)d=m[r],w=d._getVersion,w=w(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,w]:o.mutableSourceEagerHydrationData.push(d,w);return new iu(o)},yn.render=function(r,o,d){if(!lu(o))throw Error(n(200));return cu(null,r,o,!1,d)},yn.unmountComponentAtNode=function(r){if(!lu(r))throw Error(n(40));return r._reactRootContainer?(Oa(function(){cu(null,null,r,!1,function(){r._reactRootContainer=null,r[Kr]=null})}),!0):!1},yn.unstable_batchedUpdates=Jh,yn.unstable_renderSubtreeIntoContainer=function(r,o,d,m){if(!lu(d))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return cu(r,o,d,!1,m)},yn.version="18.3.1-next-f1338f8080-20240426",yn}var Cb;function xC(){if(Cb)return hf.exports;Cb=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(),hf.exports=VR(),hf.exports}var Tb;function YR(){if(Tb)return hu;Tb=1;var e=xC();return hu.createRoot=e.createRoot,hu.hydrateRoot=e.hydrateRoot,hu}var KR=YR(),b=Hl();const fe=Pv(b);function Yt(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=Yt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mf={exports:{}},gf={},yf={exports:{}},wf={};/**
|
|
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 Ab;function XR(){if(Ab)return wf;Ab=1;var e=Hl();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(g,y){var v=y(),S=s({inst:{value:v,getSnapshot:y}}),_=S[0].inst,j=S[1];return l(function(){_.value=v,_.getSnapshot=y,f(_)&&j({inst:_})},[g,v,y]),a(function(){return f(_)&&j({inst:_}),g(function(){f(_)&&j({inst:_})})},[g]),c(v),v}function f(g){var y=g.getSnapshot;g=g.value;try{var v=y();return!n(g,v)}catch{return!0}}function p(g,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return wf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,wf}var Rb;function QR(){return Rb||(Rb=1,yf.exports=XR()),yf.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 Mb;function ZR(){if(Mb)return gf;Mb=1;var e=Hl(),t=QR();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return gf.useSyncExternalStoreWithSelector=function(p,h,g,y,v){var S=l(null);if(S.current===null){var _={hasValue:!1,value:null};S.current=_}else _=S.current;S=u(function(){function x(I){if(!N){if(N=!0,E=I,I=y(I),v!==void 0&&_.hasValue){var $=_.value;if(v($,I))return C=$}return C=I}if($=C,s(E,I))return $;var B=y(I);return v!==void 0&&v($,B)?(E=I,$):(E=I,C=B)}var N=!1,E,C,R=g===void 0?null:g;return[function(){return x(h())},R===null?void 0:function(){return x(R())}]},[h,g,y,v]);var j=a(p,S[0],S[1]);return c(function(){_.hasValue=!0,_.value=j},[j]),f(j),j},gf}var Ib;function JR(){return Ib||(Ib=1,mf.exports=ZR()),mf.exports}var eM=JR();const tM=Pv(eM),nM={},$b=e=>{let t;const n=new Set,s=(h,g)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const v=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(S=>S(t,v))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(nM?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},rM=e=>e?$b(e):$b,{useDebugValue:sM}=fe,{useSyncExternalStoreWithSelector:aM}=tM,oM=e=>e;function bC(e,t=oM,n){const s=aM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return sM(s),s}const Ob=(e,t)=>{const n=rM(e),s=(a,l=t)=>bC(n,a,l);return Object.assign(s,n),s},iM=(e,t)=>e?Ob(e,t):Ob;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 lM={value:()=>{}};function cd(){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 Ou(n)}function Ou(e){this._=e}function cM(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}})}Ou.prototype=cd.prototype={constructor:Ou,on:function(e,t){var n=this._,s=cM(e+"",n),a,l=-1,c=s.length;if(arguments.length<2){for(;++l<c;)if((a=(e=s[l]).type)&&(a=uM(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]=Pb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Pb(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 Ou(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 uM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function Pb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=lM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var tv="http://www.w3.org/1999/xhtml";const Lb={svg:"http://www.w3.org/2000/svg",xhtml:tv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ud(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lb.hasOwnProperty(t)?{space:Lb[t],local:e}:e}function dM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tv&&t.documentElement.namespaceURI===tv?t.createElement(e):t.createElementNS(n,e)}}function hM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function kC(e){var t=ud(e);return(t.local?hM:dM)(t)}function fM(){}function Lv(e){return e==null?fM:function(){return this.querySelector(e)}}function pM(e){typeof e!="function"&&(e=Lv(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,u=s[a]=new Array(c),f,p,h=0;h<c;++h)(f=l[h])&&(p=e.call(f,f.__data__,h,l))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Rn(s,this._parents)}function mM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gM(){return[]}function _C(e){return e==null?gM:function(){return this.querySelectorAll(e)}}function yM(e){return function(){return mM(e.apply(this,arguments))}}function wM(e){typeof e=="function"?e=yM(e):e=_C(e);for(var t=this._groups,n=t.length,s=[],a=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),a.push(f));return new Rn(s,a)}function NC(e){return function(){return this.matches(e)}}function SC(e){return function(t){return t.matches(e)}}var vM=Array.prototype.find;function xM(e){return function(){return vM.call(this.children,e)}}function bM(){return this.firstElementChild}function kM(e){return this.select(e==null?bM:xM(typeof e=="function"?e:SC(e)))}var _M=Array.prototype.filter;function NM(){return Array.from(this.children)}function SM(e){return function(){return _M.call(this.children,e)}}function jM(e){return this.selectAll(e==null?NM:SM(typeof e=="function"?e:SC(e)))}function EM(e){typeof e!="function"&&(e=NC(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,u=s[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Rn(s,this._parents)}function jC(e){return new Array(e.length)}function CM(){return new Rn(this._enter||this._groups.map(jC),this._parents)}function Uu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Uu.prototype={constructor:Uu,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 TM(e){return function(){return e}}function AM(e,t,n,s,a,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],s[c]=u):n[c]=new Uu(e,l[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function RM(e,t,n,s,a,l,c){var u,f,p=new Map,h=t.length,g=l.length,y=new Array(h),v;for(u=0;u<h;++u)(f=t[u])&&(y[u]=v=c.call(f,f.__data__,u,t)+"",p.has(v)?a[u]=f:p.set(v,f));for(u=0;u<g;++u)v=c.call(e,l[u],u,l)+"",(f=p.get(v))?(s[u]=f,f.__data__=l[u],p.delete(v)):n[u]=new Uu(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function MM(e){return e.__data__}function IM(e,t){if(!arguments.length)return Array.from(this,MM);var n=t?RM:AM,s=this._parents,a=this._groups;typeof e!="function"&&(e=TM(e));for(var l=a.length,c=new Array(l),u=new Array(l),f=new Array(l),p=0;p<l;++p){var h=s[p],g=a[p],y=g.length,v=$M(e.call(h,h&&h.__data__,p,s)),S=v.length,_=u[p]=new Array(S),j=c[p]=new Array(S),x=f[p]=new Array(y);n(h,g,_,j,x,v,t);for(var N=0,E=0,C,R;N<S;++N)if(C=_[N]){for(N>=E&&(E=N+1);!(R=j[E])&&++E<S;);C._next=R||null}}return c=new Rn(c,s),c._enter=u,c._exit=f,c}function $M(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function OM(){return new Rn(this._exit||this._groups.map(jC),this._parents)}function PM(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 LM(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),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=s[f],g=p.length,y=u[f]=new Array(g),v,S=0;S<g;++S)(v=p[S]||h[S])&&(y[S]=v);for(;f<a;++f)u[f]=n[f];return new Rn(u,this._parents)}function DM(){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 qM(e){e||(e=FM);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,a=new Array(s),l=0;l<s;++l){for(var c=n[l],u=c.length,f=a[l]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new Rn(a,this._parents).order()}function FM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function BM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zM(){return Array.from(this)}function UM(){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 WM(){let e=0;for(const t of this)++e;return e}function HM(){return!this.node()}function GM(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],l=0,c=a.length,u;l<c;++l)(u=a[l])&&e.call(u,u.__data__,l,a);return this}function VM(e){return function(){this.removeAttribute(e)}}function YM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function KM(e,t){return function(){this.setAttribute(e,t)}}function XM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function QM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ZM(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 JM(e,t){var n=ud(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?YM:VM:typeof t=="function"?n.local?ZM:QM:n.local?XM:KM)(n,t))}function EC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function eI(e){return function(){this.style.removeProperty(e)}}function tI(e,t,n){return function(){this.style.setProperty(e,t,n)}}function nI(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function rI(e,t,n){return arguments.length>1?this.each((t==null?eI:typeof t=="function"?nI:tI)(e,t,n??"")):hi(this.node(),e)}function hi(e,t){return e.style.getPropertyValue(t)||EC(e).getComputedStyle(e,null).getPropertyValue(t)}function sI(e){return function(){delete this[e]}}function aI(e,t){return function(){this[e]=t}}function oI(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function iI(e,t){return arguments.length>1?this.each((t==null?sI:typeof t=="function"?oI:aI)(e,t)):this.node()[e]}function CC(e){return e.trim().split(/^|\s+/)}function Dv(e){return e.classList||new TC(e)}function TC(e){this._node=e,this._names=CC(e.getAttribute("class")||"")}TC.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 AC(e,t){for(var n=Dv(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function RC(e,t){for(var n=Dv(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function lI(e){return function(){AC(this,e)}}function cI(e){return function(){RC(this,e)}}function uI(e,t){return function(){(t.apply(this,arguments)?AC:RC)(this,e)}}function dI(e,t){var n=CC(e+"");if(arguments.length<2){for(var s=Dv(this.node()),a=-1,l=n.length;++a<l;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?uI:t?lI:cI)(n,t))}function hI(){this.textContent=""}function fI(e){return function(){this.textContent=e}}function pI(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function mI(e){return arguments.length?this.each(e==null?hI:(typeof e=="function"?pI:fI)(e)):this.node().textContent}function gI(){this.innerHTML=""}function yI(e){return function(){this.innerHTML=e}}function wI(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function vI(e){return arguments.length?this.each(e==null?gI:(typeof e=="function"?wI:yI)(e)):this.node().innerHTML}function xI(){this.nextSibling&&this.parentNode.appendChild(this)}function bI(){return this.each(xI)}function kI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _I(){return this.each(kI)}function NI(e){var t=typeof e=="function"?e:kC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function SI(){return null}function jI(e,t){var n=typeof e=="function"?e:kC(e),s=t==null?SI:typeof t=="function"?t:Lv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function EI(){var e=this.parentNode;e&&e.removeChild(this)}function CI(){return this.each(EI)}function TI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function AI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function RI(e){return this.select(e?AI:TI)}function MI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function II(e){return function(t){e.call(this,t,this.__data__)}}function $I(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 OI(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 PI(e,t,n){return function(){var s=this.__on,a,l=II(t);if(s){for(var c=0,u=s.length;c<u;++c)if((a=s[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=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 LI(e,t,n){var s=$I(e+""),a,l=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<l;++a)if((c=s[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?PI:OI,a=0;a<l;++a)this.each(u(s[a],t,n));return this}function MC(e,t,n){var s=EC(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 DI(e,t){return function(){return MC(this,e,t)}}function qI(e,t){return function(){return MC(this,e,t.apply(this,arguments))}}function FI(e,t){return this.each((typeof t=="function"?qI:DI)(e,t))}function*BI(){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 IC=[null];function Rn(e,t){this._groups=e,this._parents=t}function Gl(){return new Rn([[document.documentElement]],IC)}function zI(){return this}Rn.prototype=Gl.prototype={constructor:Rn,select:pM,selectAll:wM,selectChild:kM,selectChildren:jM,filter:EM,data:IM,enter:CM,exit:OM,join:PM,merge:LM,selection:zI,order:DM,sort:qM,call:BM,nodes:zM,node:UM,size:WM,empty:HM,each:GM,attr:JM,style:rI,property:iI,classed:dI,text:mI,html:vI,raise:bI,lower:_I,append:NI,insert:jI,remove:CI,clone:RI,datum:MI,on:LI,dispatch:FI,[Symbol.iterator]:BI};function Fn(e){return typeof e=="string"?new Rn([[document.querySelector(e)]],[document.documentElement]):new Rn([[e]],IC)}function UI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ar(e,t){if(e=UI(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 WI={passive:!1},Ml={capture:!0,passive:!1};function vf(e){e.stopImmediatePropagation()}function ii(e){e.preventDefault(),e.stopImmediatePropagation()}function $C(e){var t=e.document.documentElement,n=Fn(e).on("dragstart.drag",ii,Ml);"onselectstart"in t?n.on("selectstart.drag",ii,Ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function OC(e,t){var n=e.document.documentElement,s=Fn(e).on("dragstart.drag",null);t&&(s.on("click.drag",ii,Ml),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 fu=e=>()=>e;function nv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:l,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}nv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function HI(e){return!e.ctrlKey&&!e.button}function GI(){return this.parentNode}function VI(e,t){return t??{x:e.x,y:e.y}}function YI(){return navigator.maxTouchPoints||"ontouchstart"in this}function KI(){var e=HI,t=GI,n=VI,s=YI,a={},l=cd("start","drag","end"),c=0,u,f,p,h,g=0;function y(C){C.on("mousedown.drag",v).filter(s).on("touchstart.drag",j).on("touchmove.drag",x,WI).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,R){if(!(h||!e.call(this,C,R))){var I=E(this,t.call(this,C,R),C,R,"mouse");I&&(Fn(C.view).on("mousemove.drag",S,Ml).on("mouseup.drag",_,Ml),$C(C.view),vf(C),p=!1,u=C.clientX,f=C.clientY,I("start",C))}}function S(C){if(ii(C),!p){var R=C.clientX-u,I=C.clientY-f;p=R*R+I*I>g}a.mouse("drag",C)}function _(C){Fn(C.view).on("mousemove.drag mouseup.drag",null),OC(C.view,p),ii(C),a.mouse("end",C)}function j(C,R){if(e.call(this,C,R)){var I=C.changedTouches,$=t.call(this,C,R),B=I.length,O,M;for(O=0;O<B;++O)(M=E(this,$,C,R,I[O].identifier,I[O]))&&(vf(C),M("start",C,I[O]))}}function x(C){var R=C.changedTouches,I=R.length,$,B;for($=0;$<I;++$)(B=a[R[$].identifier])&&(ii(C),B("drag",C,R[$]))}function N(C){var R=C.changedTouches,I=R.length,$,B;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<I;++$)(B=a[R[$].identifier])&&(vf(C),B("end",C,R[$]))}function E(C,R,I,$,B,O){var M=l.copy(),L=ar(O||I,R),Y,D,A;if((A=n.call(C,new nv("beforestart",{sourceEvent:I,target:y,identifier:B,active:c,x:L[0],y:L[1],dx:0,dy:0,dispatch:M}),$))!=null)return Y=A.x-L[0]||0,D=A.y-L[1]||0,function Q(z,te,J){var q=L,K;switch(z){case"start":a[B]=Q,K=c++;break;case"end":delete a[B],--c;case"drag":L=ar(J||te,R),K=c;break}M.call(z,C,new nv(z,{sourceEvent:te,subject:A,target:y,identifier:B,active:K,x:L[0]+Y,y:L[1]+D,dx:L[0]-q[0],dy:L[1]-q[1],dispatch:M}),$)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:fu(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:fu(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:fu(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:fu(!!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?(g=(C=+C)*C,y):Math.sqrt(g)},y}function qv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function PC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Vl(){}var Il=.7,Wu=1/Il,li="\\s*([+-]?\\d+)\\s*",$l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",XI=/^#([0-9a-f]{3,8})$/,QI=new RegExp(`^rgb\\(${li},${li},${li}\\)$`),ZI=new RegExp(`^rgb\\(${Cr},${Cr},${Cr}\\)$`),JI=new RegExp(`^rgba\\(${li},${li},${li},${$l}\\)$`),e$=new RegExp(`^rgba\\(${Cr},${Cr},${Cr},${$l}\\)$`),t$=new RegExp(`^hsl\\(${$l},${Cr},${Cr}\\)$`),n$=new RegExp(`^hsla\\(${$l},${Cr},${Cr},${$l}\\)$`),Db={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};qv(Vl,Ol,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qb,formatHex:qb,formatHex8:r$,formatHsl:s$,formatRgb:Fb,toString:Fb});function qb(){return this.rgb().formatHex()}function r$(){return this.rgb().formatHex8()}function s$(){return LC(this).formatHsl()}function Fb(){return this.rgb().formatRgb()}function Ol(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=XI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Bb(t):n===3?new wn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=QI.exec(e))?new wn(t[1],t[2],t[3],1):(t=ZI.exec(e))?new wn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=JI.exec(e))?pu(t[1],t[2],t[3],t[4]):(t=e$.exec(e))?pu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=t$.exec(e))?Wb(t[1],t[2]/100,t[3]/100,1):(t=n$.exec(e))?Wb(t[1],t[2]/100,t[3]/100,t[4]):Db.hasOwnProperty(e)?Bb(Db[e]):e==="transparent"?new wn(NaN,NaN,NaN,0):null}function Bb(e){return new wn(e>>16&255,e>>8&255,e&255,1)}function pu(e,t,n,s){return s<=0&&(e=t=n=NaN),new wn(e,t,n,s)}function a$(e){return e instanceof Vl||(e=Ol(e)),e?(e=e.rgb(),new wn(e.r,e.g,e.b,e.opacity)):new wn}function rv(e,t,n,s){return arguments.length===1?a$(e):new wn(e,t,n,s??1)}function wn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}qv(wn,rv,PC(Vl,{brighter(e){return e=e==null?Wu:Math.pow(Wu,e),new wn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Il:Math.pow(Il,e),new wn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wn(Wa(this.r),Wa(this.g),Wa(this.b),Hu(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:zb,formatHex:zb,formatHex8:o$,formatRgb:Ub,toString:Ub}));function zb(){return`#${za(this.r)}${za(this.g)}${za(this.b)}`}function o$(){return`#${za(this.r)}${za(this.g)}${za(this.b)}${za((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ub(){const e=Hu(this.opacity);return`${e===1?"rgb(":"rgba("}${Wa(this.r)}, ${Wa(this.g)}, ${Wa(this.b)}${e===1?")":`, ${e})`}`}function Hu(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 Wb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new or(e,t,n,s)}function LC(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof Vl||(e=Ol(e)),!e)return new or;if(e instanceof or)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,u=l-a,f=(l+a)/2;return u?(t===l?c=(n-s)/u+(n<s)*6:n===l?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?l+a:2-l-a,c*=60):u=f>0&&f<1?0:c,new or(c,u,f,e.opacity)}function i$(e,t,n,s){return arguments.length===1?LC(e):new or(e,t,n,s??1)}function or(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}qv(or,i$,PC(Vl,{brighter(e){return e=e==null?Wu:Math.pow(Wu,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Il:Math.pow(Il,e),new or(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 wn(xf(e>=240?e-240:e+120,a,s),xf(e,a,s),xf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new or(Hb(this.h),mu(this.s),mu(this.l),Hu(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=Hu(this.opacity);return`${e===1?"hsl(":"hsla("}${Hb(this.h)}, ${mu(this.s)*100}%, ${mu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hb(e){return e=(e||0)%360,e<0?e+360:e}function mu(e){return Math.max(0,Math.min(1,e||0))}function xf(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 DC=e=>()=>e;function l$(e,t){return function(n){return e+n*t}}function c$(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 u$(e){return(e=+e)==1?qC:function(t,n){return n-t?c$(t,n,e):DC(isNaN(t)?n:t)}}function qC(e,t){var n=t-e;return n?l$(e,n):DC(isNaN(e)?t:e)}const Gb=(function e(t){var n=u$(t);function s(a,l){var c=n((a=rv(a)).r,(l=rv(l)).r),u=n(a.g,l.g),f=n(a.b,l.b),p=qC(a.opacity,l.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function Vs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var sv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bf=new RegExp(sv.source,"g");function d$(e){return function(){return e}}function h$(e){return function(t){return e(t)+""}}function f$(e,t){var n=sv.lastIndex=bf.lastIndex=0,s,a,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=sv.exec(e))&&(a=bf.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(s=s[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:Vs(s,a)})),n=bf.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?h$(f[0].x):d$(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)u[(g=f[h]).i]=g.x(p);return u.join("")})}var Vb=180/Math.PI,av={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function FC(e,t,n,s,a,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*Vb,skewX:Math.atan(f)*Vb,scaleX:c,scaleY:u}}var gu;function p$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?av:FC(t.a,t.b,t.c,t.d,t.e,t.f)}function m$(e){return e==null||(gu||(gu=document.createElementNS("http://www.w3.org/2000/svg","g")),gu.setAttribute("transform",e),!(e=gu.transform.baseVal.consolidate()))?av:(e=e.matrix,FC(e.a,e.b,e.c,e.d,e.e,e.f))}function BC(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function l(p,h,g,y,v,S){if(p!==g||h!==y){var _=v.push("translate(",null,t,null,n);S.push({i:_-4,x:Vs(p,g)},{i:_-2,x:Vs(h,y)})}else(g||y)&&v.push("translate("+g+t+y+n)}function c(p,h,g,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:g.push(a(g)+"rotate(",null,s)-2,x:Vs(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function u(p,h,g,y){p!==h?y.push({i:g.push(a(g)+"skewX(",null,s)-2,x:Vs(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,y,v,S){if(p!==g||h!==y){var _=v.push(a(v)+"scale(",null,",",null,")");S.push({i:_-4,x:Vs(p,g)},{i:_-2,x:Vs(h,y)})}else(g!==1||y!==1)&&v.push(a(v)+"scale("+g+","+y+")")}return function(p,h){var g=[],y=[];return p=e(p),h=e(h),l(p.translateX,p.translateY,h.translateX,h.translateY,g,y),c(p.rotate,h.rotate,g,y),u(p.skewX,h.skewX,g,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,y),p=h=null,function(v){for(var S=-1,_=y.length,j;++S<_;)g[(j=y[S]).i]=j.x(v);return g.join("")}}}var g$=BC(p$,"px, ","px)","deg)"),y$=BC(m$,", ",")",")"),w$=1e-12;function Yb(e){return((e=Math.exp(e))+1/e)/2}function v$(e){return((e=Math.exp(e))-1/e)/2}function x$(e){return((e=Math.exp(2*e))-1)/(e+1)}const b$=(function e(t,n,s){function a(l,c){var u=l[0],f=l[1],p=l[2],h=c[0],g=c[1],y=c[2],v=h-u,S=g-f,_=v*v+S*S,j,x;if(_<w$)x=Math.log(y/p)/t,j=function($){return[u+$*v,f+$*S,p*Math.exp(t*$*x)]};else{var N=Math.sqrt(_),E=(y*y-p*p+s*_)/(2*p*n*N),C=(y*y-p*p-s*_)/(2*y*n*N),R=Math.log(Math.sqrt(E*E+1)-E),I=Math.log(Math.sqrt(C*C+1)-C);x=(I-R)/t,j=function($){var B=$*x,O=Yb(R),M=p/(n*N)*(O*x$(t*B+R)-v$(R));return[u+M*v,f+M*S,p*O/Yb(t*B+R)]}}return j.duration=x*1e3*t/Math.SQRT2,j}return a.rho=function(l){var c=Math.max(.001,+l),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var fi=0,Sl=0,gl=0,zC=1e3,Gu,jl,Vu=0,Ga=0,dd=0,Pl=typeof performance=="object"&&performance.now?performance:Date,UC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fv(){return Ga||(UC(k$),Ga=Pl.now()+dd)}function k$(){Ga=0}function Yu(){this._call=this._time=this._next=null}Yu.prototype=WC.prototype={constructor:Yu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fv():+n)+(t==null?0:+t),!this._next&&jl!==this&&(jl?jl._next=this:Gu=this,jl=this),this._call=e,this._time=n,ov()},stop:function(){this._call&&(this._call=null,this._time=1/0,ov())}};function WC(e,t,n){var s=new Yu;return s.restart(e,t,n),s}function _$(){Fv(),++fi;for(var e=Gu,t;e;)(t=Ga-e._time)>=0&&e._call.call(void 0,t),e=e._next;--fi}function Kb(){Ga=(Vu=Pl.now())+dd,fi=Sl=0;try{_$()}finally{fi=0,S$(),Ga=0}}function N$(){var e=Pl.now(),t=e-Vu;t>zC&&(dd-=t,Vu=e)}function S$(){for(var e,t=Gu,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:Gu=n);jl=e,ov(s)}function ov(e){if(!fi){Sl&&(Sl=clearTimeout(Sl));var t=e-Ga;t>24?(e<1/0&&(Sl=setTimeout(Kb,e-Pl.now()-dd)),gl&&(gl=clearInterval(gl))):(gl||(Vu=Pl.now(),gl=setInterval(N$,zC)),fi=1,UC(Kb))}}function Xb(e,t,n){var s=new Yu;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var j$=cd("start","end","cancel","interrupt"),E$=[],HC=0,Qb=1,iv=2,Pu=3,Zb=4,lv=5,Lu=6;function hd(e,t,n,s,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;C$(e,n,{name:t,index:s,group:a,on:j$,tween:E$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:HC})}function Bv(e,t){var n=fr(e,t);if(n.state>HC)throw new Error("too late; already scheduled");return n}function Tr(e,t){var n=fr(e,t);if(n.state>Pu)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function C$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=WC(l,0,n.time);function l(p){n.state=Qb,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,g,y,v;if(n.state!==Qb)return f();for(h in s)if(v=s[h],v.name===n.name){if(v.state===Pu)return Xb(c);v.state===Zb?(v.state=Lu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[h]):+h<t&&(v.state=Lu,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[h])}if(Xb(function(){n.state===Pu&&(n.state=Zb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=iv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===iv){for(n.state=Pu,a=new Array(y=n.tween.length),h=0,g=-1;h<y;++h)(v=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=v);a.length=g+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=lv,1),g=-1,y=a.length;++g<y;)a[g].call(e,h);n.state===lv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Lu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Du(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>iv&&s.state<lv,s.state=Lu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}l&&delete e.__transition}}function T$(e){return this.each(function(){Du(this,e)})}function A$(e,t){var n,s;return function(){var a=Tr(this,e),l=a.tween;if(l!==n){s=n=l;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}a.tween=s}}function R$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var l=Tr(this,e),c=l.tween;if(c!==s){a=(s=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}l.tween=a}}function M$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(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?A$:R$)(n,e,t))}function zv(e,t,n){var s=e._id;return e.each(function(){var a=Tr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return fr(a,s).value[t]}}function GC(e,t){var n;return(typeof t=="number"?Vs:t instanceof Ol?Gb:(n=Ol(t))?(t=n,Gb):f$)(e,t)}function I$(e){return function(){this.removeAttribute(e)}}function $$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function O$(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 P$(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 L$(e,t,n){var s,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===a?l:(a=f,l=t(s=c,u)))}}function D$(e,t,n){var s,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===a?l:(a=f,l=t(s=c,u)))}}function q$(e,t){var n=ud(e),s=n==="transform"?y$:GC;return this.attrTween(e,typeof t=="function"?(n.local?D$:L$)(n,s,zv(this,"attr."+e,t)):t==null?(n.local?$$:I$)(n):(n.local?P$:O$)(n,s,t))}function F$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function B$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function z$(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&B$(e,l)),n}return a._value=t,a}function U$(e,t){var n,s;function a(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&F$(e,l)),n}return a._value=t,a}function W$(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=ud(e);return this.tween(n,(s.local?z$:U$)(s,t))}function H$(e,t){return function(){Bv(this,e).delay=+t.apply(this,arguments)}}function G$(e,t){return t=+t,function(){Bv(this,e).delay=t}}function V$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?H$:G$)(t,e)):fr(this.node(),t).delay}function Y$(e,t){return function(){Tr(this,e).duration=+t.apply(this,arguments)}}function K$(e,t){return t=+t,function(){Tr(this,e).duration=t}}function X$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Y$:K$)(t,e)):fr(this.node(),t).duration}function Q$(e,t){if(typeof t!="function")throw new Error;return function(){Tr(this,e).ease=t}}function Z$(e){var t=this._id;return arguments.length?this.each(Q$(t,e)):fr(this.node(),t).ease}function J$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Tr(this,e).ease=n}}function eO(e){if(typeof e!="function")throw new Error;return this.each(J$(this._id,e))}function tO(e){typeof e!="function"&&(e=NC(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,u=s[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new is(s,this._parents,this._name,this._id)}function nO(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),u=0;u<l;++u)for(var f=t[u],p=n[u],h=f.length,g=c[u]=new Array(h),y,v=0;v<h;++v)(y=f[v]||p[v])&&(g[v]=y);for(;u<s;++u)c[u]=t[u];return new is(c,this._parents,this._name,this._id)}function rO(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 sO(e,t,n){var s,a,l=rO(t)?Bv:Tr;return function(){var c=l(this,e),u=c.on;u!==s&&(a=(s=u).copy()).on(t,n),c.on=a}}function aO(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(sO(n,e,t))}function oO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function iO(){return this.on("end.remove",oO(this._id))}function lO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Lv(e));for(var s=this._groups,a=s.length,l=new Array(a),c=0;c<a;++c)for(var u=s[c],f=u.length,p=l[c]=new Array(f),h,g,y=0;y<f;++y)(h=u[y])&&(g=e.call(h,h.__data__,y,u))&&("__data__"in h&&(g.__data__=h.__data__),p[y]=g,hd(p[y],t,n,y,p,fr(h,n)));return new is(l,this._parents,t,n)}function cO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_C(e));for(var s=this._groups,a=s.length,l=[],c=[],u=0;u<a;++u)for(var f=s[u],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var y=e.call(h,h.__data__,g,f),v,S=fr(h,n),_=0,j=y.length;_<j;++_)(v=y[_])&&hd(v,t,n,_,y,S);l.push(y),c.push(h)}return new is(l,c,t,n)}var uO=Gl.prototype.constructor;function dO(){return new uO(this._groups,this._parents)}function hO(e,t){var n,s,a;return function(){var l=hi(this,e),c=(this.style.removeProperty(e),hi(this,e));return l===c?null:l===n&&c===s?a:a=t(n=l,s=c)}}function VC(e){return function(){this.style.removeProperty(e)}}function fO(e,t,n){var s,a=n+"",l;return function(){var c=hi(this,e);return c===a?null:c===s?l:l=t(s=c,n)}}function pO(e,t,n){var s,a,l;return function(){var c=hi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),hi(this,e))),c===f?null:c===s&&f===a?l:(a=f,l=t(s=c,u))}}function mO(e,t){var n,s,a,l="style."+t,c="end."+l,u;return function(){var f=Tr(this,e),p=f.on,h=f.value[l]==null?u||(u=VC(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(c,a=h),f.on=s}}function gO(e,t,n){var s=(e+="")=="transform"?g$:GC;return t==null?this.styleTween(e,hO(e,s)).on("end.style."+e,VC(e)):typeof t=="function"?this.styleTween(e,pO(e,s,zv(this,"style."+e,t))).each(mO(this._id,e)):this.styleTween(e,fO(e,s,t),n).on("end.style."+e,null)}function yO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function wO(e,t,n){var s,a;function l(){var c=t.apply(this,arguments);return c!==a&&(s=(a=c)&&yO(e,c,n)),s}return l._value=t,l}function vO(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,wO(e,t,n??""))}function xO(e){return function(){this.textContent=e}}function bO(e){return function(){var t=e(this);this.textContent=t??""}}function kO(e){return this.tween("text",typeof e=="function"?bO(zv(this,"text",e)):xO(e==null?"":e+""))}function _O(e){return function(t){this.textContent=e.call(this,t)}}function NO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&_O(a)),t}return s._value=e,s}function SO(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,NO(e))}function jO(){for(var e=this._name,t=this._id,n=YC(),s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=fr(f,t);hd(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new is(s,this._parents,e,n)}function EO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(l,c){var u={value:c},f={value:function(){--a===0&&l()}};n.each(function(){var p=Tr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&l()})}var CO=0;function is(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function YC(){return++CO}var rs=Gl.prototype;is.prototype={constructor:is,select:lO,selectAll:cO,selectChild:rs.selectChild,selectChildren:rs.selectChildren,filter:tO,merge:nO,selection:dO,transition:jO,call:rs.call,nodes:rs.nodes,node:rs.node,size:rs.size,empty:rs.empty,each:rs.each,on:aO,attr:q$,attrTween:W$,style:gO,styleTween:vO,text:kO,textTween:SO,remove:iO,tween:M$,delay:V$,duration:X$,ease:Z$,easeVarying:eO,end:EO,[Symbol.iterator]:rs[Symbol.iterator]};function TO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var AO={time:null,delay:0,duration:250,ease:TO};function RO(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 MO(e){var t,n;e instanceof is?(t=e._id,e=e._name):(t=YC(),(n=AO).time=Fv(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,l=0;l<a;++l)for(var c=s[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&hd(f,e,t,p,c,n||RO(f,t));return new is(s,this._parents,e,t)}Gl.prototype.interrupt=T$;Gl.prototype.transition=MO;const yu=e=>()=>e;function IO(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 ss(e,t,n){this.k=e,this.x=t,this.y=n}ss.prototype={constructor:ss,scale:function(e){return e===1?this:new ss(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ss(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 as=new ss(1,0,0);ss.prototype;function kf(e){e.stopImmediatePropagation()}function yl(e){e.preventDefault(),e.stopImmediatePropagation()}function $O(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function OO(){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 Jb(){return this.__zoom||as}function PO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function LO(){return navigator.maxTouchPoints||"ontouchstart"in this}function DO(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 KC(){var e=$O,t=OO,n=DO,s=PO,a=LO,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=b$,p=cd("start","zoom","end"),h,g,y,v=500,S=150,_=0,j=10;function x(A){A.property("__zoom",Jb).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",M).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(A,Q,z,te){var J=A.selection?A.selection():A;J.property("__zoom",Jb),A!==J?R(A,Q,z,te):J.interrupt().each(function(){I(this,arguments).event(te).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},x.scaleBy=function(A,Q,z,te){x.scaleTo(A,function(){var J=this.__zoom.k,q=typeof Q=="function"?Q.apply(this,arguments):Q;return J*q},z,te)},x.scaleTo=function(A,Q,z,te){x.transform(A,function(){var J=t.apply(this,arguments),q=this.__zoom,K=z==null?C(J):typeof z=="function"?z.apply(this,arguments):z,P=q.invert(K),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(E(N(q,G),K,P),J,c)},z,te)},x.translateBy=function(A,Q,z,te){x.transform(A,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),c)},null,te)},x.translateTo=function(A,Q,z,te,J){x.transform(A,function(){var q=t.apply(this,arguments),K=this.__zoom,P=te==null?C(q):typeof te=="function"?te.apply(this,arguments):te;return n(as.translate(P[0],P[1]).scale(K.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof z=="function"?-z.apply(this,arguments):-z),q,c)},te,J)};function N(A,Q){return Q=Math.max(l[0],Math.min(l[1],Q)),Q===A.k?A:new ss(Q,A.x,A.y)}function E(A,Q,z){var te=Q[0]-z[0]*A.k,J=Q[1]-z[1]*A.k;return te===A.x&&J===A.y?A:new ss(A.k,te,J)}function C(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function R(A,Q,z,te){A.on("start.zoom",function(){I(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(te).end()}).tween("zoom",function(){var J=this,q=arguments,K=I(J,q).event(te),P=t.apply(J,q),G=z==null?C(P):typeof z=="function"?z.apply(J,q):z,he=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),H=J.__zoom,U=typeof Q=="function"?Q.apply(J,q):Q,Z=f(H.invert(G).concat(he/H.k),U.invert(G).concat(he/U.k));return function(V){if(V===1)V=U;else{var le=Z(V),pe=he/le[2];V=new ss(pe,G[0]-le[0]*pe,G[1]-le[1]*pe)}K.zoom(null,V)}})}function I(A,Q,z){return!z&&A.__zooming||new $(A,Q)}function $(A,Q){this.that=A,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,Q),this.taps=0}$.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,Q){return this.mouse&&A!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var Q=Fn(this.that).datum();p.call(A,this.that,new IO(A,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:p}),Q)}};function B(A,...Q){if(!e.apply(this,arguments))return;var z=I(this,Q).event(A),te=this.__zoom,J=Math.max(l[0],Math.min(l[1],te.k*Math.pow(2,s.apply(this,arguments)))),q=ar(A);if(z.wheel)(z.mouse[0][0]!==q[0]||z.mouse[0][1]!==q[1])&&(z.mouse[1]=te.invert(z.mouse[0]=q)),clearTimeout(z.wheel);else{if(te.k===J)return;z.mouse=[q,te.invert(q)],Du(this),z.start()}yl(A),z.wheel=setTimeout(K,S),z.zoom("mouse",n(E(N(te,J),z.mouse[0],z.mouse[1]),z.extent,c));function K(){z.wheel=null,z.end()}}function O(A,...Q){if(y||!e.apply(this,arguments))return;var z=A.currentTarget,te=I(this,Q,!0).event(A),J=Fn(A.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",he,!0),q=ar(A,z),K=A.clientX,P=A.clientY;$C(A.view),kf(A),te.mouse=[q,this.__zoom.invert(q)],Du(this),te.start();function G(H){if(yl(H),!te.moved){var U=H.clientX-K,Z=H.clientY-P;te.moved=U*U+Z*Z>_}te.event(H).zoom("mouse",n(E(te.that.__zoom,te.mouse[0]=ar(H,z),te.mouse[1]),te.extent,c))}function he(H){J.on("mousemove.zoom mouseup.zoom",null),OC(H.view,te.moved),yl(H),te.event(H).end()}}function M(A,...Q){if(e.apply(this,arguments)){var z=this.__zoom,te=ar(A.changedTouches?A.changedTouches[0]:A,this),J=z.invert(te),q=z.k*(A.shiftKey?.5:2),K=n(E(N(z,q),te,J),t.apply(this,Q),c);yl(A),u>0?Fn(this).transition().duration(u).call(R,K,te,A):Fn(this).call(x.transform,K,te,A)}}function L(A,...Q){if(e.apply(this,arguments)){var z=A.touches,te=z.length,J=I(this,Q,A.changedTouches.length===te).event(A),q,K,P,G;for(kf(A),K=0;K<te;++K)P=z[K],G=ar(P,this),G=[G,this.__zoom.invert(G),P.identifier],J.touch0?!J.touch1&&J.touch0[2]!==G[2]&&(J.touch1=G,J.taps=0):(J.touch0=G,q=!0,J.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(J.taps<2&&(g=G[0],h=setTimeout(function(){h=null},v)),Du(this),J.start())}}function Y(A,...Q){if(this.__zooming){var z=I(this,Q).event(A),te=A.changedTouches,J=te.length,q,K,P,G;for(yl(A),q=0;q<J;++q)K=te[q],P=ar(K,this),z.touch0&&z.touch0[2]===K.identifier?z.touch0[0]=P:z.touch1&&z.touch1[2]===K.identifier&&(z.touch1[0]=P);if(K=z.that.__zoom,z.touch1){var he=z.touch0[0],H=z.touch0[1],U=z.touch1[0],Z=z.touch1[1],V=(V=U[0]-he[0])*V+(V=U[1]-he[1])*V,le=(le=Z[0]-H[0])*le+(le=Z[1]-H[1])*le;K=N(K,Math.sqrt(V/le)),P=[(he[0]+U[0])/2,(he[1]+U[1])/2],G=[(H[0]+Z[0])/2,(H[1]+Z[1])/2]}else if(z.touch0)P=z.touch0[0],G=z.touch0[1];else return;z.zoom("touch",n(E(K,P,G),z.extent,c))}}function D(A,...Q){if(this.__zooming){var z=I(this,Q).event(A),te=A.changedTouches,J=te.length,q,K;for(kf(A),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),q=0;q<J;++q)K=te[q],z.touch0&&z.touch0[2]===K.identifier?delete z.touch0:z.touch1&&z.touch1[2]===K.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(K=ar(K,this),Math.hypot(g[0]-K[0],g[1]-K[1])<j)){var P=Fn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return x.wheelDelta=function(A){return arguments.length?(s=typeof A=="function"?A:yu(+A),x):s},x.filter=function(A){return arguments.length?(e=typeof A=="function"?A:yu(!!A),x):e},x.touchable=function(A){return arguments.length?(a=typeof A=="function"?A:yu(!!A),x):a},x.extent=function(A){return arguments.length?(t=typeof A=="function"?A:yu([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),x):t},x.scaleExtent=function(A){return arguments.length?(l[0]=+A[0],l[1]=+A[1],x):[l[0],l[1]]},x.translateExtent=function(A){return arguments.length?(c[0][0]=+A[0][0],c[1][0]=+A[1][0],c[0][1]=+A[0][1],c[1][1]=+A[1][1],x):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},x.constrain=function(A){return arguments.length?(n=A,x):n},x.duration=function(A){return arguments.length?(u=+A,x):u},x.interpolate=function(A){return arguments.length?(f=A,x):f},x.on=function(){var A=p.on.apply(p,arguments);return A===p?x:A},x.clickDistance=function(A){return arguments.length?(_=(A=+A)*A,x):Math.sqrt(_)},x.tapDistance=function(A){return arguments.length?(j=+A,x):j},x}var Uv=xC();const fd=b.createContext(null),qO=fd.Provider,ls={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.`},XC=ls.error001();function it(e,t){const n=b.useContext(fd);if(n===null)throw new Error(XC);return bC(n,e,t)}const At=()=>{const e=b.useContext(fd);if(e===null)throw new Error(XC);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},FO=e=>e.userSelectionActive?"none":"all";function Wv({position:e,children:t,className:n,style:s,...a}){const l=it(FO),c=`${e}`.split("-");return fe.createElement("div",{className:Yt(["react-flow__panel",n,...c]),style:{...s,pointerEvents:l},...a},t)}function BO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:fe.createElement(Wv,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const zO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const g=b.useRef(null),[y,v]=b.useState({x:0,y:0,width:0,height:0}),S=Yt(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(g.current){const _=g.current.getBBox();v({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),typeof n>"u"||!n?null:fe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:S,visibility:y.width?"visible":"hidden",...h},a&&fe.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),fe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),f)};var UO=b.memo(zO);const Hv=e=>({width:e.offsetWidth,height:e.offsetHeight}),pi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Gv=(e={x:0,y:0},t)=>({x:pi(e.x,t[0][0],t[1][0]),y:pi(e.y,t[0][1],t[1][1])}),ek=(e,t,n)=>e<t?pi(Math.abs(e-t),1,50)/50:e>n?-pi(Math.abs(e-n),1,50)/50:0,QC=(e,t)=>{const n=ek(e.x,35,t.width-35)*20,s=ek(e.y,35,t.height-35)*20;return[n,s]},ZC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},JC=(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)}),Ll=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),eT=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),tk=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),WO=(e,t)=>eT(JC(Ll(e),Ll(t))),cv=(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)},HO=e=>Bn(e.width)&&Bn(e.height)&&Bn(e.x)&&Bn(e.y),Bn=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),tT=["Enter"," ","Escape"],GO=(e,t)=>{},VO=e=>"nativeEvent"in e;function uv(e){var a,l;const t=VO(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 nT=e=>"clientX"in e,Xs=(e,t)=>{var l,c;const n=nT(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)}},Ku=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Yl=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:v=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),v&&fe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),a&&Bn(n)&&Bn(s)?fe.createElement(UO,{x:n,y:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Yl.displayName="BaseEdge";function wl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(l=>l.id===e);a&&n(s,{...a})}}function rT({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,u=s<t?s+c:s-c;return[l,u,a,c]}function sT({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+u*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}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 Dl;(function(e){e.Partial="partial",e.Full="full"})(Dl||(Dl={}));var Ks;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ks||(Ks={}));var Xu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xu||(Xu={}));var qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(qe||(qe={}));function nk({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===qe.Left||e===qe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function aT({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:l=qe.Top}){const[c,u]=nk({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=nk({pos:l,x1:s,y1:a,x2:e,y2:t}),[h,g,y,v]=sT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${a}`,h,g,y,v]}const Vv=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=qe.Bottom,targetPosition:l=qe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:S,interactionWidth:_})=>{const[j,x,N]=aT({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l});return fe.createElement(Yl,{path:j,labelX:x,labelY:N,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:S,interactionWidth:_})});Vv.displayName="SimpleBezierEdge";const rk={[qe.Left]:{x:-1,y:0},[qe.Right]:{x:1,y:0},[qe.Top]:{x:0,y:-1},[qe.Bottom]:{x:0,y:1}},YO=({source:e,sourcePosition:t=qe.Bottom,target:n})=>t===qe.Left||t===qe.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},sk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function KO({source:e,sourcePosition:t=qe.Bottom,target:n,targetPosition:s=qe.Top,center:a,offset:l}){const c=rk[t],u=rk[s],f={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+u.x*l,y:n.y+u.y*l},h=YO({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let v=[],S,_;const j={x:0,y:0},x={x:0,y:0},[N,E,C,R]=rT({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[g]*u[g]===-1){S=a.x??N,_=a.y??E;const $=[{x:S,y:f.y},{x:S,y:p.y}],B=[{x:f.x,y:_},{x:p.x,y:_}];c[g]===y?v=g==="x"?$:B:v=g==="x"?B:$}else{const $=[{x:f.x,y:p.y}],B=[{x:p.x,y:f.y}];if(g==="x"?v=c.x===y?B:$:v=c.y===y?$:B,t===s){const D=Math.abs(e[g]-n[g]);if(D<=l){const A=Math.min(l-1,l-D);c[g]===y?j[g]=(f[g]>e[g]?-1:1)*A:x[g]=(p[g]>n[g]?-1:1)*A}}if(t!==s){const D=g==="x"?"y":"x",A=c[g]===u[D],Q=f[D]>p[D],z=f[D]<p[D];(c[g]===1&&(!A&&Q||A&&z)||c[g]!==1&&(!A&&z||A&&Q))&&(v=g==="x"?$:B)}const O={x:f.x+j.x,y:f.y+j.y},M={x:p.x+x.x,y:p.y+x.y},L=Math.max(Math.abs(O.x-v[0].x),Math.abs(M.x-v[0].x)),Y=Math.max(Math.abs(O.y-v[0].y),Math.abs(M.y-v[0].y));L>=Y?(S=(O.x+M.x)/2,_=v[0].y):(S=v[0].x,_=(O.y+M.y)/2)}return[[e,{x:f.x+j.x,y:f.y+j.y},...v,{x:p.x+x.x,y:p.y+x.y},n],S,_,C,R]}function XO(e,t,n,s){const a=Math.min(sk(e,t)/2,sk(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,h=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${l},${c+a*f}Q ${l},${c} ${l+a*u},${c}`}function dv({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:l=qe.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,g,y,v,S]=KO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((j,x,N)=>{let E="";return N>0&&N<h.length-1?E=XO(h[N-1],x,h[N+1],c):E=`${N===0?"M":"L"}${x.x} ${x.y}`,j+=E,j},""),g,y,v,S]}const pd=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=qe.Bottom,targetPosition:y=qe.Top,markerEnd:v,markerStart:S,pathOptions:_,interactionWidth:j})=>{const[x,N,E]=dv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return fe.createElement(Yl,{path:x,labelX:N,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:v,markerStart:S,interactionWidth:j})});pd.displayName="SmoothStepEdge";const Yv=b.memo(e=>{var t;return fe.createElement(pd,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Yv.displayName="StepEdge";function QO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,l,c,u]=rT({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,l,c,u]}const Kv=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:v})=>{const[S,_,j]=QO({sourceX:e,sourceY:t,targetX:n,targetY:s});return fe.createElement(Yl,{path:S,labelX:_,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:v})});Kv.displayName="StraightEdge";function wu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ak({pos:e,x1:t,y1:n,x2:s,y2:a,c:l}){switch(e){case qe.Left:return[t-wu(t-s,l),n];case qe.Right:return[t+wu(s-t,l),n];case qe.Top:return[t,n-wu(n-a,l)];case qe.Bottom:return[t,n+wu(a-n,l)]}}function oT({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:l=qe.Top,curvature:c=.25}){const[u,f]=ak({pos:n,x1:e,y1:t,x2:s,y2:a,c}),[p,h]=ak({pos:l,x1:s,y1:a,x2:e,y2:t,c}),[g,y,v,S]=sT({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${s},${a}`,g,y,v,S]}const Qu=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=qe.Bottom,targetPosition:l=qe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:S,pathOptions:_,interactionWidth:j})=>{const[x,N,E]=oT({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:l,curvature:_==null?void 0:_.curvature});return fe.createElement(Yl,{path:x,labelX:N,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:v,markerStart:S,interactionWidth:j})});Qu.displayName="BezierEdge";const Xv=b.createContext(null),ZO=Xv.Provider;Xv.Consumer;const JO=()=>b.useContext(Xv),eP=e=>"id"in e&&"source"in e&&"target"in e,tP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,hv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,nP=(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)),rP=(e,t)=>{if(!e.source||!e.target)return t;let n;return eP(e)?n={...e}:n={...e,id:tP(e)},nP(n,t)?t:t.concat(n)},fv=({x:e,y:t},[n,s,a],l,[c,u])=>{const f={x:(e-n)/a,y:(t-s)/a};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},iT=({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}},md=(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 JC(s,Ll({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 eT(n)},lT=(e,t,[n,s,a]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:g,height:y,selectable:v=!0,hidden:S=!1}=h;if(c&&!v||S)return!1;const{positionAbsolute:_}=Ha(h,u),j={x:_.x,y:_.y,width:g||0,height:y||0},x=cv(f,j),N=typeof g>"u"||typeof y>"u"||g===null||y===null,E=l&&x>0,C=(g||0)*(y||0);(N||E||x>=C||h.dragging)&&p.push(h)}),p},cT=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},uT=(e,t,n,s,a,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=pi(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,v=n/2-g*p;return{x:y,y:v,zoom:p}},Ba=(e,t=0)=>e.transition().duration(t);function ok(e,t,n,s){return(t[n]||[]).reduce((a,l)=>{var c,u;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:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+l.y+l.height/2}),a},[])}function sP(e,t,n,s,a,l){const{x:c,y:u}=Xs(e),p=t.elementsFromPoint(c,u).find(S=>S.classList.contains("react-flow__handle"));if(p){const S=p.getAttribute("data-nodeid");if(S){const _=Qv(void 0,p),j=p.getAttribute("data-handleid"),x=l({nodeId:S,id:j,type:_});if(x){const N=a.find(E=>E.nodeId===S&&E.type===_&&E.id===j);return{handle:{id:j,type:_,nodeId:S,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:x}}}}let h=[],g=1/0;if(a.forEach(S=>{const _=Math.sqrt((S.x-n.x)**2+(S.y-n.y)**2);if(_<=s){const j=l(S);_<=g&&(_<g?h=[{handle:S,validHandleResult:j}]:_===g&&h.push({handle:S,validHandleResult:j}),g=_)}}),!h.length)return{handle:null,validHandleResult:dT()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:S})=>S.isValid),v=h.some(({handle:S})=>S.type==="target");return h.find(({handle:S,validHandleResult:_})=>v?S.type==="target":y?_.isValid:!0)||h[0]}const aP={source:null,target:null,sourceHandle:null,targetHandle:null},dT=()=>({handleDomNode:null,isValid:!1,connection:aP,endHandle:null});function hT(e,t,n,s,a,l,c){const u=a==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...dT(),handleDomNode:f};if(f){const h=Qv(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),v=f.classList.contains("connectable"),S=f.classList.contains("connectableend"),_={source:u?g:n,sourceHandle:u?y:s,target:u?n:g,targetHandle:u?s:y};p.connection=_,v&&S&&(t===Va.Strict?u&&h==="source"||!u&&h==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:h},p.isValid=l(_))}return p}function oP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,l)=>{if(l[Nt]){const{handleBounds:c}=l[Nt];let u=[],f=[];c&&(u=ok(l,c,"source",`${t}-${n}-${s}`),f=ok(l,c,"target",`${t}-${n}-${s}`)),a.push(...u,...f)}return a},[])}function Qv(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function _f(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function fT({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=ZC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:v,connectionRadius:S,onConnectStart:_,panBy:j,getNodes:x,cancelConnection:N}=l();let E=0,C;const{x:R,y:I}=Xs(e),$=h==null?void 0:h.elementFromPoint(R,I),B=Qv(f,$),O=y==null?void 0:y.getBoundingClientRect();if(!O||!B)return;let M,L=Xs(e,O),Y=!1,D=null,A=!1,Q=null;const z=oP({nodes:x(),nodeId:n,handleId:t,handleType:B}),te=()=>{if(!v)return;const[K,P]=QC(L,O);j({x:K,y:P}),E=requestAnimationFrame(te)};c({connectionPosition:L,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:B,connectionStartHandle:{nodeId:n,handleId:t,type:B},connectionEndHandle:null}),_==null||_(e,{nodeId:n,handleId:t,handleType:B});function J(K){const{transform:P}=l();L=Xs(K,O);const{handle:G,validHandleResult:he}=sP(K,h,fv(L,P,!1,[1,1]),S,z,H=>hT(H,g,n,t,a?"target":"source",u,h));if(C=G,Y||(te(),Y=!0),Q=he.handleDomNode,D=he.connection,A=he.isValid,c({connectionPosition:C&&A?iT({x:C.x,y:C.y},P):L,connectionStatus:iP(!!C,A),connectionEndHandle:he.endHandle}),!C&&!A&&!Q)return _f(M);D.source!==D.target&&Q&&(_f(M),M=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",A),Q.classList.toggle("react-flow__handle-valid",A))}function q(K){var P,G;(C||Q)&&D&&A&&(s==null||s(D)),(G=(P=l()).onConnectEnd)==null||G.call(P,K),f&&(p==null||p(K)),_f(M),N(),cancelAnimationFrame(E),Y=!1,A=!1,D=null,Q=null,h.removeEventListener("mousemove",J),h.removeEventListener("mouseup",q),h.removeEventListener("touchmove",J),h.removeEventListener("touchend",q)}h.addEventListener("mousemove",J),h.addEventListener("mouseup",q),h.addEventListener("touchmove",J),h.addEventListener("touchend",q)}const ik=()=>!0,lP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),cP=(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}},pT=b.forwardRef(({type:e="source",position:t=qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:g,...y},v)=>{var O,M;const S=c||null,_=e==="target",j=At(),x=JO(),{connectOnClick:N,noPanClassName:E}=it(lP,Dt),{connecting:C,clickConnecting:R}=it(cP(x,S,e),Dt);x||(M=(O=j.getState()).onError)==null||M.call(O,"010",ls.error010());const I=L=>{const{defaultEdgeOptions:Y,onConnect:D,hasDefaultEdges:A}=j.getState(),Q={...Y,...L};if(A){const{edges:z,setEdges:te}=j.getState();te(rP(Q,z))}D==null||D(Q),u==null||u(Q)},$=L=>{if(!x)return;const Y=nT(L);a&&(Y&&L.button===0||!Y)&&fT({event:L,handleId:S,nodeId:x,onConnect:I,isTarget:_,getState:j.getState,setState:j.setState,isValidConnection:n||j.getState().isValidConnection||ik}),Y?h==null||h(L):g==null||g(L)},B=L=>{const{onClickConnectStart:Y,onClickConnectEnd:D,connectionClickStartHandle:A,connectionMode:Q,isValidConnection:z}=j.getState();if(!x||!A&&!a)return;if(!A){Y==null||Y(L,{nodeId:x,handleId:S,handleType:e}),j.setState({connectionClickStartHandle:{nodeId:x,type:e,handleId:S}});return}const te=ZC(L.target),J=n||z||ik,{connection:q,isValid:K}=hT({nodeId:x,id:S,type:e},Q,A.nodeId,A.handleId||null,A.type,J,te);K&&I(q),D==null||D(L),j.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":S,"data-nodeid":x,"data-handlepos":t,"data-id":`${x}-${S}-${e}`,className:Yt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!_,target:_,connectable:s,connectablestart:a,connectableend:l,connecting:R,connectionindicator:s&&(a&&!C||l&&C)}]),onMouseDown:$,onTouchStart:$,onClick:N?B:void 0,ref:v,...y},f)});pT.displayName="Handle";var mi=b.memo(pT);const mT=({data:e,isConnectable:t,targetPosition:n=qe.Top,sourcePosition:s=qe.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(mi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,fe.createElement(mi,{type:"source",position:s,isConnectable:t}));mT.displayName="DefaultNode";var pv=b.memo(mT);const gT=({data:e,isConnectable:t,sourcePosition:n=qe.Bottom})=>fe.createElement(fe.Fragment,null,e==null?void 0:e.label,fe.createElement(mi,{type:"source",position:n,isConnectable:t}));gT.displayName="InputNode";var yT=b.memo(gT);const wT=({data:e,isConnectable:t,targetPosition:n=qe.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(mi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);wT.displayName="OutputNode";var vT=b.memo(wT);const Zv=()=>null;Zv.displayName="GroupNode";const uP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),vu=e=>e.id;function dP(e,t){return Dt(e.selectedNodes.map(vu),t.selectedNodes.map(vu))&&Dt(e.selectedEdges.map(vu),t.selectedEdges.map(vu))}const xT=b.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=it(uP,dP);return b.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,s,e]),null});xT.displayName="SelectionListener";const hP=e=>!!e.onSelectionChange;function fP({onSelectionChange:e}){const t=it(hP);return e||t?fe.createElement(xT,{onSelectionChange:e}):null}const pP=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 Yo(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ze(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const mP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:v,elevateNodesOnSelect:S,minZoom:_,maxZoom:j,nodeExtent:x,onNodesChange:N,onEdgesChange:E,elementsSelectable:C,connectionMode:R,snapGrid:I,snapToGrid:$,translateExtent:B,connectOnClick:O,defaultEdgeOptions:M,fitView:L,fitViewOptions:Y,onNodesDelete:D,onEdgesDelete:A,onNodeDrag:Q,onNodeDragStart:z,onNodeDragStop:te,onSelectionDrag:J,onSelectionDragStart:q,onSelectionDragStop:K,noPanClassName:P,nodeOrigin:G,rfId:he,autoPanOnConnect:H,autoPanOnNodeDrag:U,onError:Z,connectionRadius:V,isValidConnection:le,nodeDragThreshold:pe})=>{const{setNodes:me,setEdges:Ce,setDefaultNodesAndEdges:Ue,setMinZoom:ue,setMaxZoom:xe,setTranslateExtent:ye,setNodeExtent:De,reset:ke}=it(pP,Dt),Ee=At();return b.useEffect(()=>{const Ge=s==null?void 0:s.map(ot=>({...ot,...M}));return Ue(n,Ge),()=>{ke()}},[]),Ze("defaultEdgeOptions",M,Ee.setState),Ze("connectionMode",R,Ee.setState),Ze("onConnect",a,Ee.setState),Ze("onConnectStart",l,Ee.setState),Ze("onConnectEnd",c,Ee.setState),Ze("onClickConnectStart",u,Ee.setState),Ze("onClickConnectEnd",f,Ee.setState),Ze("nodesDraggable",p,Ee.setState),Ze("nodesConnectable",h,Ee.setState),Ze("nodesFocusable",g,Ee.setState),Ze("edgesFocusable",y,Ee.setState),Ze("edgesUpdatable",v,Ee.setState),Ze("elementsSelectable",C,Ee.setState),Ze("elevateNodesOnSelect",S,Ee.setState),Ze("snapToGrid",$,Ee.setState),Ze("snapGrid",I,Ee.setState),Ze("onNodesChange",N,Ee.setState),Ze("onEdgesChange",E,Ee.setState),Ze("connectOnClick",O,Ee.setState),Ze("fitViewOnInit",L,Ee.setState),Ze("fitViewOnInitOptions",Y,Ee.setState),Ze("onNodesDelete",D,Ee.setState),Ze("onEdgesDelete",A,Ee.setState),Ze("onNodeDrag",Q,Ee.setState),Ze("onNodeDragStart",z,Ee.setState),Ze("onNodeDragStop",te,Ee.setState),Ze("onSelectionDrag",J,Ee.setState),Ze("onSelectionDragStart",q,Ee.setState),Ze("onSelectionDragStop",K,Ee.setState),Ze("noPanClassName",P,Ee.setState),Ze("nodeOrigin",G,Ee.setState),Ze("rfId",he,Ee.setState),Ze("autoPanOnConnect",H,Ee.setState),Ze("autoPanOnNodeDrag",U,Ee.setState),Ze("onError",Z,Ee.setState),Ze("connectionRadius",V,Ee.setState),Ze("isValidConnection",le,Ee.setState),Ze("nodeDragThreshold",pe,Ee.setState),Yo(e,me),Yo(t,Ce),Yo(_,ue),Yo(j,xe),Yo(B,ye),Yo(x,De),null},lk={display:"none"},gP={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",kT="react-flow__edge-desc",yP="react-flow__aria-live",wP=e=>e.ariaLiveMessage;function vP({rfId:e}){const t=it(wP);return fe.createElement("div",{id:`${yP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gP},t)}function xP({rfId:e,disableKeyboardA11y:t}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${bT}-${e}`,style:lk},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${kT}-${e}`,style:lk},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&fe.createElement(vP,{rfId:e}))}var ql=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),a=b.useRef(!1),l=b.useRef(new Set([])),[c,u]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),h=p.reduce((g,y)=>g.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=v=>{if(a.current=v.ctrlKey||v.metaKey||v.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&uv(v))return!1;const _=uk(v.code,u);l.current.add(v[_]),ck(c,l.current,!1)&&(v.preventDefault(),s(!0))},g=v=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&uv(v))return!1;const _=uk(v.code,u);ck(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",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function ck(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function uk(e,t){return t.includes(e)?"code":"key"}function _T(e,t,n,s){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Ha(l,s);return _T(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[Nt])==null?void 0:u.z)??0)>(n.z??0)?((f=l[Nt])==null?void 0:f.z)??0:n.z??0},s)}function NT(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:u,z:f}=_T(s,e,{...s.position,z:((l=s[Nt])==null?void 0:l.z)??0},t);s.positionAbsolute={x:c,y:u},s[Nt].z=f,n!=null&&n[s.id]&&(s[Nt].isParent=!0)}})}function Nf(e,t,n,s){const a=new Map,l={},c=s?1e3:0;return e.forEach(u=>{var v;const f=(Bn(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(l[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Nt,{enumerable:!1,value:{handleBounds:y||(v=p==null?void 0:p[Nt])==null?void 0:v.handleBounds,z:f}}),a.set(u.id,h)}),NT(a,n,l),a}function ST(e,t={}){const{getNodes:n,width:s,height:a,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const S=n().filter(j=>{var N;const x=t.includeHiddenNodes?j.width&&j.height:!j.hidden;return(N=t.nodes)!=null&&N.length?x&&t.nodes.some(E=>E.id===j.id):x}),_=S.every(j=>j.width&&j.height);if(S.length>0&&_){const j=md(S,g),{x,y:N,zoom:E}=uT(j,s,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=as.translate(x,N).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(Ba(f,t.duration),C):u.transform(f,C),!0}}return!1}function bP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Nt]:s[Nt],selected:n.selected})}),new Map(t)}function kP(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function xu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:bP(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:kP(t,l)}),u==null||u(t))}const Ko=()=>{},_P={zoomIn:Ko,zoomOut:Ko,zoomTo:Ko,getZoom:()=>1,setViewport:Ko,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ko,fitBounds:Ko,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},NP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),SP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=it(NP,Dt);return b.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,u,f]=e.getState().transform,p=as.translate(a.x??c,a.y??u).scale(a.zoom??f);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=>ST(e.getState,a),setCenter:(a,l,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,g=u/2-a*h,y=f/2-l*h,v=as.translate(g,y).scale(h);t.transform(Ba(n,c==null?void 0:c.duration),v)},fitBounds:(a,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:y}=uT(a,c,u,f,p,(l==null?void 0:l.padding)??.1),v=as.translate(h,g).scale(y);t.transform(Ba(n,l==null?void 0:l.duration),v)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),fv(a,l,c,u)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),g={x:a.x-p,y:a.y-h};return fv(g,l,c,u)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=iT(a,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:_P,[t,n])};function Kl(){const e=SP(),t=At(),n=b.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=b.useCallback(_=>t.getState().nodeInternals.get(_),[]),a=b.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(j=>({...j}))},[]),l=b.useCallback(_=>{const{edges:j=[]}=t.getState();return j.find(x=>x.id===_)},[]),c=b.useCallback(_=>{const{getNodes:j,setNodes:x,hasDefaultNodes:N,onNodesChange:E}=t.getState(),C=j(),R=typeof _=="function"?_(C):_;if(N)x(R);else if(E){const I=R.length===0?C.map($=>({type:"remove",id:$.id})):R.map($=>({item:$,type:"reset"}));E(I)}},[]),u=b.useCallback(_=>{const{edges:j=[],setEdges:x,hasDefaultEdges:N,onEdgesChange:E}=t.getState(),C=typeof _=="function"?_(j):_;if(N)x(C);else if(E){const R=C.length===0?j.map(I=>({type:"remove",id:I.id})):C.map(I=>({item:I,type:"reset"}));E(R)}},[]),f=b.useCallback(_=>{const j=Array.isArray(_)?_:[_],{getNodes:x,setNodes:N,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const I=[...x(),...j];N(I)}else if(C){const R=j.map(I=>({item:I,type:"add"}));C(R)}},[]),p=b.useCallback(_=>{const j=Array.isArray(_)?_:[_],{edges:x=[],setEdges:N,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)N([...x,...j]);else if(C){const R=j.map(I=>({item:I,type:"add"}));C(R)}},[]),h=b.useCallback(()=>{const{getNodes:_,edges:j=[],transform:x}=t.getState(),[N,E,C]=x;return{nodes:_().map(R=>({...R})),edges:j.map(R=>({...R})),viewport:{x:N,y:E,zoom:C}}},[]),g=b.useCallback(({nodes:_,edges:j})=>{const{nodeInternals:x,getNodes:N,edges:E,hasDefaultNodes:C,hasDefaultEdges:R,onNodesDelete:I,onEdgesDelete:$,onNodesChange:B,onEdgesChange:O}=t.getState(),M=(_||[]).map(Q=>Q.id),L=(j||[]).map(Q=>Q.id),Y=N().reduce((Q,z)=>{const te=z.parentNode||z.parentId,J=!M.includes(z.id)&&te&&Q.find(K=>K.id===te);return(typeof z.deletable=="boolean"?z.deletable:!0)&&(M.includes(z.id)||J)&&Q.push(z),Q},[]),D=E.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),A=D.filter(Q=>L.includes(Q.id));if(Y||A){const Q=cT(Y,D),z=[...A,...Q],te=z.reduce((J,q)=>(J.includes(q.id)||J.push(q.id),J),[]);if((R||C)&&(R&&t.setState({edges:E.filter(J=>!te.includes(J.id))}),C&&(Y.forEach(J=>{x.delete(J.id)}),t.setState({nodeInternals:new Map(x)}))),te.length>0&&($==null||$(z),O&&O(te.map(J=>({id:J,type:"remove"})))),Y.length>0&&(I==null||I(Y),B)){const J=Y.map(q=>({id:q.id,type:"remove"}));B(J)}}},[]),y=b.useCallback(_=>{const j=HO(_),x=j?null:t.getState().nodeInternals.get(_.id);return!j&&!x?[null,null,j]:[j?_:tk(x),x,j]},[]),v=b.useCallback((_,j=!0,x)=>{const[N,E,C]=y(_);return N?(x||t.getState().getNodes()).filter(R=>{if(!C&&(R.id===E.id||!R.positionAbsolute))return!1;const I=tk(R),$=cv(I,N);return j&&$>0||$>=N.width*N.height}):[]},[]),S=b.useCallback((_,j,x=!0)=>{const[N]=y(_);if(!N)return!1;const E=cv(N,j);return x&&E>0||E>=N.width*N.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:v,isNodeIntersecting:S}),[e,n,s,a,l,c,u,f,p,h,g,v,S])}const jP={actInsideInputWithModifier:!1};var EP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=Kl(),a=ql(e,jP),l=ql(t);b.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function CP(e){const t=At();b.useEffect(()=>{let n;const s=()=>{var l,c;if(!e.current)return;const a=Hv(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",ls.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 Jv={position:"absolute",width:"100%",height:"100%",top:0,left:0},TP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,bu=e=>({x:e.x,y:e.y,zoom:e.k}),Xo=(e,t)=>e.target.closest(`.${t}`),dk=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),hk=e=>{const t=e.ctrlKey&&Ku()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},AP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),RP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Ua.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:y,translateExtent:v,minZoom:S,maxZoom:_,zoomActivationKeyCode:j,preventScrolling:x=!0,children:N,noWheelClassName:E,noPanClassName:C})=>{const R=b.useRef(),I=At(),$=b.useRef(!1),B=b.useRef(!1),O=b.useRef(null),M=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:L,d3Selection:Y,d3ZoomHandler:D,userSelectionActive:A}=it(AP,Dt),Q=ql(j),z=b.useRef(0),te=b.useRef(!1),J=b.useRef();return CP(O),b.useEffect(()=>{if(O.current){const q=O.current.getBoundingClientRect(),K=KC().scaleExtent([S,_]).translateExtent(v),P=Fn(O.current).call(K),G=as.translate(y.x,y.y).scale(pi(y.zoom,S,_)),he=[[0,0],[q.width,q.height]],H=K.constrain()(G,he,v);K.transform(P,H),K.wheelDelta(hk),I.setState({d3Zoom:K,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:O.current.closest(".react-flow")})}},[]),b.useEffect(()=>{Y&&L&&(c&&!Q&&!A?Y.on("wheel.zoom",q=>{if(Xo(q,E))return!1;q.preventDefault(),q.stopImmediatePropagation();const K=Y.property("__zoom").k||1;if(q.ctrlKey&&l){const le=ar(q),pe=hk(q),me=K*Math.pow(2,pe);L.scaleTo(Y,me,le,q);return}const P=q.deltaMode===1?20:1;let G=f===Ua.Vertical?0:q.deltaX*P,he=f===Ua.Horizontal?0:q.deltaY*P;!Ku()&&q.shiftKey&&f!==Ua.Vertical&&(G=q.deltaY*P,he=0),L.translateBy(Y,-(G/K)*u,-(he/K)*u,{internal:!0});const H=bu(Y.property("__zoom")),{onViewportChangeStart:U,onViewportChange:Z,onViewportChangeEnd:V}=I.getState();clearTimeout(J.current),te.current||(te.current=!0,t==null||t(q,H),U==null||U(H)),te.current&&(e==null||e(q,H),Z==null||Z(H),J.current=setTimeout(()=>{n==null||n(q,H),V==null||V(H),te.current=!1},150))},{passive:!1}):typeof D<"u"&&Y.on("wheel.zoom",function(q,K){if(!x&&q.type==="wheel"&&!q.ctrlKey||Xo(q,E))return null;q.preventDefault(),D.call(this,q,K)},{passive:!1}))},[A,c,f,Y,L,D,Q,l,x,E,t,e,n]),b.useEffect(()=>{L&&L.on("start",q=>{var G,he;if(!q.sourceEvent||q.sourceEvent.internal)return null;z.current=(G=q.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:K}=I.getState(),P=bu(q.transform);$.current=!0,M.current=P,((he=q.sourceEvent)==null?void 0:he.type)==="mousedown"&&I.setState({paneDragging:!0}),K==null||K(P),t==null||t(q.sourceEvent,P)})},[L,t]),b.useEffect(()=>{L&&(A&&!$.current?L.on("zoom",null):A||L.on("zoom",q=>{var P;const{onViewportChange:K}=I.getState();if(I.setState({transform:[q.transform.x,q.transform.y,q.transform.k]}),B.current=!!(s&&dk(g,z.current??0)),(e||K)&&!((P=q.sourceEvent)!=null&&P.internal)){const G=bu(q.transform);K==null||K(G),e==null||e(q.sourceEvent,G)}}))},[A,L,e,g,s]),b.useEffect(()=>{L&&L.on("end",q=>{if(!q.sourceEvent||q.sourceEvent.internal)return null;const{onViewportChangeEnd:K}=I.getState();if($.current=!1,I.setState({paneDragging:!1}),s&&dk(g,z.current??0)&&!B.current&&s(q.sourceEvent),B.current=!1,(n||K)&&TP(M.current,q.transform)){const P=bu(q.transform);M.current=P,clearTimeout(R.current),R.current=setTimeout(()=>{K==null||K(P),n==null||n(q.sourceEvent,P)},c?150:0)}})},[L,c,g,n,s]),b.useEffect(()=>{L&&L.filter(q=>{const K=Q||a,P=l&&q.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&q.button===1&&q.type==="mousedown"&&(Xo(q,"react-flow__node")||Xo(q,"react-flow__edge")))return!0;if(!g&&!K&&!c&&!p&&!l||A||!p&&q.type==="dblclick"||Xo(q,E)&&q.type==="wheel"||Xo(q,C)&&(q.type!=="wheel"||c&&q.type==="wheel"&&!Q)||!l&&q.ctrlKey&&q.type==="wheel"||!K&&!c&&!P&&q.type==="wheel"||!g&&(q.type==="mousedown"||q.type==="touchstart")||Array.isArray(g)&&!g.includes(q.button)&&q.type==="mousedown")return!1;const G=Array.isArray(g)&&g.includes(q.button)||!q.button||q.button<=1;return(!q.ctrlKey||q.type==="wheel")&&G})},[A,L,a,l,c,p,g,h,Q]),fe.createElement("div",{className:"react-flow__renderer",ref:O,style:Jv},N)},MP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function IP(){const{userSelectionActive:e,userSelectionRect:t}=it(MP,Dt);return e&&t?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function fk(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 $P(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(u=>u.id===a.id);if(l.length===0)return s.push(a),s;const c={...a};for(const u of l)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&fk(s,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&fk(s,c);break}case"remove":return s}return s.push(c),s},n)}function OP(e,t){return $P(e,t)}const Ys=(e,t)=>({id:e,type:"select",selected:t});function ri(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Ys(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Ys(s.id,!1))),n},[])}const Sf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},PP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),jT=b.memo(({isSelecting:e,selectionMode:t=Dl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const y=b.useRef(null),v=At(),S=b.useRef(0),_=b.useRef(0),j=b.useRef(),{userSelectionActive:x,elementsSelectable:N,dragging:E}=it(PP,Dt),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),S.current=0,_.current=0},R=D=>{l==null||l(D),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},I=D=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){D.preventDefault();return}c==null||c(D)},$=u?D=>u(D):void 0,B=D=>{const{resetSelectedElements:A,domNode:Q}=v.getState();if(j.current=Q==null?void 0:Q.getBoundingClientRect(),!N||!e||D.button!==0||D.target!==y.current||!j.current)return;const{x:z,y:te}=Xs(D,j.current);A(),v.setState({userSelectionRect:{width:0,height:0,startX:z,startY:te,x:z,y:te}}),s==null||s(D)},O=D=>{const{userSelectionRect:A,nodeInternals:Q,edges:z,transform:te,onNodesChange:J,onEdgesChange:q,nodeOrigin:K,getNodes:P}=v.getState();if(!e||!j.current||!A)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Xs(D,j.current),he=A.startX??0,H=A.startY??0,U={...A,x:G.x<he?G.x:he,y:G.y<H?G.y:H,width:Math.abs(G.x-he),height:Math.abs(G.y-H)},Z=P(),V=lT(Q,U,te,t===Dl.Partial,!0,K),le=cT(V,z).map(me=>me.id),pe=V.map(me=>me.id);if(S.current!==pe.length){S.current=pe.length;const me=ri(Z,pe);me.length&&(J==null||J(me))}if(_.current!==le.length){_.current=le.length;const me=ri(z,le);me.length&&(q==null||q(me))}v.setState({userSelectionRect:U})},M=D=>{if(D.button!==0)return;const{userSelectionRect:A}=v.getState();!x&&A&&D.target===y.current&&(R==null||R(D)),v.setState({nodesSelectionActive:S.current>0}),C(),a==null||a(D)},L=D=>{x&&(v.setState({nodesSelectionActive:S.current>0}),a==null||a(D)),C()},Y=N&&(e||x);return fe.createElement("div",{className:Yt(["react-flow__pane",{dragging:E,selection:e}]),onClick:Y?void 0:Sf(R,y),onContextMenu:Sf(I,y),onWheel:Sf($,y),onMouseEnter:Y?void 0:f,onMouseDown:Y?B:void 0,onMouseMove:Y?O:p,onMouseUp:Y?M:void 0,onMouseLeave:Y?L:h,ref:y,style:Jv},g,fe.createElement(IP,null))});jT.displayName="Pane";function ET(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:ET(s,t):!1}function pk(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 LP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!ET(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 DP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function CT(e,t,n,s,a=[0,0],l){const c=DP(e,e.extent||s);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=n.get(f),{x:y,y:v}=Ha(g,a).positionAbsolute;u=g&&Bn(y)&&Bn(v)&&Bn(g.width)&&Bn(g.height)?[[y+e.width*a[0],v+e.height*a[1]],[y+g.width-e.width+e.width*a[0],v+g.height-e.height+e.height*a[1]]]:u}else l==null||l("005",ls.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:y,y:v}=Ha(g,a).positionAbsolute;u=[[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(f){const g=n.get(f);p=Ha(g,a).positionAbsolute}const h=u&&u!=="parent"?Gv(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function jf({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 mk=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...Hv(f)}})};function vl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function mv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",ls.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function qP(){const e=At();return b.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:l?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:l?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function Ef(e){return(t,n,s)=>e==null?void 0:e(t,s)}function TT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const u=At(),[f,p]=b.useState(!1),h=b.useRef([]),g=b.useRef({x:null,y:null}),y=b.useRef(0),v=b.useRef(null),S=b.useRef({x:0,y:0}),_=b.useRef(null),j=b.useRef(!1),x=b.useRef(!1),N=b.useRef(!1),E=qP();return b.useEffect(()=>{if(e!=null&&e.current){const C=Fn(e.current),R=({x:B,y:O})=>{const{nodeInternals:M,onNodeDrag:L,onSelectionDrag:Y,updateNodePositions:D,nodeExtent:A,snapGrid:Q,snapToGrid:z,nodeOrigin:te,onError:J}=u.getState();g.current={x:B,y:O};let q=!1,K={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&A){const G=md(h.current,te);K=Ll(G)}if(h.current=h.current.map(G=>{const he={x:B-G.distance.x,y:O-G.distance.y};z&&(he.x=Q[0]*Math.round(he.x/Q[0]),he.y=Q[1]*Math.round(he.y/Q[1]));const H=[[A[0][0],A[0][1]],[A[1][0],A[1][1]]];h.current.length>1&&A&&!G.extent&&(H[0][0]=G.positionAbsolute.x-K.x+A[0][0],H[1][0]=G.positionAbsolute.x+(G.width??0)-K.x2+A[1][0],H[0][1]=G.positionAbsolute.y-K.y+A[0][1],H[1][1]=G.positionAbsolute.y+(G.height??0)-K.y2+A[1][1]);const U=CT(G,he,M,H,te,J);return q=q||G.position.x!==U.position.x||G.position.y!==U.position.y,G.position=U.position,G.positionAbsolute=U.positionAbsolute,G}),!q)return;D(h.current,!0,!0),p(!0);const P=a?L:Ef(Y);if(P&&_.current){const[G,he]=jf({nodeId:a,dragItems:h.current,nodeInternals:M});P(_.current,G,he)}},I=()=>{if(!v.current)return;const[B,O]=QC(S.current,v.current);if(B!==0||O!==0){const{transform:M,panBy:L}=u.getState();g.current.x=(g.current.x??0)-B/M[2],g.current.y=(g.current.y??0)-O/M[2],L({x:B,y:O})&&R(g.current)}y.current=requestAnimationFrame(I)},$=B=>{var te;const{nodeInternals:O,multiSelectionActive:M,nodesDraggable:L,unselectNodesAndEdges:Y,onNodeDragStart:D,onSelectionDragStart:A}=u.getState();x.current=!0;const Q=a?D:Ef(A);(!c||!l)&&!M&&a&&((te=O.get(a))!=null&&te.selected||Y()),a&&l&&c&&mv({id:a,store:u,nodeRef:e});const z=E(B);if(g.current=z,h.current=LP(O,L,z,a),Q&&h.current){const[J,q]=jf({nodeId:a,dragItems:h.current,nodeInternals:O});Q(B.sourceEvent,J,q)}};if(t)C.on(".drag",null);else{const B=KI().on("start",O=>{const{domNode:M,nodeDragThreshold:L}=u.getState();L===0&&$(O),N.current=!1;const Y=E(O);g.current=Y,v.current=(M==null?void 0:M.getBoundingClientRect())||null,S.current=Xs(O.sourceEvent,v.current)}).on("drag",O=>{var D,A;const M=E(O),{autoPanOnNodeDrag:L,nodeDragThreshold:Y}=u.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!j.current&&x.current&&L&&(j.current=!0,I()),!x.current){const Q=M.xSnapped-(((D=g==null?void 0:g.current)==null?void 0:D.x)??0),z=M.ySnapped-(((A=g==null?void 0:g.current)==null?void 0:A.y)??0);Math.sqrt(Q*Q+z*z)>Y&&$(O)}(g.current.x!==M.xSnapped||g.current.y!==M.ySnapped)&&h.current&&x.current&&(_.current=O.sourceEvent,S.current=Xs(O.sourceEvent,v.current),R(M))}}).on("end",O=>{if(!(!x.current||N.current)&&(p(!1),j.current=!1,x.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:M,nodeInternals:L,onNodeDragStop:Y,onSelectionDragStop:D}=u.getState(),A=a?Y:Ef(D);if(M(h.current,!1,!1),A){const[Q,z]=jf({nodeId:a,dragItems:h.current,nodeInternals:L});A(O.sourceEvent,Q,z)}}}).filter(O=>{const M=O.target;return!O.button&&(!n||!pk(M,`.${n}`,e))&&(!s||pk(M,s,e))});return C.call(B),()=>{C.on(".drag",null)}}}},[e,t,n,s,l,u,a,c,E]),f}function AT(){const e=At();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=c().filter(N=>N.selected&&(N.draggable||h&&typeof N.draggable>"u")),y=u?f[0]:5,v=u?f[1]:5,S=n.isShiftPressed?4:1,_=n.x*y*S,j=n.y*v*S,x=g.map(N=>{if(N.positionAbsolute){const E={x:N.positionAbsolute.x+_,y:N.positionAbsolute.y+j};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:R}=CT(N,E,s,a,void 0,p);N.position=R,N.positionAbsolute=C}return N});l(x,!0,!1)},[])}const ci={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var xl=e=>{const t=({id:n,type:s,data:a,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:y,onMouseLeave:v,onContextMenu:S,onDoubleClick:_,style:j,className:x,isDraggable:N,isSelectable:E,isConnectable:C,isFocusable:R,selectNodesOnDrag:I,sourcePosition:$,targetPosition:B,hidden:O,resizeObserver:M,dragHandle:L,zIndex:Y,isParent:D,noDragClassName:A,noPanClassName:Q,initialized:z,disableKeyboardA11y:te,ariaLabel:J,rfId:q,hasHandleBounds:K})=>{const P=At(),G=b.useRef(null),he=b.useRef(null),H=b.useRef($),U=b.useRef(B),Z=b.useRef(s),V=E||N||h||g||y||v,le=AT(),pe=vl(n,P.getState,g),me=vl(n,P.getState,y),Ce=vl(n,P.getState,v),Ue=vl(n,P.getState,S),ue=vl(n,P.getState,_),xe=ke=>{const{nodeDragThreshold:Ee}=P.getState();if(E&&(!I||!N||Ee>0)&&mv({id:n,store:P,nodeRef:G}),h){const Ge=P.getState().nodeInternals.get(n);Ge&&h(ke,{...Ge})}},ye=ke=>{if(!uv(ke)&&!te)if(tT.includes(ke.key)&&E){const Ee=ke.key==="Escape";mv({id:n,store:P,unselect:Ee,nodeRef:G})}else N&&p&&Object.prototype.hasOwnProperty.call(ci,ke.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${ke.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),le({x:ci[ke.key].x,y:ci[ke.key].y,isShiftPressed:ke.shiftKey}))};b.useEffect(()=>()=>{he.current&&(M==null||M.unobserve(he.current),he.current=null)},[]),b.useEffect(()=>{if(G.current&&!O){const ke=G.current;(!z||!K||he.current!==ke)&&(he.current&&(M==null||M.unobserve(he.current)),M==null||M.observe(ke),he.current=ke)}},[O,z,K]),b.useEffect(()=>{const ke=Z.current!==s,Ee=H.current!==$,Ge=U.current!==B;G.current&&(ke||Ee||Ge)&&(ke&&(Z.current=s),Ee&&(H.current=$),Ge&&(U.current=B),P.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,s,$,B]);const De=TT({nodeRef:G,disabled:O||!N,noDragClassName:A,handleSelector:L,nodeId:n,isSelectable:E,selectNodesOnDrag:I});return O?null:fe.createElement("div",{className:Yt(["react-flow__node",`react-flow__node-${s}`,{[Q]:N},x,{selected:p,selectable:E,parent:D,dragging:De}]),ref:G,style:{zIndex:Y,transform:`translate(${u}px,${f}px)`,pointerEvents:V?"all":"none",visibility:z?"visible":"hidden",...j},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:me,onMouseLeave:Ce,onContextMenu:Ue,onClick:xe,onDoubleClick:ue,onKeyDown:R?ye:void 0,tabIndex:R?0:void 0,role:R?"button":void 0,"aria-describedby":te?void 0:`${bT}-${q}`,"aria-label":J},fe.createElement(ZO,{value:n},fe.createElement(e,{id:n,data:a,type:s,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:$,targetPosition:B,dragging:De,dragHandle:L,zIndex:Y})))};return t.displayName="NodeWrapper",b.memo(t)};const FP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...md(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function BP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:a,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=it(FP,Dt),h=AT(),g=b.useRef(null);if(b.useEffect(()=>{var S;n||(S=g.current)==null||S.focus({preventScroll:!0})},[n]),TT({nodeRef:g}),p||!a||!l)return null;const y=e?S=>{const _=s.getState().getNodes().filter(j=>j.selected);e(S,_)}:void 0,v=S=>{Object.prototype.hasOwnProperty.call(ci,S.key)&&h({x:ci[S.key].x,y:ci[S.key].y,isShiftPressed:S.shiftKey})};return fe.createElement("div",{className:Yt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},fe.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l,top:u,left:c}}))}var zP=b.memo(BP);const UP=e=>e.nodesSelectionActive,RT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:y,selectionMode:v,onSelectionStart:S,onSelectionEnd:_,multiSelectionKeyCode:j,panActivationKeyCode:x,zoomActivationKeyCode:N,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:R,panOnScroll:I,panOnScrollSpeed:$,panOnScrollMode:B,zoomOnDoubleClick:O,panOnDrag:M,defaultViewport:L,translateExtent:Y,minZoom:D,maxZoom:A,preventScrolling:Q,onSelectionContextMenu:z,noWheelClassName:te,noPanClassName:J,disableKeyboardA11y:q})=>{const K=it(UP),P=ql(g),G=ql(x),he=G||M,H=G||I,U=P||y&&he!==!0;return EP({deleteKeyCode:u,multiSelectionKeyCode:j}),fe.createElement(RP,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:R,panOnScroll:H,panOnScrollSpeed:$,panOnScrollMode:B,zoomOnDoubleClick:O,panOnDrag:!P&&he,defaultViewport:L,translateExtent:Y,minZoom:D,maxZoom:A,zoomActivationKeyCode:N,preventScrolling:Q,noWheelClassName:te,noPanClassName:J},fe.createElement(jT,{onSelectionStart:S,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:he,isSelecting:!!U,selectionMode:v},e,K&&fe.createElement(zP,{onSelectionContextMenu:z,noPanClassName:J,disableKeyboardA11y:q})))};RT.displayName="FlowRenderer";var WP=b.memo(RT);function HP(e){return it(b.useCallback(n=>e?lT(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function GP(e){const t={input:xl(e.input||yT),default:xl(e.default||pv),output:xl(e.output||vT),group:xl(e.group||Zv)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=xl(e[l]||pv),a),n);return{...t,...s}}const VP=({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]},YP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),MT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:l,onError:c}=it(YP,Dt),u=HP(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const y=g.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));l(y)});return f.current=h,h},[]);return b.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:Jv},u.map(h=>{var R,I,$;let g=h.type||"default";e.nodeTypes[g]||(c==null||c("003",ls.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,v=!!(h.draggable||t&&typeof h.draggable>"u"),S=!!(h.selectable||a&&typeof h.selectable>"u"),_=!!(h.connectable||n&&typeof h.connectable>"u"),j=!!(h.focusable||s&&typeof h.focusable>"u"),x=e.nodeExtent?Gv(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,N=(x==null?void 0:x.x)??0,E=(x==null?void 0:x.y)??0,C=VP({x:N,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return fe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||qe.Bottom,targetPosition:h.targetPosition||qe.Top,hidden:h.hidden,xPos:N,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:v,isSelectable:S,isConnectable:_,isFocusable:j,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((R=h[Nt])==null?void 0:R.z)??0,isParent:!!((I=h[Nt])!=null&&I.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!(($=h[Nt])!=null&&$.handleBounds)})}))};MT.displayName="NodeRenderer";var KP=b.memo(MT);const XP=(e,t,n)=>n===qe.Left?e-t:n===qe.Right?e+t:e,QP=(e,t,n)=>n===qe.Top?e-t:n===qe.Bottom?e+t:e,gk="react-flow__edgeupdater",yk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:u})=>fe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Yt([gk,`${gk}-${u}`]),cx:XP(t,s,e),cy:QP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),ZP=()=>!0;var Qo=e=>{const t=({id:n,className:s,type:a,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:_,style:j,source:x,target:N,sourceX:E,sourceY:C,targetX:R,targetY:I,sourcePosition:$,targetPosition:B,elementsSelectable:O,hidden:M,sourceHandleId:L,targetHandleId:Y,onContextMenu:D,onMouseEnter:A,onMouseMove:Q,onMouseLeave:z,reconnectRadius:te,onReconnect:J,onReconnectStart:q,onReconnectEnd:K,markerEnd:P,markerStart:G,rfId:he,ariaLabel:H,isFocusable:U,isReconnectable:Z,pathOptions:V,interactionWidth:le,disableKeyboardA11y:pe})=>{const me=b.useRef(null),[Ce,Ue]=b.useState(!1),[ue,xe]=b.useState(!1),ye=At(),De=b.useMemo(()=>`url('#${hv(G,he)}')`,[G,he]),ke=b.useMemo(()=>`url('#${hv(P,he)}')`,[P,he]);if(M)return null;const Ee=Ae=>{var Re;const{edges:Se,addSelectedEdges:Te,unselectNodesAndEdges:Be,multiSelectionActive:kt}=ye.getState(),ut=Se.find(ht=>ht.id===n);ut&&(O&&(ye.setState({nodesSelectionActive:!1}),ut.selected&&kt?(Be({nodes:[],edges:[ut]}),(Re=me.current)==null||Re.blur()):Te([n])),c&&c(Ae,ut))},Ge=wl(n,ye.getState,u),ot=wl(n,ye.getState,D),re=wl(n,ye.getState,A),Ye=wl(n,ye.getState,Q),Ke=wl(n,ye.getState,z),ge=(Ae,Se)=>{if(Ae.button!==0)return;const{edges:Te,isValidConnection:Be}=ye.getState(),kt=Se?N:x,ut=(Se?Y:L)||null,Re=Se?"target":"source",ht=Be||ZP,wt=Se,St=Te.find(ln=>ln.id===n);xe(!0),q==null||q(Ae,St,Re);const Et=ln=>{xe(!1),K==null||K(ln,St,Re)};fT({event:Ae,handleId:ut,nodeId:kt,onConnect:ln=>J==null?void 0:J(St,ln),isTarget:wt,getState:ye.getState,setState:ye.setState,isValidConnection:ht,edgeUpdaterType:Re,onReconnectEnd:Et})},_e=Ae=>ge(Ae,!0),Fe=Ae=>ge(Ae,!1),Xe=()=>Ue(!0),at=()=>Ue(!1),pt=!O&&!c,se=Ae=>{var Se;if(!pe&&tT.includes(Ae.key)&&O){const{unselectNodesAndEdges:Te,addSelectedEdges:Be,edges:kt}=ye.getState();Ae.key==="Escape"?((Se=me.current)==null||Se.blur(),Te({edges:[kt.find(Re=>Re.id===n)]})):Be([n])}};return fe.createElement("g",{className:Yt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:pt,updating:Ce}]),onClick:Ee,onDoubleClick:Ge,onContextMenu:ot,onMouseEnter:re,onMouseMove:Ye,onMouseLeave:Ke,onKeyDown:U?se: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 ${x} to ${N}`,"aria-describedby":U?`${kT}-${he}`:void 0,ref:me},!ue&&fe.createElement(e,{id:n,source:x,target:N,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:_,data:l,style:j,sourceX:E,sourceY:C,targetX:R,targetY:I,sourcePosition:$,targetPosition:B,sourceHandleId:L,targetHandleId:Y,markerStart:De,markerEnd:ke,pathOptions:V,interactionWidth:le}),Z&&fe.createElement(fe.Fragment,null,(Z==="source"||Z===!0)&&fe.createElement(yk,{position:$,centerX:E,centerY:C,radius:te,onMouseDown:_e,onMouseEnter:Xe,onMouseOut:at,type:"source"}),(Z==="target"||Z===!0)&&fe.createElement(yk,{position:B,centerX:R,centerY:I,radius:te,onMouseDown:Fe,onMouseEnter:Xe,onMouseOut:at,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function JP(e){const t={default:Qo(e.default||Qu),straight:Qo(e.bezier||Kv),step:Qo(e.step||Yv),smoothstep:Qo(e.step||pd),simplebezier:Qo(e.simplebezier||Vv)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Qo(e[l]||Qu),a),n);return{...t,...s}}function wk(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 qe.Top:return{x:s+l/2,y:a};case qe.Right:return{x:s+l,y:a+c/2};case qe.Bottom:return{x:s+l/2,y:a+c};case qe.Left:return{x:s,y:a+c/2}}}function vk(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const e3=(e,t,n,s,a,l)=>{const c=wk(n,e,t),u=wk(l,s,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function t3({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:l,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=Ll({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*y)>0}function xk(e){var s,a,l,c,u;const t=((s=e==null?void 0:e[Nt])==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:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const n3=[{level:0,isMaxLevel:!0,edges:[]}];function r3(e,t,n=!1){let s=-1;const a=e.reduce((c,u)=>{var h,g;const f=Bn(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),v=t.get(u.source),S=u.selected||(y==null?void 0:y.selected)||(v==null?void 0:v.selected),_=Math.max(((h=v==null?void 0:v[Nt])==null?void 0:h.z)||0,((g=y==null?void 0:y[Nt])==null?void 0:g.z)||0,1e3);p=(f?u.zIndex:0)+(S?_:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),l=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return l.length===0?n3:l}function s3(e,t,n){const s=it(b.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),u=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&t3({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return r3(s,t,n)}const a3=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),o3=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),bk={[Xu.Arrow]:a3,[Xu.ArrowClosed]:o3};function i3(e){const t=At();return b.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(bk,e)?bk[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",ls.error009(e)),null)},[e])}const l3=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=i3(t);return f?fe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},fe.createElement(f,{color:n,strokeWidth:c})):null},c3=({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 u=hv(c,t);s.includes(u)||(a.push({id:u,color:c.color||e,...c}),s.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},IT=({defaultColor:e,rfId:t})=>{const n=it(b.useCallback(c3({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((l,c)=>l.id!==a[c].id)));return fe.createElement("defs",null,n.map(s=>fe.createElement(l3,{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})))};IT.displayName="MarkerDefinitions";var u3=b.memo(IT);const d3=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}),$T=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:v,onReconnectEnd:S,reconnectRadius:_,children:j,disableKeyboardA11y:x})=>{const{edgesFocusable:N,edgesUpdatable:E,elementsSelectable:C,width:R,height:I,connectionMode:$,nodeInternals:B,onError:O}=it(d3,Dt),M=s3(t,B,n);return R?fe.createElement(fe.Fragment,null,M.map(({level:L,edges:Y,isMaxLevel:D})=>fe.createElement("svg",{key:L,style:{zIndex:L},width:R,height:I,className:"react-flow__edges react-flow__container"},D&&fe.createElement(u3,{defaultColor:e,rfId:s}),fe.createElement("g",null,Y.map(A=>{const[Q,z,te]=xk(B.get(A.source)),[J,q,K]=xk(B.get(A.target));if(!te||!K)return null;let P=A.type||"default";a[P]||(O==null||O("011",ls.error011(P)),P="default");const G=a[P]||a.default,he=$===Va.Strict?q.target:(q.target??[]).concat(q.source??[]),H=vk(z.source,A.sourceHandle),U=vk(he,A.targetHandle),Z=(H==null?void 0:H.position)||qe.Bottom,V=(U==null?void 0:U.position)||qe.Top,le=!!(A.focusable||N&&typeof A.focusable>"u"),pe=A.reconnectable||A.updatable,me=typeof y<"u"&&(pe||E&&typeof pe>"u");if(!H||!U)return O==null||O("008",ls.error008(H,A)),null;const{sourceX:Ce,sourceY:Ue,targetX:ue,targetY:xe}=e3(Q,H,Z,J,U,V);return fe.createElement(G,{key:A.id,id:A.id,className:Yt([A.className,l]),type:P,data:A.data,selected:!!A.selected,animated:!!A.animated,hidden:!!A.hidden,label:A.label,labelStyle:A.labelStyle,labelShowBg:A.labelShowBg,labelBgStyle:A.labelBgStyle,labelBgPadding:A.labelBgPadding,labelBgBorderRadius:A.labelBgBorderRadius,style:A.style,source:A.source,target:A.target,sourceHandleId:A.sourceHandle,targetHandleId:A.targetHandle,markerEnd:A.markerEnd,markerStart:A.markerStart,sourceX:Ce,sourceY:Ue,targetX:ue,targetY:xe,sourcePosition:Z,targetPosition:V,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:v,onReconnectEnd:S,reconnectRadius:_,rfId:s,ariaLabel:A.ariaLabel,isFocusable:le,isReconnectable:me,pathOptions:"pathOptions"in A?A.pathOptions:void 0,interactionWidth:A.interactionWidth,disableKeyboardA11y:x})})))),j):null};$T.displayName="EdgeRenderer";var h3=b.memo($T);const f3=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function p3({children:e}){const t=it(f3);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function m3(e){const t=Kl(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const g3={[qe.Left]:qe.Right,[qe.Right]:qe.Left,[qe.Top]:qe.Bottom,[qe.Bottom]:qe.Top},OT=({nodeId:e,handleType:t,style:n,type:s=Ks.Bezier,CustomComponent:a,connectionStatus:l})=>{var I,$,B;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=it(b.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),g=(I=c==null?void 0:c[Nt])==null?void 0:I.handleBounds;let y=g==null?void 0:g[t];if(h===Va.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!c||!y)return null;const v=u?y.find(O=>O.id===u):y[0],S=v?v.x+v.width/2:(c.width??0)/2,_=v?v.y+v.height/2:c.height??0,j=((($=c.positionAbsolute)==null?void 0:$.x)??0)+S,x=(((B=c.positionAbsolute)==null?void 0:B.y)??0)+_,N=v==null?void 0:v.position,E=N?g3[N]:null;if(!N||!E)return null;if(a)return fe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:v,fromX:j,fromY:x,toX:f,toY:p,fromPosition:N,toPosition:E,connectionStatus:l});let C="";const R={sourceX:j,sourceY:x,sourcePosition:N,targetX:f,targetY:p,targetPosition:E};return s===Ks.Bezier?[C]=oT(R):s===Ks.Step?[C]=dv({...R,borderRadius:0}):s===Ks.SmoothStep?[C]=dv(R):s===Ks.SimpleBezier?[C]=aT(R):C=`M${j},${x} ${f},${p}`,fe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};OT.displayName="ConnectionLine";const y3=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function w3({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=it(y3,Dt);return!(a&&l&&u&&c)?null:fe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:Yt(["react-flow__connection",p])},fe.createElement(OT,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function kk(e,t){return b.useRef(null),At(),b.useMemo(()=>t(e),[e])}const PT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:v,onSelectionContextMenu:S,onSelectionStart:_,onSelectionEnd:j,connectionLineType:x,connectionLineStyle:N,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:R,selectionOnDrag:I,selectionMode:$,multiSelectionKeyCode:B,panActivationKeyCode:O,zoomActivationKeyCode:M,deleteKeyCode:L,onlyRenderVisibleElements:Y,elementsSelectable:D,selectNodesOnDrag:A,defaultViewport:Q,translateExtent:z,minZoom:te,maxZoom:J,preventScrolling:q,defaultMarkerColor:K,zoomOnScroll:P,zoomOnPinch:G,panOnScroll:he,panOnScrollSpeed:H,panOnScrollMode:U,zoomOnDoubleClick:Z,panOnDrag:V,onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:Ce,onPaneScroll:Ue,onPaneContextMenu:ue,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:De,onEdgeMouseLeave:ke,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:ot,reconnectRadius:re,noDragClassName:Ye,noWheelClassName:Ke,noPanClassName:ge,elevateEdgesOnSelect:_e,disableKeyboardA11y:Fe,nodeOrigin:Xe,nodeExtent:at,rfId:pt})=>{const se=kk(e,GP),Ae=kk(t,JP);return m3(l),fe.createElement(WP,{onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:Ce,onPaneContextMenu:ue,onPaneScroll:Ue,deleteKeyCode:L,selectionKeyCode:R,selectionOnDrag:I,selectionMode:$,onSelectionStart:_,onSelectionEnd:j,multiSelectionKeyCode:B,panActivationKeyCode:O,zoomActivationKeyCode:M,elementsSelectable:D,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:G,zoomOnDoubleClick:Z,panOnScroll:he,panOnScrollSpeed:H,panOnScrollMode:U,panOnDrag:V,defaultViewport:Q,translateExtent:z,minZoom:te,maxZoom:J,onSelectionContextMenu:S,preventScrolling:q,noDragClassName:Ye,noWheelClassName:Ke,noPanClassName:ge,disableKeyboardA11y:Fe},fe.createElement(p3,null,fe.createElement(h3,{edgeTypes:Ae,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:Y,onEdgeContextMenu:xe,onEdgeMouseEnter:ye,onEdgeMouseMove:De,onEdgeMouseLeave:ke,onReconnect:Ee,onReconnectStart:Ge,onReconnectEnd:ot,reconnectRadius:re,defaultMarkerColor:K,noPanClassName:ge,elevateEdgesOnSelect:!!_e,disableKeyboardA11y:Fe,rfId:pt},fe.createElement(w3,{style:N,type:x,component:E,containerStyle:C})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(KP,{nodeTypes:se,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:A,onlyRenderVisibleElements:Y,noPanClassName:ge,noDragClassName:Ye,disableKeyboardA11y:Fe,nodeOrigin:Xe,nodeExtent:at,rfId:pt})))};PT.displayName="GraphView";var v3=b.memo(PT);const gv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Hs={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:gv,nodeExtent:gv,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:GO,isValidConnection:void 0},x3=()=>iM((e,t)=>({...Hs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:Nf(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?Nf(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:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(g.transform),v=n.reduce((_,j)=>{const x=a.get(j.id);if(x!=null&&x.hidden)a.set(x.id,{...x,[Nt]:{...x[Nt],handleBounds:void 0}});else if(x){const N=Hv(j.nodeElement);!!(N.width&&N.height&&(x.width!==N.width||x.height!==N.height||j.forceUpdate))&&(a.set(x.id,{...x,[Nt]:{...x[Nt],handleBounds:{source:mk(".source",j.nodeElement,y,p),target:mk(".target",j.nodeElement,y,p)}},...N}),_.push({id:x.id,type:"dimensions",dimensions:N}))}return _},[]);NT(a,p);const S=c||l&&!c&&ST(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:S}),(v==null?void 0:v.length)>0&&(s==null||s(v))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=OP(n,u()),h=Nf(p,a,c,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,u=null;s?c=n.map(f=>Ys(f,!0)):(c=ri(l(),n),u=ri(a,[])),xu({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:l}=t();let c,u=null;s?c=n.map(f=>Ys(f,!0)):(c=ri(a,n),u=ri(l(),[])),xu({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),u=s||a,f=c.map(h=>(h.selected=!1,Ys(h.id,!1))),p=u.map(h=>Ys(h.id,!1));xu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),l=s().filter(u=>u.selected).map(u=>Ys(u.id,!1)),c=n.filter(u=>u.selected).map(u=>Ys(u.id,!1));xu({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Gv(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=as.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,l]],g=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Hs.connectionNodeId,connectionHandleId:Hs.connectionHandleId,connectionHandleType:Hs.connectionHandleType,connectionStatus:Hs.connectionStatus,connectionStartHandle:Hs.connectionStartHandle,connectionEndHandle:Hs.connectionEndHandle}),reset:()=>e({...Hs})}),Object.is),ex=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=x3()),fe.createElement(qO,{value:t.current},e)};ex.displayName="ReactFlowProvider";const LT=({children:e})=>b.useContext(fd)?fe.createElement(fe.Fragment,null,e):fe.createElement(ex,null,e);LT.displayName="ReactFlowWrapper";const b3={input:yT,default:pv,output:vT,group:Zv},k3={default:Qu,straight:Kv,step:Yv,smoothstep:pd,simplebezier:Vv},_3=[0,0],N3=[15,15],S3={x:0,y:0,zoom:1},j3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},DT=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:l=b3,edgeTypes:c=k3,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onConnect:v,onConnectStart:S,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:x,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:I,onNodeDragStart:$,onNodeDrag:B,onNodeDragStop:O,onNodesDelete:M,onEdgesDelete:L,onSelectionChange:Y,onSelectionDragStart:D,onSelectionDrag:A,onSelectionDragStop:Q,onSelectionContextMenu:z,onSelectionStart:te,onSelectionEnd:J,connectionMode:q=Va.Strict,connectionLineType:K=Ks.Bezier,connectionLineStyle:P,connectionLineComponent:G,connectionLineContainerStyle:he,deleteKeyCode:H="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:Z=!1,selectionMode:V=Dl.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:pe=Ku()?"Meta":"Control",zoomActivationKeyCode:me=Ku()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:Ue=N3,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:xe=!0,nodesDraggable:ye,nodesConnectable:De,nodesFocusable:ke,nodeOrigin:Ee=_3,edgesFocusable:Ge,edgesUpdatable:ot,elementsSelectable:re,defaultViewport:Ye=S3,minZoom:Ke=.5,maxZoom:ge=2,translateExtent:_e=gv,preventScrolling:Fe=!0,nodeExtent:Xe,defaultMarkerColor:at="#b1b1b7",zoomOnScroll:pt=!0,zoomOnPinch:se=!0,panOnScroll:Ae=!1,panOnScrollSpeed:Se=.5,panOnScrollMode:Te=Ua.Free,zoomOnDoubleClick:Be=!0,panOnDrag:kt=!0,onPaneClick:ut,onPaneMouseEnter:Re,onPaneMouseMove:ht,onPaneMouseLeave:wt,onPaneScroll:St,onPaneContextMenu:Et,children:Gn,onEdgeContextMenu:ln,onEdgeDoubleClick:Rr,onEdgeMouseEnter:mr,onEdgeMouseMove:Za,onEdgeMouseLeave:Ja,onEdgeUpdate:ta,onEdgeUpdateStart:eo,onEdgeUpdateEnd:Kt,onReconnect:na,onReconnectStart:Mr,onReconnectEnd:rn,reconnectRadius:Mn=10,edgeUpdaterRadius:gr=10,onNodesChange:ds,onEdgesChange:ra,noDragClassName:to="nodrag",noWheelClassName:no="nowheel",noPanClassName:sa="nopan",fitView:xn=!1,fitViewOptions:aa,connectOnClick:oa=!0,attributionPosition:ro,proOptions:so,defaultEdgeOptions:ia,elevateNodesOnSelect:ao=!0,elevateEdgesOnSelect:Ir=!1,disableKeyboardA11y:la=!1,autoPanOnConnect:Ci=!0,autoPanOnNodeDrag:lt=!0,connectionRadius:oo=20,isValidConnection:yr,onError:ca,style:$r,id:Vn,nodeDragThreshold:io,...Or},sn)=>{const ua=Vn||"1";return fe.createElement("div",{...Or,style:{...$r,...j3},ref:sn,className:Yt(["react-flow",a]),"data-testid":"rf__wrapper",id:Vn},fe.createElement(LT,null,fe.createElement(v3,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:I,nodeTypes:l,edgeTypes:c,connectionLineType:K,connectionLineStyle:P,connectionLineComponent:G,connectionLineContainerStyle:he,selectionKeyCode:U,selectionOnDrag:Z,selectionMode:V,deleteKeyCode:H,multiSelectionKeyCode:pe,panActivationKeyCode:le,zoomActivationKeyCode:me,onlyRenderVisibleElements:ue,selectNodesOnDrag:xe,defaultViewport:Ye,translateExtent:_e,minZoom:Ke,maxZoom:ge,preventScrolling:Fe,zoomOnScroll:pt,zoomOnPinch:se,zoomOnDoubleClick:Be,panOnScroll:Ae,panOnScrollSpeed:Se,panOnScrollMode:Te,panOnDrag:kt,onPaneClick:ut,onPaneMouseEnter:Re,onPaneMouseMove:ht,onPaneMouseLeave:wt,onPaneScroll:St,onPaneContextMenu:Et,onSelectionContextMenu:z,onSelectionStart:te,onSelectionEnd:J,onEdgeContextMenu:ln,onEdgeDoubleClick:Rr,onEdgeMouseEnter:mr,onEdgeMouseMove:Za,onEdgeMouseLeave:Ja,onReconnect:na??ta,onReconnectStart:Mr??eo,onReconnectEnd:rn??Kt,reconnectRadius:Mn??gr,defaultMarkerColor:at,noDragClassName:to,noWheelClassName:no,noPanClassName:sa,elevateEdgesOnSelect:Ir,rfId:ua,disableKeyboardA11y:la,nodeOrigin:Ee,nodeExtent:Xe}),fe.createElement(mP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:S,onConnectEnd:_,onClickConnectStart:j,onClickConnectEnd:x,nodesDraggable:ye,nodesConnectable:De,nodesFocusable:ke,edgesFocusable:Ge,edgesUpdatable:ot,elementsSelectable:re,elevateNodesOnSelect:ao,minZoom:Ke,maxZoom:ge,nodeExtent:Xe,onNodesChange:ds,onEdgesChange:ra,snapToGrid:Ce,snapGrid:Ue,connectionMode:q,translateExtent:_e,connectOnClick:oa,defaultEdgeOptions:ia,fitView:xn,fitViewOptions:aa,onNodesDelete:M,onEdgesDelete:L,onNodeDragStart:$,onNodeDrag:B,onNodeDragStop:O,onSelectionDrag:A,onSelectionDragStart:D,onSelectionDragStop:Q,noPanClassName:sa,nodeOrigin:Ee,rfId:ua,autoPanOnConnect:Ci,autoPanOnNodeDrag:lt,onError:ca,connectionRadius:oo,isValidConnection:yr,nodeDragThreshold:io}),fe.createElement(fP,{onSelectionChange:Y}),Gn,fe.createElement(BO,{proOptions:so,position:ro}),fe.createElement(xP,{rfId:ua,disableKeyboardA11y:la})))});DT.displayName="ReactFlow";const E3=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function qT(){return it(E3,Dt)}const FT=({id:e,x:t,y:n,width:s,height:a,style:l,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:y,selected:v})=>{const{background:S,backgroundColor:_}=l||{},j=c||S||_;return fe.createElement("rect",{className:Yt(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:j,stroke:u,strokeWidth:f,shapeRendering:g,onClick:y?x=>y(x,e):void 0})};FT.displayName="MiniMapNode";var C3=b.memo(FT);const T3=e=>e.nodeOrigin,A3=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Cf=e=>e instanceof Function?e:()=>e;function R3({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:l=C3,onClick:c}){const u=it(A3,Dt),f=it(T3),p=Cf(t),h=Cf(e),g=Cf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,u.map(v=>{const{x:S,y:_}=Ha(v,f).positionAbsolute;return fe.createElement(l,{key:v.id,x:S,y:_,width:v.width,height:v.height,style:v.style,selected:v.selected,className:g(v),color:p(v),borderRadius:s,strokeColor:h(v),strokeWidth:a,shapeRendering:y,onClick:c,id:v.id})}))}var M3=b.memo(R3);const I3=200,$3=150,O3=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?WO(md(t,e.nodeOrigin),n):n,rfId:e.rfId}},P3="react-flow__minimap-desc";function BT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:y,onNodeClick:v,pannable:S=!1,zoomable:_=!1,ariaLabel:j="React Flow mini map",inversePan:x=!1,zoomStep:N=10,offsetScale:E=5}){const C=At(),R=b.useRef(null),{boundingRect:I,viewBB:$,rfId:B}=it(O3,Dt),O=(e==null?void 0:e.width)??I3,M=(e==null?void 0:e.height)??$3,L=I.width/O,Y=I.height/M,D=Math.max(L,Y),A=D*O,Q=D*M,z=E*D,te=I.x-(A-I.width)/2-z,J=I.y-(Q-I.height)/2-z,q=A+z*2,K=Q+z*2,P=`${P3}-${B}`,G=b.useRef(0);G.current=D,b.useEffect(()=>{if(R.current){const U=Fn(R.current),Z=pe=>{const{transform:me,d3Selection:Ce,d3Zoom:Ue}=C.getState();if(pe.sourceEvent.type!=="wheel"||!Ce||!Ue)return;const ue=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*N,xe=me[2]*Math.pow(2,ue);Ue.scaleTo(Ce,xe)},V=pe=>{const{transform:me,d3Selection:Ce,d3Zoom:Ue,translateExtent:ue,width:xe,height:ye}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!Ce||!Ue)return;const De=G.current*Math.max(1,me[2])*(x?-1:1),ke={x:me[0]-pe.sourceEvent.movementX*De,y:me[1]-pe.sourceEvent.movementY*De},Ee=[[0,0],[xe,ye]],Ge=as.translate(ke.x,ke.y).scale(me[2]),ot=Ue.constrain()(Ge,Ee,ue);Ue.transform(Ce,ot)},le=KC().on("zoom",S?V:null).on("zoom.wheel",_?Z:null);return U.call(le),()=>{U.on("zoom",null)}}},[S,_,x,N]);const he=y?U=>{const Z=ar(U);y(U,{x:Z[0],y:Z[1]})}:void 0,H=v?(U,Z)=>{const V=C.getState().nodeInternals.get(Z);v(U,V)}:void 0;return fe.createElement(Wv,{position:g,style:e,className:Yt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:O,height:M,viewBox:`${te} ${J} ${q} ${K}`,role:"img","aria-labelledby":P,ref:R,onClick:he},j&&fe.createElement("title",{id:P},j),fe.createElement(M3,{onClick:H,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${te-z},${J-z}h${q+z*2}v${K+z*2}h${-q-z*2}z
|
|
57
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}BT.displayName="MiniMap";var L3=b.memo(BT);function D3(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function q3(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function F3(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function B3(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function z3(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Er=({children:e,className:t,...n})=>fe.createElement("button",{type:"button",className:Yt(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const U3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),zT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const y=At(),[v,S]=b.useState(!1),{isInteractive:_,minZoomReached:j,maxZoomReached:x}=it(U3,Dt),{zoomIn:N,zoomOut:E,fitView:C}=Kl();if(b.useEffect(()=>{S(!0)},[]),!v)return null;const R=()=>{N(),l==null||l()},I=()=>{E(),c==null||c()},$=()=>{C(a),u==null||u()},B=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return fe.createElement(Wv,{className:Yt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&fe.createElement(fe.Fragment,null,fe.createElement(Er,{onClick:R,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:x},fe.createElement(D3,null)),fe.createElement(Er,{onClick:I,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:j},fe.createElement(q3,null))),n&&fe.createElement(Er,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},fe.createElement(F3,null)),s&&fe.createElement(Er,{className:"react-flow__controls-interactive",onClick:B,title:"toggle interactivity","aria-label":"toggle interactivity"},_?fe.createElement(z3,null):fe.createElement(B3,null)),h)};zT.displayName="Controls";var W3=b.memo(zT),ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ur||(ur={}));function H3({color:e,dimensions:t,lineWidth:n}){return fe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function G3({color:e,radius:t}){return fe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const V3={[ur.Dots]:"#91919a",[ur.Lines]:"#eee",[ur.Cross]:"#e2e2e2"},Y3={[ur.Dots]:1,[ur.Lines]:1,[ur.Cross]:6},K3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function UT({id:e,variant:t=ur.Dots,gap:n=20,size:s,lineWidth:a=1,offset:l=2,color:c,style:u,className:f}){const p=b.useRef(null),{transform:h,patternId:g}=it(K3,Dt),y=c||V3[t],v=s||Y3[t],S=t===ur.Dots,_=t===ur.Cross,j=Array.isArray(n)?n:[n,n],x=[j[0]*h[2]||1,j[1]*h[2]||1],N=v*h[2],E=_?[N,N]:x,C=S?[N/l,N/l]:[E[0]/l,E[1]/l];return fe.createElement("svg",{className:Yt(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},fe.createElement("pattern",{id:g+e,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},S?fe.createElement(G3,{color:y,radius:N/l}):fe.createElement(H3,{dimensions:E,color:y,lineWidth:a})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}UT.displayName="Background";var X3=b.memo(UT);const Q3=["us-gov","global","apac","us","eu","jp","au"],Z3=new RegExp(`^(?:(?:${Q3.join("|")})\\.)?anthropic\\.`,"i");function Xl(e){return e.replace(Z3,"")}const J3=["command","cmd","file_path","path","url","pattern","notebook_path"],_k=120,Tf=e=>e.length>_k?`${e.slice(0,_k-1)}…`:e;function eL(e){if(typeof e=="string")return e.trim()?Tf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of J3){const s=t[n];if(typeof s=="string"&&s.trim())return Tf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return Tf(a)}}return null}function WT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function tx(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 tL(e){const t=tx(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 nL(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]=tL(s));return Object.keys(t).length?t:void 0}function HT(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),...tx(n)};for(const s of Object.values(n)){const a=HT(s,t+1);if(a)return a}return null}const rL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function GT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&rL.test(Xl(n.model)))return n.model;for(const s of Object.values(n)){const a=GT(s,t+1);if(a)return a}return null}function yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Qs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Nk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Ql(e,t){return`${e}::${t}`}function Zu(e){return e.agent_type??e.subagent_type??"subagent"}function Al(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function si(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:WT()},e.agents.set(a,l),l)}function VT(e,t,n,s){const a=Ql(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&s.cwd&&(l.cwd=s.cwd,l.cwdBasename=Qs(s.cwd));const c=Zu(s);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function sL(e,t,n){const s=t.session_id??"unknown",a=Al(t);if(a){const f=VT(e,s,a,t);if(f)return f}const l=e.activeSubagentStack.get(s),c=l&&l.length>0?l[l.length-1]:null;if(c){const f=e.agents.get(Ql(s,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Qs(t.cwd)),f}const u=si(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Qs(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Qs(t.cwd)??"session"),u}function aL(e,t,n,s,a){const l=Ql(t,n),c=si(e,t,a,!0);let u=e.agents.get(l);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Qs(s.cwd));const f=Zu(s);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:l,sessionId:t,label:Zu(s),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Qs(s.cwd),toolCount:0,childCount:0,usage:WT()},e.agents.set(l,u),c.childCount+=1,u}function oL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function iL(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 ku(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 Sk=200,lL=25;function cL(e,t){const n=t.tools;if(n.length>Sk){const s=n.splice(0,n.length-Sk);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-lL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function uL(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 jk=2e3;function dL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-jk)return!1;if(a.text===n&&a.at<=t+jk)return!0}return!1}function YT(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 Zl(e,t){return t&&(e.revision+=1),t}function hL(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,h]of e.agents){if(h.parentId!=null){const g=c.get(h.parentId);g?g.push(p):c.set(h.parentId,[p])}a(h)&&l.push({id:p,endedAt:h.endedAt})}if(l.length===0)return!1;l.sort((p,h)=>p.endedAt-h.endedAt);let u=0;const f=p=>{const h=e.agents.get(p);h&&(YT(e,h),e.agents.delete(p),u++)};for(const p of l){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const h=(c.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!h.some(g=>!a(g))){for(const g of h)f(g.id);f(p.id)}}return Zl(e,u>0)}function fL(e,t,n,s){const a=new Map;for(const[p,h]of e.agents){let g=a.get(h.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},a.set(h.sessionId,g)),g.ids.push(p),h.kind==="root"&&h.closedAt!=null&&(g.closed=!0),h.state==="done"&&h.endedAt!=null?g.endedAt=Math.max(g.endedAt,h.endedAt):g.live=!0}const l=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,h)=>p.closed===h.closed?p.endedAt-h.endedAt:p.closed?-1:1);let u=[...a.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let f=!1;for(const p of l){if(u<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&YT(e,g),e.agents.delete(h)}u--,f=!0}return Zl(e,f)}function pL(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 mL(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 Zl(e,t)}function gL(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 u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return Zl(e,s)}const Ek=90*6e4;function yL(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 Zl(e,s)}function wL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const vL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function xL(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 bL=3e4;function kL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>bL)&&!(e.startedAt>t))return{name:e.name,preview:eL(e.input)??""}}function _L(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const l=xL(e,t),c={kind:n,message:s,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=kL(l,a);return u&&(c.tool=u),c}function NL(e,t,n){if(e.kind==="idle")return!0;const s=Al(t);return s==null?!0:e.subagentId!=null&&Ql(n,s)===e.subagentId}function Ck(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{...yv(),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(!vL.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&NL(h.waiting,s,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??Nk(),currentContextTokens:s.context_tokens})}if(l==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,v]of Object.entries(g)){if(typeof v!="string")continue;const S=`${c}::${y}`,_=e.agents.get(S);_&&(_.model=v)}return e}if(l==="ContextObserved"){const h=s.context??null;if(h){const g=e.agents.get(c);if(g){const y=g.context??Nk(),v=(_,j)=>typeof h[_]=="number"?h[_]:j,S=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.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:S??y.memoryFiles}}}return e}if(l==="SessionNamed"){const h=e.agents.get(c);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),y&&(h.sessionTitle=y);const v=h.sessionName??"";h.sessionTitle&&v&&h.sessionTitle.toLowerCase()===v.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(l==="UsageObserved"){const h=s.usage??null;if(h){const g=e.agents.get(c);if(g){g.usage.inputTokens=Number(h.input_tokens??0),g.usage.outputTokens=Number(h.output_tokens??0),g.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=tx(h);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=nL(s.usageByModel)}}return e}const f=sL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=GT(s);switch(p&&(f.model=p),l){case"SessionStart":{const h=si(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.startedAt=h.startedAt||a,!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=Qs(s.cwd)),h.label==="session"&&s.cwd&&(h.label=Qs(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=si(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!dL(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=ku(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?uL(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=ku(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,y=Al(s),v={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:ku(s.tool_input),agentId:f.id,explicitSubagentId:y?Ql(c,y):void 0,startedAt:a};f.tools.push(v),f.toolCount+=1,f.state="active",e.toolIndex.set(g,v),e.toolOwner.set(g,f.id),cL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),y=!1;if(!g)for(const S of e.agents.values()){const _=S.tools.find(j=>j.id===h);if(_){g=_,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=a,g.ok=l==="PostToolUse",g.trimmed||(g.response=s.tool_response),l==="PostToolUseFailure"?g.errorPreview=ku(s.tool_response):y&&(g.errorPreview=void 0);const v=HT(s.tool_response);v&&(g.usage=v),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=Al(s);if(!h)break;const g=aL(e,c,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const y=Zu(s);y&&(g.label=y),oL(e,c,h);break}case"SubagentStop":{const h=Al(s);if(!h)break;const g=VT(e,c,h,s);if(!g)break;g.state="done",g.endedAt=a,iL(e,c,h);break}case"Stop":case"SessionEnd":{const h=si(e,c,a,!1);h.state="done",h.endedAt=a;for(const g of h.provider==="codex"?[]:h.tools)g.endedAt==null&&(g.endedAt=a,g.ok=!1,g.errorPreview=g.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(g.id),e.toolOwner.delete(g.id));l==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=wL(s.notification_type);if(!h)break;const g=si(e,c,a,!1),y=typeof s.message=="string"?s.message:"",v=g.waiting;g.waiting=v&&v.kind===h&&v.message===y?{...v,since:Math.min(v.since,a)}:_L(e,c,h,y,a);break}}return e}function nx(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 SL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},jL=[{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:SL},{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 EL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function bi(e,t=Date.now()){if(!e)return null;const n=Xl(e);for(const s of jL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function KT(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 XT(e,t,n=Date.now()){if(!EL(t))return e.inputTokens;const s=bi(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 rx(e,t,n=Date.now()){const s=bi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=XT(e,t,n)*s.input/1e6,l=e.outputTokens*s.output/1e6,c=e.cacheReadTokens*s.cacheRead/1e6,u=KT(e,s),f=u.usd5m+u.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:f,total:a+l+c+f}}const Tk=2e5,CL=1e6,TL=[/\[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],AL=[{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 RL(e){if(!e)return Tk;const t=Xl(e);for(const n of TL)if(n.test(t))return CL;for(const n of AL)if(n.match.test(t))return n.window;return Tk}function QT(e,t){return typeof e=="number"&&e>0?e:RL(t)}const ni="not priced";function Je(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 sx(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Je(s)}/min`:`${Je(n*3600)}/hr`}function ML(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 IL(e,t){let n=0,s=0,a=0,l=0,c=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,l+=g.cacheCreateTokens,c+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const f=(g,y)=>Math.max(0,g-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Jl(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=IL(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:ML(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 Jl(e)){const a=rx(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 wv(e,t=Date.now()){let n=0;for(const s of Jl(e))bi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function ZT(e){const t=[];for(const n of Jl(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 JT(e){return ZT(e).filter(t=>t!==e.model)}const $L=new Set(["untrusted","on-request","on-failure"]);function OL(e){return typeof e!="string"||!e?null:$L.has(e)?!0:e==="never"?!1:null}function PL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=OL(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 Ak(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Zs(e){const t=Xl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=Ak(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(Ak);return[`GPT-${a}`,...l].join(" ")}return e}function gd(e){const t=Xl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function ec(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function LL(e){const t=[];for(const n of e)n.kind==="root"&&ec(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 DL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function yd(e,t){return`${e}@${t.since}`}function e2(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 qL(e){const t=e.message||"Needs your permission",n=e2(e,t);return n?`${t}
|
|
60
|
-
Likely on: ${n}`:t}function FL(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const l of e){if(!ec(l.waiting))continue;const c=yd(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:qL(l.waiting),sessionId:l.id})}return a}function BL(e,t,n){const s=new Set;for(const l of e)s.add(yd(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 Rk(e){return new Set(e.map(t=>yd(t.id,t.waiting)))}function zL(e,t){return e!==t}function Tt(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 Ju(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 t2(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 n2(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 UL=1;function WL(){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 ed=WL();function HL(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Mk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function GL(e,t){return!e||!e.isConnected||Mk(e)?!1:t==null||Mk(t)}const Ik="a[href], button, input, select, textarea, [tabindex]";function VL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function YL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function KL({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 ax(e){return e.ctrlKey||e.metaKey||e.altKey}const XL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),QL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),ZL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function r2(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function ox(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=r2(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!XL.has(String(e.type??"text").toLowerCase())}function JL(e){if(!e)return!1;if(ox(e)||QL.has(r2(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>ZL.has(n))}function e4({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function s2(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(Ik))return VL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&YL({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(Ik)!=null})}):[]}function t4(e,t){const n=s2(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=b.useRef(null),l=b.useRef(e);l.current=e;const c=b.useRef(null);c.current===null&&(c.current=()=>l.current());const u=c.current;return b.useEffect(()=>ed.push(u,s),[u,s]),b.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??s2(a.current)[0])==null||p.focus(),()=>{GL(f,document.activeElement)&&f.focus()}},[]),b.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||ax(p))return;const h=a.current;if(!h)return;const g=document.activeElement;if(!(g!=null&&h.contains(g))&&!ed.isTop(u))return;const v=t4(h,g),S=KL({count:v.length,index:g?v.indexOf(g):-1,shiftKey:p.shiftKey});S.kind!=="allow"&&(p.preventDefault(),S.kind==="focus"&&((_=v[S.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function n4(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 qn(e){return e.toLocaleString()}function r4(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const s4=60;function a4(e,t=s4){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 o4({agent:e,onClose:t}){var y;const n=b.useRef(null),s=Ut(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=QT(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=An(e),h=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens,g=n4(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:g.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(f),children:i.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),i.jsxs("div",{className:"ctx-window-meta",children:[i.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),i.jsxs("span",{children:[qn(c)," / ",qn(u)," tok (",g.windowScope,")"]})]})]}),i.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),i.jsxs("div",{className:"ctx-grid",children:[i.jsx(sr,{label:"input tokens",val:qn(l.inputTokens)}),i.jsx(sr,{label:"output tokens",val:qn(l.outputTokens)}),i.jsx(sr,{label:"cache reads",val:qn(l.cacheReadTokens)}),i.jsx(sr,{label:"cache writes",val:qn(l.cacheCreateTokens)}),i.jsx(sr,{label:"cumulative total",val:qn(h)}),i.jsx(sr,{label:"estimated cost",val:Je(p.total),accent:!0})]}),i.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?i.jsxs("div",{className:"ctx-grid",children:[i.jsx(sr,{label:"user messages",val:qn((a==null?void 0:a.msgsUser)??0)}),i.jsx(sr,{label:"assistant messages",val:qn((a==null?void 0:a.msgsAssistant)??0)}),i.jsx(sr,{label:"tool uses",val:qn((a==null?void 0:a.toolUses)??0)}),i.jsx(sr,{label:"tool results",val:qn((a==null?void 0:a.toolResults)??0)}),i.jsx(sr,{label:"system-reminders",val:qn((a==null?void 0:a.systemReminders)??0)})]}):i.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),i.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?i.jsx("div",{className:"ctx-empty",children:g.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:a4(v.path)}),i.jsx("span",{className:"ctx-md-size",children:r4(v.bytes)})]},v.path))})]})})}function sr({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 i4({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const l=QT(n,t),c=Math.min(1,e/l),u=s/2-3,f=s/2,p=2*Math.PI*u,h=p*c,g=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:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),i.jsx("circle",{cx:f,cy:f,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),i.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function $k(e,t){const n=bi(t);if(!n)return`model: ${t}
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,l=rx(e,t),c=KT(e,n),u=c.tokens1h>0?[`cache w5m${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(c.usd5m)}`,`cache w1h${s(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Je(c.usd1h)}`]:[`cache w ${s(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(c.usd5m)}`],f=XT(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${Je(l.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${Je(l.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${Je(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Je(l.total)}`].join(`
|
|
62
|
-
`)}function Ok(e){const t=Jl(e);return t.length<=1?$k(e.usage,e.model):[...t.map(n=>$k(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Je(An(e).total)}`].join(`
|
|
63
|
-
`)}function l4({data:e,selected:t}){var v;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(S=>!S.endedAt).length,l=e.tools.filter(S=>S.ok===!1).length,c=nx(e.sessionId),u=((v=e.context)==null?void 0:v.currentContextTokens)??0,f=e.kind==="root"&&u>0,p=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,h=JT(e),g=h.length>0?`${e.model}
|
|
65
|
-
spend on this card also covers:
|
|
66
|
-
${h.join(`
|
|
67
|
-
`)}`:e.model,y=n2(e.sessionName,e.sessionTitle);return i.jsxs("div",{className:s,style:{"--session-hue":c},children:[i.jsx("span",{className:"accent-stripe"}),i.jsx(mi,{type:"target",position:qe.Left,style:{background:"transparent",border:"none"}}),i.jsxs("div",{className:"head",children:[i.jsxs("div",{className:"title",children:[i.jsx(c4,{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:[f&&e.onOpenContext&&i.jsx(i4,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),i.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Ju(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":gd(e.model),title:g,children:[Zs(e.model),h.length>0?` +${h.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(h4,{waiting:e.waiting,now:n}),(()=>{const S=PL(e);return S?i.jsxs("div",{className:"approval-blind-row",title:S.detail,children:[i.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),i.jsx("span",{className:"approval-blind-said",children:S.label})]}):null})(),e.tools.length>0&&i.jsx(f4,{tools:e.tools,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:Tt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const S=bi(e.model),_=An(e),j=wv(e);if(!S&&_.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:i.jsx("span",{className:"cost-unpriced",title:Ok(e),children:ni});if(_.total<=0)return null;const x=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),N=e.state==="active"?sx(_.total,x):null,E=Ok(e)+(N?`
|
|
68
|
-
burn: ${N}`:"");return i.jsx("span",{className:"cost-meta",title:E,children:i.jsxs("b",{children:[Je(_.total),j>0?"+":""]})})})()]}),i.jsx(mi,{type:"source",position:qe.Right,style:{background:"transparent",border:"none"}})]})}function td(e){return e==="active"?"live":e==="done"?"done":"err"}function c4({state:e}){return i.jsx("span",{className:`state-pill state-${e}`,children:td(e)})}function Fl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function u4(e,t){const n=e2(e,t);return n?`Likely on: ${n}`:null}function d4(e){return e.kind==="idle"?"Your turn":Fl(e)}function h4({waiting:e,now:t}){const n=ec(e),s=Fl(e);return i.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
-
Blocked for ${Ju(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:d4(e)}),i.jsx("b",{children:Ju(e.since,void 0,t)})]})}function f4({tools:e,now:t}){const l=new Array(24).fill(0);let c=0;for(const S of e){const _=t-S.startedAt;if(_<0||_>=6e4)continue;const j=23-Math.floor(_/2500);j>=0&&j<24&&(l[j]+=1,c+=1)}const u=4,f=Math.max(0,...l),p=132,h=14,g=p/24,y=f/(2500/1e3),v=c===0?"no tool calls in the last 60s":`${c} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return i.jsxs("div",{className:"tool-spark-row",title:v,children:[i.jsx("svg",{className:"tool-spark",width:p,height:h,viewBox:`0 0 ${p} ${h}`,"aria-hidden":!0,children:l.map((S,_)=>{const j=S===0?1.5:Math.max(1.5,Math.min(1,S/u)*h),x=_===23&&S>0,E=`tool-spark-bar${S>0?" active":""}${x?" latest":""}`;return i.jsx("rect",{x:_*g+.4,y:h-j,width:Math.max(.5,g-1),height:j,rx:.8,className:E},_)})}),i.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Pk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function p4({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:t2(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:Pk(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…)":Pk(e.response??e.errorPreview)})]})]})]})})}const _u=18,Lk=26,m4=12;function g4(e){return y4(e.nodeInternals.values())}function y4(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,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(l.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),l.kind==="root"&&(h.label=Fk(l)??h.label),l.kind==="root"&&(h.name=Bk(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:Fk(l)??l.sessionId,name:Bk(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,...x4(l.label,l.name,a,c),x:l.minX-_u,y:l.minY-_u-Lk,w:l.maxX-l.minX+_u*2,h:l.maxY-l.minY+_u*2+Lk})}return s}const vv=" · ",w4=32,v4=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function Dk(e){return v4.test(e)?2:1}function qk(e,t=w4){const n=[...e];let s=0;for(const c of n)s+=Dk(c);if(s<=t)return e;const a=[];let l=0;for(const c of n){const u=Dk(c);if(l+u>t-1)break;a.push(c),l+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function x4(e,t,n,s){const a=(t==null?void 0:t.trim())??"",l=s?b4(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:qk(e),name:a?qk(a):void 0,shortId:l,fullLabel:c.join(vv)}}function b4(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function Fk(e){if(e.kind==="root")return e.label}function Bk(e){if(e.kind==="root")return n2(e.sessionName,e.sessionTitle).face}function k4({onFit:e}){const{x:t,y:n,zoom:s}=qT(),a=Kl(),l=it(g4,_4);if(l.length<=1)return null;const c=f=>{try{const p=a.getNodes().filter(h=>{const g=h.data;return(g==null?void 0:g.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${s})`};return i.jsx("div",{className:"session-clusters",style:u,children:l.map(f=>{const p=nx(f.sessionId),h={position:"absolute",left:f.x,top:f.y,width:f.w,height:f.h,"--session-hue":p},g={position:"absolute",left:f.x+16,top:f.y-m4,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return i.jsxs(fe.Fragment,{children:[i.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),i.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${f.fullLabel}
|
|
70
|
-
drag the wrapper to move the whole session`,onClick:()=>c(f.sessionId),children:[f.label,f.name?i.jsxs(i.Fragment,{children:[vv,i.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?i.jsx("span",{className:"cluster-label-id",children:vv+f.shortId}):null]})]},f.sessionId)})})}function _4(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 N4({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 tc={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},S4=Object.fromEntries(Object.entries(tc).map(([e,t])=>[e,t.category])),j4=Object.fromEntries(Object.entries(tc).map(([e,t])=>[e,t.emoji])),E4=Object.fromEntries(Object.entries(tc).map(([e,t])=>[e,t.label])),C4=new Set(Object.keys(tc)),T4=new Set(Object.entries(tc).filter(([,e])=>e.shell).map(([e])=>e)),zk={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",...S4};function a2(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(zk,e)?zk[e]:"other"}const A4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,R4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function M4(e){if(typeof e!="string"||!e)return null;const t=A4.exec(e);if(t){const s=I4(t[2]);if(s.trim())return s}const n=R4.exec(e);return n?n[1]:null}function I4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const o2=600,$4=4,O4=36,xv=16,P4=60,L4=6,Uk=220,Wk=96,D4=28,Hk={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:"📡",...j4};function Gk(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Hk,e)?Hk[e]:"✨"}const Vk={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 i2(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 i2(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 q4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=M4(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 F4=new Set(["Bash","PowerShell",...T4]),B4=C4;function z4(e,t){return B4.has(e)||e.startsWith("mcp__")?Math.max(Wk,34+t.length*7.5):Wk}function U4(e,t){if(!F4.has(e))return null;const n=q4(t);if(!n)return null;const s=i2(n);return s?{emoji:Object.hasOwn(Vk,s)?Vk[s]:"⚙️",label:s,category:"shell",detail:n}:null}const W4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Yk={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:"🗄️"},Kk={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 H4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function G4(e){const t=e.toLowerCase();if(Object.hasOwn(Kk,t))return Kk[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(Yk,s))return Yk[s]}return"📄"}function V4(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 Y4(e,t){if(!W4.has(e))return null;const n=V4(e,t);if(!n)return null;const s=H4(n);return s?{emoji:e==="LS"?"📂":G4(s),label:s,category:"file",detail:n}:null}const Xk={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 ix(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 K4(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 l2(e){const t=e.toLowerCase();return Object.hasOwn(Xk,t)?Xk[t]:void 0}function X4(e,t){const n=ix(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const l=l2(s);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${s} · ${a}`}}function Q4(e,t){return U4(e,t)??Y4(e,t)??X4(e)}const Qk=E4,Zk=18;function Z4(e){const t=[...e];return t.length<=Zk?e:t.slice(0,Zk-1).join("")+"…"}function c2(e){const t=ix(e);if(t){const s=l2(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:Z4(t.server),hue:K4(t.server)}}const n=Object.hasOwn(Qk,e)?Qk[e]:"";return n?{emoji:Gk(e),label:n}:{emoji:Gk(e),label:e}}function J4(e){let t=null,n="";for(const s of e){const a=ix(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 e5(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function t5(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/o2)}function n5(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 r5(e,t,n,s,a,l){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&l-u.exitAt>o2)continue;const f=s.get(u.id)??n.get(u.id);if(!f)continue;const p=n5(u.tools,$4);if(p.length===0)continue;const h=u.exitAt??null,g=a.get(u.id),y=Math.max((g==null?void 0:g.width)??Uk,Uk),v=(g==null?void 0:g.height)??130,S=f.x,_=f.y,j=S+y,x=_+v/2;p.forEach((N,E)=>{const C=E*O4,R=S+y+P4,I=_+L4+C,$=t5(l,h),B=N.inputPreview??"",O=e5(N),M=$<.999,L=c2(N.name);c.push({id:`${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:L.label,emoji:L.emoji,status:O,category:a2(N.name),mcpHue:L.hue,inputPreview:B,fade:$,fading:M,worldX:R,worldY:I,anchorX:j,anchorY:x,spawnDx:j-R,spawnDy:x-(I+xv)});const Y=Q4(N.name,N.input);if(Y){const D=z4(N.name,L.label),A=R+D+D4,Q=I,z=R+D,te=I+xv;c.push({id:`sub:${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:Y.label,emoji:Y.emoji,isSub:!0,status:O,category:Y.category,inputPreview:Y.detail??B,fade:$,fading:M,worldX:A,worldY:Q,anchorX:z,anchorY:te,spawnDx:z-A,spawnDy:0})}})}return c}function s5({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=r5(e,t,n,s,a,u),h=c&&c.size>0?p.filter(g=>!c.has(g.category)):p;return i.jsx(a5,{bursts:h,spotlight:l,onOpenTool:f})}function a5({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:l}=qT();return i.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[i.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*l+s,f=c.anchorY*l+a,p=(c.worldX+6)*l+s,h=(c.worldY+xv)*l+a,g=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/g),v=u+g*(.55-.22*y),S=t!=null&&!t.has(c.agentId),_=c.fade*(S?.14:1);return i.jsx("path",{d:`M ${u} ${f} Q ${v} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const u=c.worldX*l+s,f=c.worldY*l+a,p={left:`${u}px`,top:`${f}px`,transform:`scale(${l})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},h=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,g=c.inputPreview?`${h} · ${c.inputPreview}`:h,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:g,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 o5(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 u=An(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,s+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:l,sum:n+s}}const i5="spend on this board",l5="on this board",Jk=`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.`,u2="session spend";function lx({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(l,c,u)=>{if(l<=0)return null;const f=l/n*100;return i.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${Je(l)} (${f.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=b.useMemo(()=>u5(e,t),[e,t]),a=b.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:u2}),i.jsx("div",{className:"ss-cost",children:Je(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":gd(c),title:c,children:Zs(c)},c))})]}),i.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&i.jsxs(i.Fragment,{children:[i.jsx(lx,{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:Je(s.cost.input)})]}),i.jsxs("span",{className:"ssl ssl-out",children:["output ",i.jsx("b",{children:Je(s.cost.output)})]}),i.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",i.jsx("b",{children:Je(s.cost.cacheRead)})]}),i.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",i.jsx("b",{children:Je(s.cost.cacheWrite)})]})]})]})})]}),i.jsxs("section",{className:"ss-stats",children:[i.jsx(Zo,{label:"agents",value:s.agentCount}),i.jsx(Zo,{label:"subagents",value:s.subagentCount}),i.jsx(Zo,{label:"tool calls",value:s.toolCount}),i.jsx(Zo,{label:"prompts",value:s.promptCount}),i.jsx(Zo,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&i.jsx(Zo,{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,u])=>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:`${u/s.topTools[0][1]*100}%`}})}),i.jsx("span",{className:"ss-tt-count",children:u})]},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 Zo({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 u5(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 u=0,f=0,p=0,h=0,g=0,y,v=1/0,S=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 R of ZT(E))l.add(R);E.model&&l.add(E.model),E.kind==="subagent"&&g++,f+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,v=Math.min(v,E.startedAt),S=Math.max(S,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const _=Math.max(0,S-v),j=Math.floor(_/1e3),x=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,N=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:x,cost:a,modelChips:Array.from(l),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:N,firstPrompt:y}}function e1(e){return e.waiting?ec(e.waiting)?0:1:e.state==="active"?2:3}function d5(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 u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;a+=u.toolCount,l+=An(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:a,cost:l,startedAt:s.startedAt,lastActivity:c})}return n.sort((s,a)=>{const l=e1(s),c=e1(a);return l!==c?l-c:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function t1(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 h5({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const l=b.useMemo(()=>d5(e),[e,e.revision,t]),c=l.filter(f=>f.state==="active").length,u=l.filter(f=>ec(f.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})]}),u>0&&i.jsxs("span",{className:"sl-waiting-count",children:[u," 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(f=>{const p=n.has(f.sessionId);return i.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[i.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:td(f.state)}),i.jsxs("div",{className:"sl-row-body",children:[i.jsxs("div",{className:"sl-row-head",children:[i.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&i.jsx("span",{className:"model-chip","data-family":gd(f.modelId),title:f.modelId,children:Zs(f.modelId)})]}),i.jsxs("div",{className:"sl-row-meta",children:[i.jsxs("span",{title:"tool calls",children:[i.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&i.jsx("span",{className:"sl-cost",title:u2,children:i.jsx("b",{children:Je(f.cost)})}),f.waiting?i.jsxs("span",{className:"sl-waiting",title:[Fl(f.waiting),u4(f.waiting,Fl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
-
`),children:["waiting ",t1(f.waiting.since,void 0,t),f.waiting.tool&&i.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):i.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:t1(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const f5=e=>1-Math.pow(1-e,5),d2=420;function p5(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 m5(e,t,n,s=d2){return n>=s?t:n<=0?e:e+(t-e)*f5(n/s)}function g5(e,t,n,s={}){const a=s.now??(()=>performance.now()),l=s.raf??(v=>requestAnimationFrame(v)),c=s.cancel??(v=>cancelAnimationFrame(v)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!p5(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const y=()=>{if(!g)return;const v=a()-p;n(m5(e,t,v)),v<d2&&(h=l(y))};return h=l(y),()=>{g=!1,h&&c(h)}}const bv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function n1(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 y5(e,t){if(!e)return bv;const n={...bv};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}function kv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const wd=[{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 w5(e,t,n=wd.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 v5(e,t=new Date){return e==="today"?kv(1,t):e==="month"?kv(t.getDate(),t):"20200101"}const Tn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,qu=e=>typeof e=="string"?e:"";function h2(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=qu(l==null?void 0:l.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Tn(l==null?void 0:l.cost),u.inputTokens+=Tn(l==null?void 0:l.inputTokens),u.outputTokens+=Tn(l==null?void 0:l.outputTokens),u.cacheReadTokens+=Tn(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=Tn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function x5(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const l=qu(a==null?void 0:a.period);if(!l)continue;const c=a==null?void 0:a.metadata,u=typeof(c==null?void 0:c.lastActivity)=="string"?Date.parse(c.lastActivity):NaN;s.push({sessionId:l,label:t.get(l)??null,agent:qu(a==null?void 0:a.agent)||"claude",cost:Tn(a==null?void 0:a.totalCost),tokens:Tn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(qu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function f2(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Tn(t.cacheReadTokens),p=Tn(t.cacheCreationTokens),h=Tn(t.inputTokens),g=Tn(t.outputTokens);return{cost:Tn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Tn(t.totalTokens)||h+g+f+p}}const n=h2(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),l=s(f=>f.outputTokens),c=s(f=>f.cacheReadTokens),u=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+l+c+u}}function b5(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 r1(e,t){var n;return((n=wd.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function k5(e,t,n){const s=e!=null,a=f2(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 _5="1",s1="agent-dag.schema",N5=["agent-dag.layout","agent-dag.viewport"];function ki(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function S5(e,t=_5){let n=null;try{n=e.getItem(s1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of N5)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(s1,t)}catch{}return s}const zt="ccdeck";function p2(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 _v(e){return p2(Math.floor(e/1e3))}function m2(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 j5(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function E5(e,t,n){const s=new Date(e),a=_v(t-e);return{label:j5(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 vd(e){return e==null}const Nv="self";function lr(e,t=!1){const n=Js(e?Nv:null,Nv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function cr(e){return vd(e?Nv:null)}function C5(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function T5(e){return e==null||e==="BODY"||e==="HTML"}const g2="agent-dag.usagePeriod";function A5(){const e=ki(g2);return wd.some(t=>t.key===e)?e:"today"}function R5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(g2,e)}catch{}}const y2="agent-dag.usageSessionsOpen";function M5(){return ki(y2)==="1"}function I5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(y2,e?"1":"0")}catch{}}function a1(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 $5(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 Af="__unknown__";function O5(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),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=l>0?e/l:0,h=p>0?f/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),v=Math.floor(h%3600/60);g.runsOutIn=y>0?`${y}h ${v}m`:`${v}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function qa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:l,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=l||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,g=u===0?2:u,y=s?m2(s,c):null,v=s&&a?O5(u,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:h})]}),i.jsxs("div",{className:"qb-track",children:[i.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===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 P5=6e4;function L5(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(c.current))){p&&(c.current=!0,a(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),P5),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function D5(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 q5(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 w2=6e4,o1=6e4;function F5(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),l=b.useRef(null),c=b.useRef(!1),u=async(p=!1)=>{if(!(p&&!cr(c.current))){p&&(c.current=!0,a(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return b.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),w2),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function B5(e){const[t,n]=b.useState(null),s=b.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return b.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,w2),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function z5(e,t,n){const[s,a]=b.useState(null),[l,c]=b.useState(!1),[u,f]=b.useState(0),p=b.useRef(0);b.useEffect(()=>{const g=()=>document.visibilityState==="visible",y=()=>{g()&&f(_=>_+1)},v=window.setInterval(y,o1),S=()=>{g()&&Date.now()-p.current>=o1&&f(_=>_+1)};return document.addEventListener("visibilitychange",S),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",S)}},[]);const h=b.useRef(t);return b.useEffect(()=>{let g=!0;const y=t!==h.current;h.current=t;const v=e,S=v5(v);return c(!0),fetch(`/api/ccusage?since=${S}${y?"&refresh=1":""}`).then(_=>_.ok?_.json():null).then(_=>{!g||!(_!=null&&_.ok)||(p.current=Date.now(),a({period:v,data:_,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&c(!1)}),()=>{g=!1}},[e,t,u]),{...b5(s,e),loading:l}}function bl(e){const[t,n]=b.useState(e),s=b.useRef(e),a=b.useRef(!0);return b.useEffect(()=>{s.current=t},[t]),b.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return g5(s.current,e,c=>{s.current=c,n(c)})},[e]),t}function U5({state:e,now:t,providers:n,onClose:s}){var Ye,Ke;const{quota:a,loading:l,refresh:c}=L5(n.claude),{data:u,loading:f,refresh:p}=F5(n.codex),{data:h}=B5(n.codex),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3));b.useEffect(()=>{const ge=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ge)},[]);const{byModel:v,totalCost:S,totalTokens:_,burnRate:j}=b.useMemo(()=>{const ge=new Map;for(const se of e.agents.values())for(const Ae of Jl(se)){const Se=Ae.model??Af,Te=rx(Ae.usage,Ae.model),Be=ge.get(Se);Be?(Be.inputTokens+=Ae.usage.inputTokens,Be.outputTokens+=Ae.usage.outputTokens,Be.cacheReadTokens+=Ae.usage.cacheReadTokens,Be.cacheCreateTokens+=Ae.usage.cacheCreateTokens,Be.cost.total+=Te.total,Be.cost.input+=Te.input,Be.cost.output+=Te.output,Be.cost.cacheRead+=Te.cacheRead,Be.cost.cacheWrite+=Te.cacheWrite,Be.agentCount++):ge.set(Se,{model:Se,inputTokens:Ae.usage.inputTokens,outputTokens:Ae.usage.outputTokens,cacheReadTokens:Ae.usage.cacheReadTokens,cacheCreateTokens:Ae.usage.cacheCreateTokens,cost:{...Te},agentCount:1,priced:bi(Ae.model)!=null})}const _e=Array.from(ge.values()).sort((se,Ae)=>Ae.cost.total-se.cost.total||Ae.inputTokens+Ae.outputTokens-(se.inputTokens+se.outputTokens));let Fe=0,Xe=0;for(const se of e.agents.values()){if(se.state!=="active")continue;const Ae=An(se);Fe+=Ae.total,Xe=Math.max(Xe,((se.endedAt??t)-se.startedAt)/1e3)}const at=Xe>0?sx(Fe,Xe):null,pt=o5(e.agents.values());return{byModel:_e,totalCost:pt.cost,totalTokens:pt,burnRate:at}},[e,e.revision,t]),x=b.useMemo(()=>{const ge=[];for(const _e of e.agents.values()){if(_e.kind!=="root")continue;let Fe=An(_e).total,Xe=_e.usage.inputTokens,at=_e.usage.outputTokens,pt=wv(_e);for(const se of e.agents.values())se.sessionId!==_e.sessionId||se.kind==="root"||(Fe+=An(se).total,Xe+=se.usage.inputTokens,at+=se.usage.outputTokens,pt+=wv(se));ge.push({sessionId:_e.sessionId,label:_e.label||_e.cwdBasename||"session",state:_e.state,cost:Fe,inputTokens:Xe,outputTokens:at,unpricedTokens:pt})}return ge.sort((_e,Fe)=>Fe.cost-_e.cost||Fe.inputTokens+Fe.outputTokens-(_e.inputTokens+_e.outputTokens)).slice(0,12)},[e,e.revision]),[N,E]=b.useState(A5);b.useEffect(()=>{R5(N)},[N]);const[C,R]=b.useState(M5);b.useEffect(()=>{I5(C)},[C]);const I=b.useRef([]),[$,B]=b.useState(0),O=b.useRef(()=>new Map);O.current=()=>n1(e.agents.values(),t);const M=b.useCallback(()=>O.current(),[]),{data:L,shown:Y,stale:D,loading:A,baseline:Q}=z5(N,$,M),z=L!=null,te=A&&D,J=b.useMemo(()=>{const ge=new Map;for(const _e of e.agents.values()){if(_e.kind!=="root"||!_e.sessionId)continue;const Fe=_e.label||_e.cwdBasename;Fe&&ge.set(_e.sessionId,Fe)}return ge},[e,e.revision]),q=b.useMemo(()=>{const ge=new Map;for(const _e of e.agents.values())_e.kind!=="root"||!_e.sessionId||ge.set(_e.sessionId,_e.state);return ge},[e,e.revision]),K=b.useMemo(()=>z?h2(L):[],[L,z]),P=b.useMemo(()=>{if(!z)return[];const ge=x5(L,J).slice(0,12),_e=new Map;for(const Fe of ge)Fe.label&&_e.set(Fe.label,(_e.get(Fe.label)??0)+1);return ge.map(Fe=>Fe.label&&(_e.get(Fe.label)??0)>1?{...Fe,label:`${Fe.label} ${Fe.sessionId.slice(0,4)}`}:Fe)},[L,z,J]),G=b.useMemo(()=>f2(L),[L]),he=r1(Y,N),H=D?" up-stale":"",U=b.useMemo(()=>z?y5(Q,n1(e.agents.values(),t)):bv,[e,e.revision,Q,z,t]),Z=k5(L,{..._,cost:S},U),V=Z.hasCost,le=Z.tokenSum,pe=bl(Z.cost),me=bl(Z.inputTokens),Ce=bl(Z.outputTokens),Ue=bl(Z.cacheReadTokens),ue=bl(Z.cacheCreateTokens),xe=v.filter(ge=>ge.cost.total>0||ge.inputTokens+ge.outputTokens>0),ye=x.filter(ge=>ge.cost>0||ge.inputTokens+ge.outputTokens>0),De=z?K.some(ge=>ge.cost<=0&&ge.tokens>0):xe.some(ge=>!ge.priced),ke=l||f,Ee=a1(a==null?void 0:a.fetchedAt,g),Ge=a1(u==null?void 0:u.fetchedAt,g),ot=()=>{c(),p(),B(ge=>ge+1)},re=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return i.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[i.jsxs("div",{className:"up-header",children:[i.jsx("h2",{children:"Usage"}),j&&i.jsx("span",{className:"up-rate",children:j}),i.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&i.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ot,...lr(ke),"aria-label":re,title:re,children:ke?"…":"↻"}),i.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"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",Ee&&!l&&i.jsx("span",{className:"up-section-age",title:$5(a==null?void 0:a.source),children:Ee})]}),a!=null&&a.ok?i.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&i.jsx(qa,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&i.jsx(qa,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&i.jsx(qa,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&i.jsx(qa,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:D5(a.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",(u==null?void 0:u.ok)&&u.planLabel&&i.jsx("span",{className:"up-plan-badge",children:u.planLabel}),Ge&&!f&&i.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Ge})]}),u!=null&&u.ok?i.jsxs("div",{className:"up-quota-bars",children:[(Ye=u.windows)==null?void 0:Ye.map(ge=>i.jsx(qa,{label:ge.label,pct:ge.pct,reset:ge.reset??void 0,resetAt:ge.resetAt??void 0,windowSec:ge.windowSec??void 0,limitReached:u.limitReached&&ge.pct>=100,nowSec:g},ge.id)),(Ke=u.extraWindows)==null?void 0:Ke.map(ge=>i.jsx(qa,{label:ge.label,pct:ge.pct,reset:ge.reset??void 0,resetAt:ge.resetAt??void 0,windowSec:ge.windowSec??void 0,nowSec:g},ge.id)),u.creditLimit&&i.jsx(qa,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&i.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&i.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&i.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&i.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&i.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?i.jsxs("div",{className:"up-quota-na",children:[i.jsx("span",{children:"Quota unavailable."}),i.jsx("span",{className:"up-quota-hint",children:q5(u.reason)})]}):i.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&i.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${h.window5h?`
|
|
75
|
-
last 5h: ${Tt(h.window5h.totalTokens)} tokens · ${h.window5h.sessionCount} session${h.window5h.sessionCount!==1?"s":""}`:""}`,children:[Tt(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]})]}),z&&i.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":te||void 0,onKeyDown:ge=>{var Xe;const _e=I.current.indexOf(ge.target);if(_e<0)return;const Fe=w5(ge.key,_e);Fe!==null&&(ge.preventDefault(),(Xe=I.current[Fe])==null||Xe.focus())},children:wd.map((ge,_e)=>i.jsx("button",{type:"button",ref:Fe=>{I.current[_e]=Fe},tabIndex:N===ge.key?0:-1,"aria-pressed":N===ge.key,"data-pending":N===ge.key&&te?"":void 0,title:N===ge.key&&te?`Reading ${ge.noun} from the transcripts on this machine…`:ge.hint,className:"uh-range-btn",onClick:()=>E(ge.key),children:ge.label},ge.key))}),z&&i.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:te?`Reading ${r1(N,N)}…`:""}),le>0?i.jsxs(i.Fragment,{children:[V&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`up-total${H}`,title:z?void 0:Jk,children:[i.jsx("span",{className:"up-total-value",children:Je(pe)}),i.jsx("span",{className:"up-total-label",children:z?he:i5})]}),Z.showCostBar&&i.jsx(lx,{cost:S})]}),i.jsxs("div",{className:`up-tokens-row${H}`,title:z?void 0:Jk,children:[i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"in"}),Tt(me)]}),i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"out"}),Tt(Ce)]}),Z.cacheReadTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache r"}),Tt(Ue)]}),Z.cacheCreateTokens>0&&i.jsxs("span",{className:"up-tok",children:[i.jsx("span",{className:"up-k",children:"cache c"}),Tt(ue)]}),!V&&i.jsx("span",{className:"up-tok up-scope",children:l5})]}),(z?K.length:xe.length)>0&&i.jsxs("section",{className:`up-section${H}`,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:z?K.map(ge=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ge.model,children:Zs(ge.model)}),i.jsx("td",{className:"up-num",children:Tt(ge.tokens)}),ge.cost>0?i.jsx("td",{className:"up-num up-cost-val",children:Je(ge.cost)}):i.jsx("td",{className:"up-num up-unpriced",children:ni})]},ge.model)):xe.map(ge=>i.jsxs("tr",{children:[i.jsx("td",{className:"up-model-name",title:ge.model===Af?"no model reported yet":ge.model,children:ge.model===Af?"unknown":Zs(ge.model)}),i.jsx("td",{className:"up-num",children:Tt(ge.inputTokens+ge.outputTokens)}),ge.priced?i.jsx("td",{className:"up-num up-cost-val",children:Je(ge.cost.total)}):i.jsx("td",{className:"up-num up-unpriced",children:ni})]},ge.model))})]})]}),z&&P.length===0&&G.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 ",he," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(z?P.length:ye.length)>0&&(()=>{const ge=z?P.length:ye.length;return i.jsxs("section",{className:`up-section${H}`,children:[i.jsx("h3",{className:"up-section-title",children:i.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":C,"aria-controls":"up-sessions",title:C?"Hide the per-session breakdown":`Show the per-session breakdown — ${ge} session${ge===1?"":"s"}`,onClick:()=>R(_e=>!_e),children:["By session",z&&i.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${he}, 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 ",he]}),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:!C,children:[z&&P.map(_e=>{const Fe=q.get(_e.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:td(Fe)})]}):i.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),i.jsx("span",{className:`up-session-label${_e.label?"":" up-session-id"}`,title:_e.label?`${_e.label}
|
|
77
|
-
${_e.sessionId}`:_e.sessionId,children:_e.label??_e.sessionId.slice(0,8)}),i.jsx("span",{className:"up-session-tokens",children:Tt(_e.tokens)}),_e.cost>0?i.jsx("span",{className:"up-session-cost",title:_e.models.join(", ")||void 0,children:Je(_e.cost)}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ni})]},_e.sessionId)}),!z&&ye.map(_e=>i.jsxs("div",{className:"up-session-row",children:[i.jsx("span",{className:`sl-dot state-${_e.state}`,"aria-hidden":!0}),i.jsx("span",{className:"vis-hidden",children:td(_e.state)}),i.jsx("span",{className:"up-session-label",children:_e.label}),i.jsx("span",{className:"up-session-tokens",children:Tt(_e.inputTokens+_e.outputTokens)}),_e.cost>0?i.jsxs("span",{className:"up-session-cost",title:_e.unpricedTokens>0?`${Tt(_e.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(_e.cost),_e.unpricedTokens>0?"+":""]}):i.jsx("span",{className:"up-session-cost up-unpriced",children:ni})]},_e.sessionId))]})]})})(),De&&i.jsxs("div",{className:"up-hint",children:["“",ni,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):i.jsx("div",{className:"up-empty",children:z?i.jsxs(i.Fragment,{children:["No usage ",he,".",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 Vt={l:30,r:6,t:6,b:2},Gs={l:0,r:0,t:2,b:1},xd=104,W5=64;function ir(e,t=100,n=xd,s=Vt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function v2(e,t,n,s=100,a=xd,l=Vt){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const g=t-l.l-l.r;return l.l+(c>0?g*(h-e[0].t)/c:g/2)};let f="",p=null;for(const h of e){const g=p&&h.t-p.t<=n*2?"L":"M";f+=`${g}${u(h.t).toFixed(1)} ${ir(h.v,s,a,l).toFixed(1)}`,p=h}return f}function x2(e,t,n,s=100,a=xd,l=Vt){if(e.length<2)return"";const c=a-l.b,u=e[e.length-1].t-e[0].t,f=t-l.l-l.r,p=v=>l.l+(u>0?f*(v-e[0].t)/u:f/2);let h="",g=[];const y=()=>{if(g.length>=2){let v=`M${p(g[0].t).toFixed(1)} ${c}`;for(const S of g)v+=`L${p(S.t).toFixed(1)} ${ir(S.v,s,a,l).toFixed(1)}`;h+=`${v}L${p(g[g.length-1].t).toFixed(1)} ${c}Z`}g=[]};for(const v of e)g.length&&v.t-g[g.length-1].t>n*2&&y(),g.push(v);return y(),h}function H5(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 G5(e,t,n=s=>Rl(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 Rl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function cx(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 V5({group:e,title:t,onClose:n}){const s=Ut(n),[a,l]=b.useState(null);b.useEffect(()=>{let p=!0;const h=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{}};h();const g=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=b.useMemo(()=>{let p=1/0,h=0;for(const g of c)g.points.length&&(p=Math.min(p,g.points[0].t),h=Math.max(h,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return Uv.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&&u>0&&i.jsxs("span",{className:"hist-since",children:["since ",Rl(u)," · ",cx(u,f||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(Y5,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function Y5({series:e,stepMs:t}){const n=b.useRef(null),[s,a]=b.useState(560),[l,c]=b.useState(null);b.useEffect(()=>{const $=n.current;if(!$||typeof ResizeObserver>"u")return;const B=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return B.observe($),()=>B.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:g,top:y,restsAtZero:v}=e,S=v?W5:xd,{now:_,peak:j}=H5(u),x=f==="C"?"°C":f,N=g==="Throttling"?G5(u,t):null,E=l!=null?u[l]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,R=$=>{const B=s-Vt.l-Vt.r;return Vt.l+(C>0?B*($-u[0].t)/C:B/2)},I=$=>{if(u.length<2)return;const B=$.currentTarget.getBoundingClientRect(),O=($.clientX-B.left-Vt.l)/Math.max(1,B.width-Vt.l-Vt.r),M=u[0].t+C*Math.max(0,Math.min(1,O));let L=0;for(let Y=1;Y<u.length;Y++)Math.abs(u[Y].t-M)<Math.abs(u[L].t-M)&&(L=Y);c(L)};return i.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[i.jsxs("div",{className:"hist-head",children:[i.jsx("span",{className:"hist-label",children:g}),i.jsxs("span",{className:"hist-stats",children:[_!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{children:_}),i.jsxs("span",{children:[x," now"]})]}),j!=null&&i.jsxs(i.Fragment,{children:[i.jsx("b",{className:b2(j,p,h),children:j}),i.jsxs("span",{children:[x," peak"]})]})]})]}),i.jsx("div",{className:"hist-plot",ref:n,children:i.jsxs("svg",{className:"hist-chart",width:"100%",height:S,viewBox:`0 0 ${s} ${S}`,preserveAspectRatio:"none",role:"img","aria-label":_==null?`${g}: nothing measured yet`:`${g}: ${_}${x} now, peak ${j}${x}, over ${cx(u[0].t,u[u.length-1].t)}`,onPointerMove:I,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([$,B])=>B==null||B>y?null:i.jsxs("g",{children:[i.jsx("line",{className:`hist-rule ${$}`,x1:Vt.l,x2:s-Vt.r,y1:ir(B,y,S),y2:ir(B,y,S)}),i.jsx("text",{className:`hist-rule-tag ${$}`,x:2,y:ir(B,y,S)+3,children:B})]},$)),i.jsx("line",{className:"hist-floor",x1:Vt.l,x2:s-Vt.r,y1:S-Vt.b,y2:S-Vt.b}),i.jsx("path",{className:"hist-area",d:x2(u,s,t,y,S)}),i.jsx("path",{className:"hist-line",d:v2(u,s,t,y,S)}),u.length===1&&i.jsx("circle",{className:"hist-dot",cx:R(u[0].t),cy:ir(u[0].v,y,S),r:3}),E&&i.jsxs("g",{children:[i.jsx("line",{className:"hist-cross",x1:R(E.t),x2:R(E.t),y1:Vt.t,y2:S-Vt.b}),i.jsx("circle",{className:"hist-dot",cx:R(E.t),cy:ir(E.v,y,S),r:3})]})]})}),i.jsx("div",{className:"hist-axis",children:E?i.jsxs("span",{className:"hist-at",children:[Rl(E.t)," — ",i.jsx("b",{children:E.v}),x]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:u.length?Rl(u[0].t):""}),i.jsx("span",{children:u.length?Rl(u[u.length-1].t):""})]})}),N&&i.jsx("div",{className:"hist-note",children:N})]})}const K5="thermal:Throttling";function X5(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[K5]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Fu(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Nu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Fu(e,t)}const i1=["cores","memory","load","thermal"],Fa=116,jr=24,Q5=60,Z5=6e4;function J5(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function eD(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function tD(e,t=Q5){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function nD({sys:e}){const[t,n]=b.useState({});b.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(i1.map(async h=>{try{const g=await fetch(`/api/system/history?group=${h}`);return g.ok?[h,await g.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const g={...h};for(const[y,v]of p)v!=null&&v.ok&&(g[y]=v);return g})};u();const f=setInterval(()=>void u(),Z5);return()=>{c=!1,clearInterval(f)}},[]);const s=b.useMemo(()=>X5(e),[e]),a=b.useMemo(()=>i1.flatMap(c=>{const u=t[c];return u?u.series.filter(J5).map(f=>({series:tD(f),stepMs:u.stepMs})):[]}),[t]),l=b.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?cx(c,u):"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:u})=>i.jsx(rD,{series:c,stepMs:u,now:s[c.key],span:l},c.key))}):null}function rD({series:e,stepMs:t,now:n,span:s}){var v;const{points:a,top:l,unit:c,warnAt:u,critAt:f}=e,p=eD(e),h=n??((v=a[a.length-1])==null?void 0:v.v),g=h==null?"":b2(h,u,f),y=Math.max(...a.map(S=>S.v));return i.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${Fu(y,c)} over the last ${s}`,u!=null?`over ${Nu(u,c)} is uncomfortable`:"",f!=null?`over ${Nu(f,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:h==null?"—":Fu(h,c)})]}),i.jsxs("svg",{className:"pl-spark",width:Fa,height:jr,viewBox:`0 0 ${Fa} ${jr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[i.jsx("line",{className:"pl-spark-floor",x1:0,x2:Fa,y1:jr-Gs.b,y2:jr-Gs.b}),i.jsx("path",{className:"pl-spark-area",d:x2(a,Fa,t,l,jr,Gs)}),u!=null&&i.jsx("line",{className:"pl-rule warn",x1:0,x2:Fa,y1:ir(u,l,jr,Gs),y2:ir(u,l,jr,Gs)}),f!=null&&i.jsx("line",{className:"pl-rule hot",x1:0,x2:Fa,y1:ir(f,l,jr,Gs),y2:ir(f,l,jr,Gs)}),i.jsx("path",{className:"pl-spark-line",d:v2(a,Fa,t,l,jr,Gs)})]}),i.jsxs("span",{className:"vis-hidden",children:["peak ",Fu(y,c)," over the last ",s,u!=null&&`, uncomfortable over ${Nu(u,c)}`,f!=null&&`, the machine acts over ${Nu(f,c)}`]})]})}const sD={key:"cpu",dir:"desc"};function aD(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function oD(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??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=s(l),f=s(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};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 lD=4e3;function cD(){const[e,t]=b.useState(null);return b.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,lD);return()=>{n=!1,window.clearInterval(a)}},[]),e}function uD(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 dD(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 hD({sys:e,onClose:t}){const n=Ut(t),[s,a]=b.useState(sD),l=cD(),c=l?oD(l.procs,s):null;return Uv.createPortal(i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.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(Jo,{col:"cpu",label:"cpu",sort:s,onSort:a}),i.jsx(Jo,{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(Jo,{col:"threads",label:"threads",sort:s,onSort:a}),i.jsx(Jo,{col:"uptime",label:"up",sort:s,onSort:a}),i.jsx(Jo,{col:"user",label:"user",sort:s,onSort:a}),i.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),i.jsx(Jo,{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(u=>i.jsxs("tr",{children:[i.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),i.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:uD(u.rssBytes)}),i.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),i.jsx("td",{className:"sd-num sd-dim",children:dD(u.uptimeSec)}),i.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),i.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),i.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&i.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),i.jsx(nD,{sys:e})]})]})}),document.body)}function Jo({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(aD(s,e)),children:[t,i.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const fD=3e3;function pD(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function mD(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}% ${gD(t.lastMs,n)}`:"running at full speed, and never held back"}}function gD(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function kl(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function yD(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]=b.useState(null),n=b.useRef(null);return b.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,fD))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",u),()=>{s=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function l1({usageOpen:e,sub:t,onClose:n,children:s}){return i.jsxs("aside",{className:`sysdetail${e?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[i.jsxs("div",{className:"sd-head",children:[i.jsx("span",{className:"sd-title",children:"This machine"}),t&&i.jsx("span",{className:"sd-sub",children:t}),i.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function vD({usageOpen:e,onClose:t}){const n=wD();if(!n||n.cpu==null||!n.memory)return i.jsx(l1,{usageOpen:e,onClose:t,children:i.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:l,loadavg:c,cores:u,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,y=p==="win32"?"Commit":"Swap",v=a&&a.total>0?a.used/a.total*100:0;return i.jsxs(l1,{usageOpen:e,sub:`up ${yD(f)} · ${u} cores`,onClose:t,children:[l&&l.length>0&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:i.jsx(Bu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:i.jsx("div",{className:"sd-cores",style:{"--n":l.length},children:l.map((S,_)=>i.jsx("span",{className:"sd-core",title:`core ${_+1}: ${S}%`,children:i.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,S)/100})`}})},_))})})}),i.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:i.jsxs(Bu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&i.jsx(nd,{label:"Physical",value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:kl(g)})," of ",kl(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${kl(s.available)} available`}),a&&a.total>0&&i.jsx(nd,{label:y,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:kl(a.used)})," of ",kl(a.total)]}),pct:v,tone:v>=90?"warn":"calm",note:v>=50?"paging to disk":void 0})]})}),c&&i.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:i.jsxs(Bu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[i.jsx("div",{className:"sd-load",children:c.map((S,_)=>i.jsxs("span",{className:`sd-load-item${S>u?" over":""}`,children:[i.jsx("b",{children:S.toFixed(2)}),i.jsx("span",{children:["1m","5m","15m"][_]})]},_))}),i.jsx("div",{className:"sd-note",children:c[0]>u?`${(c[0]/u).toFixed(1)}× more work queued than cores to run it`:`within ${u} cores`})]})}),i.jsx(xD,{thermal:h}),i.jsx(bD,{sys:n})]})}function Bu({group:e,title:t,action:n,label:s,children:a}){const[l,c]=b.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(V5,{group:e,title:t,onClose:()=>c(!1)})]})}function xD({thermal:e}){if(!e)return null;const t=e.throttle?mD(e.throttle.speedLimit,e.heldBack):null;return i.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:i.jsxs(Bu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>i.jsx(nd,{label:n.label,value:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:pD(n.celsius,n.warnAt,n.critAt)},n.label)),t&&i.jsx(nd,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function bD({sys:e}){const[t,n]=b.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(hD,{sys:e,onClose:()=>n(!1)})]})}function nd({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 c1=18,kD=1100,ei=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},_D=Array.from({length:c1},(e,t)=>{const n=-72+144*t/(c1-1)+(ei(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+ei(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+ei(t,3)*260),delay:Math.round(ei(t,4)*90),dur:760+Math.round(ei(t,5)*260),scale:.8+ei(t,6)*.45,hue:t%4,round:t%3===0}});function u1({anchor:e}){var a;const[t,n]=b.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return b.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 u=window.setTimeout(()=>n(null),kD);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:Uv.createPortal(i.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:_D.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 k2=new Set(["awaiting_url","awaiting_code","registering"]);function ND(e){return e!=null&&k2.has(e)}function _2(e){return e!=null&&e!=="done"&&!k2.has(e)}const SD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",jD="the sign-in did not complete";function ED({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?SD:jD)}}const CD="done";function TD(){let e=!1;return{shouldAnnounce(t){return t!==CD?(e=!1,!1):e?!1:(e=!0,!0)}}}function ux(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const AD={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},RD={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"},MD=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function Sv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(gi(e)))return MD;const n=ux(RD,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function gi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const ID={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"},$D="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 OD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const PD="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",LD="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",DD=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),qD=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,FD=/[\\/]_npx[\\/]/i,BD=`the copy of ccusage ${zt} installed for itself`;function zD(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function UD(e,t){const n=WD(e,t),s=zD(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 ${_l(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${_l(n)}`;case"managed":return`${BD} failed to run: ${_l(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${_l(n)}`:`the ccusage this deck found on your PATH failed to run: ${_l(n)}`;default:return n}}const _l=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function WD(e,t){const n=gi(e);if(DD(n)){if(FD.test(n))return LD;if(qD.test(n))return PD}if(OD(n))return $D;const s=ux(ID,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function ai(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&_2(e.state))return e.error;const n=ux(AD,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function HD(e,t,n){if(n<=0||ax(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 N2(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 GD(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 VD(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 YD(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 KD(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const l=n("healed");l&&s.push(`${l} had a dead token replaced`);const c=n("updated");c&&s.push(`${c} updated`);const u=n("present");u&&s.push(`${u} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const XD=1500,Su=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],d1="aa-panel",h1=e=>`aa-tab-${e}`;async function Nl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const jv=fe.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"})]}));jv.displayName="SuccessMark";function QD({onClose:e,onChanged:t}){const[n,s]=b.useState("login"),[a,l]=b.useState(null),[c,u]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(!1),[y,v]=b.useState(null),[S,_]=b.useState(null),[j,x]=b.useState(null),[N,E]=b.useState(null),C=b.useRef(""),R=b.useRef(!1),I=b.useRef(!1),$=b.useRef(null),B=b.useRef(null),O=b.useRef(null),M=b.useRef(null),L=b.useRef([]),Y=b.useRef(!1),D=b.useCallback(()=>{R.current&&Nl({action:"login-cancel"}).catch(()=>{}),e()},[e]),A=Ut(D,{focusRef:O}),Q=b.useCallback(async()=>{if(!cr(I.current))return;I.current=!0,g(!0),v(null),R.current=!0;const U=await Nl({action:"login"}).catch(()=>null);if(I.current=!1,g(!1),!(U!=null&&U.ok)){v(ai(U,"could not start the sign-in"));return}l(U)},[]);b.useEffect(()=>{if(!ND(a==null?void 0:a.state))return;const U=window.setInterval(async()=>{try{const Z=await fetch("/api/claude-accounts/login");Z.ok&&l(await Z.json())}catch{}},XD);return()=>window.clearInterval(U)},[a]);const z=b.useRef(t);z.current=t;const te=b.useState(TD)[0];b.useEffect(()=>{var U;(a==null?void 0:a.state)==="awaiting_code"&&((U=$.current)==null||U.focus()),te.shouldAnnounce(a==null?void 0:a.state)&&z.current()},[a==null?void 0:a.state,te]),b.useEffect(()=>{var U;n==="paste"&&!Y.current&&((U=B.current)==null||U.focus()),Y.current=!1},[n]);const J=b.useCallback(U=>{var V;const Z=HD(U,Su.findIndex(le=>le.id===n),Su.length);Z.kind!=="pass"&&(U.preventDefault(),Y.current=!0,s(Su[Z.index].id),(V=L.current[Z.index])==null||V.focus())},[n]),q=b.useCallback(async()=>{var Z;if(!cr(I.current))return;I.current=!0,g(!0),v(null);const U=await Nl({action:"login-code",code:c}).catch(()=>null);if(I.current=!1,g(!1),!(U!=null&&U.ok)){v(ai(U,"the code was not accepted")),U!=null&&U.state&&l(U),(Z=$.current)==null||Z.select();return}u(""),l(U)},[c,a]),K=b.useCallback(async()=>{if(!cr(I.current))return;I.current=!0,g(!0),v(null);const U=await Nl({action:"import",blob:f}).catch(()=>null);if(I.current=!1,g(!1),!(U!=null&&U.ok)){v(ai(U,"the import failed"));return}C.current=f,p(""),E(null),_(U.results??[]),t()},[f,t]),P=b.useCallback(async U=>{const Z=`${U.email}|${U.org??""}`;if(!cr(I.current)||!C.current)return;I.current=!0,g(!0),x(Z),E(null);const V=await Nl({action:"import",blob:C.current,force:!0,only:{email:U.email,org:U.org??""}}).catch(()=>null);if(I.current=!1,g(!1),x(null),!(V!=null&&V.ok)){E({key:Z,text:ai(V,"that account could not be updated")});return}const le=(V.results??[])[0];le&&_(pe=>pe&&pe.map(me=>`${me.email}|${me.org??""}`===Z?le:me)),t()},[t]),G=(a==null?void 0:a.state)==="done"?a.account:null,he=_2(a==null?void 0:a.state)||!!(y&&R.current&&!h),H=ED({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return i.jsx("div",{className:"modal-backdrop",onClick:D,role:"presentation",children:i.jsxs("div",{ref:A,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:J,children:Su.map((U,Z)=>i.jsx("button",{type:"button",role:"tab",id:h1(U.id),ref:V=>{L.current[Z]=V},"aria-selected":n===U.id,"aria-controls":d1,tabIndex:n===U.id?0:-1,className:`aa-tab${n===U.id?" on":""}`,onClick:()=>{Y.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:D,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),i.jsx("section",{className:"modal-body aa-body",id:d1,role:"tabpanel","aria-labelledby":h1(n),children:n==="login"?G?i.jsxs("div",{className:"aa-done",children:[i.jsx(jv,{ref:M}),i.jsx(u1,{anchor:M}),i.jsx("h4",{children:G.added?`Account ${G.num} added`:"Credentials refreshed"}),i.jsxs("p",{className:"aa-note",children:[i.jsx("strong",{children:G.email}),G.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:$,type:"text",value:c,onChange:U=>u(U.target.value),onKeyDown:U=>{U.key==="Enter"&&c.trim()&&!h&&q()},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",...lr(h,!c.trim()||a.state==="registering"),onClick:q,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:()=>{R.current=!1,l(null),v(null),Q()},children:"Try again"})]}):h||R.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:Q,children:"Open the sign-in page"})})]}):S?(()=>{const U=S.filter(Z=>Z.state==="imported").length;return i.jsxs("div",{className:"aa-done",children:[i.jsx(jv,{ref:M}),U>0&&i.jsx(u1,{anchor:M}),i.jsx("h4",{children:KD(S)}),S.length>0&&i.jsx("ul",{className:"aa-results",children:S.map(Z=>{const V=`${Z.email}|${Z.org??""}`;return i.jsxs("li",{className:`aa-result ${Z.state}`,children:[i.jsx("span",{className:"aa-result-who",children:Z.email||(Z.num?`slot ${Z.num}`:"an account")}),i.jsx("span",{className:"aa-result-what",children:YD(Z.state)}),Z.state==="present"&&i.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":j===V,title:`Overwrite the stored login for ${Z.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(Z),children:j===V?"updating…":"update anyway"}),(N==null?void 0:N.key)===V&&i.jsx("span",{className:"aa-result-err",children:N.text})]},V)})}),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:B,type:"text",value:f,onChange:U=>p(U.target.value),onKeyDown:U=>{U.key==="Enter"&&f.trim()&&!h&&K()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),i.jsx("button",{type:"button",className:"btn primary",...lr(h,!f.trim()),onClick:K,children:h?"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."]})]})})]})})}async function ZD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const JD=1800;function e6({accounts:e,onClose:t,copyText:n}){const[s,a]=b.useState([]),[l,c]=b.useState(null),[u,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(!1),[v,S]=b.useState(()=>Math.floor(Date.now()/1e3)),_=b.useRef(null),j=b.useRef(!1),x=Ut(t,{focusRef:_});b.useEffect(()=>{if(!l)return;S(Math.floor(Date.now()/1e3));const M=window.setInterval(()=>S(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(M)},[l]);const N=GD(e),E=e.filter(M=>!s.includes(M.num)).map(M=>M.num),C=E.length===e.length,R=M=>a(L=>L.includes(M)?L.filter(Y=>Y!==M):[...L,M]),I=b.useCallback(async()=>{if(!cr(j.current)||!E.length)return;j.current=!0,f(!0),h(null),y(!1);const M=await ZD({action:"share",accounts:E}).catch(()=>null);if(j.current=!1,f(!1),!(M!=null&&M.ok)){h(ai(M,"the share could not be made"));return}c({blob:M.blob,expiresAt:M.expiresAt,shared:M.shared??[],failed:M.failed??[]})},[e,E]),$=l?N2(l.expiresAt,v):null,B=($==null?void 0:$.tone)==="gone",O=(l==null?void 0:l.shared.length)??0;return i.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:i.jsxs("div",{ref:x,className:"modal sa-modal",onClick:M=>M.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:B?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),i.jsx("code",{className:`ap-share-blob${B?" 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(B){c(null),I();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),JD))},children:B?"make a new share":g?"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 ${$==null?void 0:$.tone}`,children:$==null?void 0:$.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(M=>{var Y;const L=!!(M.email&&((Y=M.detail)!=null&&Y.includes(M.email)));return i.jsxs("li",{children:[!L&&i.jsx("span",{className:"sa-who",children:M.email||`account ${M.num}`}),i.jsx("span",{className:"sa-why",children:M.detail||"could not be exported"})]},`${M.num}-${M.email}`)})})]}),i.jsx("p",{className:"sa-note",children:B?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 ",zt,"?"]}),i.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:VD(E.length)}),i.jsx("ul",{className:"sa-list sa-pick",children:N.map(M=>i.jsx("li",{children:i.jsxs("label",{className:"sa-row",children:[i.jsx("input",{type:"checkbox",checked:E.includes(M.num),onChange:()=>R(M.num)}),i.jsx("span",{className:"sa-who",children:M.label}),M.sub&&i.jsx("span",{className:"sa-sub",children:M.sub})]})},M.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(M=>M.num):[]),children:C?"Clear all":"Select all"}),i.jsx("button",{type:"button",className:"btn primary",ref:_,...lr(u,!E.length),onClick:I,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})})}function t6(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 n6(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 r6(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function s6(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 a6(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 f1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function p1(e){const t=e.filter(u=>!f1(u)),n=e.filter(u=>f1(u)),s=t.length?t:n,a=t.length?n:[],l=s.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)l&&u.pct<=l.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:s,rest:a,fuller:c,peak:c??l}}function o6(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 l6="\0";function dx(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}${l6}${n}`}function c6(e,t){const n=dx(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function u6(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(dx)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const d6=64;function h6(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const f6=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function m1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function p6(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=gi(t.body);return{text:Sv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function g1(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 S2({title:e,steps:t,finish:n,aside:s,onClose:a}){const l=b.useRef(null),c=Ut(a,{focusRef:l}),[u,f]=b.useState(0),p=u===t.length-1,h=t[u],g=S=>f(Math.max(0,Math.min(t.length-1,S))),y=S=>{S.key!=="ArrowRight"&&S.key!=="ArrowLeft"||(S.preventDefault(),S.stopPropagation(),g(S.key==="ArrowRight"?u+1:u-1))},v=()=>{if(!p){g(u+1);return}n?n.act():a()};return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal guide",onClick:S=>S.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:[u+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:h.art},u),i.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),i.jsx("p",{className:"guide-tip",children:h.tip??""}),i.jsxs("div",{className:"guide-foot",children:[i.jsx("div",{className:"guide-dots",children:t.map((S,_)=>i.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${_+1} of ${t.length}`,"aria-current":_===u?"step":void 0,onClick:()=>g(_)},_))}),p&&s&&i.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:s.act,children:s.label}),u>0&&i.jsx("button",{type:"button",className:"btn",onClick:()=>g(u-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"})]})]})]})})}const Ev={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Un({children:e}){return i.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function zn({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 dr({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:Ev[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 ${Ev[a]}`,children:s}),l==null?void 0:l.map((c,u)=>i.jsxs("g",{children:[i.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),i.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),i.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),i.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function j2({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 ju({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 y1({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 w1({x:e,y:t,d:n}){return i.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function hx({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 fx(){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 oi({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:Ev[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 ui({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 rd({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(j2,{x:e+118,y:t-13,on:!0})]})}function m6(){return i.jsxs(Un,{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 g6(){return i.jsxs(Un,{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(oi,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),i.jsx(oi,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),i.jsx(oi,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),i.jsx(oi,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),i.jsx(ui,{x:326,y:28,label:"Read"}),i.jsx(ui,{x:380,y:28,label:"Grep",live:!0}),i.jsx(ui,{x:326,y:90,label:"Bash",live:!0})]})}function v1({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 y6(){return i.jsxs(Un,{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(v1,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),i.jsx(v1,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function w6(){return i.jsxs(Un,{children:[i.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),i.jsx(oi,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),i.jsx(hx,{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(zn,{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(ui,{x:214,y:122,label:"Read"}),i.jsx(ui,{x:266,y:122,label:"Edit"}),i.jsx(ui,{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 v6(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return i.jsxs(Un,{children:[i.jsx(zn,{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 x6(){return i.jsxs(Un,{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(oi,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function b6(){return i.jsxs(Un,{children:[i.jsx(zn,{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(w1,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),i.jsx(w1,{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(dr,{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(dr,{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(hx,{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(zn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),i.jsx("g",{className:"ga-pop",children:i.jsx(dr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function k6(){return i.jsxs(Un,{children:[i.jsx(zn,{x:14,label:"THIS MACHINE"}),i.jsx(rd,{x:28,y:60}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(dr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(dr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(zn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(rd,{x:264,y:60}),i.jsx(dr,{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(fx,{})})]})}const _6=[{art:i.jsx(m6,{}),line:"Sessions waiting on you rise to the top, longest wait first.",tip:"A tone and a system notification when one stops to ask. The bell in the topbar."},{art:i.jsx(g6,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:i.jsx(w6,{}),line:"Click any node: its prompt, every tool call, tokens and timing."},{art:i.jsx(y6,{}),line:"What each session costs, and how much quota is left."},{art:i.jsx(v6,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:i.jsx(b6,{}),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(x6,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function N6(){return i.jsxs(Un,{children:[i.jsx(zn,{x:14,label:"THIS MACHINE"}),i.jsx(dr,{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(zn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(dr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function S6(){return i.jsxs(Un,{children:[i.jsx(zn,{x:14,label:"THIS MACHINE"}),i.jsx(rd,{x:28,y:60}),i.jsx(ju,{x:28,y:92,name:"Ana's MacBook"}),i.jsx(ju,{x:28,y:114,name:"Dorin's PC"}),i.jsx(zn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(rd,{x:264,y:60}),i.jsx(ju,{x:264,y:92,name:"Your MacBook"}),i.jsx(ju,{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(Un,{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(y1,{x:106,y:88,on:!0}),i.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),i.jsx(y1,{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(j2,{x:304,y:157,on:!0}),i.jsx(hx,{x:115,y:97})]})}function E6(){return i.jsxs(Un,{children:[i.jsx(zn,{x:14,label:"THIS MACHINE"}),i.jsx("g",{className:"ga-swap-out",children:i.jsx(dr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),i.jsx("g",{className:"ga-swap-in",children:i.jsx(dr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),i.jsx(zn,{x:250,label:"ANOTHER MACHINE"}),i.jsx(dr,{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(fx,{})})]})}const C6=[{art:i.jsx(N6,{}),line:"A login can expire on one machine while it still works on another."},{art:i.jsx(S6,{}),line:"Turn this on, on both machines. They find each other and 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(E6,{}),line:"An expired login is copied from a paired machine within a minute."}];function T6(){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(fx,{})})]})}async function Rf(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const A6={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."},R6={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function x1(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Lt(n,t)}function M6({status:e,manual:t,onClose:n,onChanged:s}){var te,J;const a=b.useRef(null),l=Ut(n,{focusRef:a}),[c,u]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(null),[y,v]=b.useState(null),[S,_]=b.useState(null),[j,x]=b.useState(null),[N,E]=b.useState(()=>Date.now());b.useEffect(()=>{const q=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(q)},[]);const C=b.useRef(!0);b.useEffect(()=>()=>{C.current=!1},[]);const R=b.useRef(null),I=b.useCallback(q=>vd(R.current)?(R.current=q,_(q),!0):!1,[]),$=b.useCallback(()=>{R.current=null,C.current&&_(null)},[]),B=q=>{const K=Js(S,q);return{disabled:K.disabled,"aria-busy":K.busy}},O=q=>(h==null?void 0:h.field)===q?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},M=q=>g(K=>K&&K.field===q?null:K),L=b.useCallback(async()=>{const q=z6(c);if(!q){g({text:I6(c),field:"addr"});return}const K=`${q.addr}:${q.port}`,P=e.peers.find(G=>G.addr===q.addr&&G.port===q.port&&G.paired);if(P){g({text:`Already paired with ${P.name} at that address.`,field:"addr"});return}if(t.includes(K)){g({text:"This deck already calls that address.",field:"addr"});return}if(I("add"))try{const G=await Rf("/api/prefs",{lan:{manual:[...t,K]}});if(!C.current)return;G!=null&&G.ok?(g(null),u(""),s(),n()):g({text:Lt("add that address",G),field:"addr"})}catch{C.current&&g({text:Lt("add that address",null),field:"addr"})}finally{$()}},[c,t,e.peers,s,n,I,$]),Y=b.useCallback(async q=>{if(!I(`invite:${q}`))return;const K=q==="make"?"make an invite":"cancel that invite";try{const P=await Rf("/api/lan/invite",{action:q});if(!C.current)return;P!=null&&P.ok?(g(null),v(null),s()):g({text:x1(R6,P,K)})}catch{C.current&&g({text:Lt(K,null)})}finally{$()}},[s,I,$]),D=b.useCallback(async()=>{const q=f.trim();if(!(!q||!I("join"))){x(null);try{const K=await Rf("/api/lan/invite",{action:"join",token:q});if(!C.current)return;K!=null&&K.ok?(p(""),g(null),s(),n()):(K==null?void 0:K.reason)==="unreachable"&&Array.isArray(K.tried)&&K.tried.length?(x(K.tried),g(null)):(x(null),g({text:x1(A6,K,"use that invite"),field:"join"}))}catch{C.current&&g({text:Lt("use that invite",null),field:"join"})}finally{$()}}},[f,s,n,I,$]),A=b.useCallback(async(q,K)=>{try{await navigator.clipboard.writeText(q),v(K),window.setTimeout(()=>{C.current&&v(P=>P===K?null:P)},1600)}catch{g({text:"Could not copy it — select the text and copy it by hand."})}},[]),Q=e.invite&&e.invite.expiresAt>N?e.invite:null,z=((te=e.reach)==null?void 0:te.steps)??[];return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:l,className:"modal lan-add",onClick:q=>q.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:[h&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>g(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((J=e.reach)==null?void 0:J.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."}),z.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:z.join(`
|
|
80
|
-
`)})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...B("copy:fix"),onClick:()=>void A(z.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:q=>{u(q.target.value),M("addr")},onKeyDown:q=>{q.key==="Enter"&&L()}}),c.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...B("add"),onClick:()=>void L(),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",!Q&&i.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...B("invite:make"),onClick:()=>void Y("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:S==="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:f,placeholder:"paste one you were sent",spellCheck:!1,...O("join"),onChange:q=>{p(q.target.value),x(null),M("join")},onKeyDown:q=>{q.key==="Enter"&&D()}}),f.trim()!==""&&i.jsx("button",{type:"button",className:"ap-manage-btn",...B("join"),onClick:()=>void D(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:S==="join"?"joining…":"join"})]}),i.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),j&&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."}),j.map(q=>i.jsxs("span",{className:"ap-lan-tried-row",children:[i.jsx("code",{className:"ap-lan-code",children:q.addr}),i.jsx("span",{className:"ap-lan-bad",children:q.why})]},q.addr))]}),Q&&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:[W6(Q.expiresAt,N)," left"]})]}),i.jsx("code",{className:"ap-lan-token",children:Q.token}),i.jsxs("div",{className:"ap-lan-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...B("copy:invite"),onClick:()=>void A(Q.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",...B("invite:withdraw"),onClick:()=>void Y("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."})]})]})]})]})})}function I6(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 $6=1e3;function O6(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=os(e,t);return`${n} · ${s==="now"?"just now":s}`}function P6(){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 L6({row:e,source:t,status:n,accounts:s,now:a,busy:l,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h}){var ke,Ee,Ge,ot;const g=b.useRef(null),y=Ut(c,{focusRef:g}),[v,S]=b.useState(null),[_,j]=b.useState(null),[x,N]=b.useState(!1),E=b.useRef(0),[C,R]=b.useState(!1),[I,$]=b.useState(!1),B=b.useRef(null),O=b.useRef(!0);b.useEffect(()=>()=>{O.current=!1},[]);const M=v!=null;b.useEffect(()=>{var re;M&&((re=B.current)==null||re.select())},[M]),b.useEffect(()=>{if(!x)return;const re=window.setTimeout(()=>N(!1),4e3);return()=>window.clearTimeout(re)},[x]);const L=re=>{const Ye=Js(l,re);return{disabled:Ye.disabled,"aria-busy":Ye.busy}},Y=async re=>{const Ye=await re();return O.current&&j(Ye),Ye==null},{peer:D,stranger:A}=t,Q=e.kind==="paired",z=e.self??e.name,te=e.kind!=="dialling",J=e.kind==="dialling"?null:e.fp,q=D?D.addr?`${D.addr}:${D.port}`:"":A?A.port?`${A.addr}:${A.port}`:A.addr:e.addr,K=(D==null?void 0:D.about)??null,P=((ke=n.about)==null?void 0:ke.version)??null,G=async re=>{const Ye=re.trim()===z?"":re;await Y(()=>u(Ye))&&S(null)},he=async()=>{if(J)try{if(await navigator.clipboard.writeText(J),!O.current)return;R(!0),window.setTimeout(()=>{O.current&&R(!1)},1600)}catch{O.current&&j("Could not copy it — select the fingerprint and copy it by hand.")}},H=Q?D!=null&&D.waiting?D.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":D!=null&&D.offers?"not said — it runs an older version":"not reached yet":"shown once paired",U=(()=>{if(!(K!=null&&K.version))return null;const re=P?Q6(K.version,P):null;return re==null?K.version:re===0?`${K.version} · same as this deck`:`${K.version} · ${re<0?"older":"newer"} than this deck's ${P}`})(),Z=D?E2(D.last,a):null,V=(Ee=D==null?void 0:D.last)!=null&&Ee.error&&Z&&Z.text!==D.last.error?D.last.error:null,le=((Ge=D==null?void 0:D.last)==null?void 0:Ge.done)??[],pe=[];pe.push({label:"Address",value:q?i.jsx("code",{className:"ap-lan-code",children:q}):"none here — it calls this deck",tone:q?void 0:"quiet"}),pe.push({label:"Reached",value:D?D.waiting?"it calls this deck · one-way":D.manual?"by an address added here":"found on this network":e.kind==="nearby"?"heard on this network":"asked this deck to pair"}),e.kind!=="dialling"&&(pe.push({label:"Paired",value:Q?D!=null&&D.pairedAt?O6(D.pairedAt,a):"before this deck kept the date":e.kind==="declined"&&A?`no · you said no ${mx(A.at,a)}`:"not yet",tone:Q&&!(D!=null&&D.pairedAt)?"quiet":"meta"}),K?(pe.push({label:"Deck",value:U??"not said",tone:U?"meta":"quiet"}),pe.push({label:"System",value:K.os?[K.os,K.arch].filter(Boolean).join(" · "):"not said",tone:K.os?"meta":"quiet"})):pe.push({label:"Version, OS",value:H,tone:"quiet"})),pe.push({label:"Fingerprint",value:J?i.jsxs("span",{className:"lan-fp",children:[i.jsx("code",{className:"ap-lan-code",children:J}),i.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void he(),"aria-label":C?"Fingerprint copied":"Copy the fingerprint",children:C?"copied":"copy"})]}):"not known — nothing has answered there",tone:J?void 0:"quiet"}),(Q||e.kind==="dialling")&&pe.push({label:"Last round",value:Z?i.jsxs(i.Fragment,{children:[Z.text.replace(/ · now$/," · just now"),V&&i.jsx("span",{className:"lan-fact-raw",children:V}),le.length>0&&i.jsx("ul",{className:"lan-done",children:le.map(re=>i.jsxs("li",{"data-ok":re.ok,children:[re.email," ",i.jsx("span",{className:"lan-done-what",children:re.ok?"arrived":"did not arrive"})]},`${re.email}:${re.action}`))})]}):"not asked yet",tone:(Z==null?void 0:Z.tone)==="bad"?"bad":Z?void 0:"quiet"});const me=new Map(s.map(re=>[re.key,re])),Ce=new Set(n.shared??[]),Ue=(n.shared??[]).map(re=>me.get(re)).filter(re=>!!re),ue=Ue.filter(re=>!re.alive),xe=Ue.length-ue.length,ye=(D==null?void 0:D.offers)??null,De=ye&&(D!=null&&D.last)&&D.last.at-ye.at>$6?os(ye.at,a):null;return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:y,className:"modal lan-peer","data-tone":e.tone,onClick:re=>re.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:[M?i.jsxs("form",{className:"lan-peer-edit",onSubmit:re=>{re.preventDefault(),G(v??"")},children:[i.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),i.jsx("input",{ref:B,className:"ap-manage-input lan-peer-input",value:v??"",maxLength:48,placeholder:z,"aria-label":"Name for this deck, shown on this deck only",onChange:re=>S(re.target.value)}),i.jsx("button",{type:"submit",className:"ap-manage-btn",...L(`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}),te&&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(P6,{})})]}),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}),M&&i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...L(`alias:${e.fp}`),onClick:()=>void G(""),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:g,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:[_&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:_}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>j(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"Connection"}),i.jsx("dl",{className:"lan-facts",children:pe.map(re=>i.jsxs("div",{className:"lan-fact","data-tone":re.tone,children:[i.jsx("dt",{children:re.label}),i.jsx("dd",{children:re.value})]},re.label))}),(D==null?void 0:D.waiting)&&i.jsx("p",{className:"lan-note",children:e.hint})]}),Q&&i.jsxs("div",{className:"modal-section",children:[i.jsxs("h3",{className:"lan-h",children:["From ",e.name]}),De&&i.jsxs("p",{className:"lan-stale",children:["Last told us ",De==="now"?"just now":De," — the last round did not get through, so this may have changed."]}),D!=null&&D.waiting?i.jsx("p",{className:"lan-empty",children:"Not known. This deck never asks it — it calls in — so what it offers only shows once this deck can reach it."}):ye?ye.accounts.length===0?i.jsx("p",{className:"lan-empty",children:"Nothing. Nobody at that deck has chosen a login to share."}):i.jsx("ul",{className:"lan-offers",role:"list",children:ye.accounts.map(re=>{const Ye=Z6(re,me.get(re.key)??null,Ce.has(re.key));return i.jsxs("li",{role:"listitem",className:"lan-offer","data-tone":Ye.tone,children:[i.jsx("span",{className:"lan-offer-email",children:re.email}),i.jsx("span",{className:"lan-offer-there",children:Ye.there}),i.jsx("span",{className:"lan-offer-here",children:Ye.here}),Ye.note&&i.jsx("span",{className:"lan-offer-note",children:Ye.note})]},re.key)})}):i.jsx("p",{className:"lan-empty",children:(ot=D==null?void 0:D.last)!=null&&ot.error?"Not known — the last attempt to ask it did not get through.":"Not asked yet. The next round asks it."})]}),Q&&i.jsxs("div",{className:"modal-section",children:[i.jsx("h3",{className:"lan-h",children:"From this deck"}),Ue.length===0?i.jsx("p",{className:"lan-empty",children:"Nothing. No login on this deck is chosen to share."}):i.jsxs(i.Fragment,{children:[ue.length>0&&i.jsx("ul",{className:"lan-offers",role:"list",children:ue.map(re=>i.jsxs("li",{role:"listitem",className:"lan-offer","data-tone":"bad",children:[i.jsx("span",{className:"lan-offer-email",children:re.email}),i.jsx("span",{className:"lan-offer-there"}),i.jsx("span",{className:"lan-offer-here",children:"expired here"}),i.jsx("span",{className:"lan-offer-note",children:"offered to every paired deck and gives them nothing — sign in again"})]},re.key))}),xe>0&&i.jsxs("button",{type:"button",className:"ap-lan-word lan-more","aria-expanded":I,onClick:()=>$(re=>!re),children:[xe===1?"1 login works here":`${xe} logins work here`,i.jsx("span",{className:"lan-more-mark","aria-hidden":!0,children:I?"−":"+"})]}),I&&xe>0&&i.jsx("ul",{className:"lan-offers",role:"list",children:Ue.filter(re=>re.alive).map(re=>i.jsxs("li",{role:"listitem",className:"lan-offer","data-tone":"ok",children:[i.jsx("span",{className:"lan-offer-email",children:re.email}),i.jsx("span",{className:"lan-offer-there"}),i.jsx("span",{className:"lan-offer-here",children:"works here"})]},re.key))})]}),i.jsx("p",{className:"lan-scope",children:"Every paired deck gets this list, the ones here now and any paired later."}),i.jsx("button",{type:"button",className:"ap-lan-word lan-peer-settings",onClick:h,children:"Change what this deck offers"})]})]}),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."}),Q&&!(D!=null&&D.waiting)&&i.jsx("button",{type:"button",className:"btn",...L(`check:${e.fp}`),onClick:()=>void Y(f),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${x?" armed":""}`,...L(`unpair:${e.fp}`),onKeyDown:re=>{re.repeat&&re.preventDefault()},onClick:()=>{if(!x){N(!0),E.current=Date.now();return}Date.now()-E.current<T2||(N(!1),Y(p))},"aria-label":x?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:x?"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…":x?"Unpair — sure?":"Unpair"}),e.kind==="nearby"&&i.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...L(`accept:${e.fp}`),onClick:()=>void Y(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",...L(`drop:${e.fp}`),onClick:()=>void Y(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",...L(`allow:${e.fp}`),onClick:()=>void Y(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"})]})]})})}function D6({status:e,accounts:t,onClose:n,onChanged:s}){const a=Ut(n),[l,c]=b.useState(null),[u,f]=b.useState(null),[p,h]=b.useState(null),g=b.useRef(null),y=C=>{const R=Js(p,C);return{disabled:R.disabled,"aria-busy":R.busy}},v=b.useRef(null),S=b.useRef(!0);b.useEffect(()=>()=>{S.current=!1},[]),b.useEffect(()=>{v.current&&U6(v.current,e.shared??[])&&(v.current=null)},[e.shared]);const _=b.useCallback(async(C,R,I="write")=>{g.current=I,h(I);try{const B=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:C})})).json().catch(()=>null);return S.current?(B!=null&&B.ok?f(null):f(Lt(R,B)),s(),(B==null?void 0:B.ok)===!0):!1}catch{return S.current&&f(Lt(R,null)),!1}finally{g.current=null,S.current&&h(null)}},[s]),j=b.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await _({name:l},"save the name","name"))return;S.current&&c(null)}n()},[l,e.name,_,n]),x=new Set(v.current??e.shared??[]),N=e.autoAsk!==!1,E=e.autoAccept!==!1;return i.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal lan-modal",onClick:C=>C.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:[u&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",children:u}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(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:C=>c(C.target.value),onKeyDown:C=>{C.key!=="Enter"||l==null||(_({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&i.jsx("button",{type:"button",className:"ap-manage-btn",...y("name"),onClick:()=>{_({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:"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(C=>i.jsxs("label",{className:"ap-lan-pick",title:C.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:x.has(C.key),onChange:R=>{const I=new Set(v.current??e.shared??[]);R.target.checked?I.add(C.key):I.delete(C.key),v.current=[...I],_({shared:[...I]},R.target.checked?"share that account":"stop sharing that account")}}),i.jsx("span",{className:"ap-lan-pick-name",children:C.email}),!C.alive&&i.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},C.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${N?" live":""}`,role:"switch","aria-checked":N,"aria-label":"Ask every deck this one finds",...y("ask"),onClick:()=>void _({autoAsk:!N},N?"stop asking automatically":"ask every deck this one finds","ask"),title:N?"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${E?" live":""}`,role:"switch","aria-checked":E,"aria-label":"Say yes to every deck that asks",...y("accept"),onClick:()=>void _({autoAccept:!E},E?"stop accepting automatically":"accept every deck that asks","accept"),title:E?"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."})]})]}),E?null:N?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",...y("name"),onClick:()=>void j(),children:"Done"})]})]})})}function os(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 px={"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"}},q6={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 F6(e){var s;const t=B6[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&q6[n]||e}const B6={"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 E2(e,t){if(!e)return null;if(e.error)return px[e.error]??{text:F6(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${os(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 · ${os(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${os(e.at,t)}`,tone:"bad"}}const Cv=5e3,C2=6e4,T2=400;function z6(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 U6(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function W6(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function A2(e,t){var n,s;return(n=e.last)!=null&&n.error&&!px[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<sd||e.lastSeen!=null&&t-e.lastSeen<sd)}const sd=95e3;function H6(e,t){const n=[],s=[];for(const a of e??[])(A2(a,t)?n:s).push(a);return{online:n,offline:s}}function G6(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 S;return!((S=v.last)!=null&&S.error)&&v.lastSeen!=null&&t-v.lastSeen<sd}),{online:u,offline:f}=H6(l,t),p=[...f,...a.filter(v=>!c.includes(v))],h=u.length+c.length,g=u.filter(v=>{var S;return((S=v.last)==null?void 0:S.error)==="waiting for the other deck to accept this one"});if(h&&g.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function V6(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=os(e,t);return s==="now"?"checked just now":`checked ${s}`}function mx(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 Y6(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<sd;return{text:n?"online · one-way, it calls in":`one-way · last online ${os(e,t)}`,here:n}}function b1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${os(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function K6(e,t){var y,v,S,_,j;if(!e)return[];const n=[],s=new Set,a=(x,N)=>x.name.localeCompare(N.name,void 0,{numeric:!0}),l=e.aliases??{},c=(x,N)=>{const E=x?l[x]:void 0;return E&&E!==N?{name:E,self:N}:{name:N}};for(const x of e.pending??[]){if(!(x!=null&&x.fp)||s.has(x.fp))continue;s.add(x.fp);const N=c(x.fp,x.name||x.fp);n.push({fp:x.fp,name:N.name,...N.self?{self:N.self}:{},addr:x.addr??"",kind:"asks",state:`wants to pair · ${mx(x.at,t)}`,tone:"wait",here:!0,hint:`${N.name} at ${x.addr} is waiting for an answer.`})}const u=[],f=[];for(const x of e.peers??[]){const N=x.peerFp??x.fp;if(!N||s.has(N))continue;s.add(N);const E=E2(x.last,t),C=A2(x,t),R=x.addr?`${x.addr}:${x.port}`:"";if(!x.paired&&x.manual&&!x.met){f.push({fp:R,name:R||x.name||N,addr:x.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=x.last)!=null&&y.error?`Nothing has answered at ${R} yet — ${x.last.error}.`:`Dialling ${R} until something answers.`});continue}const I=x.waiting?Y6(x.lastSeen,t):null,$=I?I.here:C,B=!I&&E?$?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${b1(x,$,t)}`:I?I.text:b1(x,$,t),O=(v=x.last)!=null&&v.error?px[x.last.error]:null,M=!I&&$&&!((S=x.last)!=null&&S.error)&&!(((_=x.last)==null?void 0:_.done)??[]).length,L=x.manual&&!x.met?{name:R}:c(N,x.name||N);u.push({fp:N,name:L.name,...L.self?{self:L.self}:{},addr:x.addr??"",kind:"paired",state:B,quiet:M,tone:O?O.tone==="bad"?"bad":"wait":E?E.tone:$?"ok":"idle",here:I?I.here:C,hint:I?`${L.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. ${x.lastSeen==null?"It has not called since this deck started.":`It last called ${os(x.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${L.name}${R?` at ${R}`:""}${(j=x.last)!=null&&j.error?` — ${x.last.error}`:""}`})}n.push(...u.sort(a),...f.sort(a));const p=[];for(const x of e.strangers??[]){if(!(x!=null&&x.fp)||s.has(x.fp))continue;s.add(x.fp);const N=c(x.fp,x.name||x.fp);p.push({fp:x.fp,name:N.name,...N.self?{self:N.self}:{},addr:x.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${N.name} at ${x.addr} is on this network and nothing is shared with it.`})}n.push(...p.sort(a));const h=[];for(const x of e.declined??[]){if(!(x!=null&&x.fp)||s.has(x.fp))continue;s.add(x.fp);const N=c(x.fp,x.name||x.fp);h.push({fp:x.fp,name:N.name,...N.self?{self:N.self}:{},addr:x.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${N.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const g=new Map;for(const x of n)g.set(x.name,(g.get(x.name)??0)+1);for(const x of n)(g.get(x.name)??0)<2||!x.addr||(x.state=x.quiet||!x.state?x.addr:`${x.addr} · ${x.state}`,x.quiet=!1);return n}function k1(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function X6(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 Q6(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 Z6(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"}}async function ti(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function J6({accounts:e,onChanged:t}){const[n,s]=b.useState(null),[a,l]=b.useState([]),[c,u]=b.useState(null),[f,p]=b.useState(!1),[h,g]=b.useState(null),y=b.useRef(0),[v,S]=b.useState(!1),[_,j]=b.useState(!1),[x,N]=b.useState(!1),[E,C]=b.useState(null),R=b.useRef(null),I=b.useCallback(ue=>vd(R.current)?(R.current=ue,u(ue),!0):!1,[]),$=b.useCallback(()=>{R.current=null,L.current&&u(null)},[]),B=ue=>{const xe=Js(c,ue);return{disabled:xe.disabled,"aria-busy":xe.busy}},[O,M]=b.useState(()=>Date.now()),L=b.useRef(!0),Y=b.useRef(Cv),D=b.useCallback(async()=>{var ue,xe;try{const[ye,De]=await Promise.all([fetch("/api/lan").then(ke=>ke.json()),fetch("/api/prefs").then(ke=>ke.json())]);if(!L.current)return;ye!=null&&ye.ok&&s(ye),De!=null&&De.ok&&l(Array.isArray((xe=(ue=De.prefs)==null?void 0:ue.lan)==null?void 0:xe.manual)?De.prefs.lan.manual:[]),Y.current=(ye==null?void 0:ye.enabled)===!0?Cv:C2}catch{}},[]);b.useEffect(()=>{L.current=!0;let ue=0;const xe=async()=>{M(Date.now()),await D(),L.current&&(ue=window.setTimeout(xe,Y.current))};return xe(),()=>{L.current=!1,window.clearTimeout(ue)}},[D]);const A=b.useCallback(async()=>{const ue=(n==null?void 0:n.enabled)===!0;if(I("switch"))try{const xe=await ti("/api/prefs",{lan:{enabled:!ue}});if(!L.current)return;xe!=null&&xe.ok?(C(null),ue||p(!0)):C(Lt(ue?"turn this off":"turn this on",xe)),await D()}catch{L.current&&C(Lt(ue?"turn this off":"turn this on",null))}finally{$()}},[n==null?void 0:n.enabled,D,I,$]),Q=b.useCallback(async(ue,xe,ye)=>{if(!I(`${ue}:${xe}`))return null;let De=null;try{const ke=await ti("/api/lan/peer",{action:ue,fp:xe});if(!L.current)return null;ke!=null&&ke.ok?(s(ke),C(null)):(De=Lt(ye,ke),C(De)),await D()}catch{De=Lt(ye,null),L.current&&C(De)}finally{$()}return De},[D,I,$]),z=b.useCallback(async ue=>{if(!I(`drop:${ue}`))return null;let xe=null;try{const ye=await ti("/api/prefs",{lan:{manual:a.filter(De=>De!==ue)}});if(!L.current)return null;ye!=null&&ye.ok?(C(null),t()):(xe=Lt("stop dialling that address",ye),C(xe)),await D()}catch{xe=Lt("stop dialling that address",null),L.current&&C(xe)}finally{$()}return xe},[a,D,t,I,$]),[te,J]=b.useState(null),q=b.useCallback(async(ue,xe)=>{if(!I(`alias:${ue}`))return"Something else is still being saved. Try again in a moment.";try{const ye=await ti("/api/lan/peer",{action:"alias",fp:ue,name:xe});return L.current?ye!=null&&ye.ok?(s(ye),null):Lt("rename that deck",ye):null}catch{return Lt("rename that deck",null)}finally{$()}},[I,$]),K=b.useCallback(async ue=>{if(!I(`check:${ue}`))return null;try{const xe=await ti("/api/lan/sync",{fp:ue});return L.current?xe!=null&&xe.ok?(s(xe),t(),null):(xe==null?void 0:xe.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",xe):null}catch{return Lt("check that deck",null)}finally{$()}},[I,$,t]),P=b.useCallback(async()=>{if(I("check"))try{const ue=await ti("/api/lan/sync",{});if(!L.current)return;ue!=null&&ue.ok?(s(ue),C(null)):C(Lt("check the other decks",ue)),t()}catch{L.current&&C(Lt("check the other decks",null))}finally{$()}},[I,$,t]),G=(n==null?void 0:n.enabled)===!0,he=K6(n,O),H=te?he.find(ue=>ue.fp===te)??null:null;b.useEffect(()=>{te&&n&&!H&&J(null)},[te,n,H]);const U=he.filter(ue=>ue.kind==="asks"),Z=he.filter(ue=>ue.kind!=="asks"),V=Z.filter(ue=>ue.here),le=Z.filter(ue=>!ue.here),pe=le.filter(ue=>ue.tone==="bad").length,me=x||V.length===0,Ce=G6(n,O),Ue=Z.filter(ue=>ue.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"}),G&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>S(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children: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"})})}),G&&Ue>0&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...B("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"})]})}),G&&i.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...B("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${G?" live":""}`,role:"switch","aria-checked":G,"aria-label":"Local network sync",...B("switch"),onClick:()=>void A(),title:G?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins"})]}),!G&&i.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>j(!0),title:"Four pictures: what this does, and what to do on each machine",children:[i.jsx(T6,{}),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 ${Ce.tone}`,role:"status",children:Ce.tone==="ok"?"":Ce.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:"×"})]}),G&&i.jsxs(i.Fragment,{children:[U.length>0&&i.jsx("div",{className:"ap-lan-asks",role:"alert",children:U.map(ue=>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:ue.name})," at ",i.jsx("code",{className:"ap-lan-code",children:ue.addr})," wants to pair"]}),i.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",i.jsx("code",{className:"ap-lan-code",children:ue.fp})]}),i.jsxs("span",{className:"ap-lan-ask-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...B(`accept:${ue.fp}`),onClick:()=>void Q("accept",ue.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ue.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),i.jsx("button",{type:"button",className:"ap-manage-btn",...B(`dismiss:${ue.fp}`),onClick:()=>void Q("dismiss",ue.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ue.fp))}),(me?[...V,...le]:V).length>0&&i.jsx("ul",{className:"ap-lan-here",children:(me?[...V,...le]:V).map((ue,xe)=>i.jsxs("li",{className:"ap-lan-who","data-tone":ue.tone,children:[i.jsx("i",{className:ue.here?"ap-pulse":"ap-dot","aria-hidden":!0}),i.jsx("span",{className:"ap-lan-who-name","aria-hidden":!0,children:ue.name}),i.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${xe}`,onClick:()=>J(ue.fp),children:i.jsxs("span",{className:"vis-hidden",children:[ue.name,", details"]})}),i.jsx("span",{id:`lan-who-state-${xe}`,className:ue.quiet?"vis-hidden":"ap-lan-who-when",children:ue.state}),ue.kind==="nearby"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...B(`accept:${ue.fp}`),onClick:()=>void Q("accept",ue.fp,"reach that deck"),"aria-label":`Ask ${ue.name} to pair`,title:`Send ${ue.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ue.fp}.`,children:"ask"}),ue.kind==="paired"&&i.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${h===ue.fp?" armed":""}`,...B(`unpair:${ue.fp}`),onClick:()=>{if(h!==ue.fp){g(ue.fp),y.current=Date.now(),window.setTimeout(()=>g(ye=>ye===ue.fp?null:ye),4e3);return}Date.now()-y.current<T2||(g(null),Q("unpair",ue.fp,"unpair that deck"))},"aria-label":h===ue.fp?`Confirm unpairing ${ue.name}`:`Unpair ${ue.name}`,title:h===ue.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:h===ue.fp?"sure?":"unpair"}),ue.kind==="dialling"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...B(`drop:${ue.fp}`),onClick:()=>void z(ue.fp),"aria-label":`Stop dialling ${ue.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ue.kind==="declined"&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...B(`allow:${ue.fp}`),onClick:()=>void Q("allow",ue.fp,"let that deck ask again"),"aria-label":`Let ${ue.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ue.kind}:${ue.fp}`))}),(V.length>0&&le.length>0||G&&Ue>0)&&i.jsxs("div",{className:"ap-lan-tail",children:[V.length>0&&le.length>0&&i.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":x,onClick:()=>N(ue=>!ue),title:x?"Show only the decks that are on":`Show the ${le.length} deck${le.length===1?"":"s"} that are not answering right now`,children:[i.jsx("span",{className:`ap-lan-chev${x?" open":""}`,"aria-hidden":!0,children:"›"}),x?"fewer":`${le.length} more`,!x&&pe>0&&i.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",pe," not answering"]})]}),G&&Ue>0&&i.jsx("span",{className:"ap-lan-checked",children:V6(n==null?void 0:n.checkedAt,O,c==="check")})]}),Z.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:()=>j(!0),children:"How it works"})]})]}),v&&n&&i.jsx(M6,{status:n,manual:a,onClose:()=>S(!1),onChanged:()=>{D(),t()}}),_&&i.jsx(S2,{title:"How Local network works",steps:C6,finish:G?void 0:{label:"Turn it on",act:()=>{j(!1),A()}},onClose:()=>j(!1)}),f&&n&&i.jsx(D6,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{D(),t()}}),H&&n&&i.jsx(L6,{row:H,source:X6(n,H),status:n,accounts:e,now:O,busy:c,onClose:()=>J(null),onRename:ue=>q(H.fp,ue),onCheck:()=>K(H.fp),onVerb:()=>{switch(H.kind){case"paired":return Q("unpair",H.fp,"unpair that deck");case"nearby":return Q("accept",H.fp,"reach that deck");case"declined":return Q("allow",H.fp,"let that deck ask again");case"dialling":return z(H.fp);default:return Promise.resolve(null)}},onSettings:()=>{J(null),p(!0)}})]})}const _1=15e3,eq=8e3,Mf=1800,tq=3e4,nq=[70,80,85,90,95];function N1(e,t){return p2(t-Math.floor(e/1e3))}function rq(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 sq(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 aq(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 S1(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 j1({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?m2(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 E1(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 oq({onClose:e}){var _e,Fe,Xe,at,pt;const[t,n]=b.useState(null),[s,a]=b.useState(null),[l,c]=b.useState(null),[u,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3)),v=b.useRef(null),[S,_]=b.useState(null),[j,x]=b.useState(!1),[N,E]=b.useState(""),[C,R]=b.useState(null),[I,$]=b.useState(null),[B,O]=b.useState(null),[M,L]=b.useState(!1),[Y,D]=b.useState(!1),[A,Q]=b.useState(null),[z,te]=b.useState(null),[J,q]=b.useState(null),[K,P]=b.useState(null),[G,he]=b.useState(!1),[H,U]=b.useState([]),Z=b.useRef(null),V=b.useCallback(se=>vd(Z.current)?(Z.current=se,c(se),!0):!1,[]),le=b.useCallback(()=>{Z.current=null,c(null)},[]),pe=(se,Ae=!1)=>{const Se=Js(l,se);return{disabled:Se.disabled,"aria-busy":Se.busy||Ae}},me=b.useCallback(se=>{window.requestAnimationFrame(()=>{var Ae;if(T5(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Se of C5(se)){const Te=document.querySelector(Se);if(Te){Te.focus();return}}})},[]),Ce=b.useCallback(async(se=!1)=>{se&&f(!0);const Ae=new AbortController,Se=window.setTimeout(()=>Ae.abort(),tq);try{const[Te,Be]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Te.ok){const ut=await Te.json();n(ut),U(Re=>u6(Re,ut.accounts))}Be.ok&&a(await Be.json());const kt=p6([await m1(Te),await m1(Be)]);h(ut=>g1(ut,kt))}catch{h(Te=>g1(Te,f6))}finally{window.clearTimeout(Se),se&&f(!1)}},[]),Ue=b.useCallback(async(se,Ae)=>{if(!V(Ae))return null;h(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||h({text:Sv(Te,"command failed"),raw:gi(Te)}),Te}catch{return h({text:"server unreachable"}),null}finally{le()}},[V,le]),ue=b.useCallback(async(se,Ae)=>{if(!V(Ae))return null;h(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||h({text:ai(Te,"command failed")}),Te}catch{return h({text:"server unreachable"}),null}finally{le()}},[V,le]);b.useEffect(()=>(Ce(!0),v.current=window.setInterval(()=>Ce(!1),_1),()=>{v.current!=null&&window.clearInterval(v.current)}),[Ce]),b.useEffect(()=>{const se=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const xe=((_e=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:_e.value)??"90",ye=K??xe,De=a6(ye,xe),ke=(Fe=t==null?void 0:t.accounts)==null?void 0:Fe.find(se=>se.active),Ee=((Xe=p1((ke==null?void 0:ke.lanes)??[]).peak)==null?void 0:Xe.pct)??null,Ge=Ee!=null&&Ee>=Number(xe)-15,ot=async se=>{if(V(`switch-${se}`)){h(null);try{const Se=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);Se!=null&&Se.ok||h({text:Sv(Se,"the switch failed"),raw:gi(Se)}),await Ce(!0)}catch{h({text:"server unreachable"})}finally{le(),me(se)}}},re=async(se,Ae)=>{const{commit:Se,alias:Te}=h6(N,Ae);if(Se){const Be=await ue({action:"alias",account:se,alias:Te},`alias-${se}`);if(await Ce(!0),!(Be!=null&&Be.ok))return;E(Te)}R(se),window.setTimeout(()=>R(Be=>Be===se?null:Be),Mf)},Ye=async(se,Ae)=>{const Se=await ue({action:"move",account:se,slot:Ae},`move-${se}`),Te=n6({menuFor:S,shareFor:(B==null?void 0:B.num)??null},se,Se);if(await Ce(!0),Te){_(Te.menuFor),$(Te.confirmRemove),Te.shareFor==null&&(O(null),D(!1)),Q(Te.swapNote);const Be=Te.swapNote;Be&&window.setTimeout(()=>Q(kt=>kt===Be?null:kt),eq),te(null),me(Te.menuFor)}return Se},Ke=async(se,Ae,Se)=>{if(Se.sends){const Te=await Ye(se,Ae);if(!(Te!=null&&Te.ok))return}q(se),window.setTimeout(()=>q(Te=>Te===se?null:Te),Mf)},ge=async(se,Ae)=>{if(Ae.sends){const Se=await Ue({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await Ce(!0),!(Se!=null&&Se.ok))return;P(null)}he(!0),window.setTimeout(()=>he(!1),Mf)};return i.jsxs("aside",{className:"accounts-panel",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:()=>x(!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"})})}),(((at=t==null?void 0:t.accounts)==null?void 0:at.length)??0)>0&&i.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>L(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children: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:()=>Ce(!0),...pe("reload",u),"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"})})})]})]}),t==null?p?i.jsxs("div",{className:"ap-empty",role:"alert",children:[i.jsx("span",{title:p.raw||void 0,children:p.text}),i.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",_1/1e3," seconds."]}),i.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>Ce(!0),children:u?"trying…":"try again"})]}):i.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"ap-list",children:(pt=t.accounts)==null?void 0:pt.map(se=>{const{shown:Ae,rest:Se,fuller:Te,peak:Be}=p1(se.lanes),kt=H.includes(dx(se)),ut=o6(Se.length,kt,Te);return i.jsxs("li",{className:`ap-account${se.active?" active":""}`,children:[i.jsxs("div",{className:"ap-account-head",children:[i.jsx("span",{className:"ap-num",children:se.num}),se.alias&&i.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),i.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),i.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${S===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":S===se.num,"aria-controls":S===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{_(S===se.num?null:se.num),E(se.alias??""),$(null),O(null),D(!1),Q(null),R(null),te(null),q(null)},children:"⋯"}),se.active&&i.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&i.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&i.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${se.num}`),onClick:()=>ot(se.num),title:`Switch to ${se.alias??se.email}`,children:l===`switch-${se.num}`?"…":"switch"})]}),i.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:Ae.length?i.jsxs(i.Fragment,{children:[Ae.map(Re=>i.jsx(j1,{lane:Re,nowSec:g},Re.id)),kt&&Se.map(Re=>i.jsx(j1,{lane:Re,nowSec:g},Re.id))]}):i.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),i.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&(()=>{const Re=sq(se.repair??null,g);return i.jsx("span",{className:"ap-stale-copy",title:Re.hint,children:Re.text})})(),se.stopped&&(()=>{const Re=S1(se.collector??null);return i.jsx("span",{className:"ap-stopped",title:(Re==null?void 0:Re.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:(Re==null?void 0:Re.text)??"not collecting"})})(),se.stopped&&(()=>{var ht;const Re=(ht=S1(se.collector??null))==null?void 0:ht.fix;return Re?i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>x(!0),title:"Open the sign-in dialog. Signing in as this account puts its login in this slot.",children:Re}):null})(),se.error&&(()=>{const Re=aq(se.error);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"ap-err",title:Re.hint,children:Re.text}),Re.fixable&&i.jsx("button",{type:"button",className:"ap-fix",onClick:()=>x(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),ut&&i.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":kt,"aria-controls":`ap-lanes-${se.num}`,title:i6(se.headroom,(Be==null?void 0:Be.label)??null,Se.length,kt),onClick:()=>U(Re=>c6(Re,se)),children:ut}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&i.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${se.num}`),onClick:()=>Ue({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>Ce(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?i.jsxs("span",{className:`ap-age${se.stale&&!se.stopped&&!se.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 ",N1(se.fetchedAt,g),rq(se.nextAt,g)]}):i.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===se.num&&i.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[i.jsxs("div",{className:"ap-manage-name",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),i.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:N,onChange:Re=>E(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&&re(se.num,se.alias)},maxLength:d6,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),i.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${se.num}`),onClick:()=>re(se.num,se.alias),title:"A short name to show instead of the email",children:C===se.num?"saved":"save"})]}),(()=>{const Re=t6((t.accounts??[]).map(St=>St.num),se.num),ht=r6(Re,z,se.num),wt=s6(Re,ht,se.num);return i.jsxs("div",{className:"ap-manage-slot",children:[i.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),i.jsx("span",{className:"ap-field",children:i.jsx("select",{id:`ap-slot-${se.num}`,value:String(ht),...pe(`move-${se.num}`),onChange:St=>te(Number(St.target.value)),children:Re.map(St=>i.jsx("option",{value:St.slot,children:St.label},St.slot))})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${se.num}`),title:wt.title,onClick:()=>Ke(se.num,ht,wt),children:J===se.num?wt.done:wt.label})]})})(),i.jsxs("div",{className:"ap-manage-acts",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${se.num}`),title:`Copy this account to another ${zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{D(!1);const Re=await ue({action:"share",account:se.num},`share-${se.num}`);Re!=null&&Re.ok&&O({num:se.num,blob:Re.blob,expiresAt:Re.expiresAt})},children:"share"}),i.jsx("button",{type:"button",className:`ap-manage-btn danger${I===se.num?" armed":""}`,...pe(`rm-${se.num}`),title:I===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(I!==se.num){$(se.num),window.setTimeout(()=>$(Re=>Re===se.num?null:Re),4e3);return}$(null),ue({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{_(null),Ce(!0),me(null)})},children:I===se.num?"confirm":"remove"})]}),(A==null?void 0:A.at)===se.num&&(()=>{var wt;const Re=(wt=t.accounts)==null?void 0:wt.find(St=>St.num===A.displaced),ht=(Re==null?void 0:Re.alias)??(Re==null?void 0:Re.email)??"the account that was there";return i.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${A.at} was taken, so the two accounts traded places: ${ht} now holds slot ${A.displaced}.`,children:["swapped with slot ",A.displaced]})})(),(B==null?void 0:B.num)===se.num&&(()=>{const Re=N2(B.expiresAt,g),ht=Re.tone==="gone";return i.jsxs("div",{className:`ap-share${ht?" expired":""}`,children:[i.jsx("code",{className:"ap-share-blob",children:B.blob}),i.jsxs("div",{className:"ap-share-foot",children:[i.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${se.num}`),onClick:async()=>{if(ht){D(!1);const wt=await ue({action:"share",account:se.num},`share-${se.num}`);wt!=null&&wt.ok&&O({num:se.num,blob:wt.blob,expiresAt:wt.expiresAt});return}await E1(B.blob)&&(D(!0),window.setTimeout(()=>D(!1),1800))},children:ht?"make a new share":Y?"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 ${Re.tone}`,children:Re.text})]})]})]})})()]})]},se.num)})}),(s==null?void 0:s.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.jsxs("span",{className:"ap-auto-ctl",children:[Ee!=null&&i.jsxs("span",{className:`ap-auto-now${Ge?" near":""}`,title:`The active account has used ${Math.round(Ee)}% of its limit. Auto-switch trips at ${xe}%.`,children:[Math.round(Ee),"%"]}),i.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:i.jsx("select",{"aria-label":"Switch threshold",value:ye,...pe("threshold"),onChange:se=>P(se.target.value),children:nq.map(se=>i.jsxs("option",{value:se,children:[se,"%"]},se))})}),i.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:De.title,onClick:()=>ge(ye,De),children:G?De.done:De.label}),i.jsx("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>Ue({action:"enable",enabled:!s.enabled},"enable").then(()=>Ce(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit"})]})]}),s.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",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&i.jsx("div",{className:"ap-auto-foot",children:i.jsxs("span",{className:"ap-auto-result",children:["checked ",N1(s.lastTick.at,g)]})})]}),p&&i.jsxs("div",{className:"ap-failure",role:"alert",children:[i.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),i.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),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."}),i.jsx(J6,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({key:`${String(se.email??"").trim().toLowerCase()}@@${se.orgUuid??""}`,email:se.email??"",alive:se.alive===!0})),onChanged:()=>Ce(!0)})]}):i.jsx("div",{className:"ap-empty",children:t.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."}),t.hint&&i.jsx("code",{className:"ap-cmd",children:t.hint}),i.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",i.jsx("strong",{children:"+"})," button above."]})]}):t.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",t.reason?` (${t.reason})`:"","."]})]})}),j&&i.jsx(QD,{onClose:()=>x(!1),onChanged:()=>Ce(!0)}),M&&i.jsx(e6,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>L(!1),copyText:E1})]})}const iq=3e4;function lq({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function cq({bundle:e,running:t,pending:n,lastTried:s}){return t?lq({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function uq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function dq({asked:e,reported:t}){return t?t!==e:!1}function R2(e){const t=e.thresholdMs??iq;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 hq(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 fq(e,t){return e?t==null?"auto when idle":`auto in ${hq(t)}`:"auto-restart off"}function C1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function pq(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 mq(e){const t=R2(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}}async function M2(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 gq(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 wq(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function vq(e,t){const n=wq(e),s=n?`removes ${n} on the canvas`:null,a=u=>`This ${s?`${s} and ${u}`:u}`;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 u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${u}${f}`)}. 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 xq({agentCount:e,onConfirm:t,onCancel:n}){const s=b.useRef(null),a=Ut(n,{focusRef:s,layer:UL}),[l,c]=b.useState(null);b.useEffect(()=>{let p=!1;return fetch("/api/clear").then(h=>h.ok?h.json():null).then(h=>{p||c(yq(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:f}=vq(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:u}),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:f})]})]})]})})}const bq="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.",kq=[{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 _q({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:bq}),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:kq.map(s=>i.jsxs(b.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 Nq=["done","needs-input"],Sq=[{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}]}],jq=[{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}]}],gx={done:Sq,"needs-input":jq},yi="two";function Tv(e,t){const n=gx[e];return n.find(s=>s.id===t)??n.find(s=>s.id===yi)??n[0]}function I2(e,t){return gx[e].some(s=>s.id===t)?t:yi}Tv("done",yi).notes,Tv("needs-input",yi).notes;const T1=.04,Eq=.24,zu=0,ad=100,Av=5,Bl=50;function zl(e){if(!Number.isFinite(e))return Bl;const t=Math.round(e/Av)*Av;return Math.min(ad,Math.max(zu,t))}function Cq(e){if(e==null)return Bl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?zl(Number(t)):Bl}function Tq(e){const t=zl(e),n=T1+(Eq-T1)*(t/ad);return Math.round(n*1e4)/1e4}function Aq(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(Tq(e)*s*1e4)/1e4}const Rq=160,Mq="agent-dag.soundLevel.done",Iq="agent-dag.soundLevel.needs-input",$q="agent-dag.soundFigure.done",Oq="agent-dag.soundFigure.needs-input",$2={done:Mq,"needs-input":Iq},O2={done:$q,"needs-input":Oq},Rv={done:{level:Bl,figure:yi},"needs-input":{level:Bl,figure:yi}};function Pq(e){const t=n=>({level:Cq(e($2[n])),figure:I2(n,e(O2[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const Lq={Stop:"done",Notification:"needs-input"};function Dq(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:Lq[n]??null}function qq(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 f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(l,()=>{}),s=!0,l()}catch{}}function u(f,p=!1){var S;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((S=e.prefs)==null?void 0:S.call(e))??Rv)[f]??Rv[f],g=Tv(f,h.figure),y=Aq(h.level,g),v=n.currentTime;for(const _ of g.notes){const j=n.createOscillator(),x=n.createGain();j.type=g.type??"sine",j.frequency.value=_.hz;const N=v+_.at,E=N+_.ms/1e3;x.gain.setValueAtTime(1e-4,N),x.gain.exponentialRampToValueAtTime(y,N+.012),x.gain.exponentialRampToValueAtTime(1e-4,E),j.connect(x).connect(n.destination),j.start(N),j.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const Fq="Notify me when a session needs my attention.",Bq="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",A1="Get notified when you're away from this tab.";function zq(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:A1};case"default":return{status:null,ask:!0,ok:!1,note:A1};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 R1={done:"Turn finished","needs-input":"Claude is asking"},Uq={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function Wq({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:l,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:y}){const v=zq(g),S=f&&!h,_=Ut(e),j=b.useRef(e);return j.current=e,b.useEffect(()=>{const x=N=>{var C,R;const E=N.target;E&&((C=_.current)!=null&&C.contains(E)||(R=u.current)!=null&&R.contains(E)||j.current())};return window.addEventListener("pointerdown",x,!0),()=>window.removeEventListener("pointerdown",x,!0)},[_,u]),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":f,"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:h?Bq:Fq})]})]}),S&&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:Nq.map(x=>{const N=s[x],E=`sm-level-${x}`,C=`sm-figure-${x}`;return i.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${x}`,children:[i.jsxs("div",{className:"sm-tone-head",children:[i.jsx("h3",{className:"sm-tone-name",id:`sm-name-${x}`,children:R1[x]}),i.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(x),"aria-label":`Hear the ${R1[x].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:zu,max:ad,step:Av,value:N.level,onChange:R=>a(x,Number(R.target.value)),style:{"--sm-level":`${(N.level-zu)/(ad-zu)*100}%`}}),i.jsxs("span",{className:"sm-read",children:[N.level,"%"]})]}),i.jsxs("div",{className:"sm-row",children:[i.jsx("label",{htmlFor:C,children:"Tone"}),i.jsx("select",{id:C,className:"sm-select",value:N.figure,onChange:R=>l(x,R.target.value),children:gx[x].map(R=>i.jsx("option",{value:R.id,children:R.label},R.id))})]}),i.jsx("p",{className:"sm-note",children:Uq[x]})]},x)})}),i.jsxs("p",{className:"sm-foot",children:[i.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const Hq=15e3;function Gq(e){return e.visibilityState==="visible"&&e.hasFocus()}function Vq(e,t){return t||e===!0}function Yq(){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 Kq={"//":["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.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.`}]},yx="agent-dag.releaseNotesSeen";function M1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function wi(e,t){const n=M1(e),s=M1(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 vi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function Xq(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 Qq(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!vi(n)||!Array.isArray(s))continue;const a=s.filter(Xq);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>wi(s.version,n.version))}const I1=Qq(Kq);function P2(e,t,n){return e.filter(s=>wi(s.version,n)<=0&&(t===null||wi(s.version,t)>0))}function Zq(e,t){return e.filter(n=>wi(n.version,t)===0)}function Jq(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 eF({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&&vi(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(!vi(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=wi(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 tF=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function nF(e){const t=tF.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function $1(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function rF(e){if(!e)return null;let t=null;try{t=e.getItem(yx)}catch{return null}return vi(t)?t:null}function sF(e){if(!e)return!1;try{return e.getItem(yx),!0}catch{return!1}}function aF(e,t){if(!e)return!1;try{return e.setItem(yx,t),!0}catch{return!1}}const L2="agent-dag.tourSeen";function oF(e){if(!e)return!1;try{return e.getItem(L2)==="1"}catch{return!1}}function iF(e){if(!e)return!1;try{return e.setItem(L2,"1"),!0}catch{return!1}}function lF({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 cF({stored:e,running:t,notes:n,remembers:s=!0}){if(!vi(t))return{show:[],record:null,reason:"no-version"};if(!vi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const c=Zq(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=wi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=P2(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function uF(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 D2(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=uF(e,l);if(c>0){a(),n.push({kind:"bold",kids:D2(e.slice(l+2,c),!1)}),l=c+2;continue}}s+=e[l],l+=1}return a(),n}function dF({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:l}){const c=Ut(a),u=Jq(e);return i.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:i.jsxs("div",{ref:c,className:"modal release-notes",onClick:f=>f.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"}),u&&i.jsx("span",{className:"modal-tool-id",children:u})]}),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:eF({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(f=>i.jsxs("section",{className:"modal-section",children:[i.jsxs("h3",{className:"rn-version",children:["v",f.version]}),i.jsx("ul",{className:"rn-notes",children:f.notes.map((p,h)=>{const{icon:g,rest:y}=nF(p.title);return i.jsxs("li",{className:"rn-note",children:[i.jsxs("p",{className:"rn-note-title",children:[g&&i.jsx("span",{className:"rn-note-icon",children:g}),y]}),i.jsx("p",{className:"rn-note-body",children:q2(D2(p.body))})]},h)})})]},f.version))]})]})})}function q2(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:q2(t.kids)},n))}function hF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function fF(e,t,n){var c;if(e.length===0)return null;const s=hF(e),a=t?s.findIndex(u=>u.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 pF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function mF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:pF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const gF=new Set(["","BODY","HTML","#DOCUMENT"]);function yF(e){return!e||ox(e)?!1:!gF.has(String(e.tagName??"").toUpperCase())}function Eu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function wF(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 vF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function xF(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 bF(e,t){const n=new Set;for(const s of t){const a=xF(e,s);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}function F2(e,t,n){return!t.has(e)||n.has(e)}function kF(e,t,n,s){return!t.has(e)&&F2(e,n,s)}function _F(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function NF(e,t,n,s){n.set(e,t),s.delete(e)}const SF=40,jF=120;function EF(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)},u=(f,p,h)=>{if(n!=null){if(s<=f)return;c()}const g=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(l,g)};return{live(f=SF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=jF){c(),s=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const CF=1e3;function TF(e={}){const t=Math.max(1,Math.floor(e.limit??CF)),n=e.protect;let s=!1,a=[],l=new Set,c=0,u=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==f;y&&(f=g,u=0);const v=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!s)return!0;if(v)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let S=0;if(l.size<a.length)for(;l.has(a[S]);)S++;const[_]=a.splice(S,1);l.delete(_),c++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],l=new Set,c=0,h}}}const B2="agent-dag.theme";function AF(e){return e==="light"?"light":"dark"}function RF(){return AF(ki(B2))}function MF({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Cu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Tu(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 IF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Tu(Cu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Tu(Cu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Tu(Cu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Tu(Cu.idle,"idle"))}`}),$F="No sessions are waiting for you.";function OF(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 PF(e,t){return t!==""?t:e===""?"":$F}function LF(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function DF(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 qF(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const O1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function wx(e){const t=e.toLowerCase();return Object.hasOwn(O1,t)?O1[t]:t?t[0].toUpperCase()+t.slice(1):""}function FF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function BF(e,t=[]){const n=t.length?FF(t.map(wx)):qF(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function zF(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 UF(e,t){const n=t.prefs??Rv,s=zl(n.done.level),a=zl(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)",u=e.codex?`
|
|
254
|
-
|
|
255
|
-
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
|
|
256
|
-
|
|
257
|
-
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
|
|
258
|
-
|
|
259
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function z2(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 WF(e){const t=z2([{agents:e}]);return t.length<2?null:t.map(n=>`${wx(n.id)} ${Je(n.cost)}`).join(" · ")}function P1(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 HF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function Au(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 GF=[7,14,30,90];function VF(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),l=b.useState(LF)[0],c=b.useRef(!1),u=(f=!1)=>{if(f&&!cr(c.current))return;const p=l.begin();c.current=f;const h=e;a(!0);const y=`/api/ccusage?since=${kv(h)}${f?"&refresh=1":""}`;fetch(y).then(v=>v.json()).then(v=>{p()&&n({range:h,resp:v})}).catch(()=>{p()&&n({range:h,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(c.current=!1,a(!1))})};return b.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function YF({onClose:e,providers:t}){var B;const[n,s]=b.useState(30),[a,l]=b.useState(null),{landed:c,loading:u,reload:f}=VF(n),p=b.useRef(null),h=Ut(e,{focusRef:p}),g=DF({loading:u,want:n,answer:c&&{range:c.range,ok:c.resp.ok===!0,days:((B=c.resp.days)==null?void 0:B.length)??0}}),y=g.phase==="chart"?c.resp.days??[]:[],v=b.useMemo(()=>y.reduce((O,M)=>Math.max(O,M.totalCost),0),[y]),S=b.useRef(null);b.useLayoutEffect(()=>{const O=S.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:j,inOut:x,cacheRead:N,modelCosts:E}=b.useMemo(()=>{let O=0,M=0,L=0,Y=0;const D=new Map;for(const A of y){O+=A.totalCost,M+=A.totalTokens,L+=A.inputTokens+A.outputTokens,Y+=A.cacheReadTokens;for(const Q of A.modelBreakdowns)D.set(Q.modelName,(D.get(Q.modelName)??0)+Q.cost)}return{totalCost:O,totalTok:M,inOut:L,cacheRead:Y,modelCosts:D}},[y]),C=b.useMemo(()=>Array.from(E.entries()).sort((O,M)=>M[1]-O[1]),[E]),R=b.useMemo(()=>z2(y),[y]),I=R.length>1,$=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:h,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:BF(t,R.map(O=>O.id))})]}),i.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:GF.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:f,...lr(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),i.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.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})]}):g.phase==="error"?i.jsxs("div",{className:"uh-status uh-err",title:gi(c.resp)||void 0,children:[UD(c.resp,"ccusage did not report usage"),i.jsx("div",{children:i.jsx("button",{className:"btn uh-retry",onClick:f,...lr(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?i.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):i.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[i.jsxs("div",{className:"uh-totals",children:[i.jsx(Ru,{label:"total cost",val:Je(_),accent:!0}),i.jsx(Ru,{label:"tokens",val:Tt(j)}),i.jsx(Ru,{label:"input+output",val:Tt(x)}),i.jsx(Ru,{label:"cache reads",val:Tt(N)})]}),I&&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:R.map(O=>i.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:P1(O.id)}},O.id))}),i.jsx("div",{className:"uh-agent-keys",children:R.map(O=>i.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Tt(O.tokens)} tokens`,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:P1(O.id)}}),wx(O.id),i.jsx("span",{className:"uh-agent-cost",children:Je(O.cost)}),i.jsx("span",{className:"uh-agent-share",children:HF(O.cost,_)})]},O.id))})]}),i.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,M)=>{const L=v>0?O.totalCost/v*100:0,Y=O.period===a,D=`${O.period}, ${Je(O.totalCost)}`;return i.jsxs("button",{className:`uh-bar-col${Y?" sel":""}`,onClick:()=>l(Y?null:O.period),"aria-pressed":Y,"aria-label":D,title:`${O.period} · ${Je(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":M,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[i.jsx("div",{className:"uh-bar",style:{height:`${Math.max(L,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((A,Q)=>Q.cost-A.cost).map(A=>{const Q=O.totalCost>0?A.cost/O.totalCost*100:0;return i.jsx("div",{className:"uh-bar-seg",style:{height:`${Q}%`,background:Au(A.modelName)}},A.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,M])=>i.jsxs("span",{className:"uh-legend-item",title:O,children:[i.jsx("span",{className:"uh-legend-dot",style:{background:Au(O)}}),Zs(O)," ",i.jsx("span",{className:"uh-legend-cost",children:Je(M)})]},O))}),$&&i.jsxs("div",{className:"uh-detail",children:[i.jsxs("div",{className:"uh-detail-head",children:[i.jsx("span",{className:"uh-detail-date",children:$.period}),i.jsx("span",{className:"uh-detail-cost",children:Je($.totalCost)}),(()=>{var L,Y;const M=WF($.agents)??((Y=(L=$.metadata)==null?void 0:L.agents)!=null&&Y.length?$.metadata.agents.join(" · "):null);return M?i.jsx("span",{className:"uh-detail-agents",title:M,children:M}):null})()]}),i.jsxs("div",{className:"uh-detail-mini",children:[i.jsx(Mu,{label:"input",val:Tt($.inputTokens)}),i.jsx(Mu,{label:"output",val:Tt($.outputTokens)}),i.jsx(Mu,{label:"cache write",val:Tt($.cacheCreationTokens)}),i.jsx(Mu,{label:"cache read",val:Tt($.cacheReadTokens)})]}),i.jsx("div",{className:"uh-detail-models",children:$.modelBreakdowns.slice().sort((O,M)=>M.cost-O.cost).map(O=>{const M=$.totalCost>0?O.cost/$.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:Au(O.modelName)}}),i.jsx("span",{className:"uh-model-label",children:Zs(O.modelName)})]}),i.jsx("span",{className:"uh-model-bar",children:i.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:Au(O.modelName)}})}),i.jsx("span",{className:"uh-model-cost",children:Je(O.cost)})]},O.modelName)})})]})]})]})})}function Ru({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 Mu({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 KF(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 L1=1e4,XF=12e3;function QF({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const l=b.useRef(null),c=b.useRef(null);return c.current={browsers:e,findings:t,watching:n},b.useEffect(()=>{var v;const u=l.current;if(!u)return;const f=u.getContext("2d");if(!f)return;const p=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let h=0,g=!1;const y=()=>{var te;if(g)return;const S=c.current;if(!S)return;const{browsers:_,findings:j,watching:x}=S,N=s["--accent"]||"#7dd3fc",E=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",R=KF(s["--bg"]),I=R?42:26,$=R?.85:.65,B=a(),O=Math.min(window.devicePixelRatio||1,2),M=u.clientWidth,L=u.clientHeight;(u.width!==M*O||u.height!==L*O)&&(u.width=M*O,u.height=L*O),f.setTransform(O,0,0,O,0,0),f.clearRect(0,0,M,L);const Y=M/2,D=L/2,A=Math.min(M,L)/2-6;f.strokeStyle=E,f.lineWidth=1,f.globalAlpha=R?1:.9;for(const J of[.4,.7,1])f.beginPath(),f.arc(Y,D,A*J,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(Y-A,D),f.lineTo(Y+A,D),f.moveTo(Y,D-A),f.lineTo(Y,D+A),f.stroke(),f.globalAlpha=1;const z=(x&&!p?B%L1/L1:0)*Math.PI*2-Math.PI/2;if(x){const J=(te=f.createConicGradient)==null?void 0:te.call(f,z-.85,Y,D);J&&(J.addColorStop(0,"transparent"),J.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${N} ${I}%, transparent)`),J.addColorStop(1,"transparent"),f.fillStyle=J,f.beginPath(),f.moveTo(Y,D),f.arc(Y,D,A,z-.85,z),f.closePath(),f.fill()),f.strokeStyle=N,f.globalAlpha=$,f.beginPath(),f.moveTo(Y,D),f.lineTo(Y+Math.cos(z)*A,D+Math.sin(z)*A),f.stroke(),f.globalAlpha=1}_.forEach((J,q)=>{const K=q/Math.max(_.length,1)*Math.PI*2-Math.PI/2,P=J.lastReadMs===null?1:Math.min(1,(B-J.lastReadMs)/12e4),G=A*(.42+P*.5),he=Y+Math.cos(K)*G,H=D+Math.sin(K)*G,U=Math.abs((z-K+Math.PI*3)%(Math.PI*2)-Math.PI),Z=x?Math.max(0,1-U/.55):0;f.beginPath(),f.arc(he,H,3+Z*1.6,0,Math.PI*2),f.fillStyle=J.running?N:C,f.globalAlpha=J.running?.55+Z*.45:.35,f.fill(),f.globalAlpha=1});for(const J of j){const q=(B-J.atMs)/XF;if(q<0||q>1)continue;const P=Math.max(0,_.findIndex(H=>H.key===J.browser))/Math.max(_.length,1)*Math.PI*2-Math.PI/2,G=Y+Math.cos(P)*A*.6,he=D+Math.sin(P)*A*.6;f.beginPath(),f.arc(G,he,4+q*22,0,Math.PI*2),f.strokeStyle=N,f.globalAlpha=(1-q)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(h)}},[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 D1="agent-dag.browserWatch.seenMs";function ZF(e,t){return e.filter(n=>n.startMs>t)}function JF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function e8(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 U2(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function q1(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 t8(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 n8(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 r8(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=U2(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 s8(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 a8(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function F1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function o8({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Ut(e),[l,c]=b.useState(null),[u,f]=b.useState(null),[p,h]=b.useState(null),[g,y]=b.useState(!1),v=b.useRef(!1),[S,_]=b.useState(null),[j,x]=b.useState(null),[N,E]=b.useState(!1),C=b.useRef(!1),[R,I]=b.useState(!1),[$,B]=b.useState(!1),[O,M]=b.useState(!1),[L,Y]=b.useState(!1),[D,A]=b.useState(!1),[Q,z]=b.useState(()=>Date.now());b.useEffect(()=>{const V=setInterval(()=>z(Date.now()),1e3);return()=>clearInterval(V)},[]);const te=b.useCallback(async V=>{var le,pe;if(!(V&&!cr(v.current))){v.current=V,y(!0);try{const me=await fetch(`/api/browser-watch${V?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const Ce=await me.json();c(Ce),C.current||_(((le=Ce==null?void 0:Ce.settings)==null?void 0:le.quietMinutes)??15),n(((pe=Ce==null?void 0:Ce.settings)==null?void 0:pe.enabled)===!0),f(null)}catch(me){f(me instanceof Error?me.message:String(me))}finally{v.current=!1,y(!1)}}},[n]);b.useEffect(()=>{te(!1)},[te]),b.useEffect(()=>{const V=setInterval(()=>{te(!1)},1e4);return()=>clearInterval(V)},[te]);const J=b.useCallback(async V=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:V.host,startMs:V.startMs})})}finally{await te(!1)}},[te]),q=b.useCallback(async V=>{C.current=!0,E(!0);try{const le=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(V)});if(!le.ok)throw new Error(`the deck answered ${le.status}`);await te(!1),h(null)}catch(le){h(le instanceof Error?le.message:String(le))}finally{C.current=!1,E(!1)}},[te]),K=b.useRef(t);K.current=t,b.useEffect(()=>()=>K.current(Date.now()),[]);const P=b.useMemo(()=>{const V=[];for(const le of(l==null?void 0:l.episodes)??[]){const pe=a8(le.startMs),me=V[V.length-1];me&&me.label===pe?me.episodes.push(le):V.push({label:pe,episodes:[le]})}return V},[l]),G=U2(l==null?void 0:l.browsers),he=((l==null?void 0:l.browsers)??[]).filter(V=>!(V.installed&&V.profiles>0)),H=l?r8(l):null,U=G.reduce((V,le)=>V+le.profiles,0),Z=l?JF(l.coverage.lastHumanMs,l.coverage.quietMs,Q):null;return i.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:i.jsxs("div",{ref:a,className:"modal bw-modal",onClick:V=>V.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 te(!0),...lr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),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&&!u&&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."})]}),u&&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:u})]})}),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:()=>M(V=>!V),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),i.jsxs("div",{className:"bw-glance",children:[i.jsx(QF,{browsers:G.map(V=>{var le;return{key:V.key,name:V.name,running:V.running,lastReadMs:((le=l.profiles.find(pe=>pe.browser===V.key))==null?void 0:le.lastWrittenMs)??null}}),findings:l.episodes.slice(0,6).map(V=>({browser:V.browser??null,atMs:V.endMs})),watching:l.settings.enabled,palette:s}),i.jsx("ul",{className:"bw-counts",children:t8(G,l.profiles).map(V=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-count-n",children:V.visits.toLocaleString("en-US")}),i.jsx("span",{className:"bw-count-of",children:V.name})]},V.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 ",n8(l.coverage.checkedMs,Q),l.coverage.checks>0&&i.jsxs(i.Fragment,{children:[" · ",l.coverage.checks.toLocaleString("en-US")," ",l.coverage.checks===1?"check":"checks"]})]}),Z!==null&&i.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",e8(Z)]}),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:()=>Y(V=>!V),"aria-expanded":L,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),L&&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:G.map(V=>i.jsxs("li",{children:[i.jsx("span",{className:`bw-prof-dot${V.running?" on":""}`,"aria-hidden":!0}),i.jsx("span",{className:"bw-prof-name",children:V.name}),i.jsx("span",{className:"bw-prof-state",children:V.running?"running":"idle"}),V.running&&V.relay.state==="live"&&i.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},V.key))}),he.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>A(V=>!V),"aria-expanded":D,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:D?"▾":"▸"})," ",he.length," not watched"]}),D&&i.jsxs("p",{className:"bw-rest",children:[he.map(V=>V.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),l.relay&&i.jsx(i8,{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(V=>i.jsxs("div",{className:"bw-day",children:[i.jsx("h4",{className:"bw-sec-head",children:V.label}),V.episodes.map(le=>{const pe=`${le.host}-${le.startMs}`,me=j===pe;return i.jsxs("div",{className:`bw-ep${me?" open":""}`,children:[i.jsxs("div",{className:"bw-ep-row",children:[i.jsxs("button",{className:"bw-ep-head",onClick:()=>x(me?null:pe),"aria-expanded":me,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),i.jsx("span",{className:"bw-ep-host",children:le.host}),i.jsxs("span",{className:"bw-ep-meta",children:[s8(le),F1(le)&&i.jsxs(i.Fragment,{children:[" · ",F1(le)]})]}),i.jsxs("span",{className:"bw-ep-count",children:[le.count," ",le.count===1?"page":"pages"]})]}),i.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void J(le),"aria-label":`Dismiss ${le.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&i.jsx("ul",{className:"bw-urls",children:le.urls.map((Ce,Ue)=>i.jsxs("li",{children:[i.jsx("span",{className:"bw-url-time",children:new Date(Ce.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),i.jsx("span",{className:"bw-url",children:Ce.url})]},`${Ce.url}-${Ce.timeMs}-${Ue}`))})]},pe)})]},V.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(V=>i.jsxs("div",{className:`bw-log-line ${V.level}${V.parts?"":" sys"}`,children:[i.jsx("span",{className:"bw-log-time",children:new Date(V.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),V.parts?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"bw-log-browser",children:V.parts.browser}),i.jsx("span",{className:"bw-log-profile",title:V.parts.profile,children:V.parts.profile}),i.jsxs("span",{className:"bw-log-value",children:[V.parts.value,V.parts.flagged>0&&i.jsxs("span",{className:"bw-log-flag",children:[" · ",V.parts.flagged," flagged"]})]})]}):i.jsx("span",{className:"bw-log-sys",children:V.text})]},`${V.atMs}-${V.level}-${V.text}`))})]})]})]}),l&&R&&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:S??l.settings.quietMinutes,onChange:V=>{_(Number(V.target.value)),q({quietMinutes:Number(V.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:V=>void q({reaction:V.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(V=>i.jsx("option",{value:V,children:V==="notify"?"notify me":V==="close-tab"?"close the tab":"quit the browser"},V))})]}),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:()=>B(V=>!V),"aria-expanded":$,children:[i.jsx("span",{className:"bw-chev","aria-hidden":!0,children:$?"▾":"▸"})," What Browser Watch can access"]}),$&&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:()=>h(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:q1(l,N).word},q1(l,N).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${R?" on":""}`,onClick:()=>I(V=>!V),"aria-expanded":R,"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 q({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 i8({relay:e}){const[t,n]=b.useState(!1),[s,a]=b.useState(!1),l=e.killswitch.blocked?"unblock":"block",c=e.command[l],u=b.useCallback(async()=>{await M2(c.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[c.command]),f=e.profiles.filter(h=>{var g;return(g=h.report)==null?void 0:g.present}),p=e.profiles.filter(h=>h.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(h=>i.jsx("code",{className:"bw-path",children:h},h))]}),i.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"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:[f.length>0&&i.jsx("dl",{className:"bw-key",children:f.map(h=>i.jsxs(b.Fragment,{children:[i.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),i.jsxs("dd",{children:[h.report.enabled?"enabled":"installed but switched off",h.report.allUrls?", can act on every site":", limited to the sites it was granted",h.report.sensitiveApis.length>0&&i.jsxs(i.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&i.jsxs("p",{className:"bw-rc-note",children:[p.map(h=>h.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."]}),f.some(h=>h.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:u,children:s?"Copied":"Copy"})]}),i.jsx("p",{className:"bw-rc-note",children:c.note})]})]})}function l8(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 c8({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:l,onLater:c}){const u=b.useRef(null),f=Ut(c,{focusRef:u}),p=Js(n,"accept"),h=Js(n,"dismiss");return i.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:i.jsxs("div",{ref:f,className:"modal lan-ask",onClick:g=>g.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 ",mx(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})," — it should match the one on their screen."]}),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:u,className:"btn",disabled:h.disabled,"aria-busy":h.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 vx(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 If,B1;function u8(){if(B1)return If;B1=1;function e(){this.__data__=[],this.size=0}return If=e,If}var $f,z1;function _i(){if(z1)return $f;z1=1;function e(t,n){return t===n||t!==t&&n!==n}return $f=e,$f}var Of,U1;function bd(){if(U1)return Of;U1=1;var e=_i();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return Of=t,Of}var Pf,W1;function d8(){if(W1)return Pf;W1=1;var e=bd(),t=Array.prototype,n=t.splice;function s(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var u=l.length-1;return c==u?l.pop():n.call(l,c,1),--this.size,!0}return Pf=s,Pf}var Lf,H1;function h8(){if(H1)return Lf;H1=1;var e=bd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Lf=t,Lf}var Df,G1;function f8(){if(G1)return Df;G1=1;var e=bd();function t(n){return e(this.__data__,n)>-1}return Df=t,Df}var qf,V1;function p8(){if(V1)return qf;V1=1;var e=bd();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 Ff,Y1;function kd(){if(Y1)return Ff;Y1=1;var e=u8(),t=d8(),n=h8(),s=f8(),a=p8();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,Ff=l,Ff}var Bf,K1;function m8(){if(K1)return Bf;K1=1;var e=kd();function t(){this.__data__=new e,this.size=0}return Bf=t,Bf}var zf,X1;function g8(){if(X1)return zf;X1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return zf=e,zf}var Uf,Q1;function y8(){if(Q1)return Uf;Q1=1;function e(t){return this.__data__.get(t)}return Uf=e,Uf}var Wf,Z1;function w8(){if(Z1)return Wf;Z1=1;function e(t){return this.__data__.has(t)}return Wf=e,Wf}var Hf,J1;function W2(){if(J1)return Hf;J1=1;var e=typeof du=="object"&&du&&du.Object===Object&&du;return Hf=e,Hf}var Gf,e_;function pr(){if(e_)return Gf;e_=1;var e=W2(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Gf=n,Gf}var Vf,t_;function Ni(){if(t_)return Vf;t_=1;var e=pr(),t=e.Symbol;return Vf=t,Vf}var Yf,n_;function v8(){if(n_)return Yf;n_=1;var e=Ni(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function l(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=s.call(c);return p&&(u?c[a]=f:delete c[a]),h}return Yf=l,Yf}var Kf,r_;function x8(){if(r_)return Kf;r_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Kf=n,Kf}var Xf,s_;function Ya(){if(s_)return Xf;s_=1;var e=Ni(),t=v8(),n=x8(),s="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:s:l&&l in Object(u)?t(u):n(u)}return Xf=c,Xf}var Qf,a_;function Wn(){if(a_)return Qf;a_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Qf=e,Qf}var Zf,o_;function nc(){if(o_)return Zf;o_=1;var e=Ya(),t=Wn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==s||f==a||f==n||f==l}return Zf=c,Zf}var Jf,i_;function b8(){if(i_)return Jf;i_=1;var e=pr(),t=e["__core-js_shared__"];return Jf=t,Jf}var ep,l_;function k8(){if(l_)return ep;l_=1;var e=b8(),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 ep=n,ep}var tp,c_;function H2(){if(c_)return tp;c_=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 tp=n,tp}var np,u_;function _8(){if(u_)return np;u_=1;var e=nc(),t=k8(),n=Wn(),s=H2(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var v=e(y)?h:l;return v.test(s(y))}return np=g,np}var rp,d_;function N8(){if(d_)return rp;d_=1;function e(t,n){return t==null?void 0:t[n]}return rp=e,rp}var sp,h_;function Ka(){if(h_)return sp;h_=1;var e=_8(),t=N8();function n(s,a){var l=t(s,a);return e(l)?l:void 0}return sp=n,sp}var ap,f_;function xx(){if(f_)return ap;f_=1;var e=Ka(),t=pr(),n=e(t,"Map");return ap=n,ap}var op,p_;function _d(){if(p_)return op;p_=1;var e=Ka(),t=e(Object,"create");return op=t,op}var ip,m_;function S8(){if(m_)return ip;m_=1;var e=_d();function t(){this.__data__=e?e(null):{},this.size=0}return ip=t,ip}var lp,g_;function j8(){if(g_)return lp;g_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return lp=e,lp}var cp,y_;function E8(){if(y_)return cp;y_=1;var e=_d(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var u=c[l];return u===t?void 0:u}return s.call(c,l)?c[l]:void 0}return cp=a,cp}var up,w_;function C8(){if(w_)return up;w_=1;var e=_d(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return up=s,up}var dp,v_;function T8(){if(v_)return dp;v_=1;var e=_d(),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 dp=n,dp}var hp,x_;function A8(){if(x_)return hp;x_=1;var e=S8(),t=j8(),n=E8(),s=C8(),a=T8();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,hp=l,hp}var fp,b_;function R8(){if(b_)return fp;b_=1;var e=A8(),t=kd(),n=xx();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return fp=s,fp}var pp,k_;function M8(){if(k_)return pp;k_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return pp=e,pp}var mp,__;function Nd(){if(__)return mp;__=1;var e=M8();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return mp=t,mp}var gp,N_;function I8(){if(N_)return gp;N_=1;var e=Nd();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return gp=t,gp}var yp,S_;function $8(){if(S_)return yp;S_=1;var e=Nd();function t(n){return e(this,n).get(n)}return yp=t,yp}var wp,j_;function O8(){if(j_)return wp;j_=1;var e=Nd();function t(n){return e(this,n).has(n)}return wp=t,wp}var vp,E_;function P8(){if(E_)return vp;E_=1;var e=Nd();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 vp=t,vp}var xp,C_;function bx(){if(C_)return xp;C_=1;var e=R8(),t=I8(),n=$8(),s=O8(),a=P8();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=s,l.prototype.set=a,xp=l,xp}var bp,T_;function L8(){if(T_)return bp;T_=1;var e=kd(),t=xx(),n=bx(),s=200;function a(l,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([l,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(l,c),this.size=u.size,this}return bp=a,bp}var kp,A_;function Sd(){if(A_)return kp;A_=1;var e=kd(),t=m8(),n=g8(),s=y8(),a=w8(),l=L8();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=s,c.prototype.has=a,c.prototype.set=l,kp=c,kp}var _p,R_;function kx(){if(R_)return _p;R_=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 _p=e,_p}var Np,M_;function G2(){if(M_)return Np;M_=1;var e=Ka(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Np=t,Np}var Sp,I_;function jd(){if(I_)return Sp;I_=1;var e=G2();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return Sp=t,Sp}var jp,$_;function Ed(){if($_)return jp;$_=1;var e=jd(),t=_i(),n=Object.prototype,s=n.hasOwnProperty;function a(l,c,u){var f=l[c];(!(s.call(l,c)&&t(f,u))||u===void 0&&!(c in l))&&e(l,c,u)}return jp=a,jp}var Ep,O_;function rc(){if(O_)return Ep;O_=1;var e=Ed(),t=jd();function n(s,a,l,c){var u=!l;l||(l={});for(var f=-1,p=a.length;++f<p;){var h=a[f],g=c?c(l[h],s[h],h,l,s):void 0;g===void 0&&(g=s[h]),u?t(l,h,g):e(l,h,g)}return l}return Ep=n,Ep}var Cp,P_;function D8(){if(P_)return Cp;P_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return Cp=e,Cp}var Tp,L_;function Ar(){if(L_)return Tp;L_=1;function e(t){return t!=null&&typeof t=="object"}return Tp=e,Tp}var Ap,D_;function q8(){if(D_)return Ap;D_=1;var e=Ya(),t=Ar(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return Ap=s,Ap}var Rp,q_;function sc(){if(q_)return Rp;q_=1;var e=q8(),t=Ar(),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 Rp=l,Rp}var Mp,F_;function Rt(){if(F_)return Mp;F_=1;var e=Array.isArray;return Mp=e,Mp}var El={exports:{}},Ip,B_;function F8(){if(B_)return Ip;B_=1;function e(){return!1}return Ip=e,Ip}El.exports;var z_;function Si(){return z_||(z_=1,(function(e,t){var n=pr(),s=F8(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||s;e.exports=p})(El,El.exports)),El.exports}var $p,U_;function Cd(){if(U_)return $p;U_=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 $p=n,$p}var Op,W_;function _x(){if(W_)return Op;W_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Op=t,Op}var Pp,H_;function B8(){if(H_)return Pp;H_=1;var e=Ya(),t=_x(),n=Ar(),s="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",y="[object RegExp]",v="[object Set]",S="[object String]",_="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",N="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",R="[object Int16Array]",I="[object Int32Array]",$="[object Uint8Array]",B="[object Uint8ClampedArray]",O="[object Uint16Array]",M="[object Uint32Array]",L={};L[N]=L[E]=L[C]=L[R]=L[I]=L[$]=L[B]=L[O]=L[M]=!0,L[s]=L[a]=L[j]=L[l]=L[x]=L[c]=L[u]=L[f]=L[p]=L[h]=L[g]=L[y]=L[v]=L[S]=L[_]=!1;function Y(D){return n(D)&&t(D.length)&&!!L[e(D)]}return Pp=Y,Pp}var Lp,G_;function Td(){if(G_)return Lp;G_=1;function e(t){return function(n){return t(n)}}return Lp=e,Lp}var Cl={exports:{}};Cl.exports;var V_;function Nx(){return V_||(V_=1,(function(e,t){var n=W2(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(Cl,Cl.exports)),Cl.exports}var Dp,Y_;function ac(){if(Y_)return Dp;Y_=1;var e=B8(),t=Td(),n=Nx(),s=n&&n.isTypedArray,a=s?t(s):e;return Dp=a,Dp}var qp,K_;function V2(){if(K_)return qp;K_=1;var e=D8(),t=sc(),n=Rt(),s=Si(),a=Cd(),l=ac(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var g=n(p),y=!g&&t(p),v=!g&&!y&&s(p),S=!g&&!y&&!v&&l(p),_=g||y||v||S,j=_?e(p.length,String):[],x=j.length;for(var N in p)(h||u.call(p,N))&&!(_&&(N=="length"||v&&(N=="offset"||N=="parent")||S&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||a(N,x)))&&j.push(N);return j}return qp=f,qp}var Fp,X_;function Ad(){if(X_)return Fp;X_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Fp=t,Fp}var Bp,Q_;function Y2(){if(Q_)return Bp;Q_=1;function e(t,n){return function(s){return t(n(s))}}return Bp=e,Bp}var zp,Z_;function z8(){if(Z_)return zp;Z_=1;var e=Y2(),t=e(Object.keys,Object);return zp=t,zp}var Up,J_;function Sx(){if(J_)return Up;J_=1;var e=Ad(),t=z8(),n=Object.prototype,s=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var u in Object(l))s.call(l,u)&&u!="constructor"&&c.push(u);return c}return Up=a,Up}var Wp,eN;function cs(){if(eN)return Wp;eN=1;var e=nc(),t=_x();function n(s){return s!=null&&t(s.length)&&!e(s)}return Wp=n,Wp}var Hp,tN;function ea(){if(tN)return Hp;tN=1;var e=V2(),t=Sx(),n=cs();function s(a){return n(a)?e(a):t(a)}return Hp=s,Hp}var Gp,nN;function U8(){if(nN)return Gp;nN=1;var e=rc(),t=ea();function n(s,a){return s&&e(a,t(a),s)}return Gp=n,Gp}var Vp,rN;function W8(){if(rN)return Vp;rN=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Vp=e,Vp}var Yp,sN;function H8(){if(sN)return Yp;sN=1;var e=Wn(),t=Ad(),n=W8(),s=Object.prototype,a=s.hasOwnProperty;function l(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return Yp=l,Yp}var Kp,aN;function Xa(){if(aN)return Kp;aN=1;var e=V2(),t=H8(),n=cs();function s(a){return n(a)?e(a,!0):t(a)}return Kp=s,Kp}var Xp,oN;function G8(){if(oN)return Xp;oN=1;var e=rc(),t=Xa();function n(s,a){return s&&e(a,t(a),s)}return Xp=n,Xp}var Tl={exports:{}};Tl.exports;var iN;function K2(){return iN||(iN=1,(function(e,t){var n=pr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===s,c=l?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,y=u?u(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(Tl,Tl.exports)),Tl.exports}var Qp,lN;function X2(){if(lN)return Qp;lN=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 Qp=e,Qp}var Zp,cN;function Q2(){if(cN)return Zp;cN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,l=0,c=[];++s<a;){var u=t[s];n(u,s,t)&&(c[l++]=u)}return c}return Zp=e,Zp}var Jp,uN;function Z2(){if(uN)return Jp;uN=1;function e(){return[]}return Jp=e,Jp}var em,dN;function jx(){if(dN)return em;dN=1;var e=Q2(),t=Z2(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return s.call(c,u)}))}:t;return em=l,em}var tm,hN;function V8(){if(hN)return tm;hN=1;var e=rc(),t=jx();function n(s,a){return e(s,t(s),a)}return tm=n,tm}var nm,fN;function Ex(){if(fN)return nm;fN=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 nm=e,nm}var rm,pN;function Rd(){if(pN)return rm;pN=1;var e=Y2(),t=e(Object.getPrototypeOf,Object);return rm=t,rm}var sm,mN;function J2(){if(mN)return sm;mN=1;var e=Ex(),t=Rd(),n=jx(),s=Z2(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:s;return sm=l,sm}var am,gN;function Y8(){if(gN)return am;gN=1;var e=rc(),t=J2();function n(s,a){return e(s,t(s),a)}return am=n,am}var om,yN;function eA(){if(yN)return om;yN=1;var e=Ex(),t=Rt();function n(s,a,l){var c=a(s);return t(s)?c:e(c,l(s))}return om=n,om}var im,wN;function tA(){if(wN)return im;wN=1;var e=eA(),t=jx(),n=ea();function s(a){return e(a,n,t)}return im=s,im}var lm,vN;function K8(){if(vN)return lm;vN=1;var e=eA(),t=J2(),n=Xa();function s(a){return e(a,n,t)}return lm=s,lm}var cm,xN;function X8(){if(xN)return cm;xN=1;var e=Ka(),t=pr(),n=e(t,"DataView");return cm=n,cm}var um,bN;function Q8(){if(bN)return um;bN=1;var e=Ka(),t=pr(),n=e(t,"Promise");return um=n,um}var dm,kN;function nA(){if(kN)return dm;kN=1;var e=Ka(),t=pr(),n=e(t,"Set");return dm=n,dm}var hm,_N;function Z8(){if(_N)return hm;_N=1;var e=Ka(),t=pr(),n=e(t,"WeakMap");return hm=n,hm}var fm,NN;function ji(){if(NN)return fm;NN=1;var e=X8(),t=xx(),n=Q8(),s=nA(),a=Z8(),l=Ya(),c=H2(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",y="[object DataView]",v=c(e),S=c(t),_=c(n),j=c(s),x=c(a),N=l;return(e&&N(new e(new ArrayBuffer(1)))!=y||t&&N(new t)!=u||n&&N(n.resolve())!=p||s&&N(new s)!=h||a&&N(new a)!=g)&&(N=function(E){var C=l(E),R=C==f?E.constructor:void 0,I=R?c(R):"";if(I)switch(I){case v:return y;case S:return u;case _:return p;case j:return h;case x:return g}return C}),fm=N,fm}var pm,SN;function J8(){if(SN)return pm;SN=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 pm=n,pm}var mm,jN;function rA(){if(jN)return mm;jN=1;var e=pr(),t=e.Uint8Array;return mm=t,mm}var gm,EN;function Cx(){if(EN)return gm;EN=1;var e=rA();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return gm=t,gm}var ym,CN;function eB(){if(CN)return ym;CN=1;var e=Cx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return ym=t,ym}var wm,TN;function tB(){if(TN)return wm;TN=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return wm=t,wm}var vm,AN;function nB(){if(AN)return vm;AN=1;var e=Ni(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return vm=s,vm}var xm,RN;function sA(){if(RN)return xm;RN=1;var e=Cx();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return xm=t,xm}var bm,MN;function rB(){if(MN)return bm;MN=1;var e=Cx(),t=eB(),n=tB(),s=nB(),a=sA(),l="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",y="[object Symbol]",v="[object ArrayBuffer]",S="[object DataView]",_="[object Float32Array]",j="[object Float64Array]",x="[object Int8Array]",N="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",R="[object Uint8ClampedArray]",I="[object Uint16Array]",$="[object Uint32Array]";function B(O,M,L){var Y=O.constructor;switch(M){case v:return e(O);case l:case c:return new Y(+O);case S:return t(O,L);case _:case j:case x:case N:case E:case C:case R:case I:case $:return a(O,L);case u:return new Y;case f:case g:return new Y(O);case p:return n(O);case h:return new Y;case y:return s(O)}}return bm=B,bm}var km,IN;function aA(){if(IN)return km;IN=1;var e=Wn(),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 km=n,km}var _m,$N;function oA(){if($N)return _m;$N=1;var e=aA(),t=Rd(),n=Ad();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return _m=s,_m}var Nm,ON;function sB(){if(ON)return Nm;ON=1;var e=ji(),t=Ar(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return Nm=s,Nm}var Sm,PN;function aB(){if(PN)return Sm;PN=1;var e=sB(),t=Td(),n=Nx(),s=n&&n.isMap,a=s?t(s):e;return Sm=a,Sm}var jm,LN;function oB(){if(LN)return jm;LN=1;var e=ji(),t=Ar(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return jm=s,jm}var Em,DN;function iB(){if(DN)return Em;DN=1;var e=oB(),t=Td(),n=Nx(),s=n&&n.isSet,a=s?t(s):e;return Em=a,Em}var Cm,qN;function iA(){if(qN)return Cm;qN=1;var e=Sd(),t=kx(),n=Ed(),s=U8(),a=G8(),l=K2(),c=X2(),u=V8(),f=Y8(),p=tA(),h=K8(),g=ji(),y=J8(),v=rB(),S=oA(),_=Rt(),j=Si(),x=aB(),N=Wn(),E=iB(),C=ea(),R=Xa(),I=1,$=2,B=4,O="[object Arguments]",M="[object Array]",L="[object Boolean]",Y="[object Date]",D="[object Error]",A="[object Function]",Q="[object GeneratorFunction]",z="[object Map]",te="[object Number]",J="[object Object]",q="[object RegExp]",K="[object Set]",P="[object String]",G="[object Symbol]",he="[object WeakMap]",H="[object ArrayBuffer]",U="[object DataView]",Z="[object Float32Array]",V="[object Float64Array]",le="[object Int8Array]",pe="[object Int16Array]",me="[object Int32Array]",Ce="[object Uint8Array]",Ue="[object Uint8ClampedArray]",ue="[object Uint16Array]",xe="[object Uint32Array]",ye={};ye[O]=ye[M]=ye[H]=ye[U]=ye[L]=ye[Y]=ye[Z]=ye[V]=ye[le]=ye[pe]=ye[me]=ye[z]=ye[te]=ye[J]=ye[q]=ye[K]=ye[P]=ye[G]=ye[Ce]=ye[Ue]=ye[ue]=ye[xe]=!0,ye[D]=ye[A]=ye[he]=!1;function De(ke,Ee,Ge,ot,re,Ye){var Ke,ge=Ee&I,_e=Ee&$,Fe=Ee&B;if(Ge&&(Ke=re?Ge(ke,ot,re,Ye):Ge(ke)),Ke!==void 0)return Ke;if(!N(ke))return ke;var Xe=_(ke);if(Xe){if(Ke=y(ke),!ge)return c(ke,Ke)}else{var at=g(ke),pt=at==A||at==Q;if(j(ke))return l(ke,ge);if(at==J||at==O||pt&&!re){if(Ke=_e||pt?{}:S(ke),!ge)return _e?f(ke,a(Ke,ke)):u(ke,s(Ke,ke))}else{if(!ye[at])return re?ke:{};Ke=v(ke,at,ge)}}Ye||(Ye=new e);var se=Ye.get(ke);if(se)return se;Ye.set(ke,Ke),E(ke)?ke.forEach(function(Te){Ke.add(De(Te,Ee,Ge,Te,ke,Ye))}):x(ke)&&ke.forEach(function(Te,Be){Ke.set(Be,De(Te,Ee,Ge,Be,ke,Ye))});var Ae=Fe?_e?h:p:_e?R:C,Se=Xe?void 0:Ae(ke);return t(Se||ke,function(Te,Be){Se&&(Be=Te,Te=ke[Be]),n(Ke,Be,De(Te,Ee,Ge,Be,ke,Ye))}),Ke}return Cm=De,Cm}var Tm,FN;function lB(){if(FN)return Tm;FN=1;var e=iA(),t=4;function n(s){return e(s,t)}return Tm=n,Tm}var Am,BN;function Tx(){if(BN)return Am;BN=1;function e(t){return function(){return t}}return Am=e,Am}var Rm,zN;function cB(){if(zN)return Rm;zN=1;function e(t){return function(n,s,a){for(var l=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++l];if(s(c[p],p,c)===!1)break}return n}}return Rm=e,Rm}var Mm,UN;function Ax(){if(UN)return Mm;UN=1;var e=cB(),t=e();return Mm=t,Mm}var Im,WN;function Rx(){if(WN)return Im;WN=1;var e=Ax(),t=ea();function n(s,a){return s&&e(s,a,t)}return Im=n,Im}var $m,HN;function uB(){if(HN)return $m;HN=1;var e=cs();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,u=s?c:-1,f=Object(a);(s?u--:++u<c)&&l(f[u],u,f)!==!1;);return a}}return $m=t,$m}var Om,GN;function Md(){if(GN)return Om;GN=1;var e=Rx(),t=uB(),n=t(e);return Om=n,Om}var Pm,VN;function Qa(){if(VN)return Pm;VN=1;function e(t){return t}return Pm=e,Pm}var Lm,YN;function lA(){if(YN)return Lm;YN=1;var e=Qa();function t(n){return typeof n=="function"?n:e}return Lm=t,Lm}var Dm,KN;function cA(){if(KN)return Dm;KN=1;var e=kx(),t=Md(),n=lA(),s=Rt();function a(l,c){var u=s(l)?e:t;return u(l,n(c))}return Dm=a,Dm}var qm,XN;function uA(){return XN||(XN=1,qm=cA()),qm}var Fm,QN;function dB(){if(QN)return Fm;QN=1;var e=Md();function t(n,s){var a=[];return e(n,function(l,c,u){s(l,c,u)&&a.push(l)}),a}return Fm=t,Fm}var Bm,ZN;function hB(){if(ZN)return Bm;ZN=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Bm=t,Bm}var zm,JN;function fB(){if(JN)return zm;JN=1;function e(t){return this.__data__.has(t)}return zm=e,zm}var Um,eS;function dA(){if(eS)return Um;eS=1;var e=bx(),t=hB(),n=fB();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,Um=s,Um}var Wm,tS;function pB(){if(tS)return Wm;tS=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 Wm=e,Wm}var Hm,nS;function hA(){if(nS)return Hm;nS=1;function e(t,n){return t.has(n)}return Hm=e,Hm}var Gm,rS;function fA(){if(rS)return Gm;rS=1;var e=dA(),t=pB(),n=hA(),s=1,a=2;function l(c,u,f,p,h,g){var y=f&s,v=c.length,S=u.length;if(v!=S&&!(y&&S>v))return!1;var _=g.get(c),j=g.get(u);if(_&&j)return _==u&&j==c;var x=-1,N=!0,E=f&a?new e:void 0;for(g.set(c,u),g.set(u,c);++x<v;){var C=c[x],R=u[x];if(p)var I=y?p(R,C,x,u,c,g):p(C,R,x,c,u,g);if(I!==void 0){if(I)continue;N=!1;break}if(E){if(!t(u,function($,B){if(!n(E,B)&&(C===$||h(C,$,f,p,g)))return E.push(B)})){N=!1;break}}else if(!(C===R||h(C,R,f,p,g))){N=!1;break}}return g.delete(c),g.delete(u),N}return Gm=l,Gm}var Vm,sS;function mB(){if(sS)return Vm;sS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,l){s[++n]=[l,a]}),s}return Vm=e,Vm}var Ym,aS;function Mx(){if(aS)return Ym;aS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Ym=e,Ym}var Km,oS;function gB(){if(oS)return Km;oS=1;var e=Ni(),t=rA(),n=_i(),s=fA(),a=mB(),l=Mx(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",y="[object Number]",v="[object RegExp]",S="[object Set]",_="[object String]",j="[object Symbol]",x="[object ArrayBuffer]",N="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function R(I,$,B,O,M,L,Y){switch(B){case N:if(I.byteLength!=$.byteLength||I.byteOffset!=$.byteOffset)return!1;I=I.buffer,$=$.buffer;case x:return!(I.byteLength!=$.byteLength||!L(new t(I),new t($)));case f:case p:case y:return n(+I,+$);case h:return I.name==$.name&&I.message==$.message;case v:case _:return I==$+"";case g:var D=a;case S:var A=O&c;if(D||(D=l),I.size!=$.size&&!A)return!1;var Q=Y.get(I);if(Q)return Q==$;O|=u,Y.set(I,$);var z=s(D(I),D($),O,M,L,Y);return Y.delete(I),z;case j:if(C)return C.call(I)==C.call($)}return!1}return Km=R,Km}var Xm,iS;function yB(){if(iS)return Xm;iS=1;var e=tA(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(l,c,u,f,p,h){var g=u&t,y=e(l),v=y.length,S=e(c),_=S.length;if(v!=_&&!g)return!1;for(var j=v;j--;){var x=y[j];if(!(g?x in c:s.call(c,x)))return!1}var N=h.get(l),E=h.get(c);if(N&&E)return N==c&&E==l;var C=!0;h.set(l,c),h.set(c,l);for(var R=g;++j<v;){x=y[j];var I=l[x],$=c[x];if(f)var B=g?f($,I,x,c,l,h):f(I,$,x,l,c,h);if(!(B===void 0?I===$||p(I,$,u,f,h):B)){C=!1;break}R||(R=x=="constructor")}if(C&&!R){var O=l.constructor,M=c.constructor;O!=M&&"constructor"in l&&"constructor"in c&&!(typeof O=="function"&&O instanceof O&&typeof M=="function"&&M instanceof M)&&(C=!1)}return h.delete(l),h.delete(c),C}return Xm=a,Xm}var Qm,lS;function wB(){if(lS)return Qm;lS=1;var e=Sd(),t=fA(),n=gB(),s=yB(),a=ji(),l=Rt(),c=Si(),u=ac(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",y=Object.prototype,v=y.hasOwnProperty;function S(_,j,x,N,E,C){var R=l(_),I=l(j),$=R?h:a(_),B=I?h:a(j);$=$==p?g:$,B=B==p?g:B;var O=$==g,M=B==g,L=$==B;if(L&&c(_)){if(!c(j))return!1;R=!0,O=!1}if(L&&!O)return C||(C=new e),R||u(_)?t(_,j,x,N,E,C):n(_,j,$,x,N,E,C);if(!(x&f)){var Y=O&&v.call(_,"__wrapped__"),D=M&&v.call(j,"__wrapped__");if(Y||D){var A=Y?_.value():_,Q=D?j.value():j;return C||(C=new e),E(A,Q,x,N,C)}}return L?(C||(C=new e),s(_,j,x,N,E,C)):!1}return Qm=S,Qm}var Zm,cS;function pA(){if(cS)return Zm;cS=1;var e=wB(),t=Ar();function n(s,a,l,c,u){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,l,c,n,u)}return Zm=n,Zm}var Jm,uS;function vB(){if(uS)return Jm;uS=1;var e=Sd(),t=pA(),n=1,s=2;function a(l,c,u,f){var p=u.length,h=p,g=!f;if(l==null)return!h;for(l=Object(l);p--;){var y=u[p];if(g&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<h;){y=u[p];var v=y[0],S=l[v],_=y[1];if(g&&y[2]){if(S===void 0&&!(v in l))return!1}else{var j=new e;if(f)var x=f(S,_,v,l,c,j);if(!(x===void 0?t(_,S,n|s,f,j):x))return!1}}return!0}return Jm=a,Jm}var eg,dS;function mA(){if(dS)return eg;dS=1;var e=Wn();function t(n){return n===n&&!e(n)}return eg=t,eg}var tg,hS;function xB(){if(hS)return tg;hS=1;var e=mA(),t=ea();function n(s){for(var a=t(s),l=a.length;l--;){var c=a[l],u=s[c];a[l]=[c,u,e(u)]}return a}return tg=n,tg}var ng,fS;function gA(){if(fS)return ng;fS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return ng=e,ng}var rg,pS;function bB(){if(pS)return rg;pS=1;var e=vB(),t=xB(),n=gA();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 rg=s,rg}var sg,mS;function Ei(){if(mS)return sg;mS=1;var e=Ya(),t=Ar(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return sg=s,sg}var ag,gS;function Ix(){if(gS)return ag;gS=1;var e=Rt(),t=Ei(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(l,c){if(e(l))return!1;var u=typeof l;return u=="number"||u=="symbol"||u=="boolean"||l==null||t(l)?!0:s.test(l)||!n.test(l)||c!=null&&l in Object(c)}return ag=a,ag}var og,yS;function kB(){if(yS)return og;yS=1;var e=bx(),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,u=a?a.apply(this,c):c[0],f=l.cache;if(f.has(u))return f.get(u);var p=s.apply(this,c);return l.cache=f.set(u,p)||f,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,og=n,og}var ig,wS;function _B(){if(wS)return ig;wS=1;var e=kB(),t=500;function n(s){var a=e(s,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return ig=n,ig}var lg,vS;function NB(){if(vS)return lg;vS=1;var e=_B(),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,u,f,p){l.push(f?p.replace(n,"$1"):u||c)}),l});return lg=s,lg}var cg,xS;function Id(){if(xS)return cg;xS=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 cg=e,cg}var ug,bS;function SB(){if(bS)return ug;bS=1;var e=Ni(),t=Id(),n=Rt(),s=Ei(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(s(u))return l?l.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return ug=c,ug}var dg,kS;function yA(){if(kS)return dg;kS=1;var e=SB();function t(n){return n==null?"":e(n)}return dg=t,dg}var hg,_S;function $d(){if(_S)return hg;_S=1;var e=Rt(),t=Ix(),n=NB(),s=yA();function a(l,c){return e(l)?l:t(l,c)?[l]:n(s(l))}return hg=a,hg}var fg,NS;function oc(){if(NS)return fg;NS=1;var e=Ei();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return fg=t,fg}var pg,SS;function Od(){if(SS)return pg;SS=1;var e=$d(),t=oc();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 pg=n,pg}var mg,jS;function jB(){if(jS)return mg;jS=1;var e=Od();function t(n,s,a){var l=n==null?void 0:e(n,s);return l===void 0?a:l}return mg=t,mg}var gg,ES;function EB(){if(ES)return gg;ES=1;function e(t,n){return t!=null&&n in Object(t)}return gg=e,gg}var yg,CS;function wA(){if(CS)return yg;CS=1;var e=$d(),t=sc(),n=Rt(),s=Cd(),a=_x(),l=oc();function c(u,f,p){f=e(f,u);for(var h=-1,g=f.length,y=!1;++h<g;){var v=l(f[h]);if(!(y=u!=null&&p(u,v)))break;u=u[v]}return y||++h!=g?y:(g=u==null?0:u.length,!!g&&a(g)&&s(v,g)&&(n(u)||t(u)))}return yg=c,yg}var wg,TS;function vA(){if(TS)return wg;TS=1;var e=EB(),t=wA();function n(s,a){return s!=null&&t(s,a,e)}return wg=n,wg}var vg,AS;function CB(){if(AS)return vg;AS=1;var e=pA(),t=jB(),n=vA(),s=Ix(),a=mA(),l=gA(),c=oc(),u=1,f=2;function p(h,g){return s(h)&&a(g)?l(c(h),g):function(y){var v=t(y,h);return v===void 0&&v===g?n(y,h):e(g,v,u|f)}}return vg=p,vg}var xg,RS;function xA(){if(RS)return xg;RS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return xg=e,xg}var bg,MS;function TB(){if(MS)return bg;MS=1;var e=Od();function t(n){return function(s){return e(s,n)}}return bg=t,bg}var kg,IS;function AB(){if(IS)return kg;IS=1;var e=xA(),t=TB(),n=Ix(),s=oc();function a(l){return n(l)?e(s(l)):t(l)}return kg=a,kg}var _g,$S;function us(){if($S)return _g;$S=1;var e=bB(),t=CB(),n=Qa(),s=Rt(),a=AB();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 _g=l,_g}var Ng,OS;function bA(){if(OS)return Ng;OS=1;var e=Q2(),t=dB(),n=us(),s=Rt();function a(l,c){var u=s(l)?e:t;return u(l,n(c,3))}return Ng=a,Ng}var Sg,PS;function RB(){if(PS)return Sg;PS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return Sg=n,Sg}var jg,LS;function kA(){if(LS)return jg;LS=1;var e=RB(),t=wA();function n(s,a){return s!=null&&t(s,a,e)}return jg=n,jg}var Eg,DS;function MB(){if(DS)return Eg;DS=1;var e=Sx(),t=ji(),n=sc(),s=Rt(),a=cs(),l=Si(),c=Ad(),u=ac(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function y(v){if(v==null)return!0;if(a(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||l(v)||u(v)||n(v)))return!v.length;var S=t(v);if(S==f||S==p)return!v.size;if(c(v))return!e(v).length;for(var _ in v)if(g.call(v,_))return!1;return!0}return Eg=y,Eg}var Cg,qS;function _A(){if(qS)return Cg;qS=1;function e(t){return t===void 0}return Cg=e,Cg}var Tg,FS;function NA(){if(FS)return Tg;FS=1;var e=Md(),t=cs();function n(s,a){var l=-1,c=t(s)?Array(s.length):[];return e(s,function(u,f,p){c[++l]=a(u,f,p)}),c}return Tg=n,Tg}var Ag,BS;function SA(){if(BS)return Ag;BS=1;var e=Id(),t=us(),n=NA(),s=Rt();function a(l,c){var u=s(l)?e:n;return u(l,t(c,3))}return Ag=a,Ag}var Rg,zS;function IB(){if(zS)return Rg;zS=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 Rg=e,Rg}var Mg,US;function $B(){if(US)return Mg;US=1;function e(t,n,s,a,l){return l(t,function(c,u,f){s=a?(a=!1,c):n(s,c,u,f)}),s}return Mg=e,Mg}var Ig,WS;function jA(){if(WS)return Ig;WS=1;var e=IB(),t=Md(),n=us(),s=$B(),a=Rt();function l(c,u,f){var p=a(c)?e:s,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return Ig=l,Ig}var $g,HS;function OB(){if(HS)return $g;HS=1;var e=Ya(),t=Rt(),n=Ar(),s="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==s}return $g=a,$g}var Og,GS;function PB(){if(GS)return Og;GS=1;var e=xA(),t=e("length");return Og=t,Og}var Pg,VS;function LB(){if(VS)return Pg;VS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+l+"]");function f(p){return u.test(p)}return Pg=f,Pg}var Lg,YS;function DB(){if(YS)return Lg;YS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,l="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",S=p+"?",_="["+l+"]?",j="(?:"+v+"(?:"+[h,g,y].join("|")+")"+_+S+")*",x=_+S+j,N="(?:"+[h+u+"?",u,g,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+N+x,"g");function C(R){for(var I=E.lastIndex=0;E.test(R);)++I;return I}return Lg=C,Lg}var Dg,KS;function qB(){if(KS)return Dg;KS=1;var e=PB(),t=LB(),n=DB();function s(a){return t(a)?n(a):e(a)}return Dg=s,Dg}var qg,XS;function FB(){if(XS)return qg;XS=1;var e=Sx(),t=ji(),n=cs(),s=OB(),a=qB(),l="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==l||p==c?f.size:e(f).length}return qg=u,qg}var Fg,QS;function BB(){if(QS)return Fg;QS=1;var e=kx(),t=aA(),n=Rx(),s=us(),a=Rd(),l=Rt(),c=Si(),u=nc(),f=Wn(),p=ac();function h(g,y,v){var S=l(g),_=S||c(g)||p(g);if(y=s(y,4),v==null){var j=g&&g.constructor;_?v=S?new j:[]:f(g)?v=u(j)?t(a(g)):{}:v={}}return(_?e:n)(g,function(x,N,E){return y(v,x,N,E)}),v}return Fg=h,Fg}var Bg,ZS;function zB(){if(ZS)return Bg;ZS=1;var e=Ni(),t=sc(),n=Rt(),s=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(s&&l&&l[s])}return Bg=a,Bg}var zg,JS;function $x(){if(JS)return zg;JS=1;var e=Ex(),t=zB();function n(s,a,l,c,u){var f=-1,p=s.length;for(l||(l=t),u||(u=[]);++f<p;){var h=s[f];a>0&&l(h)?a>1?n(h,a-1,l,c,u):e(u,h):c||(u[u.length]=h)}return u}return zg=n,zg}var Ug,ej;function UB(){if(ej)return Ug;ej=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 Ug=e,Ug}var Wg,tj;function EA(){if(tj)return Wg;tj=1;var e=UB(),t=Math.max;function n(s,a,l){return a=t(a===void 0?s.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=l(p),e(s,this,h)}}return Wg=n,Wg}var Hg,nj;function WB(){if(nj)return Hg;nj=1;var e=Tx(),t=G2(),n=Qa(),s=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return Hg=s,Hg}var Gg,rj;function HB(){if(rj)return Gg;rj=1;var e=800,t=16,n=Date.now;function s(a){var l=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return Gg=s,Gg}var Vg,sj;function CA(){if(sj)return Vg;sj=1;var e=WB(),t=HB(),n=t(e);return Vg=n,Vg}var Yg,aj;function Pd(){if(aj)return Yg;aj=1;var e=Qa(),t=EA(),n=CA();function s(a,l){return n(t(a,l,e),a+"")}return Yg=s,Yg}var Kg,oj;function TA(){if(oj)return Kg;oj=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 Kg=e,Kg}var Xg,ij;function GB(){if(ij)return Xg;ij=1;function e(t){return t!==t}return Xg=e,Xg}var Qg,lj;function VB(){if(lj)return Qg;lj=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 Qg=e,Qg}var Zg,cj;function YB(){if(cj)return Zg;cj=1;var e=TA(),t=GB(),n=VB();function s(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return Zg=s,Zg}var Jg,uj;function KB(){if(uj)return Jg;uj=1;var e=YB();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Jg=t,Jg}var ey,dj;function XB(){if(dj)return ey;dj=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 ey=e,ey}var ty,hj;function QB(){if(hj)return ty;hj=1;function e(){}return ty=e,ty}var ny,fj;function ZB(){if(fj)return ny;fj=1;var e=nA(),t=QB(),n=Mx(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(l){return new e(l)}:t;return ny=a,ny}var ry,pj;function JB(){if(pj)return ry;pj=1;var e=dA(),t=KB(),n=XB(),s=hA(),a=ZB(),l=Mx(),c=200;function u(f,p,h){var g=-1,y=t,v=f.length,S=!0,_=[],j=_;if(h)S=!1,y=n;else if(v>=c){var x=p?null:a(f);if(x)return l(x);S=!1,y=s,j=new e}else j=p?[]:_;e:for(;++g<v;){var N=f[g],E=p?p(N):N;if(N=h||N!==0?N:0,S&&E===E){for(var C=j.length;C--;)if(j[C]===E)continue e;p&&j.push(E),_.push(N)}else y(j,E,h)||(j!==_&&j.push(E),_.push(N))}return _}return ry=u,ry}var sy,mj;function AA(){if(mj)return sy;mj=1;var e=cs(),t=Ar();function n(s){return t(s)&&e(s)}return sy=n,sy}var ay,gj;function ez(){if(gj)return ay;gj=1;var e=$x(),t=Pd(),n=JB(),s=AA(),a=t(function(l){return n(e(l,1,s,!0))});return ay=a,ay}var oy,yj;function tz(){if(yj)return oy;yj=1;var e=Id();function t(n,s){return e(s,function(a){return n[a]})}return oy=t,oy}var iy,wj;function RA(){if(wj)return iy;wj=1;var e=tz(),t=ea();function n(s){return s==null?[]:e(s,t(s))}return iy=n,iy}var ly,vj;function Hn(){if(vj)return ly;vj=1;var e;if(typeof vx=="function")try{e={clone:lB(),constant:Tx(),each:uA(),filter:bA(),has:kA(),isArray:Rt(),isEmpty:MB(),isFunction:nc(),isUndefined:_A(),keys:ea(),map:SA(),reduce:jA(),size:FB(),transform:BB(),union:ez(),values:RA()}}catch{}return e||(e=window._),ly=e,ly}var cy,xj;function Ox(){if(xj)return cy;xj=1;var e=Hn();cy=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._in[g])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._out[g])})},a.prototype.setNodes=function(h,g){var y=arguments,v=this;return e.each(h,function(S){y.length>1?v.setNode(S,g):v.setNode(S)}),this},a.prototype.setNode=function(h,g){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=g),this):(this._nodes[h]=arguments.length>1?g:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var g=this;if(e.has(this._nodes,h)){var y=function(v){g.removeEdge(g._edgeObjs[v])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(v){g.setParent(v)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+g+" as parent of "+h+" would create a cycle");this.setNode(g)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=g,this._children[g][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var g=this._parent[h];if(g!==n)return g}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var g=this._children[h];if(g)return e.keys(g)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var g=this._preds[h];if(g)return e.keys(g)},a.prototype.successors=function(h){var g=this._sucs[h];if(g)return e.keys(g)},a.prototype.neighbors=function(h){var g=this.predecessors(h);if(g)return e.union(g,this.successors(h))},a.prototype.isLeaf=function(h){var g;return this.isDirected()?g=this.successors(h):g=this.neighbors(h),g.length===0},a.prototype.filterNodes=function(h){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,j){h(j)&&g.setNode(j,_)}),e.each(this._edgeObjs,function(_){g.hasNode(_.v)&&g.hasNode(_.w)&&g.setEdge(_,y.edge(_))});var v={};function S(_){var j=y.parent(_);return j===void 0||g.hasNode(j)?(v[_]=j,j):j in v?v[j]:S(j)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,S(_))}),g},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,g){var y=this,v=arguments;return e.reduce(h,function(S,_){return v.length>1?y.setEdge(S,_,g):y.setEdge(S,_),_}),this},a.prototype.setEdge=function(){var h,g,y,v,S=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(h=_.v,g=_.w,y=_.name,arguments.length===2&&(v=arguments[1],S=!0)):(h=_,g=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],S=!0)),h=""+h,g=""+g,e.isUndefined(y)||(y=""+y);var j=u(this._isDirected,h,g,y);if(e.has(this._edgeLabels,j))return S&&(this._edgeLabels[j]=v),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[j]=S?v:this._defaultEdgeLabelFn(h,g,y);var x=f(this._isDirected,h,g,y);return h=x.v,g=x.w,Object.freeze(x),this._edgeObjs[j]=x,l(this._preds[g],h),l(this._sucs[h],g),this._in[g][j]=x,this._out[h][j]=x,this._edgeCount++,this},a.prototype.edge=function(h,g,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,y);return this._edgeLabels[v]},a.prototype.hasEdge=function(h,g,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,y);return e.has(this._edgeLabels,v)},a.prototype.removeEdge=function(h,g,y){var v=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,y),S=this._edgeObjs[v];return S&&(h=S.v,g=S.w,delete this._edgeLabels[v],delete this._edgeObjs[v],c(this._preds[g],h),c(this._sucs[h],g),delete this._in[g][v],delete this._out[h][v],this._edgeCount--),this},a.prototype.inEdges=function(h,g){var y=this._in[h];if(y){var v=e.values(y);return g?e.filter(v,function(S){return S.v===g}):v}},a.prototype.outEdges=function(h,g){var y=this._out[h];if(y){var v=e.values(y);return g?e.filter(v,function(S){return S.w===g}):v}},a.prototype.nodeEdges=function(h,g){var y=this.inEdges(h,g);if(y)return y.concat(this.outEdges(h,g))};function l(h,g){h[g]?h[g]++:h[g]=1}function c(h,g){--h[g]||delete h[g]}function u(h,g,y,v){var S=""+g,_=""+y;if(!h&&S>_){var j=S;S=_,_=j}return S+s+_+s+(e.isUndefined(v)?t:v)}function f(h,g,y,v){var S=""+g,_=""+y;if(!h&&S>_){var j=S;S=_,_=j}var x={v:S,w:_};return v&&(x.name=v),x}function p(h,g){return u(h,g.v,g.w,g.name)}return cy}var uy,bj;function nz(){return bj||(bj=1,uy="2.1.8"),uy}var dy,kj;function rz(){return kj||(kj=1,dy={Graph:Ox(),version:nz()}),dy}var hy,_j;function sz(){if(_j)return hy;_j=1;var e=Hn(),t=Ox();hy={write:n,read:l};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:s(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function s(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function l(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return hy}var fy,Nj;function az(){if(Nj)return fy;Nj=1;var e=Hn();fy=t;function t(n){var s={},a=[],l;function c(u){e.has(s,u)||(s[u]=!0,l.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){l=[],c(u),l.length&&a.push(l)}),a}return fy}var py,Sj;function MA(){if(Sj)return py;Sj=1;var e=Hn();py=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],u=a[s];a[n]=u,a[s]=c,l[u.key]=n,l[c.key]=s},py}var my,jj;function IA(){if(jj)return my;jj=1;var e=Hn(),t=MA();my=s;var n=e.constant(1);function s(l,c,u,f){return a(l,String(c),u||n,f||function(p){return l.outEdges(p)})}function a(l,c,u,f){var p={},h=new t,g,y,v=function(S){var _=S.v!==g?S.v:S.w,j=p[_],x=u(S),N=y.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+x);N<j.distance&&(j.distance=N,j.predecessor=g,h.decrease(_,N))};for(l.nodes().forEach(function(S){var _=S===c?0:Number.POSITIVE_INFINITY;p[S]={distance:_},h.add(S,_)});h.size()>0&&(g=h.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(v);return p}return my}var gy,Ej;function oz(){if(Ej)return gy;Ej=1;var e=IA(),t=Hn();gy=n;function n(s,a,l){return t.transform(s.nodes(),function(c,u){c[u]=e(s,u,a,l)},{})}return gy}var yy,Cj;function $A(){if(Cj)return yy;Cj=1;var e=Hn();yy=t;function t(n){var s=0,a=[],l={},c=[];function u(f){var p=l[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var h=[],g;do g=a.pop(),l[g].onStack=!1,h.push(g);while(f!==g);c.push(h)}}return n.nodes().forEach(function(f){e.has(l,f)||u(f)}),c}return yy}var wy,Tj;function iz(){if(Tj)return wy;Tj=1;var e=Hn(),t=$A();wy=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 wy}var vy,Aj;function lz(){if(Aj)return vy;Aj=1;var e=Hn();vy=n;var t=e.constant(1);function n(a,l,c){return s(a,l||t,c||function(u){return a.outEdges(u)})}function s(a,l,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var g=h.v===p?h.w:h.v,y=l(h);u[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(g){var y=u[g];f.forEach(function(v){var S=y[p],_=h[v],j=y[v],x=S.distance+_.distance;x<j.distance&&(j.distance=x,j.predecessor=_.predecessor)})})}),u}return vy}var xy,Rj;function OA(){if(Rj)return xy;Rj=1;var e=Hn();xy=t,t.CycleException=n;function t(s){var a={},l={},c=[];function u(f){if(e.has(l,f))throw new n;e.has(a,f)||(l[f]=!0,a[f]=!0,e.each(s.predecessors(f),u),delete l[f],c.push(f))}if(e.each(s.sinks(),u),e.size(a)!==s.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,xy}var by,Mj;function cz(){if(Mj)return by;Mj=1;var e=OA();by=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return by}var ky,Ij;function PA(){if(Ij)return ky;Ij=1;var e=Hn();ky=t;function t(s,a,l){e.isArray(a)||(a=[a]);var c=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,l==="post",f,c,u)}),u}function n(s,a,l,c,u,f){e.has(c,a)||(c[a]=!0,l||f.push(a),e.each(u(a),function(p){n(s,p,l,c,u,f)}),l&&f.push(a))}return ky}var _y,$j;function uz(){if($j)return _y;$j=1;var e=PA();_y=t;function t(n,s){return e(n,s,"post")}return _y}var Ny,Oj;function dz(){if(Oj)return Ny;Oj=1;var e=PA();Ny=t;function t(n,s){return e(n,s,"pre")}return Ny}var Sy,Pj;function hz(){if(Pj)return Sy;Pj=1;var e=Hn(),t=Ox(),n=MA();Sy=s;function s(a,l){var c=new t,u={},f=new n,p;function h(y){var v=y.v===p?y.w:y.v,S=f.priority(v);if(S!==void 0){var _=l(y);_<S&&(u[v]=p,f.decrease(v,_))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return c}return Sy}var jy,Lj;function fz(){return Lj||(Lj=1,jy={components:az(),dijkstra:IA(),dijkstraAll:oz(),findCycles:iz(),floydWarshall:lz(),isAcyclic:cz(),postorder:uz(),preorder:dz(),prim:hz(),tarjan:$A(),topsort:OA()}),jy}var Ey,Dj;function pz(){if(Dj)return Ey;Dj=1;var e=rz();return Ey={Graph:e.Graph,json:sz(),alg:fz(),version:e.version},Ey}var Cy,qj;function hr(){if(qj)return Cy;qj=1;var e;if(typeof vx=="function")try{e=pz()}catch{}return e||(e=window.graphlib),Cy=e,Cy}var Ty,Fj;function mz(){if(Fj)return Ty;Fj=1;var e=iA(),t=1,n=4;function s(a){return e(a,t|n)}return Ty=s,Ty}var Ay,Bj;function Ld(){if(Bj)return Ay;Bj=1;var e=_i(),t=cs(),n=Cd(),s=Wn();function a(l,c,u){if(!s(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],l):!1}return Ay=a,Ay}var Ry,zj;function gz(){if(zj)return Ry;zj=1;var e=Pd(),t=_i(),n=Ld(),s=Xa(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,g=h>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(h=1);++p<h;)for(var y=f[p],v=s(y),S=-1,_=v.length;++S<_;){var j=v[S],x=u[j];(x===void 0||t(x,a[j])&&!l.call(u,j))&&(u[j]=y[j])}return u});return Ry=c,Ry}var My,Uj;function yz(){if(Uj)return My;Uj=1;var e=us(),t=cs(),n=ea();function s(a){return function(l,c,u){var f=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(g){return p(f[g],g,f)}}var h=a(l,c,u);return h>-1?f[p?l[h]:h]:void 0}}return My=s,My}var Iy,Wj;function wz(){if(Wj)return Iy;Wj=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Iy=t,Iy}var $y,Hj;function vz(){if(Hj)return $y;Hj=1;var e=wz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return $y=n,$y}var Oy,Gj;function xz(){if(Gj)return Oy;Gj=1;var e=vz(),t=Wn(),n=Ei(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=l.test(p);return g||c.test(p)?u(p.slice(2),g?2:8):a.test(p)?s:+p}return Oy=f,Oy}var Py,Vj;function LA(){if(Vj)return Py;Vj=1;var e=xz(),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 Py=s,Py}var Ly,Yj;function bz(){if(Yj)return Ly;Yj=1;var e=LA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Ly=t,Ly}var Dy,Kj;function kz(){if(Kj)return Dy;Kj=1;var e=TA(),t=us(),n=bz(),s=Math.max;function a(l,c,u){var f=l==null?0:l.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=s(f+p,0)),e(l,t(c,3),p)}return Dy=a,Dy}var qy,Xj;function _z(){if(Xj)return qy;Xj=1;var e=yz(),t=kz(),n=e(t);return qy=n,qy}var Fy,Qj;function DA(){if(Qj)return Fy;Qj=1;var e=$x();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Fy=t,Fy}var By,Zj;function Nz(){if(Zj)return By;Zj=1;var e=Ax(),t=lA(),n=Xa();function s(a,l){return a==null?a:e(a,t(l),n)}return By=s,By}var zy,Jj;function Sz(){if(Jj)return zy;Jj=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return zy=e,zy}var Uy,eE;function jz(){if(eE)return Uy;eE=1;var e=jd(),t=Rx(),n=us();function s(a,l){var c={};return l=n(l,3),t(a,function(u,f,p){e(c,f,l(u,f,p))}),c}return Uy=s,Uy}var Wy,tE;function Px(){if(tE)return Wy;tE=1;var e=Ei();function t(n,s,a){for(var l=-1,c=n.length;++l<c;){var u=n[l],f=s(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Wy=t,Wy}var Hy,nE;function Ez(){if(nE)return Hy;nE=1;function e(t,n){return t>n}return Hy=e,Hy}var Gy,rE;function Cz(){if(rE)return Gy;rE=1;var e=Px(),t=Ez(),n=Qa();function s(a){return a&&a.length?e(a,n,t):void 0}return Gy=s,Gy}var Vy,sE;function qA(){if(sE)return Vy;sE=1;var e=jd(),t=_i();function n(s,a,l){(l!==void 0&&!t(s[a],l)||l===void 0&&!(a in s))&&e(s,a,l)}return Vy=n,Vy}var Yy,aE;function Tz(){if(aE)return Yy;aE=1;var e=Ya(),t=Rd(),n=Ar(),s="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,u=l.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var g=t(h);if(g===null)return!0;var y=u.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return Yy=p,Yy}var Ky,oE;function FA(){if(oE)return Ky;oE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Ky=e,Ky}var Xy,iE;function Az(){if(iE)return Xy;iE=1;var e=rc(),t=Xa();function n(s){return e(s,t(s))}return Xy=n,Xy}var Qy,lE;function Rz(){if(lE)return Qy;lE=1;var e=qA(),t=K2(),n=sA(),s=X2(),a=oA(),l=sc(),c=Rt(),u=AA(),f=Si(),p=nc(),h=Wn(),g=Tz(),y=ac(),v=FA(),S=Az();function _(j,x,N,E,C,R,I){var $=v(j,N),B=v(x,N),O=I.get(B);if(O){e(j,N,O);return}var M=R?R($,B,N+"",j,x,I):void 0,L=M===void 0;if(L){var Y=c(B),D=!Y&&f(B),A=!Y&&!D&&y(B);M=B,Y||D||A?c($)?M=$:u($)?M=s($):D?(L=!1,M=t(B,!0)):A?(L=!1,M=n(B,!0)):M=[]:g(B)||l(B)?(M=$,l($)?M=S($):(!h($)||p($))&&(M=a(B))):L=!1}L&&(I.set(B,M),C(M,B,E,R,I),I.delete(B)),e(j,N,M)}return Qy=_,Qy}var Zy,cE;function Mz(){if(cE)return Zy;cE=1;var e=Sd(),t=qA(),n=Ax(),s=Rz(),a=Wn(),l=Xa(),c=FA();function u(f,p,h,g,y){f!==p&&n(p,function(v,S){if(y||(y=new e),a(v))s(f,p,S,h,u,g,y);else{var _=g?g(c(f,S),v,S+"",f,p,y):void 0;_===void 0&&(_=v),t(f,S,_)}},l)}return Zy=u,Zy}var Jy,uE;function Iz(){if(uE)return Jy;uE=1;var e=Pd(),t=Ld();function n(s){return e(function(a,l){var c=-1,u=l.length,f=u>1?l[u-1]:void 0,p=u>2?l[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(l[0],l[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=l[c];h&&s(a,h,c,f)}return a})}return Jy=n,Jy}var ew,dE;function $z(){if(dE)return ew;dE=1;var e=Mz(),t=Iz(),n=t(function(s,a,l){e(s,a,l)});return ew=n,ew}var tw,hE;function BA(){if(hE)return tw;hE=1;function e(t,n){return t<n}return tw=e,tw}var nw,fE;function Oz(){if(fE)return nw;fE=1;var e=Px(),t=BA(),n=Qa();function s(a){return a&&a.length?e(a,n,t):void 0}return nw=s,nw}var rw,pE;function Pz(){if(pE)return rw;pE=1;var e=Px(),t=us(),n=BA();function s(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return rw=s,rw}var sw,mE;function Lz(){if(mE)return sw;mE=1;var e=pr(),t=function(){return e.Date.now()};return sw=t,sw}var aw,gE;function Dz(){if(gE)return aw;gE=1;var e=Ed(),t=$d(),n=Cd(),s=Wn(),a=oc();function l(c,u,f,p){if(!s(c))return c;u=t(u,c);for(var h=-1,g=u.length,y=g-1,v=c;v!=null&&++h<g;){var S=a(u[h]),_=f;if(S==="__proto__"||S==="constructor"||S==="prototype")return c;if(h!=y){var j=v[S];_=p?p(j,S,v):void 0,_===void 0&&(_=s(j)?j:n(u[h+1])?[]:{})}e(v,S,_),v=v[S]}return c}return aw=l,aw}var ow,yE;function qz(){if(yE)return ow;yE=1;var e=Od(),t=Dz(),n=$d();function s(a,l,c){for(var u=-1,f=l.length,p={};++u<f;){var h=l[u],g=e(a,h);c(g,h)&&t(p,n(h,a),g)}return p}return ow=s,ow}var iw,wE;function Fz(){if(wE)return iw;wE=1;var e=qz(),t=vA();function n(s,a){return e(s,a,function(l,c){return t(s,c)})}return iw=n,iw}var lw,vE;function Bz(){if(vE)return lw;vE=1;var e=DA(),t=EA(),n=CA();function s(a){return n(t(a,void 0,e),a+"")}return lw=s,lw}var cw,xE;function zz(){if(xE)return cw;xE=1;var e=Fz(),t=Bz(),n=t(function(s,a){return s==null?{}:e(s,a)});return cw=n,cw}var uw,bE;function Uz(){if(bE)return uw;bE=1;var e=Math.ceil,t=Math.max;function n(s,a,l,c){for(var u=-1,f=t(e((a-s)/(l||1)),0),p=Array(f);f--;)p[c?f:++u]=s,s+=l;return p}return uw=n,uw}var dw,kE;function Wz(){if(kE)return dw;kE=1;var e=Uz(),t=Ld(),n=LA();function s(a){return function(l,c,u){return u&&typeof u!="number"&&t(l,c,u)&&(c=u=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),u=u===void 0?l<c?1:-1:n(u),e(l,c,u,a)}}return dw=s,dw}var hw,_E;function Hz(){if(_E)return hw;_E=1;var e=Wz(),t=e();return hw=t,hw}var fw,NE;function Gz(){if(NE)return fw;NE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return fw=e,fw}var pw,SE;function Vz(){if(SE)return pw;SE=1;var e=Ei();function t(n,s){if(n!==s){var a=n!==void 0,l=n===null,c=n===n,u=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&f&&h&&!p&&!g||l&&f&&h||!a&&h||!c)return 1;if(!l&&!u&&!g&&n<s||g&&a&&c&&!l&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return pw=t,pw}var mw,jE;function Yz(){if(jE)return mw;jE=1;var e=Vz();function t(n,s,a){for(var l=-1,c=n.criteria,u=s.criteria,f=c.length,p=a.length;++l<f;){var h=e(c[l],u[l]);if(h){if(l>=p)return h;var g=a[l];return h*(g=="desc"?-1:1)}}return n.index-s.index}return mw=t,mw}var gw,EE;function Kz(){if(EE)return gw;EE=1;var e=Id(),t=Od(),n=us(),s=NA(),a=Gz(),l=Td(),c=Yz(),u=Qa(),f=Rt();function p(h,g,y){g.length?g=e(g,function(_){return f(_)?function(j){return t(j,_.length===1?_[0]:_)}:_}):g=[u];var v=-1;g=e(g,l(n));var S=s(h,function(_,j,x){var N=e(g,function(E){return E(_)});return{criteria:N,index:++v,value:_}});return a(S,function(_,j){return c(_,j,y)})}return gw=p,gw}var yw,CE;function Xz(){if(CE)return yw;CE=1;var e=$x(),t=Kz(),n=Pd(),s=Ld(),a=n(function(l,c){if(l==null)return[];var u=c.length;return u>1&&s(l,c[0],c[1])?c=[]:u>2&&s(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return yw=a,yw}var ww,TE;function Qz(){if(TE)return ww;TE=1;var e=yA(),t=0;function n(s){var a=++t;return e(s)+a}return ww=n,ww}var vw,AE;function Zz(){if(AE)return vw;AE=1;function e(t,n,s){for(var a=-1,l=t.length,c=n.length,u={};++a<l;){var f=a<c?n[a]:void 0;s(u,t[a],f)}return u}return vw=e,vw}var xw,RE;function Jz(){if(RE)return xw;RE=1;var e=Ed(),t=Zz();function n(s,a){return t(s||[],a||[],e)}return xw=n,xw}var bw,ME;function yt(){if(ME)return bw;ME=1;var e;if(typeof vx=="function")try{e={cloneDeep:mz(),constant:Tx(),defaults:gz(),each:uA(),filter:bA(),find:_z(),flatten:DA(),forEach:cA(),forIn:Nz(),has:kA(),isUndefined:_A(),last:Sz(),map:SA(),mapValues:jz(),max:Cz(),merge:$z(),min:Oz(),minBy:Pz(),now:Lz(),pick:zz(),range:Hz(),reduce:jA(),sortBy:Xz(),uniqueId:Qz(),values:RA(),zipObject:Jz()}}catch{}return e||(e=window._),bw=e,bw}var kw,IE;function eU(){if(IE)return kw;IE=1,kw=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 kw}var _w,$E;function tU(){if($E)return _w;$E=1;var e=yt(),t=hr().Graph,n=eU();_w=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=u(p,h||s),y=l(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(v){return p.outEdges(v.v,v.w)}),!0)}function l(p,h,g){for(var y=[],v=h[h.length-1],S=h[0],_;p.nodeCount();){for(;_=S.dequeue();)c(p,h,g,_);for(;_=v.dequeue();)c(p,h,g,_);if(p.nodeCount()){for(var j=h.length-2;j>0;--j)if(_=h[j].dequeue(),_){y=y.concat(c(p,h,g,_,!0));break}}}return y}function c(p,h,g,y,v){var S=v?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var j=p.edge(_),x=p.node(_.v);v&&S.push({v:_.v,w:_.w}),x.out-=j,f(h,g,x)}),e.forEach(p.outEdges(y.v),function(_){var j=p.edge(_),x=_.w,N=p.node(x);N.in-=j,f(h,g,N)}),p.removeNode(y.v),S}function u(p,h){var g=new t,y=0,v=0;e.forEach(p.nodes(),function(j){g.setNode(j,{v:j,in:0,out:0})}),e.forEach(p.edges(),function(j){var x=g.edge(j.v,j.w)||0,N=h(j),E=x+N;g.setEdge(j.v,j.w,E),v=Math.max(v,g.node(j.v).out+=N),y=Math.max(y,g.node(j.w).in+=N)});var S=e.range(v+y+3).map(function(){return new n}),_=y+1;return e.forEach(g.nodes(),function(j){f(S,_,g.node(j))}),{graph:g,buckets:S,zeroIdx:_}}function f(p,h,g){g.out?g.in?p[g.out-g.in+h].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return _w}var Nw,OE;function nU(){if(OE)return Nw;OE=1;var e=yt(),t=tU();Nw={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,u(l)):s(l);e.forEach(c,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function s(l){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(l.outEdges(h),function(g){e.has(u,g.w)?c.push(g):p(g.w)}),delete u[h])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var u=l.edge(c);if(u.reversed){l.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,l.setEdge(c.w,c.v,u,f)}})}return Nw}var Sw,PE;function vn(){if(PE)return Sw;PE=1;var e=yt(),t=hr().Graph;Sw={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:y,partition:v,time:S,notime:_};function n(j,x,N,E){var C;do C=e.uniqueId(E);while(j.hasNode(C));return N.dummy=x,j.setNode(C,N),C}function s(j){var x=new t().setGraph(j.graph());return e.forEach(j.nodes(),function(N){x.setNode(N,j.node(N))}),e.forEach(j.edges(),function(N){var E=x.edge(N.v,N.w)||{weight:0,minlen:1},C=j.edge(N);x.setEdge(N.v,N.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),x}function a(j){var x=new t({multigraph:j.isMultigraph()}).setGraph(j.graph());return e.forEach(j.nodes(),function(N){j.children(N).length||x.setNode(N,j.node(N))}),e.forEach(j.edges(),function(N){x.setEdge(N,j.edge(N))}),x}function l(j){var x=e.map(j.nodes(),function(N){var E={};return e.forEach(j.outEdges(N),function(C){E[C.w]=(E[C.w]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),x)}function c(j){var x=e.map(j.nodes(),function(N){var E={};return e.forEach(j.inEdges(N),function(C){E[C.v]=(E[C.v]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),x)}function u(j,x){var N=j.x,E=j.y,C=x.x-N,R=x.y-E,I=j.width/2,$=j.height/2;if(!C&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var B,O;return Math.abs(R)*I>Math.abs(C)*$?(R<0&&($=-$),B=$*C/R,O=$):(C<0&&(I=-I),B=I,O=I*R/C),{x:N+B,y:E+O}}function f(j){var x=e.map(e.range(y(j)+1),function(){return[]});return e.forEach(j.nodes(),function(N){var E=j.node(N),C=E.rank;e.isUndefined(C)||(x[C][E.order]=N)}),x}function p(j){var x=e.min(e.map(j.nodes(),function(N){return j.node(N).rank}));e.forEach(j.nodes(),function(N){var E=j.node(N);e.has(E,"rank")&&(E.rank-=x)})}function h(j){var x=e.min(e.map(j.nodes(),function(R){return j.node(R).rank})),N=[];e.forEach(j.nodes(),function(R){var I=j.node(R).rank-x;N[I]||(N[I]=[]),N[I].push(R)});var E=0,C=j.graph().nodeRankFactor;e.forEach(N,function(R,I){e.isUndefined(R)&&I%C!==0?--E:E&&e.forEach(R,function($){j.node($).rank+=E})})}function g(j,x,N,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=N,C.order=E),n(j,"border",C,x)}function y(j){return e.max(e.map(j.nodes(),function(x){var N=j.node(x).rank;if(!e.isUndefined(N))return N}))}function v(j,x){var N={lhs:[],rhs:[]};return e.forEach(j,function(E){x(E)?N.lhs.push(E):N.rhs.push(E)}),N}function S(j,x){var N=e.now();try{return x()}finally{console.log(j+" time: "+(e.now()-N)+"ms")}}function _(j,x){return x()}return Sw}var jw,LE;function rU(){if(LE)return jw;LE=1;var e=yt(),t=vn();jw={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){s(l,c)})}function s(l,c){var u=c.v,f=l.node(u).rank,p=c.w,h=l.node(p).rank,g=c.name,y=l.edge(c),v=y.labelRank;if(h!==f+1){l.removeEdge(c);var S,_,j;for(j=0,++f;f<h;++j,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},S=t.addDummyNode(l,"edge",_,"_d"),f===v&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(u,S,{weight:y.weight},g),j===0&&l.graph().dummyChains.push(S),u=S;l.setEdge(u,p,{weight:y.weight},g)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var u=l.node(c),f=u.edgeLabel,p;for(l.setEdge(u.edgeObj,f);u.dummy;)p=l.successors(c)[0],l.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=l.node(c)})}return jw}var Ew,DE;function od(){if(DE)return Ew;DE=1;var e=yt();Ew={longestPath:t,slack:n};function t(s){var a={};function l(c){var u=s.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(s.outEdges(c),function(p){return l(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),l)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return Ew}var Cw,qE;function zA(){if(qE)return Cw;qE=1;var e=yt(),t=hr().Graph,n=od().slack;Cw=s;function s(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var g,y;a(f,u)<h;)g=l(f,u),y=f.hasNode(g.v)?n(u,g):-n(u,g),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var y=g.v,v=h===y?g.w:y;!u.hasNode(v)&&!n(f,g)&&(u.setNode(v,{}),u.setEdge(h,v,{}),p(v))})}return e.forEach(u.nodes(),p),u.nodeCount()}function l(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return Cw}var Tw,FE;function sU(){if(FE)return Tw;FE=1;var e=yt(),t=zA(),n=od().slack,s=od().longestPath,a=hr().alg.preorder,l=hr().alg.postorder,c=vn().simplify;Tw=u,u.initLowLimValues=g,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=v,u.enterEdge=S,u.exchangeEdges=_;function u(E){E=c(E),s(E);var C=t(E);g(C),f(C,E);for(var R,I;R=v(C);)I=S(C,E,R),_(C,E,R,I)}function f(E,C){var R=l(E,E.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(I){p(E,C,I)})}function p(E,C,R){var I=E.node(R),$=I.parent;E.edge(R,$).cutvalue=h(E,C,R)}function h(E,C,R){var I=E.node(R),$=I.parent,B=!0,O=C.edge(R,$),M=0;return O||(B=!1,O=C.edge($,R)),M=O.weight,e.forEach(C.nodeEdges(R),function(L){var Y=L.v===R,D=Y?L.w:L.v;if(D!==$){var A=Y===B,Q=C.edge(L).weight;if(M+=A?Q:-Q,x(E,R,D)){var z=E.edge(R,D).cutvalue;M+=A?-z:z}}}),M}function g(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,R,I,$){var B=R,O=E.node(I);return C[I]=!0,e.forEach(E.neighbors(I),function(M){e.has(C,M)||(R=y(E,C,R,M,I))}),O.low=B,O.lim=R++,$?O.parent=$:delete O.parent,R}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function S(E,C,R){var I=R.v,$=R.w;C.hasEdge(I,$)||(I=R.w,$=R.v);var B=E.node(I),O=E.node($),M=B,L=!1;B.lim>O.lim&&(M=O,L=!0);var Y=e.filter(C.edges(),function(D){return L===N(E,E.node(D.v),M)&&L!==N(E,E.node(D.w),M)});return e.minBy(Y,function(D){return n(C,D)})}function _(E,C,R,I){var $=R.v,B=R.w;E.removeEdge($,B),E.setEdge(I.v,I.w,{}),g(E),f(E,C),j(E,C)}function j(E,C){var R=e.find(E.nodes(),function($){return!C.node($).parent}),I=a(E,R);I=I.slice(1),e.forEach(I,function($){var B=E.node($).parent,O=C.edge($,B),M=!1;O||(O=C.edge(B,$),M=!0),C.node($).rank=C.node(B).rank+(M?O.minlen:-O.minlen)})}function x(E,C,R){return E.hasEdge(C,R)}function N(E,C,R){return R.low<=C.lim&&C.lim<=R.lim}return Tw}var Aw,BE;function aU(){if(BE)return Aw;BE=1;var e=od(),t=e.longestPath,n=zA(),s=sU();Aw=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":l(f);break;default:u(f)}}var l=t;function c(f){t(f),n(f)}function u(f){s(f)}return Aw}var Rw,zE;function oU(){if(zE)return Rw;zE=1;var e=yt();Rw=t;function t(a){var l=s(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,l,f.v,f.w),h=p.path,g=p.lca,y=0,v=h[y],S=!0;c!==f.w;){if(u=a.node(c),S){for(;(v=h[y])!==g&&a.node(v).maxRank<u.rank;)y++;v===g&&(S=!1)}if(!S){for(;y<h.length-1&&a.node(v=h[y+1]).minRank<=u.rank;)y++;v=h[y]}a.setParent(c,v),c=a.successors(c)[0]}})}function n(a,l,c,u){var f=[],p=[],h=Math.min(l[c].low,l[u].low),g=Math.max(l[c].lim,l[u].lim),y,v;y=c;do y=a.parent(y),f.push(y);while(y&&(l[y].low>h||g>l[y].lim));for(v=y,y=u;(y=a.parent(y))!==v;)p.push(y);return{path:f.concat(p.reverse()),lca:v}}function s(a){var l={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),l[f]={low:p,lim:c++}}return e.forEach(a.children(),u),l}return Rw}var Mw,UE;function iU(){if(UE)return Mw;UE=1;var e=yt(),t=vn();Mw={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,g=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(v){u.edge(v).minlen*=g});var y=l(u)+1;e.forEach(u.children(),function(v){s(u,f,g,y,h,p,v)}),u.graph().nodeRankFactor=g}function s(u,f,p,h,g,y,v){var S=u.children(v);if(!S.length){v!==f&&u.setEdge(f,v,{weight:0,minlen:p});return}var _=t.addBorderNode(u,"_bt"),j=t.addBorderNode(u,"_bb"),x=u.node(v);u.setParent(_,v),x.borderTop=_,u.setParent(j,v),x.borderBottom=j,e.forEach(S,function(N){s(u,f,p,h,g,y,N);var E=u.node(N),C=E.borderTop?E.borderTop:N,R=E.borderBottom?E.borderBottom:N,I=E.borderTop?h:2*h,$=C!==R?1:g-y[v]+1;u.setEdge(_,C,{weight:I,minlen:$,nestingEdge:!0}),u.setEdge(R,j,{weight:I,minlen:$,nestingEdge:!0})}),u.parent(v)||u.setEdge(f,_,{weight:0,minlen:g+y[v]})}function a(u){var f={};function p(h,g){var y=u.children(h);y&&y.length&&e.forEach(y,function(v){p(v,g+1)}),f[h]=g}return e.forEach(u.children(),function(h){p(h,1)}),f}function l(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return Mw}var Iw,WE;function lU(){if(WE)return Iw;WE=1;var e=yt(),t=vn();Iw=n;function n(a){function l(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,l),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",c,f,p),s(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),l)}function s(a,l,c,u,f,p){var h={width:0,height:0,rank:p,borderType:l},g=f[l][p-1],y=t.addDummyNode(a,"border",h,c);f[l][p]=y,a.setParent(y,u),g&&a.setEdge(g,y,{weight:1})}return Iw}var $w,HE;function cU(){if(HE)return $w;HE=1;var e=yt();$w={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&l(p),(h==="lr"||h==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function l(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,c),e.has(g,"y")&&c(g)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return $w}var Ow,GE;function uU(){if(GE)return Ow;GE=1;var e=yt();Ow=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 u(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return Ow}var Pw,VE;function dU(){if(VE)return Pw;VE=1;var e=yt();Pw=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})),u=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),f=1;f<l.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(y){var v=y.pos+f;h[v]+=y.weight;for(var S=0;v>0;)v%2&&(S+=h[v+1]),v=v-1>>1,h[v]+=y.weight;g+=y.weight*S})),g}return Pw}var Lw,YE;function hU(){if(YE)return Lw;YE=1;var e=yt();Lw=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(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return Lw}var Dw,KE;function fU(){if(KE)return Dw;KE=1;var e=yt();Dw=t;function t(a,l){var c={};e.forEach(a,function(f,p){var h=c[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(l.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var l=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();l.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}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,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),l.weight&&(c+=l.barycenter*l.weight,u+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(l.i,a.i),l.merged=!0}return Dw}var qw,XE;function pU(){if(XE)return qw;XE=1;var e=yt(),t=vn();qw=n;function n(l,c){var u=t.partition(l,function(_){return e.has(_,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(_){return-_.i}),h=[],g=0,y=0,v=0;f.sort(a(!!c)),v=s(h,p,v),e.forEach(f,function(_){v+=_.vs.length,h.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,v=s(h,p,v)});var S={vs:e.flatten(h,!0)};return y&&(S.barycenter=g/y,S.weight=y),S}function s(l,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),l.push(f.vs),u++;return u}function a(l){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:l?u.i-c.i:c.i-u.i}}return qw}var Fw,QE;function mU(){if(QE)return Fw;QE=1;var e=yt(),t=hU(),n=fU(),s=pU();Fw=a;function a(u,f,p,h){var g=u.children(f),y=u.node(f),v=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,_={};v&&(g=e.filter(g,function(R){return R!==v&&R!==S}));var j=t(u,g);e.forEach(j,function(R){if(u.children(R.v).length){var I=a(u,R.v,p,h);_[R.v]=I,e.has(I,"barycenter")&&c(R,I)}});var x=n(j,p);l(x,_);var N=s(x,h);if(v&&(N.vs=e.flatten([v,N.vs,S],!0),u.predecessors(v).length)){var E=u.node(u.predecessors(v)[0]),C=u.node(u.predecessors(S)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+E.order+C.order)/(N.weight+2),N.weight+=2}return N}function l(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return Fw}var Bw,ZE;function gU(){if(ZE)return Bw;ZE=1;var e=yt(),t=hr().Graph;Bw=n;function n(a,l,c){var u=s(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),g=a.parent(p);(h.rank===l||h.minRank<=l&&l<=h.maxRank)&&(f.setNode(p),f.setParent(p,g||u),e.forEach(a[c](p),function(y){var v=y.v===p?y.w:y.v,S=f.edge(v,p),_=e.isUndefined(S)?0:S.weight;f.setEdge(v,p,{weight:a.edge(y).weight+_})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[l],borderRight:h.borderRight[l]}))}),f}function s(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return Bw}var zw,JE;function yU(){if(JE)return zw;JE=1;var e=yt();zw=t;function t(n,s,a){var l={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=l[p],l[p]=f):(h=c,c=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return zw}var Uw,eC;function wU(){if(eC)return Uw;eC=1;var e=yt(),t=uU(),n=dU(),s=mU(),a=gU(),l=yU(),c=hr().Graph,u=vn();Uw=f;function f(y){var v=u.maxRank(y),S=p(y,e.range(1,v+1),"inEdges"),_=p(y,e.range(v-1,-1,-1),"outEdges"),j=t(y);g(y,j);for(var x=Number.POSITIVE_INFINITY,N,E=0,C=0;C<4;++E,++C){h(E%2?S:_,E%4>=2),j=u.buildLayerMatrix(y);var R=n(y,j);R<x&&(C=0,N=e.cloneDeep(j),x=R)}g(y,N)}function p(y,v,S){return e.map(v,function(_){return a(y,_,S)})}function h(y,v){var S=new c;e.forEach(y,function(_){var j=_.graph().root,x=s(_,j,S,v);e.forEach(x.vs,function(N,E){_.node(N).order=E}),l(_,S,x.vs)})}function g(y,v){e.forEach(v,function(S){e.forEach(S,function(_,j){y.node(_).order=j})})}return Uw}var Ww,tC;function vU(){if(tC)return Ww;tC=1;var e=yt(),t=hr().Graph,n=vn();Ww={positionX:S,findType1Conflicts:s,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:v};function s(x,N){var E={};function C(R,I){var $=0,B=0,O=R.length,M=e.last(I);return e.forEach(I,function(L,Y){var D=l(x,L),A=D?x.node(D).order:O;(D||L===M)&&(e.forEach(I.slice(B,Y+1),function(Q){e.forEach(x.predecessors(Q),function(z){var te=x.node(z),J=te.order;(J<$||A<J)&&!(te.dummy&&x.node(Q).dummy)&&c(E,z,Q)})}),B=Y+1,$=A)}),I}return e.reduce(N,C),E}function a(x,N){var E={};function C(I,$,B,O,M){var L;e.forEach(e.range($,B),function(Y){L=I[Y],x.node(L).dummy&&e.forEach(x.predecessors(L),function(D){var A=x.node(D);A.dummy&&(A.order<O||A.order>M)&&c(E,D,L)})})}function R(I,$){var B=-1,O,M=0;return e.forEach($,function(L,Y){if(x.node(L).dummy==="border"){var D=x.predecessors(L);D.length&&(O=x.node(D[0]).order,C($,M,Y,B,O),M=Y,B=O)}C($,M,$.length,O,I.length)}),$}return e.reduce(N,R),E}function l(x,N){if(x.node(N).dummy)return e.find(x.predecessors(N),function(E){return x.node(E).dummy})}function c(x,N,E){if(N>E){var C=N;N=E,E=C}var R=x[N];R||(x[N]=R={}),R[E]=!0}function u(x,N,E){if(N>E){var C=N;N=E,E=C}return e.has(x[N],E)}function f(x,N,E,C){var R={},I={},$={};return e.forEach(N,function(B){e.forEach(B,function(O,M){R[O]=O,I[O]=O,$[O]=M})}),e.forEach(N,function(B){var O=-1;e.forEach(B,function(M){var L=C(M);if(L.length){L=e.sortBy(L,function(z){return $[z]});for(var Y=(L.length-1)/2,D=Math.floor(Y),A=Math.ceil(Y);D<=A;++D){var Q=L[D];I[M]===M&&O<$[Q]&&!u(E,M,Q)&&(I[Q]=M,I[M]=R[M]=R[Q],O=$[Q])}}})}),{root:R,align:I}}function p(x,N,E,C,R){var I={},$=h(x,N,E,R),B=R?"borderLeft":"borderRight";function O(Y,D){for(var A=$.nodes(),Q=A.pop(),z={};Q;)z[Q]?Y(Q):(z[Q]=!0,A.push(Q),A=A.concat(D(Q))),Q=A.pop()}function M(Y){I[Y]=$.inEdges(Y).reduce(function(D,A){return Math.max(D,I[A.v]+$.edge(A))},0)}function L(Y){var D=$.outEdges(Y).reduce(function(Q,z){return Math.min(Q,I[z.w]-$.edge(z))},Number.POSITIVE_INFINITY),A=x.node(Y);D!==Number.POSITIVE_INFINITY&&A.borderType!==B&&(I[Y]=Math.max(I[Y],D))}return O(M,$.predecessors.bind($)),O(L,$.successors.bind($)),e.forEach(C,function(Y){I[Y]=I[E[Y]]}),I}function h(x,N,E,C){var R=new t,I=x.graph(),$=_(I.nodesep,I.edgesep,C);return e.forEach(N,function(B){var O;e.forEach(B,function(M){var L=E[M];if(R.setNode(L),O){var Y=E[O],D=R.edge(Y,L);R.setEdge(Y,L,Math.max($(x,M,O),D||0))}O=M})}),R}function g(x,N){return e.minBy(e.values(N),function(E){var C=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(E,function(I,$){var B=j(x,$)/2;C=Math.max(I+B,C),R=Math.min(I-B,R)}),C-R})}function y(x,N){var E=e.values(N),C=e.min(E),R=e.max(E);e.forEach(["u","d"],function(I){e.forEach(["l","r"],function($){var B=I+$,O=x[B],M;if(O!==N){var L=e.values(O);M=$==="l"?C-e.min(L):R-e.max(L),M&&(x[B]=e.mapValues(O,function(Y){return Y+M}))}})})}function v(x,N){return e.mapValues(x.ul,function(E,C){if(N)return x[N.toLowerCase()][C];var R=e.sortBy(e.map(x,C));return(R[1]+R[2])/2})}function S(x){var N=n.buildLayerMatrix(x),E=e.merge(s(x,N),a(x,N)),C={},R;e.forEach(["u","d"],function($){R=$==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(B){B==="r"&&(R=e.map(R,function(Y){return e.values(Y).reverse()}));var O=($==="u"?x.predecessors:x.successors).bind(x),M=f(x,R,E,O),L=p(x,R,M.root,M.align,B==="r");B==="r"&&(L=e.mapValues(L,function(Y){return-Y})),C[$+B]=L})});var I=g(x,C);return y(C,I),v(C,x.graph().align)}function _(x,N,E){return function(C,R,I){var $=C.node(R),B=C.node(I),O=0,M;if(O+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":M=-$.width/2;break;case"r":M=$.width/2;break}if(M&&(O+=E?M:-M),M=0,O+=($.dummy?N:x)/2,O+=(B.dummy?N:x)/2,O+=B.width/2,e.has(B,"labelpos"))switch(B.labelpos.toLowerCase()){case"l":M=B.width/2;break;case"r":M=-B.width/2;break}return M&&(O+=E?M:-M),M=0,O}}function j(x,N){return x.node(N).width}return Ww}var Hw,nC;function xU(){if(nC)return Hw;nC=1;var e=yt(),t=vn(),n=vU().positionX;Hw=s;function s(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,u){l.node(u).x=c})}function a(l){var c=t.buildLayerMatrix(l),u=l.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(g){return l.node(g).height}));e.forEach(p,function(g){l.node(g).y=f+h/2}),f+=h+u})}return Hw}var Gw,rC;function bU(){if(rC)return Gw;rC=1;var e=yt(),t=nU(),n=rU(),s=aU(),a=vn().normalizeRanks,l=oU(),c=vn().removeEmptyRanks,u=iU(),f=lU(),p=cU(),h=wU(),g=xU(),y=vn(),v=hr().Graph;Gw=S;function S(H,U){var Z=U&&U.debugTiming?y.time:y.notime;Z("layout",function(){var V=Z(" buildLayoutGraph",function(){return O(H)});Z(" runLayout",function(){_(V,Z)}),Z(" updateInputGraph",function(){j(H,V)})})}function _(H,U){U(" makeSpaceForEdgeLabels",function(){M(H)}),U(" removeSelfEdges",function(){q(H)}),U(" acyclic",function(){t.run(H)}),U(" nestingGraph.run",function(){u.run(H)}),U(" rank",function(){s(y.asNonCompoundGraph(H))}),U(" injectEdgeLabelProxies",function(){L(H)}),U(" removeEmptyRanks",function(){c(H)}),U(" nestingGraph.cleanup",function(){u.cleanup(H)}),U(" normalizeRanks",function(){a(H)}),U(" assignRankMinMax",function(){Y(H)}),U(" removeEdgeLabelProxies",function(){D(H)}),U(" normalize.run",function(){n.run(H)}),U(" parentDummyChains",function(){l(H)}),U(" addBorderSegments",function(){f(H)}),U(" order",function(){h(H)}),U(" insertSelfEdges",function(){K(H)}),U(" adjustCoordinateSystem",function(){p.adjust(H)}),U(" position",function(){g(H)}),U(" positionSelfEdges",function(){P(H)}),U(" removeBorderNodes",function(){J(H)}),U(" normalize.undo",function(){n.undo(H)}),U(" fixupEdgeLabelCoords",function(){z(H)}),U(" undoCoordinateSystem",function(){p.undo(H)}),U(" translateGraph",function(){A(H)}),U(" assignNodeIntersects",function(){Q(H)}),U(" reversePoints",function(){te(H)}),U(" acyclic.undo",function(){t.undo(H)})}function j(H,U){e.forEach(H.nodes(),function(Z){var V=H.node(Z),le=U.node(Z);V&&(V.x=le.x,V.y=le.y,U.children(Z).length&&(V.width=le.width,V.height=le.height))}),e.forEach(H.edges(),function(Z){var V=H.edge(Z),le=U.edge(Z);V.points=le.points,e.has(le,"x")&&(V.x=le.x,V.y=le.y)}),H.graph().width=U.graph().width,H.graph().height=U.graph().height}var x=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],R={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},B=["labelpos"];function O(H){var U=new v({multigraph:!0,compound:!0}),Z=he(H.graph());return U.setGraph(e.merge({},N,G(Z,x),e.pick(Z,E))),e.forEach(H.nodes(),function(V){var le=he(H.node(V));U.setNode(V,e.defaults(G(le,C),R)),U.setParent(V,H.parent(V))}),e.forEach(H.edges(),function(V){var le=he(H.edge(V));U.setEdge(V,e.merge({},$,G(le,I),e.pick(le,B)))}),U}function M(H){var U=H.graph();U.ranksep/=2,e.forEach(H.edges(),function(Z){var V=H.edge(Z);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(U.rankdir==="TB"||U.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function L(H){e.forEach(H.edges(),function(U){var Z=H.edge(U);if(Z.width&&Z.height){var V=H.node(U.v),le=H.node(U.w),pe={rank:(le.rank-V.rank)/2+V.rank,e:U};y.addDummyNode(H,"edge-proxy",pe,"_ep")}})}function Y(H){var U=0;e.forEach(H.nodes(),function(Z){var V=H.node(Z);V.borderTop&&(V.minRank=H.node(V.borderTop).rank,V.maxRank=H.node(V.borderBottom).rank,U=e.max(U,V.maxRank))}),H.graph().maxRank=U}function D(H){e.forEach(H.nodes(),function(U){var Z=H.node(U);Z.dummy==="edge-proxy"&&(H.edge(Z.e).labelRank=Z.rank,H.removeNode(U))})}function A(H){var U=Number.POSITIVE_INFINITY,Z=0,V=Number.POSITIVE_INFINITY,le=0,pe=H.graph(),me=pe.marginx||0,Ce=pe.marginy||0;function Ue(ue){var xe=ue.x,ye=ue.y,De=ue.width,ke=ue.height;U=Math.min(U,xe-De/2),Z=Math.max(Z,xe+De/2),V=Math.min(V,ye-ke/2),le=Math.max(le,ye+ke/2)}e.forEach(H.nodes(),function(ue){Ue(H.node(ue))}),e.forEach(H.edges(),function(ue){var xe=H.edge(ue);e.has(xe,"x")&&Ue(xe)}),U-=me,V-=Ce,e.forEach(H.nodes(),function(ue){var xe=H.node(ue);xe.x-=U,xe.y-=V}),e.forEach(H.edges(),function(ue){var xe=H.edge(ue);e.forEach(xe.points,function(ye){ye.x-=U,ye.y-=V}),e.has(xe,"x")&&(xe.x-=U),e.has(xe,"y")&&(xe.y-=V)}),pe.width=Z-U+me,pe.height=le-V+Ce}function Q(H){e.forEach(H.edges(),function(U){var Z=H.edge(U),V=H.node(U.v),le=H.node(U.w),pe,me;Z.points?(pe=Z.points[0],me=Z.points[Z.points.length-1]):(Z.points=[],pe=le,me=V),Z.points.unshift(y.intersectRect(V,pe)),Z.points.push(y.intersectRect(le,me))})}function z(H){e.forEach(H.edges(),function(U){var Z=H.edge(U);if(e.has(Z,"x"))switch((Z.labelpos==="l"||Z.labelpos==="r")&&(Z.width-=Z.labeloffset),Z.labelpos){case"l":Z.x-=Z.width/2+Z.labeloffset;break;case"r":Z.x+=Z.width/2+Z.labeloffset;break}})}function te(H){e.forEach(H.edges(),function(U){var Z=H.edge(U);Z.reversed&&Z.points.reverse()})}function J(H){e.forEach(H.nodes(),function(U){if(H.children(U).length){var Z=H.node(U),V=H.node(Z.borderTop),le=H.node(Z.borderBottom),pe=H.node(e.last(Z.borderLeft)),me=H.node(e.last(Z.borderRight));Z.width=Math.abs(me.x-pe.x),Z.height=Math.abs(le.y-V.y),Z.x=pe.x+Z.width/2,Z.y=V.y+Z.height/2}}),e.forEach(H.nodes(),function(U){H.node(U).dummy==="border"&&H.removeNode(U)})}function q(H){e.forEach(H.edges(),function(U){if(U.v===U.w){var Z=H.node(U.v);Z.selfEdges||(Z.selfEdges=[]),Z.selfEdges.push({e:U,label:H.edge(U)}),H.removeEdge(U)}})}function K(H){var U=y.buildLayerMatrix(H);e.forEach(U,function(Z){var V=0;e.forEach(Z,function(le,pe){var me=H.node(le);me.order=pe+V,e.forEach(me.selfEdges,function(Ce){y.addDummyNode(H,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:me.rank,order:pe+ ++V,e:Ce.e,label:Ce.label},"_se")}),delete me.selfEdges})})}function P(H){e.forEach(H.nodes(),function(U){var Z=H.node(U);if(Z.dummy==="selfedge"){var V=H.node(Z.e.v),le=V.x+V.width/2,pe=V.y,me=Z.x-le,Ce=V.height/2;H.setEdge(Z.e,Z.label),H.removeNode(U),Z.label.points=[{x:le+2*me/3,y:pe-Ce},{x:le+5*me/6,y:pe-Ce},{x:le+me,y:pe},{x:le+5*me/6,y:pe+Ce},{x:le+2*me/3,y:pe+Ce}],Z.label.x=Z.x,Z.label.y=Z.y}})}function G(H,U){return e.mapValues(e.pick(H,U),Number)}function he(H){var U={};return e.forEach(H,function(Z,V){U[V.toLowerCase()]=Z}),U}return Gw}var Vw,sC;function kU(){if(sC)return Vw;sC=1;var e=yt(),t=vn(),n=hr().Graph;Vw={debugOrdering:s};function s(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(l,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,g){return c.setEdge(h,g,{style:"invis"}),g})}),c}return Vw}var Yw,aC;function _U(){return aC||(aC=1,Yw="0.8.5"),Yw}var Kw,oC;function NU(){return oC||(oC=1,Kw={graphlib:hr(),layout:bU(),debug:kU(),util:{time:vn().time,notime:vn().notime},version:_U()}),Kw}var SU=NU();const iC=Pv(SU),xi=240,id=130,di=74,Dd=72,lC=di+Dd;function jU(e,t){var s;let n=xi;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??xi);return n}const UA=420,EU=2;function Ul(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function CU(e,t){return((t==null?void 0:t.get(e))??0)>0?UA:0}function TU(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Wl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??xi)+CU(e,n),h:Math.max((s==null?void 0:s.height)??id,TU(e,n))}}function AU(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function RU(e,t,n,s,a,l){const c=new iC.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(x=>!a.has(x)),f=new Set(u);for(const x of u){const{w:N,h:E}=Wl(x,s,l);c.setNode(x,{width:N,height:E})}for(const x of t)f.has(x.source)&&f.has(x.target)&&c.setEdge(x.source,x.target);iC.layout(c);const p=new Map;let h=1/0,g=1/0,y=-1/0,v=-1/0;for(const x of u){const N=c.node(x);if(!N)continue;const E=s.get(x),C=(E==null?void 0:E.width)??xi,R=(E==null?void 0:E.height)??id,I=Wl(x,s,l),$=N.x-I.w/2,B=N.y-I.h/2;p.set(x,{x:$,y:B}),$<h&&(h=$),B<g&&(g=B),$+C>y&&(y=$+C),B+R>v&&(v=B+R)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[x,N]of p)p.set(x,{x:N.x-h,y:N.y-g});const S=Number.isFinite(y)?y-h:0,_=Number.isFinite(v)?v-g:0;let j=null;for(const x of e){const N=a.get(x);if(!N)continue;const E=s.get(x),C=(E==null?void 0:E.width)??xi,R=(E==null?void 0:E.height)??id;j=j===null?{minX:N.x,minY:N.y,maxX:N.x+C,maxY:N.y+R}:{minX:Math.min(j.minX,N.x),minY:Math.min(j.minY,N.y),maxX:Math.max(j.maxX,N.x+C),maxY:Math.max(j.maxY,N.y+R)}}return{positions:p,width:S,height:_,pinnedBox:j}}function MU(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,u=new Map;for(const x of e){const N=Ul(x),E=u.get(N);E?E.push(x.id):u.set(N,[x.id])}const p=Array.from(u.keys()).sort().map(x=>({sid:x,...RU(u.get(x),t,s,l,a,c)})),h=jU(e,l),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=x=>{const N=[[]];let E=0;for(const C of p)N.length<x&&E>0&&E+C.height>g&&(N.push([]),E=0),N[N.length-1].push(C),E+=C.height+lC;return N},v=x=>x.reduce((N,E)=>Math.max(N,E.width),0)+UA;let S=y(n.availableWidth?EU:1);S.length>1&&S.reduce((N,E)=>N+v(E),0)+h*(S.length-1)>(n.availableWidth??0)&&(S=y(1));const _=new Map;let j=0;for(const x of S){const N=v(x);let E=0;for(const{positions:C,height:R,pinnedBox:I}of x){for(const[B,O]of C)_.set(B,{x:O.x+j,y:O.y+E});let $=E+R;I&&I.maxY>$&&I.minX<j+N&&j<I.maxX&&($=I.maxY),E=$+lC}j+=N+h}return e.map(x=>{const N=a.get(x.id);if(N)return{...x,position:N};const E=_.get(x.id);return E?{...x,position:E}:x})}function IU(e,t,n,s,a){const c=di+Dd,u=60,f=v=>Wl(v,s,a),p=new Map(e.map(v=>[v.id,Ul(v)])),h=[],g=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,S)=>v.pos.y-S.pos.y||v.pos.x-S.pos.x||v.id.localeCompare(S.id)),y=[];for(const{id:v,pos:S}of g){const{w:_,h:j}=f(v),x=p.get(v)??"_default";if(n.has(v)){h.push({x:S.x,y:S.y,w:_,h:j,sid:x});continue}let N=S.y;for(let E=0;E<h.length+1;E++){const C=h.find(R=>{const I=R.sid===x?24:u,$=R.sid===x?24:c;return S.x<R.x+R.w+I&&R.x<S.x+_+I&&N<R.y+R.h+$&&R.y<N+j+$});if(!C)break;N=C.y+C.h+(C.sid===x?24:c)}N!==S.y&&(t.set(v,{x:S.x,y:N}),y.push(v)),h.push({x:S.x,y:N,w:_,h:j,sid:x})}return y}function $U(e,t,n,s,a,l){const c=_=>Wl(_,s,l),u=_=>n.get(_)??t.get(_),f=new Map;for(const _ of e){if(!u(_.id))continue;const j=Ul(_),x=f.get(j);x?x.push(_):f.set(j,[_])}const p=new Set;for(const[_,j]of f)j.every(x=>a.has(x.id)&&!n.has(x.id))&&p.add(_);const h=new Map,g=[];for(const _ of e){const j=u(_.id);if(!j)continue;const{w:x,h:N}=c(_.id),E=Ul(_);p.has(E)?(h.get(E)??h.set(E,[]).get(E)).push(_):g.push({x:j.x,y:j.y,w:x,h:N})}if(h.size===0)return[];const y=di+Dd,v=(_,j,x,N)=>g.some(E=>_<E.x+E.w+di&&E.x<_+x+di&&j<E.y+E.h+y&&E.y<j+N+y),S=[];for(const _ of[...h.keys()].sort()){const j=h.get(_);let x=1/0,N=1/0,E=-1/0,C=-1/0;for(const L of j){const Y=u(L.id),{w:D,h:A}=c(L.id);x=Math.min(x,Y.x),N=Math.min(N,Y.y),E=Math.max(E,Y.x+D),C=Math.max(C,Y.y+A)}const R=E-x,I=C-N,$=[...new Set(g.map(L=>Math.round(L.x)))].sort((L,Y)=>L-Y),B=$.length?$:[x],O=[0,...g.map(L=>L.y+L.h+y)].sort((L,Y)=>L-Y);let M=null;e:for(const L of B)for(const Y of O){if(Y>=N)break;if(!v(L,Y,R,I)){M={x:L,y:Y};break e}}if(M){const L=M.x-x,Y=M.y-N;for(const D of j){const A=u(D.id);t.set(D.id,{x:A.x+L,y:A.y+Y})}S.push(_)}for(const L of j){const Y=u(L.id),{w:D,h:A}=c(L.id);g.push({x:Y.x,y:Y.y,w:D,h:A})}}return S}function OU(e,t,n,s,a,l=!1,c){const p=di+Dd+1,h=8,g=1.75,y=200,v=.7,S=.01,_=M=>Wl(M,s,c),j=M=>n.get(M)??t.get(M),x=new Map;for(const M of e){if(!j(M.id))continue;const L=Ul(M),Y=x.get(L);Y?Y.push(M):x.set(L,[M])}const N=[],E=new Set,C=new Set,R=a.size===0;for(const M of[...x.keys()].sort()){const L=x.get(M);let Y=1/0,D=1/0,A=-1/0,Q=-1/0,z=!1;for(const K of L){const P=j(K.id),{w:G,h:he}=_(K.id);Y=Math.min(Y,P.x),D=Math.min(D,P.y),A=Math.max(A,P.x+G),Q=Math.max(Q,P.y+he),n.has(K.id)&&(z=!0)}const te=A-Y,J=Q-D;C.add(M);const q=a.get(M);q&&(te>q.w+h||J>q.h+h)&&E.add(M),a.set(M,{w:te,h:J}),N.push({sid:M,members:L.map(K=>K.id),x:Y,y:D,w:te,h:J,anchored:z,mass:1})}for(const M of[...a.keys()])C.has(M)||a.delete(M);if(l||R)return[];let I=!1;for(let M=0;M<N.length&&!I;M++)for(let L=M+1;L<N.length;L++){const Y=N[M],D=N[L];if(!(Y.anchored&&D.anchored)&&Math.abs(Y.x+Y.w/2-(D.x+D.w/2))<(Y.w+D.w)/2+61&&Math.abs(Y.y+Y.h/2-(D.y+D.h/2))<(Y.h+D.h)/2+p){I=!0;break}}if(E.size===0&&!I)return[];if(E.size>0)for(const M of N)E.has(M.sid)&&(M.mass=8);else for(const M of N)M.mass=Math.max(1,M.w*M.h/(xi*id));const $=new Map(N.map(M=>[M.sid,M.x])),B=new Map(N.map(M=>[M.sid,M.y]));for(let M=0;M<y;M++){const L=new Map,Y=new Map;let D=0;for(let A=0;A<N.length;A++)for(let Q=A+1;Q<N.length;Q++){const z=N[A],te=N[Q];if(z.anchored&&te.anchored)continue;const J=z.x+z.w/2,q=z.y+z.h/2,K=te.x+te.w/2,P=te.y+te.h/2,G=(z.w+te.w)/2+61-Math.abs(J-K),he=(z.h+te.h)/2+p-Math.abs(q-P);if(G<=0||he<=0)continue;const H=(Ke,ge)=>!Ke.anchored&&!(ge<0&&Ke.x<=0),U=(Ke,ge)=>!Ke.anchored&&!(ge<0&&Ke.y<=0),Z=(Ke,ge,_e)=>{const Fe=Ke===ge,Xe=Fe?z.sid<te.sid?-1:1:Math.sign(Ke-ge);return _e(z,Xe)||_e(te,-Xe)?Xe:Fe&&(_e(z,-Xe)||_e(te,Xe))?-Xe:0},V=Z(J,K,H),le=Z(q,P,U),pe=V!==0,me=le!==0;if(!pe&&!me)continue;const Ce=pe&&(!me||G*g<he),[Ue,ue,xe,ye]=Ce?[V,G,L,H]:[le,he,Y,U],De=ye(z,Ue),ke=ye(te,-Ue),Ee=z.mass,Ge=te.mass,ot=De?ke?Ge/(Ee+Ge):1:0,re=ke?De?Ee/(Ee+Ge):1:0,Ye=ue*v;xe.set(z.sid,(xe.get(z.sid)??0)+Ue*Ye*ot),xe.set(te.sid,(xe.get(te.sid)??0)-Ue*Ye*re),D+=Ye}for(const A of N)A.anchored||(A.x=Math.max(0,A.x+(L.get(A.sid)??0)),A.y=Math.max(0,A.y+(Y.get(A.sid)??0)));if(D<S)break}const O=[];for(const M of N){const L=M.x-$.get(M.sid),Y=M.y-B.get(M.sid);if(!(Math.abs(L)<1&&Math.abs(Y)<1)){for(const D of M.members){if(n.has(D))continue;const A=t.get(D);A&&t.set(D,{x:A.x+L,y:A.y+Y})}O.push(M.sid)}}return O}const PU=600;function Mv(e,t){return!(e.exitAt!=null&&t-e.exitAt>PU||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function LU(e,t){const n=new Set;for(const s of e.agents.values())Mv(s,t)&&n.add(s.id);return n}function DU(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 qU(e,t,n=0){if(!e)return!1;for(const s of t)if(DU(e,s,n))return!0;return!1}const WA="sessionGroup";function FU(e,t){var s;if(e.type===WA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const HA=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function cC(e){const t={};for(const n of HA)t[n]=e(n);return t}function BU(e){return t=>e[t]??""}function zU(e,t){return HA.every(n=>e[n]===t[n])}function UU(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 WU=1200,HU=1e3;function uC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<WU?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<HU}function Xw({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function GU(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 VU({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,GU(a,t,e))return!1;return s}const YU="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Qw="click for what's new";function KU(e){if(e.checkDisabled)return`${YU} · ${Qw}`;if(e.checking)return`Asking npm for the newest release… · ${Qw}`;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 · ${Qw}, and to check npm now`}function XU(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 QU(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 ZU(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 Iv={kind:"assumed",claude:!0,codex:!0};function JU(e){if(!e||typeof e!="object")return Iv;const t=e.providers;if(!t||typeof t!="object")return Iv;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function ld(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const dC=99;function eW(e){const t=Math.max(0,Math.floor(e));return t>dC?`${dC}+`:String(t)}const tW="Pause the canvas";function nW(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 — ${ld(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)":`${ld(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function rW(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 GA="paused · full",sW=(e,t)=>t>0?GA:e>0?`paused · ${eW(e)}`:"paused";function aW(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:sW(e.held,t),widest:GA,title:t>0?`Connected — the pause is full at ${ld(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${ld(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 hC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const oW={agent:l4,sessionGroup:N4},VA="react-flow__node";function fC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,VA))===!0}function iW(e){try{const t=document.querySelector(`.${VA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const lW=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),cW=420;function uW(e){return e<.35?"far":e<.55?"mid":"full"}const Iu=18,dW=200,hW=5*6e4,fW=6,pW=2*6e4,pC=400,Lx="agent-dag.layout",Dx="agent-dag.viewport",YA="agent-dag.summariesDismissed",KA="agent-dag.sessionListOpen",XA="agent-dag.detailOpen",QA="agent-dag.usagePanelOpen",ZA="agent-dag.systemPanelOpen",mC="agent-dag.accountsPanelOpen",Zw="agent-dag.versionNoticeDismissed",gC="agent-dag.oldNameNoticeDismissed",mW=15*6e4,Jw={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:"},$u="agent-dag.autoRestart",yC="agent-dag.bundleReloadedFor";function gW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(KA)==="1"}catch{return!1}}function yW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KA,e?"1":"0")}catch{}}function wW(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(XA)==="1"}catch{return!1}}function vW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(XA,e?"1":"0")}catch{}}function xW(){const e=ki(QA);return e===null?!0:e==="1"}function bW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(QA,e?"1":"0")}catch{}}function kW(){return ki(ZA)==="1"}function _W(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ZA,e?"1":"0")}catch{}}function NW(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(YA);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 wC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(YA,JSON.stringify(n))}catch{}}function SW(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Lx);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 ev(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(Lx,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function jW(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Dx);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 EW(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Dx,JSON.stringify(e))}catch{}}function vC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Lx)}catch{}try{window.localStorage.removeItem(Dx)}catch{}}}function CW(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},l=JSON.stringify(a,null,2),c=new Blob([l],{type:"application/json"}),u=URL.createObjectURL(c),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const $v={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Ov={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},JA=a2;function TW(e,t,n,s,a,l,c,u,f,p,h,g,y,v,S,_,j,x){const N=[],E=[];for(const M of e.agents.values()){if(!j.has(M.id))continue;const L=M.exitAt!=null,Y=_!=null&&!_.has(M.id),D=[L?"rf-exiting":"",Y?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,A=l.get(M.id);if(N.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:x},className:D,...A?{width:A.width,height:A.height}:null}),M.parentId&&j.has(M.parentId)){const Q=nx(M.sessionId),z=L,te=S.size>0&&(S.has(M.id)||S.has(M.parentId)),J=_!=null&&!_.has(M.id)&&!_.has(M.parentId),q=M.state==="active"?2:1.5,K=te?q+1.5:q,P=z?.2:J?.12:1,G=["sess-edge",M.state==="active"?"sess-live":"sess-idle",z?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!z,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:K,opacity:P,transition:"var(--edge-transition)"},className:G})}}const C=new Map;for(const M of e.agents.values())M.tools.length>0&&C.set(M.id,Math.min(4,M.tools.length));const R=`${y}#lanes:${AU(C)}`,I=N.filter(M=>kF(M.id,a,h,g));if(I.length>0||R!==v.current){if(I.length>0){const M=MU(N,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:s,lanes:C});for(const L of M)F2(L.id,h,g)&&NF(L.id,L.position,h,g);$U(N,h,a,l,new Set(I.map(L=>L.id)),C)}IU(N,h,a,l,C),v.current=R}const $=OU(N,h,a,l,c,!f||p,C);$.length>0&&u($),Eu(h,e.agents),Eu(g,e.agents),Eu(a,e.agents),Eu(l,vF(e.agents.values()));const B=[];let O=!1;for(const M of N){let L=a.get(M.id)??h.get(M.id);L||(L=_F(M.id,h,g),O=!0),B.push({...M,position:L})}return O&&(v.current=""),{nodes:B,edges:E}}function AW(){return i.jsx(ex,{children:i.jsx(RW,{})})}function RW(){var Ki,Sa,Xi,Qi;const e=Kl(),t=At(),n=b.useState(yv)[0],s=b.useRef(n),[,a]=b.useState(0),l=b.useCallback(()=>a(F=>F+1),[]),[c,u]=b.useState(()=>new Set),[f,p]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback((F,W)=>{u(ae=>{if(!W)return new Set([F]);const ie=new Set(ae);return ie.has(F)?ie.delete(F):ie.add(F),ie}),p(ae=>W&&ae===F?ae:F)},[]),v=b.useCallback(()=>{u(new Set),p(null)},[]),[S,_]=b.useState(null),[j,x]=b.useState(null),N=b.useCallback(F=>x(F),[]),[E,C]=b.useState(!1),[R,I]=b.useState(!1),[$,B]=b.useState(!1),O=b.useRef(null),M=b.useState(NW)[0],[L,Y]=b.useState(gW);b.useEffect(()=>{yW(L)},[L]);const[D,A]=b.useState(wW);b.useEffect(()=>{vW(D)},[D]);const[Q,z]=b.useState(xW);b.useEffect(()=>{bW(Q)},[Q]);const[te,J]=b.useState(kW);b.useEffect(()=>{_W(te)},[te]);const[q,K]=b.useState(()=>{try{const F=window.localStorage.getItem(mC);return F===null?!0:F==="1"}catch{return!0}});b.useEffect(()=>{try{window.localStorage.setItem(mC,q?"1":"0")}catch{}},[q]);const[P,G]=b.useState(null);b.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}G(F===null?!0:F==="on")},[]);const he=b.useCallback(()=>{G(F=>{var ae;const W=F!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ae=De.current)==null||ae.unlock()),W})},[]),H=b.useCallback(F=>{he()},[he]),U=b.useRef(H);U.current=H;const Z=b.useRef(P);Z.current=P;const[V,le]=b.useState(()=>Pq(ki)),pe=b.useRef(V);pe.current=V;const me=b.useRef(null),Ce=b.useCallback((F,W=!1)=>{var ae,ie;if((ae=De.current)==null||ae.unlock(),me.current!==null&&clearTimeout(me.current),me.current=null,!W){(ie=De.current)==null||ie.play(F,!0);return}me.current=setTimeout(()=>{var je;me.current=null,(je=De.current)==null||je.play(F,!0)},Rq)},[]),Ue=b.useCallback((F,W)=>{le(ae=>{const ie={level:zl(W.level??ae[F].level),figure:I2(F,W.figure??ae[F].figure)};try{localStorage.setItem($2[F],String(ie.level)),localStorage.setItem(O2[F],ie.figure)}catch{}return{...ae,[F]:ie}}),Ce(F,!0)},[Ce]);b.useEffect(()=>()=>{me.current!==null&&clearTimeout(me.current)},[]);const[ue,xe]=b.useState(!1),ye=b.useRef(null),De=b.useRef(null),[ke,Ee]=b.useState("locked");b.useEffect(()=>{const F=qq({enabled:()=>Z.current===!0,prefs:()=>pe.current,onState:Ee});De.current=F,Ee(F.state());const W=()=>F.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ge,ot]=b.useState(!1),[re,Ye]=b.useState(null),[Ke,ge]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Zw)??""}catch{return""}}),[_e,Fe]=b.useState(!1),Xe=b.useRef(0),[at,pt]=b.useState(!1),se=b.useCallback((F=!1)=>(F&&(Xe.current=Date.now(),pt(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&Ye(W)}).catch(()=>{}).finally(()=>{F&&pt(!1)})),[]),Ae=b.useCallback(()=>{se(Date.now()-Xe.current>=mW)},[se]);b.useEffect(()=>{se();const F=window.setInterval(Ae,5*6e4),W=()=>{document.visibilityState==="visible"&&Ae()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",W)}},[se,Ae]),b.useEffect(()=>{Ge&&se()},[Ge,se]),b.useEffect(()=>{const F=Yq();let W=null;const ae=ze=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:F,looking:ze}),keepalive:!0}).catch(()=>{})},ie=()=>{const ze=Gq(document);Vq(W,ze)&&ae(ze),W=ze},je=()=>{W&&ae(!1),W=!1};ie();const Ie=window.setInterval(ie,Hq);return window.addEventListener("focus",ie),window.addEventListener("blur",ie),document.addEventListener("visibilitychange",ie),window.addEventListener("pagehide",je),()=>{window.clearInterval(Ie),window.removeEventListener("focus",ie),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",ie),window.removeEventListener("pagehide",je),je()}},[]);const Se=(re==null?void 0:re.notice)??null,[Te,Be]=b.useState(null),kt=b.useRef(!1);b.useEffect(()=>{if(kt.current)return;const F=$1(),W=rF(F),ae=cF({stored:W,running:(re==null?void 0:re.running)??null,notes:I1,remembers:sF(F)});if(ae.reason==="no-version")return;kt.current=!0,ae.record&&aF(F,ae.record);const ie=lF({tourSeen:oF(F),decision:ae}),je=ae.show.length?{entries:ae.show,since:W,firstRun:!1}:null;ie.tour&&B(!0),ie.notes==="now"?Be(je):ie.notes==="after"&&(O.current=je)},[re==null?void 0:re.running]);const ut=(re==null?void 0:re.running)??"3.22.0",Re=b.useMemo(()=>P2(I1,null,ut),[ut]),ht=b.useCallback(()=>{Be({entries:Re,since:null,firstRun:!1})},[Re]),[wt,St]=b.useState(null),[Et,Gn]=b.useState(Iv);b.useEffect(()=>{let F=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{F||(Gn(JU(W)),!(!W||typeof W.workspace!="string")&&St(W.workspace))}).catch(()=>{}),()=>{F=!0}},[Ge]);const ln=b.useRef(Et);ln.current=Et;const Rr=Se?`${Se.kind}:${Se.to}`:"",mr=Se!=null&&Ke!==Rr,Za=b.useCallback(()=>{ge("");try{window.localStorage.setItem(Zw,"")}catch{}},[]),Ja=b.useCallback(()=>{if(Se){ge(Rr);try{window.localStorage.setItem(Zw,Rr)}catch{}}},[Se,Rr]),[ta,eo]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(gC)??""}catch{return""}}),Kt=re!=null&&re.invokedAs&&re.invokedAs!==zt?re.invokedAs:null,na=Kt!=null&&ta!==Kt,Mr=b.useCallback(()=>{if(Kt){eo(Kt);try{window.localStorage.setItem(gC,Kt)}catch{}}},[Kt]),rn=((Ki=re==null?void 0:re.upgrade)==null?void 0:Ki.state)??"idle",Mn=uq(re==null?void 0:re.upgrade),gr=b.useRef(!1),ds=b.useCallback(async()=>{if(cr(gr.current||rn==="running")){gr.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await se(),gr.current=!1}},[rn,se]);b.useEffect(()=>{if(rn!=="running")return;const F=window.setInterval(se,3e3);return()=>window.clearInterval(F)},[rn,se]);const ra=b.useCallback(async()=>{const F=re==null?void 0:re.command;!F||!await M2(F)||(Fe(!0),window.setTimeout(()=>Fe(!1),1600))},[re==null?void 0:re.command]),to=b.useCallback(()=>{Y(F=>(F||K(!1),!F))},[]),no=b.useCallback(()=>{K(F=>(F||Y(!1),!F))},[]),[sa,xn]=b.useState(!1),[aa,oa]=b.useState(!1),[ro,so]=b.useState(()=>{try{return Number(localStorage.getItem(D1))||0}catch{return 0}}),[ia,ao]=b.useState([]),[Ir,la]=b.useState(!1);b.useEffect(()=>{let F=!0;const W=()=>{fetch("/api/browser-watch?live=0").then(ie=>ie.ok?ie.json():null).then(ie=>{var je;!F||!(ie!=null&&ie.ok)||(ao(ie.episodes??[]),la(((je=ie.settings)==null?void 0:je.enabled)===!0))}).catch(()=>{})};W();const ae=setInterval(W,5*6e4);return()=>{F=!1,clearInterval(ae)}},[]);const[Ci,lt]=b.useState([]),oo=b.useRef(new Set),[yr,ca]=b.useState(null);b.useEffect(()=>{let F=!0,W=0;const ae=()=>{fetch("/api/lan").then(ie=>ie.ok?ie.json():null).then(ie=>F?(ie!=null&&ie.ok&<(k1(Array.isArray(ie.pending)?ie.pending:[],ie.aliases)),ie):null).catch(()=>null).then(ie=>{F&&(W=window.setTimeout(ae,(ie==null?void 0:ie.enabled)===!0?Cv:C2))})};return ae(),()=>{F=!1,window.clearTimeout(W)}},[]);const $r=b.useCallback(async(F,W)=>{if(!yr){ca(F);try{const ie=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:F,fp:W})})).json().catch(()=>null);ie&&Array.isArray(ie.pending)?lt(k1(ie.pending,ie.aliases)):lt(je=>je.filter(Ie=>Ie.fp!==W))}catch{}finally{ca(null)}}},[yr]),Vn=b.useMemo(()=>ZF(ia,ro).length,[ia,ro]),[io,Or]=b.useState(0),sn=b.useRef(null),[ua,cn]=b.useState(!1),da=b.useRef(null),[qd,ic]=b.useState(0),Xt=b.useState(()=>TF({protect:F=>pL(s.current,F)}))[0],[Pr,ha]=b.useState(!1),hs=b.useCallback(()=>{const F=Xt.paused&&Xt.dropped>0,W=Xt.setPaused(!Xt.paused);F&&mL(s.current);for(const ae of W)s.current=Ck(s.current,ae);ha(Xt.paused)},[Xt]),[Mt,Fd]=b.useState(Date.now()),[bn,fa]=b.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem($u)!=="0"}catch{return!0}}),lo=b.useRef(!1),pa=b.useCallback(()=>{const F=!bn;lo.current=!0;try{window.localStorage.removeItem($u)}catch{}fa(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(W=>W.ok?W.json():null).then(W=>{var ae;W!=null&&W.ok&&fa(((ae=W.prefs)==null?void 0:ae.autoUpdate)!==!1)}).catch(()=>{})},[bn]),[wr,fs]=b.useState(!1),[st,lc]=b.useState("restart"),[Ti,co]=b.useState(null),Lr=b.useRef(!1),Ai=b.useRef(null),Ri=b.useRef(0),ps=b.useCallback(async F=>{if(!cr(Lr.current))return;const W=(F==null?void 0:F.upgrade)===!0;Lr.current=!0,Ai.current=Mn;const ae=++Ri.current;lc(W?"npx":"restart"),fs(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Se==null?void 0:Se.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(Ri.current===ae&&Lr.current){Lr.current=!1,fs(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[Se==null?void 0:Se.to,Mn]),ms=b.useRef(null);b.useEffect(()=>{const F=C1(s.current.agents.values())>0,W=mq({enabled:bn,kind:Se==null?void 0:Se.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:mr,visible:document.visibilityState==="visible",busy:F,idleSince:ms.current,now:Mt});ms.current=W.idleSince,W.restart&&ps()},[bn,Se==null?void 0:Se.kind,re==null?void 0:re.canRestart,mr,Mt,ps]);const Yn=C1(s.current.agents.values()),Kn=pq(Yn),Xn=R2({enabled:bn,kind:Se==null?void 0:Se.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:mr,visible:document.visibilityState==="visible",busy:Yn>0,idleSince:ms.current,now:Mt});b.useEffect(()=>{const F=re==null?void 0:re.running;let W=null,ae=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(yC)}catch{return}const ie=cq({bundle:"3.22.0",running:F,pending:W,lastTried:ae});if(ie==="reload"){try{window.sessionStorage.setItem(yC,F??"")}catch{return}window.location.reload();return}if(ie!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Lr.current=!1,fs(!1),co(F??null);const je=window.setTimeout(()=>co(null),6e3);return()=>window.clearTimeout(je)},[re==null?void 0:re.running]),b.useEffect(()=>{if(wr&&dq({asked:Ai.current,reported:Mn})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Lr.current=!1,fs(!1)}},[wr,Mn]);const gs=b.useState(()=>UU(SW()))[0],It=b.useRef(gs.pinned),kn=b.useRef(null),uo=b.useState(()=>jW())[0],[ho,ma]=b.useState(()=>new Set),[ga,Mi]=b.useState(RF),[_n,cc]=b.useState(()=>cC(hC)),uc=b.useMemo(()=>BU(_n),[_n]),ya=b.useCallback(F=>FU(F,uc),[uc]),wa=b.useMemo(()=>({background:_n["--panel"],border:`1px solid ${_n["--line"]}`,borderRadius:8}),[_n]),[Dr,fo]=b.useState(!1);b.useEffect(()=>{document.documentElement.dataset.theme=ga;try{window.localStorage.setItem(B2,ga)}catch{}cc(F=>{const W=cC(hC);return zU(F,W)?F:W})},[ga]);const qr=b.useCallback((F,W)=>{if(Xw({durationMs:W,documentHidden:document.hidden})){e.setViewport(F,{duration:W});return}const{d3Zoom:ae,d3Selection:ie}=t.getState(),je=ie==null?void 0:ie.property("__zoom");if(ae&&ie&&je&&je.k>0&&F.zoom>0){ae.transform(ie,je.scale(F.zoom/je.k).translate((F.x-je.x)/F.zoom,(F.y-je.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),va=b.useRef(null);b.useEffect(()=>{if(!uo)return;const F=window.setTimeout(()=>{try{qr(uo,0)}catch{}Nn.current=Date.now()},60);return()=>window.clearTimeout(F)},[qr,uo]);const po=b.useRef(!0);b.useEffect(()=>{const F=new EventSource("/events"),W=EF(l,{now:()=>Date.now(),setTimeout:(ae,ie)=>window.setTimeout(ae,ie),clearTimeout:ae=>window.clearTimeout(ae)});return F.addEventListener("open",()=>{ot(!0),fo(!0)}),F.addEventListener("error",()=>ot(!1)),F.addEventListener("replay-end",()=>{po.current=!1,W.flush()}),F.addEventListener("hook",ae=>{var ie;try{const je=JSON.parse(ae.data);if(!Xt.accept(je))return;s.current=Ck(s.current,je);const Ie=je.replay===!0||po.current||Date.now()-je.receivedAt>3e4;Ie?W.replay():W.live();const ze=Dq(je,Ie);ze&&((ie=De.current)==null||ie.play(ze))}catch{}}),()=>{F.close(),W.cancel()}},[l]),b.useEffect(()=>{const F=setInterval(()=>{const W=Date.now();Fd(W);let ae=gL(s.current,W,Ek);yL(s.current,W,Ek)&&(ae=!0),hL(s.current,W,dW,hW)&&(ae=!0),fL(s.current,W,fW,pW)&&(ae=!0),u(ie=>wF(ie,s.current.agents)),p(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),x(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),_(ie=>ie!=null&&!s.current.agents.has(ie)?null:ie),ae&&l()},250);return()=>clearInterval(F)},[l]);const ys=b.useRef(null),Nn=b.useRef(0),dc=420,$t=b.useCallback((F=500)=>{try{const Ie=document.querySelector(".canvas-wrap"),ze=Array.from(document.querySelectorAll(".react-flow__node")).filter(vt=>vt.offsetWidth>0);if(!Ie||ze.length===0)return;const nt=Ie.getBoundingClientRect(),mt=e.getViewport();if(!Number.isFinite(mt.zoom)||mt.zoom<=0)return;const et=vt=>(vt-nt.left-mt.x)/mt.zoom,dn=vt=>(vt-nt.top-mt.y)/mt.zoom,ja=ze.map(vt=>vt.getBoundingClientRect()),Zi=Math.min(...ja.map(vt=>et(vt.left))),ct=Math.max(...ja.map(vt=>et(vt.right))),To=Math.min(...ja.map(vt=>dn(vt.top))),Ao=Math.max(...ja.map(vt=>dn(vt.bottom))),Rs=ct-Zi,Ro=Ao-To;if(!(Rs>0&&Ro>0))return;const Vr=Math.max(.2,Math.min(1,(nt.width-160)/(Rs+dc)*.86,(nt.height-160)/Ro*.86)),Zn={x:80-Zi*Vr,y:Math.max(80,(nt.height-Ro*Vr)/2)-To*Vr,zoom:Vr};qr(Zn,F),Nn.current=Date.now(),va.current=Xw({durationMs:F,documentHidden:document.hidden})?{target:Zn,until:Date.now()+F+60}:null,window.setTimeout(()=>{var vt;try{((vt=va.current)==null?void 0:vt.target)===Zn&&(va.current=null);const Yr=e.getViewport();(Math.abs(Yr.zoom-Vr)>.01||Math.abs(Yr.x-Zn.x)>2)&&qr(Zn,0)}catch{}},F+60)}catch{}},[e,qr]);b.useEffect(()=>{const F=()=>{if(!document.hidden)return;const W=va.current;if(va.current=null,!(!W||Date.now()>W.until)){try{qr(W.target,0)}catch{}Nn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[qr]);const xa=b.useRef(""),ws=b.useRef(null),Ii=b.useRef(0),Fr=b.useCallback(()=>{Ii.current=Date.now()},[]),vs=b.useRef(null),$i=b.useRef(0),Wt=b.useCallback(()=>{$i.current=Date.now()},[]),Br=b.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Nn.current,lastCanvasInputAt:$i.current}),[]),ba="agent-dag.autoFitDisabled",xs=b.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ba)==="1"}catch{return!1}})[0],bs=b.useRef(xs),[mo,go]=b.useState(xs),zr=b.useCallback(()=>{if(!bs.current){bs.current=!0,go(!0);try{window.localStorage.setItem(ba,"1")}catch{}}},[]),yo=b.useCallback(()=>{bs.current=!1,go(!1);try{window.localStorage.removeItem(ba)}catch{}$t(400)},[e,$t]);b.useEffect(()=>{const F=setInterval(()=>{if(bs.current||Date.now()-Ii.current<800)return;const W=s.current,ae=Date.now(),ie=[];for(const Ie of W.agents.values())Mv(Ie,ae)&&ie.push({id:Ie.id});if(ie.length===0)return;const je=[];for(const{id:Ie}of ie){const ze=ks.current.get(Ie),nt=It.current.get(Ie)??un.current.get(Ie);!ze||!nt||je.push({x:nt.x,y:nt.y,width:ze.width,height:ze.height})}VU({pane:vs.current,viewport:e.getViewport(),boxes:je})&&$t(600)},1500);return()=>clearInterval(F)},[e]);const wo=b.useRef(!1),ks=b.useRef(new Map),hc=b.useRef(0),Bd=b.useCallback(F=>{const W=ks.current;let ae=!1;for(const ie of F.nodeInternals.values()){const je=ie.width,Ie=ie.height;if(je==null||Ie==null)continue;const ze=W.get(ie.id);ze?(Math.abs(ze.height-Ie)>4||Math.abs(ze.width-je)>4)&&(W.set(ie.id,{width:je,height:Ie}),ae=!0):(W.set(ie.id,{width:je,height:Ie}),ae=!0)}return ae&&(hc.current+=1),hc.current},[]),vo=it(Bd),[fc,zd]=b.useState(0);b.useEffect(()=>{let F=0;const W=()=>{const ie=ks.current;let je=!1;for(const Ie of document.querySelectorAll(".react-flow__node[data-id]")){const ze=Ie.getAttribute("data-id");if(!ze)continue;const nt=Ie.offsetWidth,mt=Ie.offsetHeight;if(!nt||!mt)continue;const et=ie.get(ze);(!et||Math.abs(et.width-nt)>4||Math.abs(et.height-mt)>4)&&(ie.set(ze,{width:nt,height:mt}),je=!0)}je&&zd(Ie=>Ie+1)};if(wo.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(W,32):F=requestAnimationFrame(W),()=>{cancelAnimationFrame(F),window.clearTimeout(ae)}});const un=b.useRef(gs.positions),Ud=b.useRef(new Set),Oi=b.useRef(""),Ur=b.useMemo(()=>{const F=[];for(const W of s.current.agents.values())Mv(W,Mt)&&F.push(W.id+(W.parentId?`>${W.parentId}`:""));return F.sort(),`${F.join("|")}#sv${vo}.${fc}`},[s.current,s.current.revision,Mt,vo,fc]),ka=b.useRef(null);b.useEffect(()=>(ka.current!=null&&window.clearTimeout(ka.current),ka.current=window.setTimeout(()=>{ev(un.current,It.current)},1500),()=>{ka.current!=null&&window.clearTimeout(ka.current)}),[Ur]),b.useEffect(()=>{if(xa.current===Ur)return;const F=xa.current;if(xa.current=Ur,!F||bs.current)return;Date.now()-Nn.current>1200&&$t(400),ys.current&&window.clearTimeout(ys.current),ys.current=window.setTimeout(()=>{bs.current||$t(500)},280)},[Ur,e,$t]);const Pi=b.useMemo(()=>bF(s.current,c),[s.current,s.current.revision,c]),Li=b.useMemo(()=>LU(s.current,Mt),[s.current,s.current.revision,Mt]),pc=b.useRef(null),[_s,mc]=b.useState({w:0,h:0});b.useEffect(()=>{const F=pc.current;if(!F||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ae=>{var je;const ie=(je=ae[0])==null?void 0:je.contentRect;ie&&(vs.current={width:ie.width,height:ie.height},mc(Ie=>Math.abs(Ie.w-ie.width)>40||Math.abs(Ie.h-ie.height)>40?{w:ie.width,h:ie.height}:Ie))});return W.observe(F),vs.current={width:F.clientWidth,height:F.clientHeight},mc({w:F.clientWidth,h:F.clientHeight}),()=>W.disconnect()},[]);const Wd=b.useCallback(F=>{var ae,ie;const W=F.target;!(W!=null&&W.closest)||W.closest(lW)!==F.currentTarget||(F.preventDefault(),(ie=(ae=document.activeElement)==null?void 0:ae.blur)==null||ie.call(ae))},[]),Hd=b.useRef(new Map),[Di,Gd]=b.useState(!1);b.useEffect(()=>{const F=window.setTimeout(()=>Gd(!0),2500);return()=>window.clearTimeout(F)},[]);const[Vd,qi]=b.useState(!1),vr=b.useRef(null),[Fi,gc]=b.useState(!1),[Yd,Bi]=b.useState("full"),Ns=b.useRef("full"),Kd=b.useCallback(()=>{vr.current&&(window.clearTimeout(vr.current),vr.current=null),qi(!1)},[]),yc=b.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{qi(!0),vr.current&&window.clearTimeout(vr.current),vr.current=window.setTimeout(()=>qi(!1),cW+80)})},[]);b.useEffect(()=>()=>{vr.current&&window.clearTimeout(vr.current)},[]);const zi=_s.w>0?_s.w*.92:0,Ui=_s.h>0?_s.h:0,{nodes:Qn,edges:wc}=b.useMemo(()=>TW(s.current,Mt,zi,Ui,It.current,ks.current,Hd.current,yc,Di,Fi,un.current,Ud.current,Ur,Oi,c,Pi,Li,N),[s.current,s.current.revision,Mt,zi,Ui,Di,Fi,Ur,c,Pi,Li,N,io]),Wr=b.useMemo(()=>{const F=new Map;for(const ae of Qn){const ie=ae.data;if(!(ie!=null&&ie.sessionId)||ie.exitAt!=null)continue;const je=ae.width,Ie=ae.height;if(je==null||Ie==null)continue;const ze=ae.position.x,nt=ae.position.y,mt=ze+je,et=nt+Ie,dn=F.get(ie.sessionId);dn?(dn.minX=Math.min(dn.minX,ze),dn.minY=Math.min(dn.minY,nt),dn.maxX=Math.max(dn.maxX,mt),dn.maxY=Math.max(dn.maxY,et)):F.set(ie.sessionId,{minX:ze,minY:nt,maxX:mt,maxY:et})}const W=[];for(const[ae,ie]of F){const je=ie.maxX-ie.minX+Iu*2,Ie=ie.maxY-ie.minY+Iu*2;W.push({id:`group:${ae}`,type:WA,position:{x:ie.minX-Iu,y:ie.minY-Iu},data:{sessionId:ae,w:je,h:Ie},width:je,height:Ie,style:{width:je,height:Ie},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[Qn,Mt]),Xd=b.useMemo(()=>{const F=[...Wr,...Qn],W=da.current;return!W||W.size===0?F:F.map(ae=>{const ie=W.get(ae.id);return ie?{...ae,position:ie}:ae})},[Wr,Qn,qd]),xo=b.useMemo(()=>{const F=new Set;for(const W of s.current.agents.values())for(const ae of W.tools)F.add(JA(ae.name));return Object.keys($v).filter(W=>F.has(W))},[s.current,s.current.revision]);b.useEffect(()=>{if(xo.length<=1){cn(!1);return}let F=0;const W=()=>{const ae=sn.current;if(ae&&!document.hidden){const ie=ae.getBoundingClientRect(),je=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(ze=>ze.getBoundingClientRect()),Ie=qU(ie,je,8);cn(ze=>ze===Ie?ze:Ie)}F=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(F)},[xo.length]);const Qd=b.useCallback(F=>{ma(W=>{const ae=new Set(W);return ae.has(F)?ae.delete(F):ae.add(F),ae})},[]),Qt=f?s.current.agents.get(f):null,bo=h?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===h)??null:null,Ss=b.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=yv(),It.current.clear(),ks.current.clear(),un.current.clear(),Oi.current="",vC(),v(),l()},[l,v]),js=b.useRef(E);js.current=E;const vc=b.useRef(R);vc.current=R;const Es=b.useRef(!1);Es.current=bo!=null||sa||j!=null||$||S!=null||aa||R||Te!=null;const ko=b.useCallback(F=>{const W=gq(F,{confirmOpen:js.current,modalOpen:Es.current});W==="confirm"?C(!0):W==="clear"&&(C(!1),Ss())},[Ss]),_o=b.useCallback(()=>{It.current.clear(),un.current.clear(),Oi.current="",vC(),l(),window.setTimeout(()=>$t(500),80)},[l,e,$t]),No=b.useCallback(()=>$t(500),[$t]),Cs=b.useRef(Qn);Cs.current=Qn;const Wi=b.useRef(f);Wi.current=f;const So=b.useCallback(F=>{const W=Cs.current,ae=fF(W.map(Ie=>({id:Ie.id,x:Ie.position.x,y:Ie.position.y})),Wi.current,F),ie=ae?W.find(Ie=>Ie.id===ae):void 0;if(!ie)return;const je=fC(document.activeElement);y(ie.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[ie]})}catch{}Nn.current=Date.now(),je&&iW(ie.id)},30)},[y,e]),jo=b.useCallback(F=>{y(F,!1),window.setTimeout(()=>{try{const W=Cs.current.find(ae=>ae.id===F);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Nn.current=Date.now()}catch{}},60)},[y,e]);b.useEffect(()=>{const F=W=>{var nt,mt;const ae=W.target,ie={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(nt=ae==null?void 0:ae.getAttribute)==null?void 0:nt.call(ae,"role"),type:ae==null?void 0:ae.type};if(W.key==="Escape"){const et=HL({overlayOpen:ed.depth()>0,typing:ox(ie)});et==="dismiss"?ed.dismissTop():et==="blur"?ae==null||ae.blur():(yF(ie)&&(ae==null||ae.blur()),v());return}if(ax(W))return;const je=fC(ae)?(mt=ae==null?void 0:ae.getAttribute)==null?void 0:mt.call(ae,"data-id"):null,Ie=je&&Cs.current.some(et=>et.id===je)?je:null,ze=mF(W,Ie);if(ze.kind==="activate"){W.preventDefault(),y(ze.nodeId,ze.additive);return}ze.kind!=="node"&&(ze.nodeId==null&&JL(ie)||e4({key:W.key,modalOpen:Es.current,sheetOpen:vc.current})||(W.key===" "&&(W.preventDefault(),hs()),(W.key==="c"||W.key==="C")&&ko("shortcut"),(W.key==="r"||W.key==="R")&&_o(),(W.key==="f"||W.key==="F")&&No(),(W.key==="l"||W.key==="L")&&to(),(W.key==="d"||W.key==="D")&&A(et=>!et),(W.key==="h"||W.key==="H")&&xn(et=>!et),(W.key==="u"||W.key==="U")&&z(et=>!et),(W.key==="a"||W.key==="A")&&ln.current.claude&&no(),(W.key==="j"||W.key==="J")&&So(1),(W.key==="k"||W.key==="K")&&So(-1),(W.key==="t"||W.key==="T")&&Mi(et=>et==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&ln.current.claude&&Z.current!==null&&U.current(W.shiftKey),W.key==="?"&&I(et=>!et)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[ko,_o,No,v,y,So,hs]);const xc=s.current.agents.size,Zt=b.useMemo(()=>LL(s.current.agents.values()),[s.current,s.current.revision]),bc=b.useMemo(()=>DL(s.current.agents.values()),[s.current,s.current.revision]),kc=b.useRef(null);b.useEffect(()=>{const F=MF({waiting:Zt.length,running:bc,connected:Ge}),W=kc.current;if(kc.current=F,(W==null?void 0:W.title)!==F.title&&(document.title=F.title),(W==null?void 0:W.icon)!==F.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=IF[F.icon])}},[Zt.length,bc,Ge]);const[Zd,Sn]=b.useState(""),Ts=OF(Zt);b.useEffect(()=>{Sn(F=>PF(F,Ts))},[Ts]);const[_a,_c]=b.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[xr,Eo]=b.useState(null),[As,Hi]=b.useState(!0),[Jd,Hr]=b.useState(!1);b.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(W=>W.ok?W.json():null).then(W=>{var ae,ie,je;if(!(!F||!(W!=null&&W.ok))){if(!lo.current){let Ie=!1;try{Ie=window.localStorage.getItem($u)==="0",window.localStorage.removeItem($u)}catch{}Ie&&((ae=W.prefs)==null?void 0:ae.autoUpdate)!==!1?(fa(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):fa(((ie=W.prefs)==null?void 0:ie.autoUpdate)!==!1)}Hi(((je=W.prefs)==null?void 0:je.notifications)!==!1),Hr(W.notificationsVetoed===!0)}}).catch(()=>{}),()=>{F=!1}},[]);const Co=b.useRef(()=>{}),Na=b.useCallback(()=>{const F=!As;Hi(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&Co.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(W=>W.ok?W.json():null).then(W=>{var ae;W!=null&&W.ok&&(Hi(((ae=W.prefs)==null?void 0:ae.notifications)!==!1),Hr(W.notificationsVetoed===!0))}).catch(()=>{})},[As]),Gi=typeof Notification<"u";b.useEffect(()=>{if(!xr)return;const W=setTimeout(()=>Eo(null),xr==="blocked"?8e3:4e3);return()=>clearTimeout(W)},[xr]);const Vi=b.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const W=F;_c(W),W==="granted"?Eo("on"):W==="denied"&&Eo("blocked")})},[]);Co.current=Vi;const Gr=b.useRef(new Set),br=b.useRef(null),Yi=Zt.map(F=>yd(F.id,F.waiting)).join("|");return b.useEffect(()=>{zL(br.current,_a)&&(br.current=_a,Gr.current=Rk(Zt))},[_a]),b.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||br.current===null)return;const F=typeof document>"u"||!document.hidden,W=FL(Zt,Gr.current,F,As);for(const ae of W)try{const ie=new Notification(ae.title,{body:ae.body,tag:ae.key});ie.onclick=()=>{window.focus(),jo(ae.sessionId),ie.close()}}catch{}Gr.current=F?Rk(Zt):BL(Zt,W,Gr.current)},[Yi]),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:zt}),Se?i.jsxs("button",{type:"button",className:"v stale",onClick:()=>{ht(),Za()},"aria-haspopup":"dialog","aria-label":QU({...Se,open:mr}),title:Se.kind==="restart"?`Running v${Se.from}; v${Se.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Se.from}; v${Se.to} is on npm · click for what's new`,children:["v",Se.from,i.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:ut,latest:re==null?void 0:re.latest,latestPending:re==null?void 0:re.latestPending,checkedAgo:re!=null&&re.checkedAt?_v(Mt-re.checkedAt):null,checkDisabled:re==null?void 0:re.checkDisabled,checking:at};return i.jsxs("button",{type:"button",className:at?"v checking":"v",onClick:()=>{ht(),se(!0)},"aria-busy":at||void 0,"aria-haspopup":"dialog","aria-label":XU(F),title:KU(F),children:["v",F.running]})})()]}),i.jsx("span",{className:"status",children:(()=>{const F=aW({connected:Ge,paused:Pr,held:Xt.size,dropped:Xt.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:Zd}),Zt.length>0&&i.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>jo(Zt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
260
|
-
${Zt.map(F=>` ${F.label}: ${Fl(F.waiting)} (${_v(Mt-F.waiting.since)})`).join(`
|
|
261
|
-
`)}`,"aria-label":`${Zt.length} session${Zt.length===1?"":"s"} waiting for you`,children:[i.jsx("span",{className:"ap-pulse","aria-hidden":!0}),i.jsx("b",{children:Zt.length})," waiting"]}),xr&&i.jsx("span",{className:xr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:xr==="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:xr==="on"?"notifications on":"notifications blocked"})]}),Qt&&(()=>{const F=An(Qt),W=Math.max(0,((Qt.endedAt??Mt)-Qt.startedAt)/1e3),ae=Qt.state==="active"?sx(F.total,W):null,ie=c.size-1;return i.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Qt.label}`,onClick:()=>{try{const je=Qn.find(Ie=>Ie.id===Qt.id);je&&e.fitView({padding:.35,duration:500,nodes:[je]}),Nn.current=Date.now()}catch{}},children:[i.jsx("span",{className:`state-pill state-${Qt.state}`,children:Qt.state==="active"?"live":Qt.state}),i.jsx("span",{className:"selected-label",children:Qt.label}),F.total>0&&i.jsxs("span",{className:"selected-cost",children:[Je(F.total),ae?i.jsxs("span",{className:"selected-rate",children:[" · ",ae]}):null]}),ie>0&&i.jsxs("span",{className:"selected-extra",children:["+",ie]}),i.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:je=>{je.stopPropagation(),v()},children:"×"})]})})(),i.jsxs("div",{className:"actions",children:[i.jsxs("div",{className:"action-run",children:[i.jsx("button",{className:"btn icon-btn",onClick:to,title:`${L?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":L,"aria-controls":L?"session-list":void 0,children:"☰"}),i.jsx("button",{className:"btn icon-btn",onClick:()=>z(F=>!F),title:`${Q?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":Q,"aria-controls":Q?"usage-panel":void 0,children:"$"}),Et.claude&&i.jsx("button",{className:"btn icon-btn",onClick:no,title:`${q?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":q,"aria-controls":q?"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:()=>J(F=>!F),title:`${te?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":te,"aria-controls":te?"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:()=>xn(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${Vn>0?" has-findings":Ir?" watching":""}`,onClick:()=>oa(F=>!F),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+(Vn>0?`, ${Vn} 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"}),Ir||Vn>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"})]}),Vn>0&&i.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Vn})]})]}),i.jsxs("div",{className:"action-run",children:[Et.claude&&P!==null&&i.jsxs("div",{className:"sound-slot",children:[i.jsx("button",{ref:ye,className:"btn icon-btn",onClick:()=>xe(F=>!F),...lr(!1),title:UF(Et,{on:P===!0,locked:ke==="locked",prefs:V}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":ue,"aria-controls":ue?"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"}),P?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"})]})]})}),ue&&i.jsx(Wq,{onClose:()=>xe(!1),soundOn:P===!0,onToggleSound:he,prefs:V,onLevel:(F,W)=>Ue(F,{level:W}),onFigure:(F,W)=>Ue(F,{figure:W}),onPreview:F=>Ce(F),notifyOn:As,onToggleNotify:Na,notifyVetoed:Jd,notifyPermission:Gi?_a:"unsupported",onAskNotify:Vi,openerRef:ye})]}),i.jsx("button",{className:"btn icon-btn",onClick:()=>Mi(F=>F==="dark"?"light":"dark"),title:`Switch to ${ga==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ga==="dark"?"☀":"☾"})]})]})]}),Ti?i.jsxs("div",{className:"ver-banner done",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:["Restarted — now running v",Ti,"."]}),i.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Dr&&!Ge?i.jsxs("div",{className:"conn-banner",role:"alert",children:[i.jsx("span",{className:"conn-dot"}),wr?st==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const F=rW({connected:Ge,paused:Pr});return i.jsxs(i.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,F&&i.jsx("span",{className:"conn-sub",children:F})]})})()]}):mr&&Se?i.jsxs("div",{className:`ver-banner ${Se.kind}`,role:"status",children:[i.jsx("span",{className:`ver-dot${Xn==null?"":" armed"}`}),Se.kind==="restart"?i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:["v",Se.to," is installed — this deck still runs v",Se.from,"."]}),re!=null&&re.canRestart?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"ver-act",onClick:()=>ps(),...lr(wr),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
262
|
-
|
|
263
|
-
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:wr?"restarting…":Kn.label}),!wr&&i.jsx("span",{className:"ver-sub",children:Kn.clause}),i.jsxs("button",{type:"button",className:`ver-auto${bn?" on":""}`,role:"switch","aria-checked":bn,onClick:pa,"aria-label":"Auto-restart when idle",title:bn?"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:fq(bn,Xn)})]})]}):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:[zt," v",Se.to," is out — you are on v",Se.from,"."]}),(re==null?void 0:re.upgradeMode)==="install"&&rn!=="failed"&&i.jsx("button",{type:"button",className:"ver-act",onClick:ds,...lr(rn==="running",rn==="done"),title:`Runs ${((Sa=re==null?void 0:re.upgrade)==null?void 0:Sa.command)??(re==null?void 0:re.command)??"npm i -g"} here, then restarts once nothing is running.`,children:rn==="running"?"installing…":rn==="done"?"installed":"Update now"}),(re==null?void 0:re.upgradeMode)==="npx"&&(re==null?void 0:re.canRestart)&&i.jsx("button",{type:"button",className:"ver-act",onClick:()=>ps({upgrade:!0}),...lr(wr),title:`Runs ${re==null?void 0:re.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:wr?"fetching…":rn==="failed"?"Retry update":"Update & restart"}),rn==="failed"?i.jsxs("span",{className:"ver-sub fail",title:((Xi=re==null?void 0:re.upgrade)==null?void 0:Xi.error)??"",children:[(re==null?void 0:re.upgradeMode)==="npx"?"update failed":"install failed",": ",((Qi=re==null?void 0:re.upgrade)==null?void 0:Qi.error)??"unknown error"," — run it yourself:"]}):(re==null?void 0:re.upgradeMode)==="npx"?i.jsx("span",{className:"ver-sub",children:re!=null&&re.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Jw.npx}):re!=null&&re.upgradeBlocked?i.jsx("span",{className:"ver-sub",children:Object.hasOwn(Jw,re.upgradeBlocked)?Jw[re.upgradeBlocked]:"cannot install from here"}):null,i.jsxs("button",{type:"button",className:"ver-cmd",onClick:ra,title:"Copy to clipboard",children:[i.jsx("code",{children:re==null?void 0:re.command}),i.jsx("span",{className:"ver-cmd-hint",children:_e?"copied":"copy"})]})]}),i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ja,children:"×"})]}):na&&Kt?i.jsxs("div",{className:"ver-banner",role:"status",children:[i.jsx("span",{className:"ver-dot"}),i.jsxs("strong",{children:[Kt," still works — the deck is called ",zt," now."]}),re!=null&&re.renameFix?i.jsx("span",{className:"ver-sub",children:re.renameFix}):null,i.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Mr,children:"×"})]}):null,Q&&i.jsx(U5,{state:s.current,now:Mt,providers:Et,onClose:()=>z(!1)}),q&&Et.claude&&i.jsx(oq,{onClose:()=>K(!1)}),te&&i.jsx(vD,{usageOpen:Q,onClose:()=>J(!1)}),L&&i.jsx(h5,{state:s.current,now:Mt,selectedIds:c,onSelect:jo,onClose:()=>Y(!1)}),i.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Vd?" bubbling":""}${Fi?" dragging-any":""}`,"data-detail":Yd,ref:pc,onMouseDownCapture:Wd,onPointerDownCapture:Wt,onPointerUpCapture:Wt,onWheelCapture:Wt,children:[xc===0&&i.jsx(MW,{live:Ge,everConnected:Dr,providers:Et,workspace:wt,onTour:()=>B(!0)}),(xo.length>1||ho.size>0)&&i.jsx("div",{ref:sn,className:`cat-filter-bar${ua?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:xo.map(F=>{const W=ho.has(F);return i.jsxs("button",{type:"button",className:`cat-filter${W?" off":""}`,onClick:()=>Qd(F),"aria-pressed":!W,title:`${W?"Show":"Hide"} ${Ov[F]} tools`,children:[i.jsx("span",{className:"cat-emoji",children:$v[F]}),i.jsx("span",{className:"cat-name",children:Ov[F]})]},F)})}),i.jsxs(DT,{nodes:Xd,edges:wc,nodeTypes:oW,fitView:!uo,fitViewOptions:{padding:.25,duration:Xw({durationMs:pC,documentHidden:document.hidden})?pC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(F,W)=>{if(W.type==="sessionGroup"){v();return}y(W.id,F.shiftKey)},onPaneClick:()=>v(),onMoveStart:F=>{uC(Br(F))&&zr()},onMove:(F,W)=>{Fr(),uC(Br(F))&&zr();const ae=uW(W.zoom);ae!==Ns.current&&(Ns.current=ae,Bi(ae)),ws.current&&window.clearTimeout(ws.current),ws.current=window.setTimeout(()=>EW(W),250)},onNodeDragStart:(F,W)=>{var ae;if(Kd(),wo.current=!0,da.current=new Map,gc(!0),Fr(),zr(),W.type==="sessionGroup"){const ie=(ae=W.data)==null?void 0:ae.sessionId,je=new Map;if(ie)for(const Ie of Qn){const ze=Ie.data;(ze==null?void 0:ze.sessionId)===ie&&je.set(Ie.id,{x:Ie.position.x,y:Ie.position.y})}kn.current={start:{x:W.position.x,y:W.position.y},members:je};return}It.current.set(W.id,{x:W.position.x,y:W.position.y})},onNodeDrag:(F,W)=>{var ae;if(Fr(),W.type==="sessionGroup"){const ie=kn.current;if(!ie)return;const je=W.position.x-ie.start.x,Ie=W.position.y-ie.start.y;for(const[nt,mt]of ie.members){const et={x:mt.x+je,y:mt.y+Ie};It.current.set(nt,et),un.current.set(nt,et)}const ze=da.current;if(ze){for(const[nt,mt]of ie.members)ze.set(nt,{x:mt.x+je,y:mt.y+Ie});ze.set(W.id,{x:W.position.x,y:W.position.y})}ic(nt=>nt+1);return}It.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),(ae=da.current)==null||ae.set(W.id,{x:W.position.x,y:W.position.y}),ic(ie=>ie+1)},onNodeDragStop:(F,W)=>{if(Fr(),wo.current=!1,da.current=null,gc(!1),Or(ae=>ae+1),W.type==="sessionGroup"){const ae=kn.current;if(ae){const ie=W.position.x-ae.start.x,je=W.position.y-ae.start.y;for(const[Ie,ze]of ae.members){const nt={x:ze.x+ie,y:ze.y+je};It.current.set(Ie,nt),un.current.set(Ie,nt)}}kn.current=null,ev(un.current,It.current),Or(ie=>ie+1);return}It.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),ev(un.current,It.current)},children:[i.jsx(X3,{gap:28,size:1,color:_n["--grid-line"]}),i.jsx(k4,{onFit:()=>{Nn.current=Date.now()}}),i.jsx(s5,{agents:s.current.agents,visibleAgentIds:Li,positions:un.current,pinned:It.current,measured:ks.current,spotlight:Pi,hiddenCategories:ho,now:Mt,onOpenTool:g}),i.jsxs(W3,{showInteractive:!1,children:[i.jsx(Er,{onClick:yo,title:mo?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:mo?{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(Er,{onClick:hs,title:nW({paused:Pr,held:Xt.size,dropped:Xt.dropped}),"aria-label":tW,"aria-pressed":Pr,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(Er,{onClick:_o,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(Er,{onClick:()=>ko("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(Er,{onClick:()=>I(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(L3,{zoomable:!0,pannable:!0,nodeColor:ya,nodeStrokeWidth:2,maskColor:_n["--minimap-mask"],style:wa})]})]}),D&&Qt?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:()=>A(!1),children:"×"}),i.jsx($W,{agent:Qt,now:Mt,onOpenTool:g,onShowSummary:F=>{M.has(F)&&(M.delete(F),wC(M)),_(F)},onExportSession:F=>CW(s.current,F)})]}):null,bo&&i.jsx(p4,{tool:bo,onClose:()=>g(null)}),sa&&i.jsx(YF,{providers:Et,onClose:()=>xn(!1)}),aa&&i.jsx(o8,{onClose:()=>oa(!1),onSeen:F=>{so(F);try{localStorage.setItem(D1,String(F))}catch{}},onWatching:la,palette:_n}),j&&(()=>{const F=s.current.agents.get(j);return F?i.jsx(o4,{agent:F,onClose:()=>x(null)}):null})(),S&&i.jsx(c5,{state:s.current,sessionId:S,onClose:()=>{M.add(S),wC(M),_(null)}}),Te&&i.jsx(dF,{entries:Te.entries,since:Te.since,firstRun:Te.firstRun,running:ut,onClose:()=>Be(null),onTour:()=>{Be(null),B(!0)}}),(()=>{const{request:F,waiting:W}=l8(Ci,oo.current);return F?i.jsx(c8,{request:F,waiting:W,busy:yr,now:Date.now(),onAccept:()=>void $r("accept",F.fp),onDecline:()=>void $r("dismiss",F.fp),onLater:()=>{yr||(oo.current.add(F.fp),lt(ae=>[...ae]))}}):null})(),R&&i.jsx(_q,{onClose:()=>I(!1),onTour:()=>{I(!1),B(!0)}}),$&&i.jsx(S2,{title:"What the deck shows you",steps:_6,onClose:()=>{B(!1),iF($1());const F=O.current;O.current=null,F&&Be(F)}}),E&&i.jsx(xq,{agentCount:xc,onConfirm:()=>ko("confirmation"),onCancel:()=>C(!1)})]})}function MW({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:["The browser cannot reach ",i.jsx("code",{children:"/events"}),". Check that",i.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):IW(n,s),!l&&i.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function IW(e,t){const n=ZU(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."]}),i.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",i.jsx("code",{children:zt})," is running."]}),zF(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 $W({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const l=Ju(e.startedAt,e.endedAt,t),c=An(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const S of e.tools){const _=JA(S.name);p.set(_,(p.get(_)??0)+1)}const h=e.tools.filter(S=>S.ok===!1).length,g=e.tools.filter(S=>!S.endedAt).length,y=Array.from(p.entries()).sort((S,_)=>_[1]-S[1]),v=p.has("mcp")?J4(e.tools.map(S=>S.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 S=JT(e);return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hero-sep",children:"·"}),i.jsxs("span",{className:"model-chip","data-family":gd(e.model),title:S.length>0?`${e.model}
|
|
264
|
-
spend on this panel also covers:
|
|
265
|
-
${S.join(`
|
|
266
|
-
`)}`:e.model,children:[Zs(e.model),S.length>0?` +${S.length}`:""]})]})})()]}),u&&i.jsxs("div",{className:"hero-cost",children:[i.jsxs("div",{className:"hero-cost-headline",children:[i.jsx("span",{className:"hero-cost-value",children:Je(c.total)}),i.jsx("span",{className:"hero-cost-label",children:"spend"})]}),i.jsx(lx,{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"]}),g>0&&i.jsxs("span",{className:"ac-item ac-live",children:[i.jsx("b",{children:g})," live"]}),h>0&&i.jsxs("span",{className:"ac-item ac-err",children:[i.jsx("b",{children:h})," err"]})]}),i.jsx("div",{className:"cat-strip",children:y.map(([S,_])=>{const j=S==="mcp"?v:null,x=j==null?void 0:j.hue,N=`${_} ${Ov[S]} call${_===1?"":"s"}`;return i.jsxs("span",{className:`cat-chip cat-${S}${x!=null?" mcp-hue":""}`,style:x!=null?{"--mcp-hue":x}:void 0,title:j?`${N}, all to ${j.label}`:N,children:[i.jsx("span",{className:"cat-emoji",children:$v[S]}),i.jsx("span",{className:"cat-count",children:_}),j&&i.jsx("span",{className:"cat-server",children:j.label})]},S)})})]})]}),f>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((S,_)=>{const j=E5(S.at,t);return i.jsxs("div",{className:"prompt-entry",children:[i.jsx("div",{className:"prompt-time",title:j.title,children:j.label}),i.jsx("div",{className:"prompt-text",children:S.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(S=>i.jsx(PW,{t:S,onClick:()=>n(S.id)},S.id))})]})]})}const OW={inflight:"in-flight",done:"done",err:"error"};function PW({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=t2(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:OW[n]}),e.name]}),i.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{S5(window.localStorage)}catch{}const LW=KR.createRoot(document.getElementById("root"));LW.render(i.jsx(AW,{}));
|