ccdeck 3.27.6 → 3.28.0

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,297 +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"]'))r(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"&&r(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 r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var gd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gp={exports:{}},lc={},yp={exports:{}},ot={};/**
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 Zk;function S$(){if(Zk)return ot;Zk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=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"),m=Symbol.iterator;function y(F){return F===null||typeof F!="object"?null:(F=m&&F[m]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,k={};function S(F,K,de){this.props=F,this.context=K,this.refs=k,this.updater=de||w}S.prototype.isReactComponent={},S.prototype.setState=function(F,K){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,K,"setState")},S.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function b(){}b.prototype=S.prototype;function N(F,K,de){this.props=F,this.context=K,this.refs=k,this.updater=de||w}var E=N.prototype=new b;E.constructor=N,j(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,A={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function B(F,K,de){var H,Q={},O=null,te=null;if(K!=null)for(H in K.ref!==void 0&&(te=K.ref),K.key!==void 0&&(O=""+K.key),K)T.call(K,H)&&!I.hasOwnProperty(H)&&(Q[H]=K[H]);var ae=arguments.length-2;if(ae===1)Q.children=de;else if(1<ae){for(var he=Array(ae),ge=0;ge<ae;ge++)he[ge]=arguments[ge+2];Q.children=he}if(F&&F.defaultProps)for(H in ae=F.defaultProps,ae)Q[H]===void 0&&(Q[H]=ae[H]);return{$$typeof:e,type:F,key:O,ref:te,props:Q,_owner:A.current}}function q(F,K){return{$$typeof:e,type:F.type,key:K,ref:F.ref,props:F.props,_owner:F._owner}}function L(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function U(F){var K={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(de){return K[de]})}var X=/\/+/g;function Y(F,K){return typeof F=="object"&&F!==null&&F.key!=null?U(""+F.key):K.toString(36)}function M(F,K,de,H,Q){var O=typeof F;(O==="undefined"||O==="boolean")&&(F=null);var te=!1;if(F===null)te=!0;else switch(O){case"string":case"number":te=!0;break;case"object":switch(F.$$typeof){case e:case t:te=!0}}if(te)return te=F,Q=Q(te),F=H===""?"."+Y(te,0):H,C(Q)?(de="",F!=null&&(de=F.replace(X,"$&/")+"/"),M(Q,K,de,"",function(ge){return ge})):Q!=null&&(L(Q)&&(Q=q(Q,de+(!Q.key||te&&te.key===Q.key?"":(""+Q.key).replace(X,"$&/")+"/")+F)),K.push(Q)),1;if(te=0,H=H===""?".":H+":",C(F))for(var ae=0;ae<F.length;ae++){O=F[ae];var he=H+Y(O,ae);te+=M(O,K,de,he,Q)}else if(he=y(F),typeof he=="function")for(F=he.call(F),ae=0;!(O=F.next()).done;)O=O.value,he=H+Y(O,ae++),te+=M(O,K,de,he,Q);else if(O==="object")throw K=String(F),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return te}function J(F,K,de){if(F==null)return F;var H=[],Q=0;return M(F,H,"","",function(O){return K.call(de,O,Q++)}),H}function V(F){if(F._status===-1){var K=F._result;K=K(),K.then(function(de){(F._status===0||F._status===-1)&&(F._status=1,F._result=de)},function(de){(F._status===0||F._status===-1)&&(F._status=2,F._result=de)}),F._status===-1&&(F._status=0,F._result=K)}if(F._status===1)return F._result.default;throw F._result}var $={current:null},z={transition:null},W={ReactCurrentDispatcher:$,ReactCurrentBatchConfig:z,ReactCurrentOwner:A};function G(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:J,forEach:function(F,K,de){J(F,function(){K.apply(this,arguments)},de)},count:function(F){var K=0;return J(F,function(){K++}),K},toArray:function(F){return J(F,function(K){return K})||[]},only:function(F){if(!L(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},ot.Component=S,ot.Fragment=n,ot.Profiler=a,ot.PureComponent=N,ot.StrictMode=r,ot.Suspense=f,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,ot.act=G,ot.cloneElement=function(F,K,de){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var H=j({},F.props),Q=F.key,O=F.ref,te=F._owner;if(K!=null){if(K.ref!==void 0&&(O=K.ref,te=A.current),K.key!==void 0&&(Q=""+K.key),F.type&&F.type.defaultProps)var ae=F.type.defaultProps;for(he in K)T.call(K,he)&&!I.hasOwnProperty(he)&&(H[he]=K[he]===void 0&&ae!==void 0?ae[he]:K[he])}var he=arguments.length-2;if(he===1)H.children=de;else if(1<he){ae=Array(he);for(var ge=0;ge<he;ge++)ae[ge]=arguments[ge+2];H.children=ae}return{$$typeof:e,type:F.type,key:Q,ref:O,props:H,_owner:te}},ot.createContext=function(F){return F={$$typeof:c,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:l,_context:F},F.Consumer=F},ot.createElement=B,ot.createFactory=function(F){var K=B.bind(null,F);return K.type=F,K},ot.createRef=function(){return{current:null}},ot.forwardRef=function(F){return{$$typeof:u,render:F}},ot.isValidElement=L,ot.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:V}},ot.memo=function(F,K){return{$$typeof:p,type:F,compare:K===void 0?null:K}},ot.startTransition=function(F){var K=z.transition;z.transition={};try{F()}finally{z.transition=K}},ot.unstable_act=G,ot.useCallback=function(F,K){return $.current.useCallback(F,K)},ot.useContext=function(F){return $.current.useContext(F)},ot.useDebugValue=function(){},ot.useDeferredValue=function(F){return $.current.useDeferredValue(F)},ot.useEffect=function(F,K){return $.current.useEffect(F,K)},ot.useId=function(){return $.current.useId()},ot.useImperativeHandle=function(F,K,de){return $.current.useImperativeHandle(F,K,de)},ot.useInsertionEffect=function(F,K){return $.current.useInsertionEffect(F,K)},ot.useLayoutEffect=function(F,K){return $.current.useLayoutEffect(F,K)},ot.useMemo=function(F,K){return $.current.useMemo(F,K)},ot.useReducer=function(F,K,de){return $.current.useReducer(F,K,de)},ot.useRef=function(F){return $.current.useRef(F)},ot.useState=function(F){return $.current.useState(F)},ot.useSyncExternalStore=function(F,K,de){return $.current.useSyncExternalStore(F,K,de)},ot.useTransition=function(){return $.current.useTransition()},ot.version="18.3.1",ot}var Qk;function Vc(){return Qk||(Qk=1,yp.exports=S$()),yp.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 Jk;function j$(){if(Jk)return lc;Jk=1;var e=Vc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=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,m={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)r.call(f,h)&&!l.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return lc.Fragment=n,lc.jsx=c,lc.jsxs=c,lc}var e1;function E$(){return e1||(e1=1,gp.exports=j$()),gp.exports}var o=E$(),yd={},wp={exports:{}},Hn={},vp={exports:{}},xp={};/**
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 t1;function C$(){return t1||(t1=1,(function(e){function t(z,W){var G=z.length;z.push(W);e:for(;0<G;){var F=G-1>>>1,K=z[F];if(0<a(K,W))z[F]=W,z[G]=K,G=F;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var W=z[0],G=z.pop();if(G!==W){z[0]=G;e:for(var F=0,K=z.length,de=K>>>1;F<de;){var H=2*(F+1)-1,Q=z[H],O=H+1,te=z[O];if(0>a(Q,G))O<K&&0>a(te,Q)?(z[F]=te,z[O]=G,F=O):(z[F]=Q,z[H]=G,F=H);else if(O<K&&0>a(te,G))z[F]=te,z[O]=G,F=O;else break e}}return W}function a(z,W){var G=z.sortIndex-W.sortIndex;return G!==0?G:z.id-W.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,m=null,y=3,w=!1,j=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,b=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(z){for(var W=n(p);W!==null;){if(W.callback===null)r(p);else if(W.startTime<=z)r(p),W.sortIndex=W.expirationTime,t(f,W);else break;W=n(p)}}function C(z){if(k=!1,E(z),!j)if(n(f)!==null)j=!0,V(T);else{var W=n(p);W!==null&&$(C,W.startTime-z)}}function T(z,W){j=!1,k&&(k=!1,b(B),B=-1),w=!0;var G=y;try{for(E(W),m=n(f);m!==null&&(!(m.expirationTime>W)||z&&!U());){var F=m.callback;if(typeof F=="function"){m.callback=null,y=m.priorityLevel;var K=F(m.expirationTime<=W);W=e.unstable_now(),typeof K=="function"?m.callback=K:m===n(f)&&r(f),E(W)}else r(f);m=n(f)}if(m!==null)var de=!0;else{var H=n(p);H!==null&&$(C,H.startTime-W),de=!1}return de}finally{m=null,y=G,w=!1}}var A=!1,I=null,B=-1,q=5,L=-1;function U(){return!(e.unstable_now()-L<q)}function X(){if(I!==null){var z=e.unstable_now();L=z;var W=!0;try{W=I(!0,z)}finally{W?Y():(A=!1,I=null)}}else A=!1}var Y;if(typeof N=="function")Y=function(){N(X)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,J=M.port2;M.port1.onmessage=X,Y=function(){J.postMessage(null)}}else Y=function(){S(X,0)};function V(z){I=z,A||(A=!0,Y())}function $(z,W){B=S(function(){z(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_continueExecution=function(){j||w||(j=!0,V(T))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(z){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var G=y;y=W;try{return z()}finally{y=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,W){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var G=y;y=z;try{return W()}finally{y=G}},e.unstable_scheduleCallback=function(z,W,G){var F=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?F+G:F):G=F,z){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=G+K,z={id:h++,callback:W,priorityLevel:z,startTime:G,expirationTime:K,sortIndex:-1},G>F?(z.sortIndex=G,t(p,z),n(f)===null&&z===n(p)&&(k?(b(B),B=-1):k=!0,$(C,G-F))):(z.sortIndex=K,t(f,z),j||w||(j=!0,V(T))),z},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(z){var W=y;return function(){var G=y;y=W;try{return z.apply(this,arguments)}finally{y=G}}}})(xp)),xp}var n1;function T$(){return n1||(n1=1,vp.exports=C$()),vp.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 r1;function A$(){if(r1)return Hn;r1=1;var e=Vc(),t=T$();function n(s){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+s,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function l(s,i){c(s,i),c(s+"Capture",i)}function c(s,i){for(a[s]=i,s=0;s<i.length;s++)r.add(i[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},m={};function y(s){return f.call(m,s)?!0:f.call(h,s)?!1:p.test(s)?m[s]=!0:(h[s]=!0,!1)}function w(s,i,d,g){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function j(s,i,d,g){if(i===null||typeof i>"u"||w(s,i,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function k(s,i,d,g,v,_,R){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=s,this.type=i,this.sanitizeURL=_,this.removeEmptyString=R}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){S[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var i=s[0];S[i]=new k(i,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){S[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){S[s]=new k(s,2,!1,s,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(s){S[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){S[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){S[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){S[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){S[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function N(s){return s[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(s){var i=s.replace(b,N);S[i]=new k(i,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var i=s.replace(b,N);S[i]=new k(i,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var i=s.replace(b,N);S[i]=new k(i,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){S[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),S.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){S[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,i,d,g){var v=S.hasOwnProperty(i)?S[i]:null;(v!==null?v.type!==0:g||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(j(i,d,v,g)&&(d=null),g||v===null?y(i)&&(d===null?s.removeAttribute(i):s.setAttribute(i,""+d)):v.mustUseProperty?s[v.propertyName]=d===null?v.type===3?!1:"":d:(i=v.attributeName,g=v.attributeNamespace,d===null?s.removeAttribute(i):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?s.setAttributeNS(g,i,d):s.setAttribute(i,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),A=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),U=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),z=Symbol.iterator;function W(s){return s===null||typeof s!="object"?null:(s=z&&s[z]||s["@@iterator"],typeof s=="function"?s:null)}var G=Object.assign,F;function K(s){if(F===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);F=i&&i[1]||""}return`
34
- `+F+s}var de=!1;function H(s,i){if(!s||de)return"";de=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(pe){var g=pe}Reflect.construct(s,[],i)}else{try{i.call()}catch(pe){g=pe}s.call(i.prototype)}else{try{throw Error()}catch(pe){g=pe}s()}}catch(pe){if(pe&&g&&typeof pe.stack=="string"){for(var v=pe.stack.split(`
35
- `),_=g.stack.split(`
36
- `),R=v.length-1,Z=_.length-1;1<=R&&0<=Z&&v[R]!==_[Z];)Z--;for(;1<=R&&0<=Z;R--,Z--)if(v[R]!==_[Z]){if(R!==1||Z!==1)do if(R--,Z--,0>Z||v[R]!==_[Z]){var ne=`
37
- `+v[R].replace(" at new "," at ");return s.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",s.displayName)),ne}while(1<=R&&0<=Z);break}}}finally{de=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?K(s):""}function Q(s){switch(s.tag){case 5:return K(s.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return s=H(s.type,!1),s;case 11:return s=H(s.type.render,!1),s;case 1:return s=H(s.type,!0),s;default:return""}}function O(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case I:return"Fragment";case A:return"Portal";case q:return"Profiler";case B:return"StrictMode";case Y:return"Suspense";case M:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case U:return(s.displayName||"Context")+".Consumer";case L:return(s._context.displayName||"Context")+".Provider";case X:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case J:return i=s.displayName||null,i!==null?i:O(s.type)||"Memo";case V:i=s._payload,s=s._init;try{return O(s(i))}catch{}}return null}function te(s){var i=s.type;switch(s.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=i.render,s=s.displayName||s.name||"",i.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return O(i);case 8:return i===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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function ae(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function he(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ge(s){var i=he(s)?"checked":"value",d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i),g=""+s[i];if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,_=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return v.call(this)},set:function(R){g=""+R,_.call(this,R)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(R){g=""+R},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function Te(s){s._valueTracker||(s._valueTracker=ge(s))}function De(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var d=i.getValue(),g="";return s&&(g=he(s)?s.checked?"true":"false":s.value),s=g,s!==d?(i.setValue(s),!0):!1}function Ve(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function je(s,i){var d=i.checked;return G({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function ve(s,i){var d=i.defaultValue==null?"":i.defaultValue,g=i.checked!=null?i.checked:i.defaultChecked;d=ae(i.value!=null?i.value:d),s._wrapperState={initialChecked:g,initialValue:d,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Ue(s,i){i=i.checked,i!=null&&E(s,"checked",i,!1)}function ke(s,i){Ue(s,i);var d=ae(i.value),g=i.type;if(d!=null)g==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+d):s.value!==""+d&&(s.value=""+d);else if(g==="submit"||g==="reset"){s.removeAttribute("value");return}i.hasOwnProperty("value")?Ge(s,i.type,d):i.hasOwnProperty("defaultValue")&&Ge(s,i.type,ae(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(s.defaultChecked=!!i.defaultChecked)}function xe(s,i,d){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var g=i.type;if(!(g!=="submit"&&g!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+s._wrapperState.initialValue,d||i===s.value||(s.value=i),s.defaultValue=i}d=s.name,d!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,d!==""&&(s.name=d)}function Ge(s,i,d){(i!=="number"||Ve(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var rt=Array.isArray;function at(s,i,d,g){if(s=s.options,i){i={};for(var v=0;v<d.length;v++)i["$"+d[v]]=!0;for(d=0;d<s.length;d++)v=i.hasOwnProperty("$"+s[d].value),s[d].selected!==v&&(s[d].selected=v),v&&g&&(s[d].defaultSelected=!0)}else{for(d=""+ae(d),i=null,v=0;v<s.length;v++){if(s[v].value===d){s[v].selected=!0,g&&(s[v].defaultSelected=!0);return}i!==null||s[v].disabled||(i=s[v])}i!==null&&(i.selected=!0)}}function le(s,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return G({},i,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function _e(s,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(rt(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}s._wrapperState={initialValue:ae(d)}}function Ie(s,i){var d=ae(i.value),g=ae(i.defaultValue);d!=null&&(d=""+d,d!==s.value&&(s.value=d),i.defaultValue==null&&s.defaultValue!==d&&(s.defaultValue=d)),g!=null&&(s.defaultValue=""+g)}function Ze(s){var i=s.textContent;i===s._wrapperState.initialValue&&i!==""&&i!==null&&(s.value=i)}function We(s){switch(s){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 Je(s,i){return s==null||s==="http://www.w3.org/1999/xhtml"?We(i):s==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var ye,Me=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,g,v){MSApp.execUnsafeLocalFunction(function(){return s(i,d,g,v)})}:s})(function(s,i){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=i;else{for(ye=ye||document.createElement("div"),ye.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=ye.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;i.firstChild;)s.appendChild(i.firstChild)}});function Qe(s,i){if(i){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=i;return}}s.textContent=i}var ue={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},kt=["Webkit","ms","Moz","O"];Object.keys(ue).forEach(function(s){kt.forEach(function(i){i=i+s.charAt(0).toUpperCase()+s.substring(1),ue[i]=ue[s]})});function pt(s,i,d){return i==null||typeof i=="boolean"||i===""?"":d||typeof i!="number"||i===0||ue.hasOwnProperty(s)&&ue[s]?(""+i).trim():i+"px"}function ut(s,i){s=s.style;for(var d in i)if(i.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=pt(d,i[d],g);d==="float"&&(d="cssFloat"),g?s.setProperty(d,v):s[d]=v}}var Bt=G({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 jt(s,i){if(i){if(Bt[s]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function vt(s,i){if(s.indexOf("-")===-1)return typeof i.is=="string";switch(s){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 an=null;function jn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Nt=null,Yt=null,fe=null;function st(s){if(s=Ke(s)){if(typeof Nt!="function")throw Error(n(280));var i=s.stateNode;i&&(i=Dt(i),Nt(s.stateNode,s.type,i))}}function It(s){Yt?fe?fe.push(s):fe=[s]:Yt=s}function Et(){if(Yt){var s=Yt,i=fe;if(fe=Yt=null,st(s),i)for(s=0;s<i.length;s++)st(i[s])}}function En(s,i){return s(i)}function Gn(){}var St=!1;function lr(s,i,d){if(St)return s(i,d);St=!0;try{return En(s,i,d)}finally{St=!1,(Yt!==null||fe!==null)&&(Gn(),Et())}}function yn(s,i){var d=s.stateNode;if(d===null)return null;var g=Dt(d);if(g===null)return null;d=g[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(n(231,i,typeof d));return d}var Xt=!1;if(u)try{var Cn={};Object.defineProperty(Cn,"passive",{get:function(){Xt=!0}}),window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch{Xt=!1}function zt(s,i,d,g,v,_,R,Z,ne){var pe=Array.prototype.slice.call(arguments,3);try{i.apply(d,pe)}catch(Ne){this.onError(Ne)}}var In=!1,Kn=null,cr=!1,$n=null,ea={onError:function(s){In=!0,Kn=s}};function ta(s,i,d,g,v,_,R,Z,ne){In=!1,Kn=null,zt.apply(ea,arguments)}function _s(s,i,d,g,v,_,R,Z,ne){if(ta.apply(this,arguments),In){if(In){var pe=Kn;In=!1,Kn=null}else throw Error(n(198));cr||(cr=!0,$n=pe)}}function On(s){var i=s,d=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(d=i.return),s=i.return;while(s)}return i.tag===3?d:null}function wn(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function ee(s){if(On(s)!==s)throw Error(n(188))}function Ae(s){var i=s.alternate;if(!i){if(i=On(s),i===null)throw Error(n(188));return i!==s?null:s}for(var d=s,g=i;;){var v=d.return;if(v===null)break;var _=v.alternate;if(_===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===_.child){for(_=v.child;_;){if(_===d)return ee(v),s;if(_===g)return ee(v),i;_=_.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=_;else{for(var R=!1,Z=v.child;Z;){if(Z===d){R=!0,d=v,g=_;break}if(Z===g){R=!0,g=v,d=_;break}Z=Z.sibling}if(!R){for(Z=_.child;Z;){if(Z===d){R=!0,d=_,g=v;break}if(Z===g){R=!0,g=_,d=v;break}Z=Z.sibling}if(!R)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?s:i}function Oe(s){return s=Ae(s),s!==null?Re(s):null}function Re(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var i=Re(s);if(i!==null)return i;s=s.sibling}return null}var ze=t.unstable_scheduleCallback,dt=t.unstable_cancelCallback,yt=t.unstable_shouldYield,Ct=t.unstable_requestPaint,gt=t.unstable_now,xt=t.unstable_getCurrentPriorityLevel,Ar=t.unstable_ImmediatePriority,Ss=t.unstable_UserBlockingPriority,ns=t.unstable_NormalPriority,Ba=t.unstable_LowPriority,Wo=t.unstable_IdlePriority,js=null,Ln=null;function Es(s){if(Ln&&typeof Ln.onCommitFiberRoot=="function")try{Ln.onCommitFiberRoot(js,s,void 0,(s.current.flags&128)===128)}catch{}}var Pn=Math.clz32?Math.clz32:su,rf=Math.log,Vo=Math.LN2;function su(s){return s>>>=0,s===0?32:31-(rf(s)/Vo|0)|0}var Cs=64,za=4194304;function na(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function rs(s,i){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,_=s.pingedLanes,R=d&268435455;if(R!==0){var Z=R&~v;Z!==0?g=na(Z):(_&=R,_!==0&&(g=na(_)))}else R=d&~v,R!==0?g=na(R):_!==0&&(g=na(_));if(g===0)return 0;if(i!==0&&i!==g&&(i&v)===0&&(v=g&-g,_=i&-i,v>=_||v===16&&(_&4194240)!==0))return i;if((g&4)!==0&&(g|=d&16),i=s.entangledLanes,i!==0)for(s=s.entanglements,i&=g;0<i;)d=31-Pn(i),v=1<<d,g|=s[d],i&=~v;return g}function sf(s,i){switch(s){case 1:case 2:case 4:return i+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 i+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 au(s,i){for(var d=s.suspendedLanes,g=s.pingedLanes,v=s.expirationTimes,_=s.pendingLanes;0<_;){var R=31-Pn(_),Z=1<<R,ne=v[R];ne===-1?((Z&d)===0||(Z&g)!==0)&&(v[R]=sf(Z,i)):ne<=i&&(s.expiredLanes|=Z),_&=~Z}}function Go(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function ou(){var s=Cs;return Cs<<=1,(Cs&4194240)===0&&(Cs=64),s}function Ko(s){for(var i=[],d=0;31>d;d++)i.push(s);return i}function Rr(s,i,d){s.pendingLanes|=i,i!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,i=31-Pn(i),s[i]=d}function af(s,i){var d=s.pendingLanes&~i;s.pendingLanes=i,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=i,s.mutableReadLanes&=i,s.entangledLanes&=i,i=s.entanglements;var g=s.eventTimes;for(s=s.expirationTimes;0<d;){var v=31-Pn(d),_=1<<v;i[v]=0,g[v]=-1,s[v]=-1,d&=~_}}function Yo(s,i){var d=s.entangledLanes|=i;for(s=s.entanglements;d;){var g=31-Pn(d),v=1<<g;v&i|s[g]&i&&(s[g]|=i),d&=~v}}var nt=0;function Ha(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var iu,Ua,Wt,lu,Mr,ra=!1,Wa=[],ss=null,hn=null,Yn=null,Va=new Map,Ga=new Map,Ir=[],cu="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 Ts(s,i){switch(s){case"focusin":case"focusout":ss=null;break;case"dragenter":case"dragleave":hn=null;break;case"mouseover":case"mouseout":Yn=null;break;case"pointerover":case"pointerout":Va.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ga.delete(i.pointerId)}}function sa(s,i,d,g,v,_){return s===null||s.nativeEvent!==_?(s={blockedOn:i,domEventName:d,eventSystemFlags:g,nativeEvent:_,targetContainers:[v]},i!==null&&(i=Ke(i),i!==null&&Ua(i)),s):(s.eventSystemFlags|=g,i=s.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),s)}function uu(s,i,d,g,v){switch(i){case"focusin":return ss=sa(ss,s,i,d,g,v),!0;case"dragenter":return hn=sa(hn,s,i,d,g,v),!0;case"mouseover":return Yn=sa(Yn,s,i,d,g,v),!0;case"pointerover":var _=v.pointerId;return Va.set(_,sa(Va.get(_)||null,s,i,d,g,v)),!0;case"gotpointercapture":return _=v.pointerId,Ga.set(_,sa(Ga.get(_)||null,s,i,d,g,v)),!0}return!1}function aa(s){var i=ct(s.target);if(i!==null){var d=On(i);if(d!==null){if(i=d.tag,i===13){if(i=wn(d),i!==null){s.blockedOn=i,Mr(s.priority,function(){Wt(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function oa(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var d=Zo(s.domEventName,s.eventSystemFlags,i[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var g=new d.constructor(d.type,d);an=g,d.target.dispatchEvent(g),an=null}else return i=Ke(d),i!==null&&Ua(i),s.blockedOn=d,!1;i.shift()}return!0}function yl(s,i,d){oa(s)&&d.delete(i)}function du(){ra=!1,ss!==null&&oa(ss)&&(ss=null),hn!==null&&oa(hn)&&(hn=null),Yn!==null&&oa(Yn)&&(Yn=null),Va.forEach(yl),Ga.forEach(yl)}function ia(s,i){s.blockedOn===i&&(s.blockedOn=null,ra||(ra=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,du)))}function la(s){function i(v){return ia(v,s)}if(0<Wa.length){ia(Wa[0],s);for(var d=1;d<Wa.length;d++){var g=Wa[d];g.blockedOn===s&&(g.blockedOn=null)}}for(ss!==null&&ia(ss,s),hn!==null&&ia(hn,s),Yn!==null&&ia(Yn,s),Va.forEach(i),Ga.forEach(i),d=0;d<Ir.length;d++)g=Ir[d],g.blockedOn===s&&(g.blockedOn=null);for(;0<Ir.length&&(d=Ir[0],d.blockedOn===null);)aa(d),d.blockedOn===null&&Ir.shift()}var Tt=C.ReactCurrentBatchConfig,As=!0;function Xo(s,i,d,g){var v=nt,_=Tt.transition;Tt.transition=null;try{nt=1,vl(s,i,d,g)}finally{nt=v,Tt.transition=_}}function wl(s,i,d,g){var v=nt,_=Tt.transition;Tt.transition=null;try{nt=4,vl(s,i,d,g)}finally{nt=v,Tt.transition=_}}function vl(s,i,d,g){if(As){var v=Zo(s,i,d,g);if(v===null)pa(s,i,g,$r,d),Ts(s,g);else if(uu(v,s,i,d,g))g.stopPropagation();else if(Ts(s,g),i&4&&-1<cu.indexOf(s)){for(;v!==null;){var _=Ke(v);if(_!==null&&iu(_),_=Zo(s,i,d,g),_===null&&pa(s,i,g,$r,d),_===v)break;v=_}v!==null&&g.stopPropagation()}else pa(s,i,g,null,d)}}var $r=null;function Zo(s,i,d,g){if($r=null,s=jn(g),s=ct(s),s!==null)if(i=On(s),i===null)s=null;else if(d=i.tag,d===13){if(s=wn(i),s!==null)return s;s=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null);return $r=s,null}function ca(s){switch(s){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(xt()){case Ar:return 1;case Ss:return 4;case ns:case Ba:return 16;case Wo:return 536870912;default:return 16}default:return 16}}var as=null,ua=null,Qo=null;function Ka(){if(Qo)return Qo;var s,i=ua,d=i.length,g,v="value"in as?as.value:as.textContent,_=v.length;for(s=0;s<d&&i[s]===v[s];s++);var R=d-s;for(g=1;g<=R&&i[d-g]===v[_-g];g++);return Qo=v.slice(s,1<g?1-g:void 0)}function Jo(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Or(){return!0}function hu(){return!1}function vn(s){function i(d,g,v,_,R){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=_,this.target=R,this.currentTarget=null;for(var Z in s)s.hasOwnProperty(Z)&&(d=s[Z],this[Z]=d?d(_):_[Z]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Or:hu,this.isPropagationStopped=hu,this}return G(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Or)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Or)},persist:function(){},isPersistent:Or}),i}var da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ei=vn(da),Ya=G({},da,{view:0,detail:0}),Xn=vn(Ya),os,Rs,is,Xa=G({},Ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:El,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==is&&(is&&s.type==="mousemove"?(os=s.screenX-is.screenX,Rs=s.screenY-is.screenY):Rs=os=0,is=s),os)},movementY:function(s){return"movementY"in s?s.movementY:Rs}}),xl=vn(Xa),Za=G({},Xa,{dataTransfer:0}),fu=vn(Za),bl=G({},Ya,{relatedTarget:0}),Lr=vn(bl),pu=G({},da,{animationName:0,elapsedTime:0,pseudoElement:0}),Dn=vn(pu),kl=G({},da,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Nl=vn(kl),mu=G({},da,{data:0}),Qa=vn(mu),_l={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gu={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"},Sl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jl(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=Sl[s])?!!i[s]:!1}function El(){return jl}var Ms=G({},Ya,{key:function(s){if(s.key){var i=_l[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=Jo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?gu[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:El,charCode:function(s){return s.type==="keypress"?Jo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Jo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Cl=vn(Ms),yu=G({},Xa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ha=vn(yu),wu=G({},Ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:El}),ti=vn(wu),Pr=G({},da,{propertyName:0,elapsedTime:0,pseudoElement:0}),Tl=vn(Pr),of=G({},Xa,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),vu=vn(of),xu=[9,13,27,32],Al=u&&"CompositionEvent"in window,$t=null;u&&"documentMode"in document&&($t=document.documentMode);var bu=u&&"TextEvent"in window&&!$t,Ja=u&&(!Al||$t&&8<$t&&11>=$t),Is=" ",fa=!1;function ni(s,i){switch(s){case"keyup":return xu.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ri(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Fn=!1;function eo(s,i){switch(s){case"compositionend":return ri(i);case"keypress":return i.which!==32?null:(fa=!0,Is);case"textInput":return s=i.data,s===Is&&fa?null:s;default:return null}}function ku(s,i){if(Fn)return s==="compositionend"||!Al&&ni(s,i)?(s=Ka(),Qo=ua=as=null,Fn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Ja&&i.locale!=="ko"?null:i.data;default:return null}}var lf={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 Nu(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!lf[s.type]:i==="textarea"}function to(s,i,d,g){It(g),i=dr(i,"onChange"),0<i.length&&(d=new ei("onChange","change",null,d,g),s.push({event:d,listeners:i}))}var no=null,ro=null;function Rl(s){Zt(s,0)}function Zn(s){var i=Pt(s);if(De(i))return s}function so(s,i){if(s==="change")return i}var Ml=!1;if(u){var Il;if(u){var $l="oninput"in document;if(!$l){var ls=document.createElement("div");ls.setAttribute("oninput","return;"),$l=typeof ls.oninput=="function"}Il=$l}else Il=!1;Ml=Il&&(!document.documentMode||9<document.documentMode)}function si(){no&&(no.detachEvent("onpropertychange",_u),ro=no=null)}function _u(s){if(s.propertyName==="value"&&Zn(ro)){var i=[];to(i,ro,s,jn(s)),lr(Rl,i)}}function cf(s,i,d){s==="focusin"?(si(),no=i,ro=d,no.attachEvent("onpropertychange",_u)):s==="focusout"&&si()}function uf(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Zn(ro)}function xn(s,i){if(s==="click")return Zn(i)}function Su(s,i){if(s==="input"||s==="change")return Zn(i)}function Ol(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var Qn=typeof Object.is=="function"?Object.is:Ol;function $s(s,i){if(Qn(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var d=Object.keys(s),g=Object.keys(i);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(i,v)||!Qn(s[v],i[v]))return!1}return!0}function ao(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function oo(s,i){var d=ao(s);s=0;for(var g;d;){if(d.nodeType===3){if(g=s+d.textContent.length,s<=i&&g>=i)return{node:d,offset:i-s};s=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=ao(d)}}function ju(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?ju(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Dr(){for(var s=window,i=Ve();i instanceof s.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)s=i.contentWindow;else break;i=Ve(s.document)}return i}function ai(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}function df(s){var i=Dr(),d=s.focusedElem,g=s.selectionRange;if(i!==d&&d&&d.ownerDocument&&ju(d.ownerDocument.documentElement,d)){if(g!==null&&ai(d)){if(i=g.start,s=g.end,s===void 0&&(s=i),"selectionStart"in d)d.selectionStart=i,d.selectionEnd=Math.min(s,d.value.length);else if(s=(i=d.ownerDocument||document)&&i.defaultView||window,s.getSelection){s=s.getSelection();var v=d.textContent.length,_=Math.min(g.start,v);g=g.end===void 0?_:Math.min(g.end,v),!s.extend&&_>g&&(v=g,g=_,_=v),v=oo(d,_);var R=oo(d,g);v&&R&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==R.node||s.focusOffset!==R.offset)&&(i=i.createRange(),i.setStart(v.node,v.offset),s.removeAllRanges(),_>g?(s.addRange(i),s.extend(R.node,R.offset)):(i.setEnd(R.node,R.offset),s.addRange(i)))}}for(i=[],s=d;s=s.parentNode;)s.nodeType===1&&i.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<i.length;d++)s=i[d],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var Eu=u&&"documentMode"in document&&11>=document.documentMode,Os=null,Ll=null,cs=null,Pl=!1;function oi(s,i,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Pl||Os==null||Os!==Ve(g)||(g=Os,"selectionStart"in g&&ai(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),cs&&$s(cs,g)||(cs=g,g=dr(Ll,"onSelect"),0<g.length&&(i=new ei("onSelect","select",null,i,d),s.push({event:i,listeners:g}),i.target=Os)))}function io(s,i){var d={};return d[s.toLowerCase()]=i.toLowerCase(),d["Webkit"+s]="webkit"+i,d["Moz"+s]="moz"+i,d}var Ls={animationend:io("Animation","AnimationEnd"),animationiteration:io("Animation","AnimationIteration"),animationstart:io("Animation","AnimationStart"),transitionend:io("Transition","TransitionEnd")},ii={},li={};u&&(li=document.createElement("div").style,"AnimationEvent"in window||(delete Ls.animationend.animation,delete Ls.animationiteration.animation,delete Ls.animationstart.animation),"TransitionEvent"in window||delete Ls.transitionend.transition);function Ps(s){if(ii[s])return ii[s];if(!Ls[s])return s;var i=Ls[s],d;for(d in i)if(i.hasOwnProperty(d)&&d in li)return ii[s]=i[d];return s}var ci=Ps("animationend"),Dl=Ps("animationiteration"),us=Ps("animationstart"),Tn=Ps("transitionend"),Cu=new Map,Tu="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 ds(s,i){Cu.set(s,i),l(i,[s])}for(var Fl=0;Fl<Tu.length;Fl++){var hs=Tu[Fl],ui=hs.toLowerCase(),ql=hs[0].toUpperCase()+hs.slice(1);ds(ui,"on"+ql)}ds(ci,"onAnimationEnd"),ds(Dl,"onAnimationIteration"),ds(us,"onAnimationStart"),ds("dblclick","onDoubleClick"),ds("focusin","onFocus"),ds("focusout","onBlur"),ds(Tn,"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 ur="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(" "),Au=new Set("cancel close invalid load scroll toggle".split(" ").concat(ur));function Bl(s,i,d){var g=s.type||"unknown-event";s.currentTarget=d,_s(g,i,void 0,s),s.currentTarget=null}function Zt(s,i){i=(i&4)!==0;for(var d=0;d<s.length;d++){var g=s[d],v=g.event;g=g.listeners;e:{var _=void 0;if(i)for(var R=g.length-1;0<=R;R--){var Z=g[R],ne=Z.instance,pe=Z.currentTarget;if(Z=Z.listener,ne!==_&&v.isPropagationStopped())break e;Bl(v,Z,pe),_=ne}else for(R=0;R<g.length;R++){if(Z=g[R],ne=Z.instance,pe=Z.currentTarget,Z=Z.listener,ne!==_&&v.isPropagationStopped())break e;Bl(v,Z,pe),_=ne}}}if(cr)throw s=$n,cr=!1,$n=null,s}function bt(s,i){var d=i[Ce];d===void 0&&(d=i[Ce]=new Set);var g=s+"__bubble";d.has(g)||(zl(i,s,2,!1),d.add(g))}function di(s,i,d){var g=0;i&&(g|=4),zl(d,s,g,i)}var hi="_reactListening"+Math.random().toString(36).slice(2);function lo(s){if(!s[hi]){s[hi]=!0,r.forEach(function(d){d!=="selectionchange"&&(Au.has(d)||di(d,!1,s),di(d,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[hi]||(i[hi]=!0,di("selectionchange",!1,i))}}function zl(s,i,d,g){switch(ca(i)){case 1:var v=Xo;break;case 4:v=wl;break;default:v=vl}d=v.bind(null,i,d,s),v=void 0,!Xt||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),g?v!==void 0?s.addEventListener(i,d,{capture:!0,passive:v}):s.addEventListener(i,d,!0):v!==void 0?s.addEventListener(i,d,{passive:v}):s.addEventListener(i,d,!1)}function pa(s,i,d,g,v){var _=g;if((i&1)===0&&(i&2)===0&&g!==null)e:for(;;){if(g===null)return;var R=g.tag;if(R===3||R===4){var Z=g.stateNode.containerInfo;if(Z===v||Z.nodeType===8&&Z.parentNode===v)break;if(R===4)for(R=g.return;R!==null;){var ne=R.tag;if((ne===3||ne===4)&&(ne=R.stateNode.containerInfo,ne===v||ne.nodeType===8&&ne.parentNode===v))return;R=R.return}for(;Z!==null;){if(R=ct(Z),R===null)return;if(ne=R.tag,ne===5||ne===6){g=_=R;continue e}Z=Z.parentNode}}g=g.return}lr(function(){var pe=_,Ne=jn(d),Se=[];e:{var be=Cu.get(s);if(be!==void 0){var $e=ei,Fe=s;switch(s){case"keypress":if(Jo(d)===0)break e;case"keydown":case"keyup":$e=Cl;break;case"focusin":Fe="focus",$e=Lr;break;case"focusout":Fe="blur",$e=Lr;break;case"beforeblur":case"afterblur":$e=Lr;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":$e=xl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=fu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=ti;break;case ci:case Dl:case us:$e=Dn;break;case Tn:$e=Tl;break;case"scroll":$e=Xn;break;case"wheel":$e=vu;break;case"copy":case"cut":case"paste":$e=Nl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=ha}var qe=(i&4)!==0,Ht=!qe&&s==="scroll",ie=qe?be!==null?be+"Capture":null:be;qe=[];for(var se=pe,ce;se!==null;){ce=se;var Ee=ce.stateNode;if(ce.tag===5&&Ee!==null&&(ce=Ee,ie!==null&&(Ee=yn(se,ie),Ee!=null&&qe.push(co(se,Ee,ce)))),Ht)break;se=se.return}0<qe.length&&(be=new $e(be,Fe,null,d,Ne),Se.push({event:be,listeners:qe}))}}if((i&7)===0){e:{if(be=s==="mouseover"||s==="pointerover",$e=s==="mouseout"||s==="pointerout",be&&d!==an&&(Fe=d.relatedTarget||d.fromElement)&&(ct(Fe)||Fe[we]))break e;if(($e||be)&&(be=Ne.window===Ne?Ne:(be=Ne.ownerDocument)?be.defaultView||be.parentWindow:window,$e?(Fe=d.relatedTarget||d.toElement,$e=pe,Fe=Fe?ct(Fe):null,Fe!==null&&(Ht=On(Fe),Fe!==Ht||Fe.tag!==5&&Fe.tag!==6)&&(Fe=null)):($e=null,Fe=pe),$e!==Fe)){if(qe=xl,Ee="onMouseLeave",ie="onMouseEnter",se="mouse",(s==="pointerout"||s==="pointerover")&&(qe=ha,Ee="onPointerLeave",ie="onPointerEnter",se="pointer"),Ht=$e==null?be:Pt($e),ce=Fe==null?be:Pt(Fe),be=new qe(Ee,se+"leave",$e,d,Ne),be.target=Ht,be.relatedTarget=ce,Ee=null,ct(Ne)===pe&&(qe=new qe(ie,se+"enter",Fe,d,Ne),qe.target=ce,qe.relatedTarget=Ht,Ee=qe),Ht=Ee,$e&&Fe)t:{for(qe=$e,ie=Fe,se=0,ce=qe;ce;ce=fs(ce))se++;for(ce=0,Ee=ie;Ee;Ee=fs(Ee))ce++;for(;0<se-ce;)qe=fs(qe),se--;for(;0<ce-se;)ie=fs(ie),ce--;for(;se--;){if(qe===ie||ie!==null&&qe===ie.alternate)break t;qe=fs(qe),ie=fs(ie)}qe=null}else qe=null;$e!==null&&uo(Se,be,$e,qe,!1),Fe!==null&&Ht!==null&&uo(Se,Ht,Fe,qe,!0)}}e:{if(be=pe?Pt(pe):window,$e=be.nodeName&&be.nodeName.toLowerCase(),$e==="select"||$e==="input"&&be.type==="file")var Be=so;else if(Nu(be))if(Ml)Be=Su;else{Be=uf;var Ye=cf}else($e=be.nodeName)&&$e.toLowerCase()==="input"&&(be.type==="checkbox"||be.type==="radio")&&(Be=xn);if(Be&&(Be=Be(s,pe))){to(Se,Be,d,Ne);break e}Ye&&Ye(s,be,pe),s==="focusout"&&(Ye=be._wrapperState)&&Ye.controlled&&be.type==="number"&&Ge(be,"number",be.value)}switch(Ye=pe?Pt(pe):window,s){case"focusin":(Nu(Ye)||Ye.contentEditable==="true")&&(Os=Ye,Ll=pe,cs=null);break;case"focusout":cs=Ll=Os=null;break;case"mousedown":Pl=!0;break;case"contextmenu":case"mouseup":case"dragend":Pl=!1,oi(Se,d,Ne);break;case"selectionchange":if(Eu)break;case"keydown":case"keyup":oi(Se,d,Ne)}var Xe;if(Al)e:{switch(s){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Fn?ni(s,d)&&(tt="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(tt="onCompositionStart");tt&&(Ja&&d.locale!=="ko"&&(Fn||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Fn&&(Xe=Ka()):(as=Ne,ua="value"in as?as.value:as.textContent,Fn=!0)),Ye=dr(pe,tt),0<Ye.length&&(tt=new Qa(tt,s,null,d,Ne),Se.push({event:tt,listeners:Ye}),Xe?tt.data=Xe:(Xe=ri(d),Xe!==null&&(tt.data=Xe)))),(Xe=bu?eo(s,d):ku(s,d))&&(pe=dr(pe,"onBeforeInput"),0<pe.length&&(Ne=new Qa("onBeforeInput","beforeinput",null,d,Ne),Se.push({event:Ne,listeners:pe}),Ne.data=Xe))}Zt(Se,i)})}function co(s,i,d){return{instance:s,listener:i,currentTarget:d}}function dr(s,i){for(var d=i+"Capture",g=[];s!==null;){var v=s,_=v.stateNode;v.tag===5&&_!==null&&(v=_,_=yn(s,d),_!=null&&g.unshift(co(s,_,v)),_=yn(s,i),_!=null&&g.push(co(s,_,v))),s=s.return}return g}function fs(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function uo(s,i,d,g,v){for(var _=i._reactName,R=[];d!==null&&d!==g;){var Z=d,ne=Z.alternate,pe=Z.stateNode;if(ne!==null&&ne===g)break;Z.tag===5&&pe!==null&&(Z=pe,v?(ne=yn(d,_),ne!=null&&R.unshift(co(d,ne,Z))):v||(ne=yn(d,_),ne!=null&&R.push(co(d,ne,Z)))),d=d.return}R.length!==0&&s.push({event:i,listeners:R})}var Hl=/\r\n?/g,hf=/\u0000|\uFFFD/g;function Ul(s){return(typeof s=="string"?s:""+s).replace(Hl,`
38
- `).replace(hf,"")}function ho(s,i,d){if(i=Ul(i),Ul(s)!==i&&d)throw Error(n(425))}function fi(){}var Wl=null,pi=null;function Ds(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var fo=typeof setTimeout=="function"?setTimeout:void 0,ff=typeof clearTimeout=="function"?clearTimeout:void 0,Vl=typeof Promise=="function"?Promise:void 0,Ru=typeof queueMicrotask=="function"?queueMicrotask:typeof Vl<"u"?function(s){return Vl.resolve(null).then(s).catch(Mu)}:fo;function Mu(s){setTimeout(function(){throw s})}function mi(s,i){var d=i,g=0;do{var v=d.nextSibling;if(s.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){s.removeChild(v),la(i);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);la(i)}function Fr(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return s}function D(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"){if(i===0)return s;i--}else d==="/$"&&i++}s=s.previousSibling}return null}var P=Math.random().toString(36).slice(2),re="__reactFiber$"+P,oe="__reactProps$"+P,we="__reactContainer$"+P,Ce="__reactEvents$"+P,Le="__reactListeners$"+P,et="__reactHandles$"+P;function ct(s){var i=s[re];if(i)return i;for(var d=s.parentNode;d;){if(i=d[we]||d[re]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(s=D(s);s!==null;){if(d=s[re])return d;s=D(s)}return i}s=d,d=s.parentNode}return null}function Ke(s){return s=s[re]||s[we],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Pt(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Dt(s){return s[oe]||null}var qr=[],hr=-1;function Jn(s){return{current:s}}function _t(s){0>hr||(s.current=qr[hr],qr[hr]=null,hr--)}function wt(s,i){hr++,qr[hr]=s.current,s.current=i}var fr={},on=Jn(fr),fn=Jn(!1),er=fr;function pr(s,i){var d=s.type.contextTypes;if(!d)return fr;var g=s.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===i)return g.__reactInternalMemoizedMaskedChildContext;var v={},_;for(_ in d)v[_]=i[_];return g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=i,s.__reactInternalMemoizedMaskedChildContext=v),v}function bn(s){return s=s.childContextTypes,s!=null}function At(){_t(fn),_t(on)}function Gl(s,i,d){if(on.current!==fr)throw Error(n(168));wt(on,i),wt(fn,d)}function xb(s,i,d){var g=s.stateNode;if(i=i.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in i))throw Error(n(108,te(s)||"Unknown",v));return G({},d,g)}function Iu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||fr,er=on.current,wt(on,s),wt(fn,fn.current),!0}function bb(s,i,d){var g=s.stateNode;if(!g)throw Error(n(169));d?(s=xb(s,i,er),g.__reactInternalMemoizedMergedChildContext=s,_t(fn),_t(on),wt(on,s)):_t(fn),wt(fn,d)}var Fs=null,$u=!1,pf=!1;function kb(s){Fs===null?Fs=[s]:Fs.push(s)}function UI(s){$u=!0,kb(s)}function ma(){if(!pf&&Fs!==null){pf=!0;var s=0,i=nt;try{var d=Fs;for(nt=1;s<d.length;s++){var g=d[s];do g=g(!0);while(g!==null)}Fs=null,$u=!1}catch(v){throw Fs!==null&&(Fs=Fs.slice(s+1)),ze(Ar,ma),v}finally{nt=i,pf=!1}}return null}var gi=[],yi=0,Ou=null,Lu=0,mr=[],gr=0,po=null,qs=1,Bs="";function mo(s,i){gi[yi++]=Lu,gi[yi++]=Ou,Ou=s,Lu=i}function Nb(s,i,d){mr[gr++]=qs,mr[gr++]=Bs,mr[gr++]=po,po=s;var g=qs;s=Bs;var v=32-Pn(g)-1;g&=~(1<<v),d+=1;var _=32-Pn(i)+v;if(30<_){var R=v-v%5;_=(g&(1<<R)-1).toString(32),g>>=R,v-=R,qs=1<<32-Pn(i)+v|d<<v|g,Bs=_+s}else qs=1<<_|d<<v|g,Bs=s}function mf(s){s.return!==null&&(mo(s,1),Nb(s,1,0))}function gf(s){for(;s===Ou;)Ou=gi[--yi],gi[yi]=null,Lu=gi[--yi],gi[yi]=null;for(;s===po;)po=mr[--gr],mr[gr]=null,Bs=mr[--gr],mr[gr]=null,qs=mr[--gr],mr[gr]=null}var tr=null,nr=null,Rt=!1,Br=null;function _b(s,i){var d=xr(5,null,null,0);d.elementType="DELETED",d.stateNode=i,d.return=s,i=s.deletions,i===null?(s.deletions=[d],s.flags|=16):i.push(d)}function Sb(s,i){switch(s.tag){case 5:var d=s.type;return i=i.nodeType!==1||d.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(s.stateNode=i,tr=s,nr=Fr(i.firstChild),!0):!1;case 6:return i=s.pendingProps===""||i.nodeType!==3?null:i,i!==null?(s.stateNode=i,tr=s,nr=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=po!==null?{id:qs,overflow:Bs}:null,s.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=xr(18,null,null,0),d.stateNode=i,d.return=s,s.child=d,tr=s,nr=null,!0):!1;default:return!1}}function yf(s){return(s.mode&1)!==0&&(s.flags&128)===0}function wf(s){if(Rt){var i=nr;if(i){var d=i;if(!Sb(s,i)){if(yf(s))throw Error(n(418));i=Fr(d.nextSibling);var g=tr;i&&Sb(s,i)?_b(g,d):(s.flags=s.flags&-4097|2,Rt=!1,tr=s)}}else{if(yf(s))throw Error(n(418));s.flags=s.flags&-4097|2,Rt=!1,tr=s}}}function jb(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;tr=s}function Pu(s){if(s!==tr)return!1;if(!Rt)return jb(s),Rt=!0,!1;var i;if((i=s.tag!==3)&&!(i=s.tag!==5)&&(i=s.type,i=i!=="head"&&i!=="body"&&!Ds(s.type,s.memoizedProps)),i&&(i=nr)){if(yf(s))throw Eb(),Error(n(418));for(;i;)_b(s,i),i=Fr(i.nextSibling)}if(jb(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,i=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"){if(i===0){nr=Fr(s.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}s=s.nextSibling}nr=null}}else nr=tr?Fr(s.stateNode.nextSibling):null;return!0}function Eb(){for(var s=nr;s;)s=Fr(s.nextSibling)}function wi(){nr=tr=null,Rt=!1}function vf(s){Br===null?Br=[s]:Br.push(s)}var WI=C.ReactCurrentBatchConfig;function Kl(s,i,d){if(s=d.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,s));var v=g,_=""+s;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===_?i.ref:(i=function(R){var Z=v.refs;R===null?delete Z[_]:Z[_]=R},i._stringRef=_,i)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function Du(s,i){throw s=Object.prototype.toString.call(i),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s))}function Cb(s){var i=s._init;return i(s._payload)}function Tb(s){function i(ie,se){if(s){var ce=ie.deletions;ce===null?(ie.deletions=[se],ie.flags|=16):ce.push(se)}}function d(ie,se){if(!s)return null;for(;se!==null;)i(ie,se),se=se.sibling;return null}function g(ie,se){for(ie=new Map;se!==null;)se.key!==null?ie.set(se.key,se):ie.set(se.index,se),se=se.sibling;return ie}function v(ie,se){return ie=Na(ie,se),ie.index=0,ie.sibling=null,ie}function _(ie,se,ce){return ie.index=ce,s?(ce=ie.alternate,ce!==null?(ce=ce.index,ce<se?(ie.flags|=2,se):ce):(ie.flags|=2,se)):(ie.flags|=1048576,se)}function R(ie){return s&&ie.alternate===null&&(ie.flags|=2),ie}function Z(ie,se,ce,Ee){return se===null||se.tag!==6?(se=up(ce,ie.mode,Ee),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function ne(ie,se,ce,Ee){var Be=ce.type;return Be===I?Ne(ie,se,ce.props.children,Ee,ce.key):se!==null&&(se.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===V&&Cb(Be)===se.type)?(Ee=v(se,ce.props),Ee.ref=Kl(ie,se,ce),Ee.return=ie,Ee):(Ee=ld(ce.type,ce.key,ce.props,null,ie.mode,Ee),Ee.ref=Kl(ie,se,ce),Ee.return=ie,Ee)}function pe(ie,se,ce,Ee){return se===null||se.tag!==4||se.stateNode.containerInfo!==ce.containerInfo||se.stateNode.implementation!==ce.implementation?(se=dp(ce,ie.mode,Ee),se.return=ie,se):(se=v(se,ce.children||[]),se.return=ie,se)}function Ne(ie,se,ce,Ee,Be){return se===null||se.tag!==7?(se=No(ce,ie.mode,Ee,Be),se.return=ie,se):(se=v(se,ce),se.return=ie,se)}function Se(ie,se,ce){if(typeof se=="string"&&se!==""||typeof se=="number")return se=up(""+se,ie.mode,ce),se.return=ie,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case T:return ce=ld(se.type,se.key,se.props,null,ie.mode,ce),ce.ref=Kl(ie,null,se),ce.return=ie,ce;case A:return se=dp(se,ie.mode,ce),se.return=ie,se;case V:var Ee=se._init;return Se(ie,Ee(se._payload),ce)}if(rt(se)||W(se))return se=No(se,ie.mode,ce,null),se.return=ie,se;Du(ie,se)}return null}function be(ie,se,ce,Ee){var Be=se!==null?se.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Be!==null?null:Z(ie,se,""+ce,Ee);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:return ce.key===Be?ne(ie,se,ce,Ee):null;case A:return ce.key===Be?pe(ie,se,ce,Ee):null;case V:return Be=ce._init,be(ie,se,Be(ce._payload),Ee)}if(rt(ce)||W(ce))return Be!==null?null:Ne(ie,se,ce,Ee,null);Du(ie,ce)}return null}function $e(ie,se,ce,Ee,Be){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return ie=ie.get(ce)||null,Z(se,ie,""+Ee,Be);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:return ie=ie.get(Ee.key===null?ce:Ee.key)||null,ne(se,ie,Ee,Be);case A:return ie=ie.get(Ee.key===null?ce:Ee.key)||null,pe(se,ie,Ee,Be);case V:var Ye=Ee._init;return $e(ie,se,ce,Ye(Ee._payload),Be)}if(rt(Ee)||W(Ee))return ie=ie.get(ce)||null,Ne(se,ie,Ee,Be,null);Du(se,Ee)}return null}function Fe(ie,se,ce,Ee){for(var Be=null,Ye=null,Xe=se,tt=se=0,un=null;Xe!==null&&tt<ce.length;tt++){Xe.index>tt?(un=Xe,Xe=null):un=Xe.sibling;var ft=be(ie,Xe,ce[tt],Ee);if(ft===null){Xe===null&&(Xe=un);break}s&&Xe&&ft.alternate===null&&i(ie,Xe),se=_(ft,se,tt),Ye===null?Be=ft:Ye.sibling=ft,Ye=ft,Xe=un}if(tt===ce.length)return d(ie,Xe),Rt&&mo(ie,tt),Be;if(Xe===null){for(;tt<ce.length;tt++)Xe=Se(ie,ce[tt],Ee),Xe!==null&&(se=_(Xe,se,tt),Ye===null?Be=Xe:Ye.sibling=Xe,Ye=Xe);return Rt&&mo(ie,tt),Be}for(Xe=g(ie,Xe);tt<ce.length;tt++)un=$e(Xe,ie,tt,ce[tt],Ee),un!==null&&(s&&un.alternate!==null&&Xe.delete(un.key===null?tt:un.key),se=_(un,se,tt),Ye===null?Be=un:Ye.sibling=un,Ye=un);return s&&Xe.forEach(function(_a){return i(ie,_a)}),Rt&&mo(ie,tt),Be}function qe(ie,se,ce,Ee){var Be=W(ce);if(typeof Be!="function")throw Error(n(150));if(ce=Be.call(ce),ce==null)throw Error(n(151));for(var Ye=Be=null,Xe=se,tt=se=0,un=null,ft=ce.next();Xe!==null&&!ft.done;tt++,ft=ce.next()){Xe.index>tt?(un=Xe,Xe=null):un=Xe.sibling;var _a=be(ie,Xe,ft.value,Ee);if(_a===null){Xe===null&&(Xe=un);break}s&&Xe&&_a.alternate===null&&i(ie,Xe),se=_(_a,se,tt),Ye===null?Be=_a:Ye.sibling=_a,Ye=_a,Xe=un}if(ft.done)return d(ie,Xe),Rt&&mo(ie,tt),Be;if(Xe===null){for(;!ft.done;tt++,ft=ce.next())ft=Se(ie,ft.value,Ee),ft!==null&&(se=_(ft,se,tt),Ye===null?Be=ft:Ye.sibling=ft,Ye=ft);return Rt&&mo(ie,tt),Be}for(Xe=g(ie,Xe);!ft.done;tt++,ft=ce.next())ft=$e(Xe,ie,tt,ft.value,Ee),ft!==null&&(s&&ft.alternate!==null&&Xe.delete(ft.key===null?tt:ft.key),se=_(ft,se,tt),Ye===null?Be=ft:Ye.sibling=ft,Ye=ft);return s&&Xe.forEach(function(_$){return i(ie,_$)}),Rt&&mo(ie,tt),Be}function Ht(ie,se,ce,Ee){if(typeof ce=="object"&&ce!==null&&ce.type===I&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case T:e:{for(var Be=ce.key,Ye=se;Ye!==null;){if(Ye.key===Be){if(Be=ce.type,Be===I){if(Ye.tag===7){d(ie,Ye.sibling),se=v(Ye,ce.props.children),se.return=ie,ie=se;break e}}else if(Ye.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===V&&Cb(Be)===Ye.type){d(ie,Ye.sibling),se=v(Ye,ce.props),se.ref=Kl(ie,Ye,ce),se.return=ie,ie=se;break e}d(ie,Ye);break}else i(ie,Ye);Ye=Ye.sibling}ce.type===I?(se=No(ce.props.children,ie.mode,Ee,ce.key),se.return=ie,ie=se):(Ee=ld(ce.type,ce.key,ce.props,null,ie.mode,Ee),Ee.ref=Kl(ie,se,ce),Ee.return=ie,ie=Ee)}return R(ie);case A:e:{for(Ye=ce.key;se!==null;){if(se.key===Ye)if(se.tag===4&&se.stateNode.containerInfo===ce.containerInfo&&se.stateNode.implementation===ce.implementation){d(ie,se.sibling),se=v(se,ce.children||[]),se.return=ie,ie=se;break e}else{d(ie,se);break}else i(ie,se);se=se.sibling}se=dp(ce,ie.mode,Ee),se.return=ie,ie=se}return R(ie);case V:return Ye=ce._init,Ht(ie,se,Ye(ce._payload),Ee)}if(rt(ce))return Fe(ie,se,ce,Ee);if(W(ce))return qe(ie,se,ce,Ee);Du(ie,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,se!==null&&se.tag===6?(d(ie,se.sibling),se=v(se,ce),se.return=ie,ie=se):(d(ie,se),se=up(ce,ie.mode,Ee),se.return=ie,ie=se),R(ie)):d(ie,se)}return Ht}var vi=Tb(!0),Ab=Tb(!1),Fu=Jn(null),qu=null,xi=null,xf=null;function bf(){xf=xi=qu=null}function kf(s){var i=Fu.current;_t(Fu),s._currentValue=i}function Nf(s,i,d){for(;s!==null;){var g=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,g!==null&&(g.childLanes|=i)):g!==null&&(g.childLanes&i)!==i&&(g.childLanes|=i),s===d)break;s=s.return}}function bi(s,i){qu=s,xf=xi=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&i)!==0&&(qn=!0),s.firstContext=null)}function yr(s){var i=s._currentValue;if(xf!==s)if(s={context:s,memoizedValue:i,next:null},xi===null){if(qu===null)throw Error(n(308));xi=s,qu.dependencies={lanes:0,firstContext:s}}else xi=xi.next=s;return i}var go=null;function _f(s){go===null?go=[s]:go.push(s)}function Rb(s,i,d,g){var v=i.interleaved;return v===null?(d.next=d,_f(i)):(d.next=v.next,v.next=d),i.interleaved=d,zs(s,g)}function zs(s,i){s.lanes|=i;var d=s.alternate;for(d!==null&&(d.lanes|=i),d=s,s=s.return;s!==null;)s.childLanes|=i,d=s.alternate,d!==null&&(d.childLanes|=i),d=s,s=s.return;return d.tag===3?d.stateNode:null}var ga=!1;function Sf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mb(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Hs(s,i){return{eventTime:s,lane:i,tag:0,payload:null,callback:null,next:null}}function ya(s,i,d){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(ht&2)!==0){var v=g.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),g.pending=i,zs(s,d)}return v=g.interleaved,v===null?(i.next=i,_f(g)):(i.next=v.next,v.next=i),g.interleaved=i,zs(s,d)}function Bu(s,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194240)!==0)){var g=i.lanes;g&=s.pendingLanes,d|=g,i.lanes=d,Yo(s,d)}}function Ib(s,i){var d=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,_=null;if(d=d.firstBaseUpdate,d!==null){do{var R={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};_===null?v=_=R:_=_.next=R,d=d.next}while(d!==null);_===null?v=_=i:_=_.next=i}else v=_=i;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:_,shared:g.shared,effects:g.effects},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=i:s.next=i,d.lastBaseUpdate=i}function zu(s,i,d,g){var v=s.updateQueue;ga=!1;var _=v.firstBaseUpdate,R=v.lastBaseUpdate,Z=v.shared.pending;if(Z!==null){v.shared.pending=null;var ne=Z,pe=ne.next;ne.next=null,R===null?_=pe:R.next=pe,R=ne;var Ne=s.alternate;Ne!==null&&(Ne=Ne.updateQueue,Z=Ne.lastBaseUpdate,Z!==R&&(Z===null?Ne.firstBaseUpdate=pe:Z.next=pe,Ne.lastBaseUpdate=ne))}if(_!==null){var Se=v.baseState;R=0,Ne=pe=ne=null,Z=_;do{var be=Z.lane,$e=Z.eventTime;if((g&be)===be){Ne!==null&&(Ne=Ne.next={eventTime:$e,lane:0,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null});e:{var Fe=s,qe=Z;switch(be=i,$e=d,qe.tag){case 1:if(Fe=qe.payload,typeof Fe=="function"){Se=Fe.call($e,Se,be);break e}Se=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=qe.payload,be=typeof Fe=="function"?Fe.call($e,Se,be):Fe,be==null)break e;Se=G({},Se,be);break e;case 2:ga=!0}}Z.callback!==null&&Z.lane!==0&&(s.flags|=64,be=v.effects,be===null?v.effects=[Z]:be.push(Z))}else $e={eventTime:$e,lane:be,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},Ne===null?(pe=Ne=$e,ne=Se):Ne=Ne.next=$e,R|=be;if(Z=Z.next,Z===null){if(Z=v.shared.pending,Z===null)break;be=Z,Z=be.next,be.next=null,v.lastBaseUpdate=be,v.shared.pending=null}}while(!0);if(Ne===null&&(ne=Se),v.baseState=ne,v.firstBaseUpdate=pe,v.lastBaseUpdate=Ne,i=v.shared.interleaved,i!==null){v=i;do R|=v.lane,v=v.next;while(v!==i)}else _===null&&(v.shared.lanes=0);vo|=R,s.lanes=R,s.memoizedState=Se}}function $b(s,i,d){if(s=i.effects,i.effects=null,s!==null)for(i=0;i<s.length;i++){var g=s[i],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var Yl={},ps=Jn(Yl),Xl=Jn(Yl),Zl=Jn(Yl);function yo(s){if(s===Yl)throw Error(n(174));return s}function jf(s,i){switch(wt(Zl,i),wt(Xl,s),wt(ps,Yl),s=i.nodeType,s){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Je(null,"");break;default:s=s===8?i.parentNode:i,i=s.namespaceURI||null,s=s.tagName,i=Je(i,s)}_t(ps),wt(ps,i)}function ki(){_t(ps),_t(Xl),_t(Zl)}function Ob(s){yo(Zl.current);var i=yo(ps.current),d=Je(i,s.type);i!==d&&(wt(Xl,s),wt(ps,d))}function Ef(s){Xl.current===s&&(_t(ps),_t(Xl))}var Ot=Jn(0);function Hu(s){for(var i=s;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Cf=[];function Tf(){for(var s=0;s<Cf.length;s++)Cf[s]._workInProgressVersionPrimary=null;Cf.length=0}var Uu=C.ReactCurrentDispatcher,Af=C.ReactCurrentBatchConfig,wo=0,Lt=null,Qt=null,ln=null,Wu=!1,Ql=!1,Jl=0,VI=0;function kn(){throw Error(n(321))}function Rf(s,i){if(i===null)return!1;for(var d=0;d<i.length&&d<s.length;d++)if(!Qn(s[d],i[d]))return!1;return!0}function Mf(s,i,d,g,v,_){if(wo=_,Lt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Uu.current=s===null||s.memoizedState===null?XI:ZI,s=d(g,v),Ql){_=0;do{if(Ql=!1,Jl=0,25<=_)throw Error(n(301));_+=1,ln=Qt=null,i.updateQueue=null,Uu.current=QI,s=d(g,v)}while(Ql)}if(Uu.current=Ku,i=Qt!==null&&Qt.next!==null,wo=0,ln=Qt=Lt=null,Wu=!1,i)throw Error(n(300));return s}function If(){var s=Jl!==0;return Jl=0,s}function ms(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Lt.memoizedState=ln=s:ln=ln.next=s,ln}function wr(){if(Qt===null){var s=Lt.alternate;s=s!==null?s.memoizedState:null}else s=Qt.next;var i=ln===null?Lt.memoizedState:ln.next;if(i!==null)ln=i,Qt=s;else{if(s===null)throw Error(n(310));Qt=s,s={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},ln===null?Lt.memoizedState=ln=s:ln=ln.next=s}return ln}function ec(s,i){return typeof i=="function"?i(s):i}function $f(s){var i=wr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=Qt,v=g.baseQueue,_=d.pending;if(_!==null){if(v!==null){var R=v.next;v.next=_.next,_.next=R}g.baseQueue=v=_,d.pending=null}if(v!==null){_=v.next,g=g.baseState;var Z=R=null,ne=null,pe=_;do{var Ne=pe.lane;if((wo&Ne)===Ne)ne!==null&&(ne=ne.next={lane:0,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),g=pe.hasEagerState?pe.eagerState:s(g,pe.action);else{var Se={lane:Ne,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null};ne===null?(Z=ne=Se,R=g):ne=ne.next=Se,Lt.lanes|=Ne,vo|=Ne}pe=pe.next}while(pe!==null&&pe!==_);ne===null?R=g:ne.next=Z,Qn(g,i.memoizedState)||(qn=!0),i.memoizedState=g,i.baseState=R,i.baseQueue=ne,d.lastRenderedState=g}if(s=d.interleaved,s!==null){v=s;do _=v.lane,Lt.lanes|=_,vo|=_,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function Of(s){var i=wr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=d.dispatch,v=d.pending,_=i.memoizedState;if(v!==null){d.pending=null;var R=v=v.next;do _=s(_,R.action),R=R.next;while(R!==v);Qn(_,i.memoizedState)||(qn=!0),i.memoizedState=_,i.baseQueue===null&&(i.baseState=_),d.lastRenderedState=_}return[_,g]}function Lb(){}function Pb(s,i){var d=Lt,g=wr(),v=i(),_=!Qn(g.memoizedState,v);if(_&&(g.memoizedState=v,qn=!0),g=g.queue,Lf(qb.bind(null,d,g,s),[s]),g.getSnapshot!==i||_||ln!==null&&ln.memoizedState.tag&1){if(d.flags|=2048,tc(9,Fb.bind(null,d,g,v,i),void 0,null),cn===null)throw Error(n(349));(wo&30)!==0||Db(d,i,v)}return v}function Db(s,i,d){s.flags|=16384,s={getSnapshot:i,value:d},i=Lt.updateQueue,i===null?(i={lastEffect:null,stores:null},Lt.updateQueue=i,i.stores=[s]):(d=i.stores,d===null?i.stores=[s]:d.push(s))}function Fb(s,i,d,g){i.value=d,i.getSnapshot=g,Bb(i)&&zb(s)}function qb(s,i,d){return d(function(){Bb(i)&&zb(s)})}function Bb(s){var i=s.getSnapshot;s=s.value;try{var d=i();return!Qn(s,d)}catch{return!0}}function zb(s){var i=zs(s,1);i!==null&&Wr(i,s,1,-1)}function Hb(s){var i=ms();return typeof s=="function"&&(s=s()),i.memoizedState=i.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ec,lastRenderedState:s},i.queue=s,s=s.dispatch=YI.bind(null,Lt,s),[i.memoizedState,s]}function tc(s,i,d,g){return s={tag:s,create:i,destroy:d,deps:g,next:null},i=Lt.updateQueue,i===null?(i={lastEffect:null,stores:null},Lt.updateQueue=i,i.lastEffect=s.next=s):(d=i.lastEffect,d===null?i.lastEffect=s.next=s:(g=d.next,d.next=s,s.next=g,i.lastEffect=s)),s}function Ub(){return wr().memoizedState}function Vu(s,i,d,g){var v=ms();Lt.flags|=s,v.memoizedState=tc(1|i,d,void 0,g===void 0?null:g)}function Gu(s,i,d,g){var v=wr();g=g===void 0?null:g;var _=void 0;if(Qt!==null){var R=Qt.memoizedState;if(_=R.destroy,g!==null&&Rf(g,R.deps)){v.memoizedState=tc(i,d,_,g);return}}Lt.flags|=s,v.memoizedState=tc(1|i,d,_,g)}function Wb(s,i){return Vu(8390656,8,s,i)}function Lf(s,i){return Gu(2048,8,s,i)}function Vb(s,i){return Gu(4,2,s,i)}function Gb(s,i){return Gu(4,4,s,i)}function Kb(s,i){if(typeof i=="function")return s=s(),i(s),function(){i(null)};if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function Yb(s,i,d){return d=d!=null?d.concat([s]):null,Gu(4,4,Kb.bind(null,i,s),d)}function Pf(){}function Xb(s,i){var d=wr();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&Rf(i,g[1])?g[0]:(d.memoizedState=[s,i],s)}function Zb(s,i){var d=wr();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&Rf(i,g[1])?g[0]:(s=s(),d.memoizedState=[s,i],s)}function Qb(s,i,d){return(wo&21)===0?(s.baseState&&(s.baseState=!1,qn=!0),s.memoizedState=d):(Qn(d,i)||(d=ou(),Lt.lanes|=d,vo|=d,s.baseState=!0),i)}function GI(s,i){var d=nt;nt=d!==0&&4>d?d:4,s(!0);var g=Af.transition;Af.transition={};try{s(!1),i()}finally{nt=d,Af.transition=g}}function Jb(){return wr().memoizedState}function KI(s,i,d){var g=ba(s);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},ek(s))tk(i,d);else if(d=Rb(s,i,d,g),d!==null){var v=Rn();Wr(d,s,g,v),nk(d,i,g)}}function YI(s,i,d){var g=ba(s),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(ek(s))tk(i,v);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=i.lastRenderedReducer,_!==null))try{var R=i.lastRenderedState,Z=_(R,d);if(v.hasEagerState=!0,v.eagerState=Z,Qn(Z,R)){var ne=i.interleaved;ne===null?(v.next=v,_f(i)):(v.next=ne.next,ne.next=v),i.interleaved=v;return}}catch{}finally{}d=Rb(s,i,v,g),d!==null&&(v=Rn(),Wr(d,s,g,v),nk(d,i,g))}}function ek(s){var i=s.alternate;return s===Lt||i!==null&&i===Lt}function tk(s,i){Ql=Wu=!0;var d=s.pending;d===null?i.next=i:(i.next=d.next,d.next=i),s.pending=i}function nk(s,i,d){if((d&4194240)!==0){var g=i.lanes;g&=s.pendingLanes,d|=g,i.lanes=d,Yo(s,d)}}var Ku={readContext:yr,useCallback:kn,useContext:kn,useEffect:kn,useImperativeHandle:kn,useInsertionEffect:kn,useLayoutEffect:kn,useMemo:kn,useReducer:kn,useRef:kn,useState:kn,useDebugValue:kn,useDeferredValue:kn,useTransition:kn,useMutableSource:kn,useSyncExternalStore:kn,useId:kn,unstable_isNewReconciler:!1},XI={readContext:yr,useCallback:function(s,i){return ms().memoizedState=[s,i===void 0?null:i],s},useContext:yr,useEffect:Wb,useImperativeHandle:function(s,i,d){return d=d!=null?d.concat([s]):null,Vu(4194308,4,Kb.bind(null,i,s),d)},useLayoutEffect:function(s,i){return Vu(4194308,4,s,i)},useInsertionEffect:function(s,i){return Vu(4,2,s,i)},useMemo:function(s,i){var d=ms();return i=i===void 0?null:i,s=s(),d.memoizedState=[s,i],s},useReducer:function(s,i,d){var g=ms();return i=d!==void 0?d(i):i,g.memoizedState=g.baseState=i,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:i},g.queue=s,s=s.dispatch=KI.bind(null,Lt,s),[g.memoizedState,s]},useRef:function(s){var i=ms();return s={current:s},i.memoizedState=s},useState:Hb,useDebugValue:Pf,useDeferredValue:function(s){return ms().memoizedState=s},useTransition:function(){var s=Hb(!1),i=s[0];return s=GI.bind(null,s[1]),ms().memoizedState=s,[i,s]},useMutableSource:function(){},useSyncExternalStore:function(s,i,d){var g=Lt,v=ms();if(Rt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),cn===null)throw Error(n(349));(wo&30)!==0||Db(g,i,d)}v.memoizedState=d;var _={value:d,getSnapshot:i};return v.queue=_,Wb(qb.bind(null,g,_,s),[s]),g.flags|=2048,tc(9,Fb.bind(null,g,_,d,i),void 0,null),d},useId:function(){var s=ms(),i=cn.identifierPrefix;if(Rt){var d=Bs,g=qs;d=(g&~(1<<32-Pn(g)-1)).toString(32)+d,i=":"+i+"R"+d,d=Jl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=VI++,i=":"+i+"r"+d.toString(32)+":";return s.memoizedState=i},unstable_isNewReconciler:!1},ZI={readContext:yr,useCallback:Xb,useContext:yr,useEffect:Lf,useImperativeHandle:Yb,useInsertionEffect:Vb,useLayoutEffect:Gb,useMemo:Zb,useReducer:$f,useRef:Ub,useState:function(){return $f(ec)},useDebugValue:Pf,useDeferredValue:function(s){var i=wr();return Qb(i,Qt.memoizedState,s)},useTransition:function(){var s=$f(ec)[0],i=wr().memoizedState;return[s,i]},useMutableSource:Lb,useSyncExternalStore:Pb,useId:Jb,unstable_isNewReconciler:!1},QI={readContext:yr,useCallback:Xb,useContext:yr,useEffect:Lf,useImperativeHandle:Yb,useInsertionEffect:Vb,useLayoutEffect:Gb,useMemo:Zb,useReducer:Of,useRef:Ub,useState:function(){return Of(ec)},useDebugValue:Pf,useDeferredValue:function(s){var i=wr();return Qt===null?i.memoizedState=s:Qb(i,Qt.memoizedState,s)},useTransition:function(){var s=Of(ec)[0],i=wr().memoizedState;return[s,i]},useMutableSource:Lb,useSyncExternalStore:Pb,useId:Jb,unstable_isNewReconciler:!1};function zr(s,i){if(s&&s.defaultProps){i=G({},i),s=s.defaultProps;for(var d in s)i[d]===void 0&&(i[d]=s[d]);return i}return i}function Df(s,i,d,g){i=s.memoizedState,d=d(g,i),d=d==null?i:G({},i,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Yu={isMounted:function(s){return(s=s._reactInternals)?On(s)===s:!1},enqueueSetState:function(s,i,d){s=s._reactInternals;var g=Rn(),v=ba(s),_=Hs(g,v);_.payload=i,d!=null&&(_.callback=d),i=ya(s,_,v),i!==null&&(Wr(i,s,v,g),Bu(i,s,v))},enqueueReplaceState:function(s,i,d){s=s._reactInternals;var g=Rn(),v=ba(s),_=Hs(g,v);_.tag=1,_.payload=i,d!=null&&(_.callback=d),i=ya(s,_,v),i!==null&&(Wr(i,s,v,g),Bu(i,s,v))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var d=Rn(),g=ba(s),v=Hs(d,g);v.tag=2,i!=null&&(v.callback=i),i=ya(s,v,g),i!==null&&(Wr(i,s,g,d),Bu(i,s,g))}};function rk(s,i,d,g,v,_,R){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,_,R):i.prototype&&i.prototype.isPureReactComponent?!$s(d,g)||!$s(v,_):!0}function sk(s,i,d){var g=!1,v=fr,_=i.contextType;return typeof _=="object"&&_!==null?_=yr(_):(v=bn(i)?er:on.current,g=i.contextTypes,_=(g=g!=null)?pr(s,v):fr),i=new i(d,_),s.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Yu,s.stateNode=i,i._reactInternals=s,g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=_),i}function ak(s,i,d,g){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,g),i.state!==s&&Yu.enqueueReplaceState(i,i.state,null)}function Ff(s,i,d,g){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},Sf(s);var _=i.contextType;typeof _=="object"&&_!==null?v.context=yr(_):(_=bn(i)?er:on.current,v.context=pr(s,_)),v.state=s.memoizedState,_=i.getDerivedStateFromProps,typeof _=="function"&&(Df(s,i,_,d),v.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(i=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),i!==v.state&&Yu.enqueueReplaceState(v,v.state,null),zu(s,d,v,g),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function Ni(s,i){try{var d="",g=i;do d+=Q(g),g=g.return;while(g);var v=d}catch(_){v=`
39
- Error generating stack: `+_.message+`
40
- `+_.stack}return{value:s,source:i,stack:v,digest:null}}function qf(s,i,d){return{value:s,source:null,stack:d??null,digest:i??null}}function Bf(s,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var JI=typeof WeakMap=="function"?WeakMap:Map;function ok(s,i,d){d=Hs(-1,d),d.tag=3,d.payload={element:null};var g=i.value;return d.callback=function(){nd||(nd=!0,np=g),Bf(s,i)},d}function ik(s,i,d){d=Hs(-1,d),d.tag=3;var g=s.type.getDerivedStateFromError;if(typeof g=="function"){var v=i.value;d.payload=function(){return g(v)},d.callback=function(){Bf(s,i)}}var _=s.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(d.callback=function(){Bf(s,i),typeof g!="function"&&(va===null?va=new Set([this]):va.add(this));var R=i.stack;this.componentDidCatch(i.value,{componentStack:R!==null?R:""})}),d}function lk(s,i,d){var g=s.pingCache;if(g===null){g=s.pingCache=new JI;var v=new Set;g.set(i,v)}else v=g.get(i),v===void 0&&(v=new Set,g.set(i,v));v.has(d)||(v.add(d),s=f$.bind(null,s,i,d),i.then(s,s))}function ck(s){do{var i;if((i=s.tag===13)&&(i=s.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return s;s=s.return}while(s!==null);return null}function uk(s,i,d,g,v){return(s.mode&1)===0?(s===i?s.flags|=65536:(s.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=Hs(-1,1),i.tag=2,ya(d,i,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var e$=C.ReactCurrentOwner,qn=!1;function An(s,i,d,g){i.child=s===null?Ab(i,null,d,g):vi(i,s.child,d,g)}function dk(s,i,d,g,v){d=d.render;var _=i.ref;return bi(i,v),g=Mf(s,i,d,g,_,v),d=If(),s!==null&&!qn?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~v,Us(s,i,v)):(Rt&&d&&mf(i),i.flags|=1,An(s,i,g,v),i.child)}function hk(s,i,d,g,v){if(s===null){var _=d.type;return typeof _=="function"&&!cp(_)&&_.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=_,fk(s,i,_,g,v)):(s=ld(d.type,null,g,i,i.mode,v),s.ref=i.ref,s.return=i,i.child=s)}if(_=s.child,(s.lanes&v)===0){var R=_.memoizedProps;if(d=d.compare,d=d!==null?d:$s,d(R,g)&&s.ref===i.ref)return Us(s,i,v)}return i.flags|=1,s=Na(_,g),s.ref=i.ref,s.return=i,i.child=s}function fk(s,i,d,g,v){if(s!==null){var _=s.memoizedProps;if($s(_,g)&&s.ref===i.ref)if(qn=!1,i.pendingProps=g=_,(s.lanes&v)!==0)(s.flags&131072)!==0&&(qn=!0);else return i.lanes=s.lanes,Us(s,i,v)}return zf(s,i,d,g,v)}function pk(s,i,d){var g=i.pendingProps,v=g.children,_=s!==null?s.memoizedState:null;if(g.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(Si,rr),rr|=d;else{if((d&1073741824)===0)return s=_!==null?_.baseLanes|d:d,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:s,cachePool:null,transitions:null},i.updateQueue=null,wt(Si,rr),rr|=s,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=_!==null?_.baseLanes:d,wt(Si,rr),rr|=g}else _!==null?(g=_.baseLanes|d,i.memoizedState=null):g=d,wt(Si,rr),rr|=g;return An(s,i,v,d),i.child}function mk(s,i){var d=i.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function zf(s,i,d,g,v){var _=bn(d)?er:on.current;return _=pr(i,_),bi(i,v),d=Mf(s,i,d,g,_,v),g=If(),s!==null&&!qn?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~v,Us(s,i,v)):(Rt&&g&&mf(i),i.flags|=1,An(s,i,d,v),i.child)}function gk(s,i,d,g,v){if(bn(d)){var _=!0;Iu(i)}else _=!1;if(bi(i,v),i.stateNode===null)Zu(s,i),sk(i,d,g),Ff(i,d,g,v),g=!0;else if(s===null){var R=i.stateNode,Z=i.memoizedProps;R.props=Z;var ne=R.context,pe=d.contextType;typeof pe=="object"&&pe!==null?pe=yr(pe):(pe=bn(d)?er:on.current,pe=pr(i,pe));var Ne=d.getDerivedStateFromProps,Se=typeof Ne=="function"||typeof R.getSnapshotBeforeUpdate=="function";Se||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(Z!==g||ne!==pe)&&ak(i,R,g,pe),ga=!1;var be=i.memoizedState;R.state=be,zu(i,g,R,v),ne=i.memoizedState,Z!==g||be!==ne||fn.current||ga?(typeof Ne=="function"&&(Df(i,d,Ne,g),ne=i.memoizedState),(Z=ga||rk(i,d,Z,g,be,ne,pe))?(Se||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(i.flags|=4194308)):(typeof R.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=g,i.memoizedState=ne),R.props=g,R.state=ne,R.context=pe,g=Z):(typeof R.componentDidMount=="function"&&(i.flags|=4194308),g=!1)}else{R=i.stateNode,Mb(s,i),Z=i.memoizedProps,pe=i.type===i.elementType?Z:zr(i.type,Z),R.props=pe,Se=i.pendingProps,be=R.context,ne=d.contextType,typeof ne=="object"&&ne!==null?ne=yr(ne):(ne=bn(d)?er:on.current,ne=pr(i,ne));var $e=d.getDerivedStateFromProps;(Ne=typeof $e=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(Z!==Se||be!==ne)&&ak(i,R,g,ne),ga=!1,be=i.memoizedState,R.state=be,zu(i,g,R,v);var Fe=i.memoizedState;Z!==Se||be!==Fe||fn.current||ga?(typeof $e=="function"&&(Df(i,d,$e,g),Fe=i.memoizedState),(pe=ga||rk(i,d,pe,g,be,Fe,ne)||!1)?(Ne||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(g,Fe,ne),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(g,Fe,ne)),typeof R.componentDidUpdate=="function"&&(i.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof R.componentDidUpdate!="function"||Z===s.memoizedProps&&be===s.memoizedState||(i.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||Z===s.memoizedProps&&be===s.memoizedState||(i.flags|=1024),i.memoizedProps=g,i.memoizedState=Fe),R.props=g,R.state=Fe,R.context=ne,g=pe):(typeof R.componentDidUpdate!="function"||Z===s.memoizedProps&&be===s.memoizedState||(i.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||Z===s.memoizedProps&&be===s.memoizedState||(i.flags|=1024),g=!1)}return Hf(s,i,d,g,_,v)}function Hf(s,i,d,g,v,_){mk(s,i);var R=(i.flags&128)!==0;if(!g&&!R)return v&&bb(i,d,!1),Us(s,i,_);g=i.stateNode,e$.current=i;var Z=R&&typeof d.getDerivedStateFromError!="function"?null:g.render();return i.flags|=1,s!==null&&R?(i.child=vi(i,s.child,null,_),i.child=vi(i,null,Z,_)):An(s,i,Z,_),i.memoizedState=g.state,v&&bb(i,d,!0),i.child}function yk(s){var i=s.stateNode;i.pendingContext?Gl(s,i.pendingContext,i.pendingContext!==i.context):i.context&&Gl(s,i.context,!1),jf(s,i.containerInfo)}function wk(s,i,d,g,v){return wi(),vf(v),i.flags|=256,An(s,i,d,g),i.child}var Uf={dehydrated:null,treeContext:null,retryLane:0};function Wf(s){return{baseLanes:s,cachePool:null,transitions:null}}function vk(s,i,d){var g=i.pendingProps,v=Ot.current,_=!1,R=(i.flags&128)!==0,Z;if((Z=R)||(Z=s!==null&&s.memoizedState===null?!1:(v&2)!==0),Z?(_=!0,i.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),wt(Ot,v&1),s===null)return wf(i),s=i.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((i.mode&1)===0?i.lanes=1:s.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(R=g.children,s=g.fallback,_?(g=i.mode,_=i.child,R={mode:"hidden",children:R},(g&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=R):_=cd(R,g,0,null),s=No(s,g,d,null),_.return=i,s.return=i,_.sibling=s,i.child=_,i.child.memoizedState=Wf(d),i.memoizedState=Uf,s):Vf(i,R));if(v=s.memoizedState,v!==null&&(Z=v.dehydrated,Z!==null))return t$(s,i,R,g,Z,v,d);if(_){_=g.fallback,R=i.mode,v=s.child,Z=v.sibling;var ne={mode:"hidden",children:g.children};return(R&1)===0&&i.child!==v?(g=i.child,g.childLanes=0,g.pendingProps=ne,i.deletions=null):(g=Na(v,ne),g.subtreeFlags=v.subtreeFlags&14680064),Z!==null?_=Na(Z,_):(_=No(_,R,d,null),_.flags|=2),_.return=i,g.return=i,g.sibling=_,i.child=g,g=_,_=i.child,R=s.child.memoizedState,R=R===null?Wf(d):{baseLanes:R.baseLanes|d,cachePool:null,transitions:R.transitions},_.memoizedState=R,_.childLanes=s.childLanes&~d,i.memoizedState=Uf,g}return _=s.child,s=_.sibling,g=Na(_,{mode:"visible",children:g.children}),(i.mode&1)===0&&(g.lanes=d),g.return=i,g.sibling=null,s!==null&&(d=i.deletions,d===null?(i.deletions=[s],i.flags|=16):d.push(s)),i.child=g,i.memoizedState=null,g}function Vf(s,i){return i=cd({mode:"visible",children:i},s.mode,0,null),i.return=s,s.child=i}function Xu(s,i,d,g){return g!==null&&vf(g),vi(i,s.child,null,d),s=Vf(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function t$(s,i,d,g,v,_,R){if(d)return i.flags&256?(i.flags&=-257,g=qf(Error(n(422))),Xu(s,i,R,g)):i.memoizedState!==null?(i.child=s.child,i.flags|=128,null):(_=g.fallback,v=i.mode,g=cd({mode:"visible",children:g.children},v,0,null),_=No(_,v,R,null),_.flags|=2,g.return=i,_.return=i,g.sibling=_,i.child=g,(i.mode&1)!==0&&vi(i,s.child,null,R),i.child.memoizedState=Wf(R),i.memoizedState=Uf,_);if((i.mode&1)===0)return Xu(s,i,R,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var Z=g.dgst;return g=Z,_=Error(n(419)),g=qf(_,g,void 0),Xu(s,i,R,g)}if(Z=(R&s.childLanes)!==0,qn||Z){if(g=cn,g!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|R))!==0?0:v,v!==0&&v!==_.retryLane&&(_.retryLane=v,zs(s,v),Wr(g,s,v,-1))}return lp(),g=qf(Error(n(421))),Xu(s,i,R,g)}return v.data==="$?"?(i.flags|=128,i.child=s.child,i=p$.bind(null,s),v._reactRetry=i,null):(s=_.treeContext,nr=Fr(v.nextSibling),tr=i,Rt=!0,Br=null,s!==null&&(mr[gr++]=qs,mr[gr++]=Bs,mr[gr++]=po,qs=s.id,Bs=s.overflow,po=i),i=Vf(i,g.children),i.flags|=4096,i)}function xk(s,i,d){s.lanes|=i;var g=s.alternate;g!==null&&(g.lanes|=i),Nf(s.return,i,d)}function Gf(s,i,d,g,v){var _=s.memoizedState;_===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(_.isBackwards=i,_.rendering=null,_.renderingStartTime=0,_.last=g,_.tail=d,_.tailMode=v)}function bk(s,i,d){var g=i.pendingProps,v=g.revealOrder,_=g.tail;if(An(s,i,g.children,d),g=Ot.current,(g&2)!==0)g=g&1|2,i.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&xk(s,d,i);else if(s.tag===19)xk(s,d,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}g&=1}if(wt(Ot,g),(i.mode&1)===0)i.memoizedState=null;else switch(v){case"forwards":for(d=i.child,v=null;d!==null;)s=d.alternate,s!==null&&Hu(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=i.child,i.child=null):(v=d.sibling,d.sibling=null),Gf(i,!1,v,d,_);break;case"backwards":for(d=null,v=i.child,i.child=null;v!==null;){if(s=v.alternate,s!==null&&Hu(s)===null){i.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}Gf(i,!0,d,null,_);break;case"together":Gf(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Zu(s,i){(i.mode&1)===0&&s!==null&&(s.alternate=null,i.alternate=null,i.flags|=2)}function Us(s,i,d){if(s!==null&&(i.dependencies=s.dependencies),vo|=i.lanes,(d&i.childLanes)===0)return null;if(s!==null&&i.child!==s.child)throw Error(n(153));if(i.child!==null){for(s=i.child,d=Na(s,s.pendingProps),i.child=d,d.return=i;s.sibling!==null;)s=s.sibling,d=d.sibling=Na(s,s.pendingProps),d.return=i;d.sibling=null}return i.child}function n$(s,i,d){switch(i.tag){case 3:yk(i),wi();break;case 5:Ob(i);break;case 1:bn(i.type)&&Iu(i);break;case 4:jf(i,i.stateNode.containerInfo);break;case 10:var g=i.type._context,v=i.memoizedProps.value;wt(Fu,g._currentValue),g._currentValue=v;break;case 13:if(g=i.memoizedState,g!==null)return g.dehydrated!==null?(wt(Ot,Ot.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?vk(s,i,d):(wt(Ot,Ot.current&1),s=Us(s,i,d),s!==null?s.sibling:null);wt(Ot,Ot.current&1);break;case 19:if(g=(d&i.childLanes)!==0,(s.flags&128)!==0){if(g)return bk(s,i,d);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),wt(Ot,Ot.current),g)break;return null;case 22:case 23:return i.lanes=0,pk(s,i,d)}return Us(s,i,d)}var kk,Kf,Nk,_k;kk=function(s,i){for(var d=i.child;d!==null;){if(d.tag===5||d.tag===6)s.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===i)break;for(;d.sibling===null;){if(d.return===null||d.return===i)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Kf=function(){},Nk=function(s,i,d,g){var v=s.memoizedProps;if(v!==g){s=i.stateNode,yo(ps.current);var _=null;switch(d){case"input":v=je(s,v),g=je(s,g),_=[];break;case"select":v=G({},v,{value:void 0}),g=G({},g,{value:void 0}),_=[];break;case"textarea":v=le(s,v),g=le(s,g),_=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(s.onclick=fi)}jt(d,g);var R;d=null;for(pe in v)if(!g.hasOwnProperty(pe)&&v.hasOwnProperty(pe)&&v[pe]!=null)if(pe==="style"){var Z=v[pe];for(R in Z)Z.hasOwnProperty(R)&&(d||(d={}),d[R]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(a.hasOwnProperty(pe)?_||(_=[]):(_=_||[]).push(pe,null));for(pe in g){var ne=g[pe];if(Z=v!=null?v[pe]:void 0,g.hasOwnProperty(pe)&&ne!==Z&&(ne!=null||Z!=null))if(pe==="style")if(Z){for(R in Z)!Z.hasOwnProperty(R)||ne&&ne.hasOwnProperty(R)||(d||(d={}),d[R]="");for(R in ne)ne.hasOwnProperty(R)&&Z[R]!==ne[R]&&(d||(d={}),d[R]=ne[R])}else d||(_||(_=[]),_.push(pe,d)),d=ne;else pe==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,Z=Z?Z.__html:void 0,ne!=null&&Z!==ne&&(_=_||[]).push(pe,ne)):pe==="children"?typeof ne!="string"&&typeof ne!="number"||(_=_||[]).push(pe,""+ne):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(pe)?(ne!=null&&pe==="onScroll"&&bt("scroll",s),_||Z===ne||(_=[])):(_=_||[]).push(pe,ne))}d&&(_=_||[]).push("style",d);var pe=_;(i.updateQueue=pe)&&(i.flags|=4)}},_k=function(s,i,d,g){d!==g&&(i.flags|=4)};function nc(s,i){if(!Rt)switch(s.tailMode){case"hidden":i=s.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function Nn(s){var i=s.alternate!==null&&s.alternate.child===s.child,d=0,g=0;if(i)for(var v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=g,s.childLanes=d,i}function r$(s,i,d){var g=i.pendingProps;switch(gf(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nn(i),null;case 1:return bn(i.type)&&At(),Nn(i),null;case 3:return g=i.stateNode,ki(),_t(fn),_t(on),Tf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(s===null||s.child===null)&&(Pu(i)?i.flags|=4:s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Br!==null&&(ap(Br),Br=null))),Kf(s,i),Nn(i),null;case 5:Ef(i);var v=yo(Zl.current);if(d=i.type,s!==null&&i.stateNode!=null)Nk(s,i,d,g,v),s.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!g){if(i.stateNode===null)throw Error(n(166));return Nn(i),null}if(s=yo(ps.current),Pu(i)){g=i.stateNode,d=i.type;var _=i.memoizedProps;switch(g[re]=i,g[oe]=_,s=(i.mode&1)!==0,d){case"dialog":bt("cancel",g),bt("close",g);break;case"iframe":case"object":case"embed":bt("load",g);break;case"video":case"audio":for(v=0;v<ur.length;v++)bt(ur[v],g);break;case"source":bt("error",g);break;case"img":case"image":case"link":bt("error",g),bt("load",g);break;case"details":bt("toggle",g);break;case"input":ve(g,_),bt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!_.multiple},bt("invalid",g);break;case"textarea":_e(g,_),bt("invalid",g)}jt(d,_),v=null;for(var R in _)if(_.hasOwnProperty(R)){var Z=_[R];R==="children"?typeof Z=="string"?g.textContent!==Z&&(_.suppressHydrationWarning!==!0&&ho(g.textContent,Z,s),v=["children",Z]):typeof Z=="number"&&g.textContent!==""+Z&&(_.suppressHydrationWarning!==!0&&ho(g.textContent,Z,s),v=["children",""+Z]):a.hasOwnProperty(R)&&Z!=null&&R==="onScroll"&&bt("scroll",g)}switch(d){case"input":Te(g),xe(g,_,!0);break;case"textarea":Te(g),Ze(g);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(g.onclick=fi)}g=v,i.updateQueue=g,g!==null&&(i.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=We(d)),s==="http://www.w3.org/1999/xhtml"?d==="script"?(s=R.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof g.is=="string"?s=R.createElement(d,{is:g.is}):(s=R.createElement(d),d==="select"&&(R=s,g.multiple?R.multiple=!0:g.size&&(R.size=g.size))):s=R.createElementNS(s,d),s[re]=i,s[oe]=g,kk(s,i,!1,!1),i.stateNode=s;e:{switch(R=vt(d,g),d){case"dialog":bt("cancel",s),bt("close",s),v=g;break;case"iframe":case"object":case"embed":bt("load",s),v=g;break;case"video":case"audio":for(v=0;v<ur.length;v++)bt(ur[v],s);v=g;break;case"source":bt("error",s),v=g;break;case"img":case"image":case"link":bt("error",s),bt("load",s),v=g;break;case"details":bt("toggle",s),v=g;break;case"input":ve(s,g),v=je(s,g),bt("invalid",s);break;case"option":v=g;break;case"select":s._wrapperState={wasMultiple:!!g.multiple},v=G({},g,{value:void 0}),bt("invalid",s);break;case"textarea":_e(s,g),v=le(s,g),bt("invalid",s);break;default:v=g}jt(d,v),Z=v;for(_ in Z)if(Z.hasOwnProperty(_)){var ne=Z[_];_==="style"?ut(s,ne):_==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&Me(s,ne)):_==="children"?typeof ne=="string"?(d!=="textarea"||ne!=="")&&Qe(s,ne):typeof ne=="number"&&Qe(s,""+ne):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(a.hasOwnProperty(_)?ne!=null&&_==="onScroll"&&bt("scroll",s):ne!=null&&E(s,_,ne,R))}switch(d){case"input":Te(s),xe(s,g,!1);break;case"textarea":Te(s),Ze(s);break;case"option":g.value!=null&&s.setAttribute("value",""+ae(g.value));break;case"select":s.multiple=!!g.multiple,_=g.value,_!=null?at(s,!!g.multiple,_,!1):g.defaultValue!=null&&at(s,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=fi)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return Nn(i),null;case 6:if(s&&i.stateNode!=null)_k(s,i,s.memoizedProps,g);else{if(typeof g!="string"&&i.stateNode===null)throw Error(n(166));if(d=yo(Zl.current),yo(ps.current),Pu(i)){if(g=i.stateNode,d=i.memoizedProps,g[re]=i,(_=g.nodeValue!==d)&&(s=tr,s!==null))switch(s.tag){case 3:ho(g.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&ho(g.nodeValue,d,(s.mode&1)!==0)}_&&(i.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[re]=i,i.stateNode=g}return Nn(i),null;case 13:if(_t(Ot),g=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Rt&&nr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)Eb(),wi(),i.flags|=98560,_=!1;else if(_=Pu(i),g!==null&&g.dehydrated!==null){if(s===null){if(!_)throw Error(n(318));if(_=i.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[re]=i}else wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Nn(i),_=!1}else Br!==null&&(ap(Br),Br=null),_=!0;if(!_)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=d,i):(g=g!==null,g!==(s!==null&&s.memoizedState!==null)&&g&&(i.child.flags|=8192,(i.mode&1)!==0&&(s===null||(Ot.current&1)!==0?Jt===0&&(Jt=3):lp())),i.updateQueue!==null&&(i.flags|=4),Nn(i),null);case 4:return ki(),Kf(s,i),s===null&&lo(i.stateNode.containerInfo),Nn(i),null;case 10:return kf(i.type._context),Nn(i),null;case 17:return bn(i.type)&&At(),Nn(i),null;case 19:if(_t(Ot),_=i.memoizedState,_===null)return Nn(i),null;if(g=(i.flags&128)!==0,R=_.rendering,R===null)if(g)nc(_,!1);else{if(Jt!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(R=Hu(s),R!==null){for(i.flags|=128,nc(_,!1),g=R.updateQueue,g!==null&&(i.updateQueue=g,i.flags|=4),i.subtreeFlags=0,g=d,d=i.child;d!==null;)_=d,s=g,_.flags&=14680066,R=_.alternate,R===null?(_.childLanes=0,_.lanes=s,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=R.childLanes,_.lanes=R.lanes,_.child=R.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=R.memoizedProps,_.memoizedState=R.memoizedState,_.updateQueue=R.updateQueue,_.type=R.type,s=R.dependencies,_.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return wt(Ot,Ot.current&1|2),i.child}s=s.sibling}_.tail!==null&&gt()>ji&&(i.flags|=128,g=!0,nc(_,!1),i.lanes=4194304)}else{if(!g)if(s=Hu(R),s!==null){if(i.flags|=128,g=!0,d=s.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),nc(_,!0),_.tail===null&&_.tailMode==="hidden"&&!R.alternate&&!Rt)return Nn(i),null}else 2*gt()-_.renderingStartTime>ji&&d!==1073741824&&(i.flags|=128,g=!0,nc(_,!1),i.lanes=4194304);_.isBackwards?(R.sibling=i.child,i.child=R):(d=_.last,d!==null?d.sibling=R:i.child=R,_.last=R)}return _.tail!==null?(i=_.tail,_.rendering=i,_.tail=i.sibling,_.renderingStartTime=gt(),i.sibling=null,d=Ot.current,wt(Ot,g?d&1|2:d&1),i):(Nn(i),null);case 22:case 23:return ip(),g=i.memoizedState!==null,s!==null&&s.memoizedState!==null!==g&&(i.flags|=8192),g&&(i.mode&1)!==0?(rr&1073741824)!==0&&(Nn(i),i.subtreeFlags&6&&(i.flags|=8192)):Nn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function s$(s,i){switch(gf(i),i.tag){case 1:return bn(i.type)&&At(),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return ki(),_t(fn),_t(on),Tf(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 5:return Ef(i),null;case 13:if(_t(Ot),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(n(340));wi()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return _t(Ot),null;case 4:return ki(),null;case 10:return kf(i.type._context),null;case 22:case 23:return ip(),null;case 24:return null;default:return null}}var Qu=!1,_n=!1,a$=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function _i(s,i){var d=s.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Ft(s,i,g)}else d.current=null}function Yf(s,i,d){try{d()}catch(g){Ft(s,i,g)}}var Sk=!1;function o$(s,i){if(Wl=As,s=Dr(),ai(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,_=g.focusNode;g=g.focusOffset;try{d.nodeType,_.nodeType}catch{d=null;break e}var R=0,Z=-1,ne=-1,pe=0,Ne=0,Se=s,be=null;t:for(;;){for(var $e;Se!==d||v!==0&&Se.nodeType!==3||(Z=R+v),Se!==_||g!==0&&Se.nodeType!==3||(ne=R+g),Se.nodeType===3&&(R+=Se.nodeValue.length),($e=Se.firstChild)!==null;)be=Se,Se=$e;for(;;){if(Se===s)break t;if(be===d&&++pe===v&&(Z=R),be===_&&++Ne===g&&(ne=R),($e=Se.nextSibling)!==null)break;Se=be,be=Se.parentNode}Se=$e}d=Z===-1||ne===-1?null:{start:Z,end:ne}}else d=null}d=d||{start:0,end:0}}else d=null;for(pi={focusedElem:s,selectionRange:d},As=!1,Pe=i;Pe!==null;)if(i=Pe,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Pe=s;else for(;Pe!==null;){i=Pe;try{var Fe=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Fe!==null){var qe=Fe.memoizedProps,Ht=Fe.memoizedState,ie=i.stateNode,se=ie.getSnapshotBeforeUpdate(i.elementType===i.type?qe:zr(i.type,qe),Ht);ie.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ce=i.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(Ee){Ft(i,i.return,Ee)}if(s=i.sibling,s!==null){s.return=i.return,Pe=s;break}Pe=i.return}return Fe=Sk,Sk=!1,Fe}function rc(s,i,d){var g=i.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&s)===s){var _=v.destroy;v.destroy=void 0,_!==void 0&&Yf(i,d,_)}v=v.next}while(v!==g)}}function Ju(s,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&s)===s){var g=d.create;d.destroy=g()}d=d.next}while(d!==i)}}function Xf(s){var i=s.ref;if(i!==null){var d=s.stateNode;switch(s.tag){case 5:s=d;break;default:s=d}typeof i=="function"?i(s):i.current=s}}function jk(s){var i=s.alternate;i!==null&&(s.alternate=null,jk(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&(delete i[re],delete i[oe],delete i[Ce],delete i[Le],delete i[et])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Ek(s){return s.tag===5||s.tag===3||s.tag===4}function Ck(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Ek(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Zf(s,i,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,i?d.nodeType===8?d.parentNode.insertBefore(s,i):d.insertBefore(s,i):(d.nodeType===8?(i=d.parentNode,i.insertBefore(s,d)):(i=d,i.appendChild(s)),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=fi));else if(g!==4&&(s=s.child,s!==null))for(Zf(s,i,d),s=s.sibling;s!==null;)Zf(s,i,d),s=s.sibling}function Qf(s,i,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,i?d.insertBefore(s,i):d.appendChild(s);else if(g!==4&&(s=s.child,s!==null))for(Qf(s,i,d),s=s.sibling;s!==null;)Qf(s,i,d),s=s.sibling}var pn=null,Hr=!1;function wa(s,i,d){for(d=d.child;d!==null;)Tk(s,i,d),d=d.sibling}function Tk(s,i,d){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(js,d)}catch{}switch(d.tag){case 5:_n||_i(d,i);case 6:var g=pn,v=Hr;pn=null,wa(s,i,d),pn=g,Hr=v,pn!==null&&(Hr?(s=pn,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):pn.removeChild(d.stateNode));break;case 18:pn!==null&&(Hr?(s=pn,d=d.stateNode,s.nodeType===8?mi(s.parentNode,d):s.nodeType===1&&mi(s,d),la(s)):mi(pn,d.stateNode));break;case 4:g=pn,v=Hr,pn=d.stateNode.containerInfo,Hr=!0,wa(s,i,d),pn=g,Hr=v;break;case 0:case 11:case 14:case 15:if(!_n&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var _=v,R=_.destroy;_=_.tag,R!==void 0&&((_&2)!==0||(_&4)!==0)&&Yf(d,i,R),v=v.next}while(v!==g)}wa(s,i,d);break;case 1:if(!_n&&(_i(d,i),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(Z){Ft(d,i,Z)}wa(s,i,d);break;case 21:wa(s,i,d);break;case 22:d.mode&1?(_n=(g=_n)||d.memoizedState!==null,wa(s,i,d),_n=g):wa(s,i,d);break;default:wa(s,i,d)}}function Ak(s){var i=s.updateQueue;if(i!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new a$),i.forEach(function(g){var v=m$.bind(null,s,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Ur(s,i){var d=i.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var _=s,R=i,Z=R;e:for(;Z!==null;){switch(Z.tag){case 5:pn=Z.stateNode,Hr=!1;break e;case 3:pn=Z.stateNode.containerInfo,Hr=!0;break e;case 4:pn=Z.stateNode.containerInfo,Hr=!0;break e}Z=Z.return}if(pn===null)throw Error(n(160));Tk(_,R,v),pn=null,Hr=!1;var ne=v.alternate;ne!==null&&(ne.return=null),v.return=null}catch(pe){Ft(v,i,pe)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)Rk(i,s),i=i.sibling}function Rk(s,i){var d=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Ur(i,s),gs(s),g&4){try{rc(3,s,s.return),Ju(3,s)}catch(qe){Ft(s,s.return,qe)}try{rc(5,s,s.return)}catch(qe){Ft(s,s.return,qe)}}break;case 1:Ur(i,s),gs(s),g&512&&d!==null&&_i(d,d.return);break;case 5:if(Ur(i,s),gs(s),g&512&&d!==null&&_i(d,d.return),s.flags&32){var v=s.stateNode;try{Qe(v,"")}catch(qe){Ft(s,s.return,qe)}}if(g&4&&(v=s.stateNode,v!=null)){var _=s.memoizedProps,R=d!==null?d.memoizedProps:_,Z=s.type,ne=s.updateQueue;if(s.updateQueue=null,ne!==null)try{Z==="input"&&_.type==="radio"&&_.name!=null&&Ue(v,_),vt(Z,R);var pe=vt(Z,_);for(R=0;R<ne.length;R+=2){var Ne=ne[R],Se=ne[R+1];Ne==="style"?ut(v,Se):Ne==="dangerouslySetInnerHTML"?Me(v,Se):Ne==="children"?Qe(v,Se):E(v,Ne,Se,pe)}switch(Z){case"input":ke(v,_);break;case"textarea":Ie(v,_);break;case"select":var be=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!_.multiple;var $e=_.value;$e!=null?at(v,!!_.multiple,$e,!1):be!==!!_.multiple&&(_.defaultValue!=null?at(v,!!_.multiple,_.defaultValue,!0):at(v,!!_.multiple,_.multiple?[]:"",!1))}v[oe]=_}catch(qe){Ft(s,s.return,qe)}}break;case 6:if(Ur(i,s),gs(s),g&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,_=s.memoizedProps;try{v.nodeValue=_}catch(qe){Ft(s,s.return,qe)}}break;case 3:if(Ur(i,s),gs(s),g&4&&d!==null&&d.memoizedState.isDehydrated)try{la(i.containerInfo)}catch(qe){Ft(s,s.return,qe)}break;case 4:Ur(i,s),gs(s);break;case 13:Ur(i,s),gs(s),v=s.child,v.flags&8192&&(_=v.memoizedState!==null,v.stateNode.isHidden=_,!_||v.alternate!==null&&v.alternate.memoizedState!==null||(tp=gt())),g&4&&Ak(s);break;case 22:if(Ne=d!==null&&d.memoizedState!==null,s.mode&1?(_n=(pe=_n)||Ne,Ur(i,s),_n=pe):Ur(i,s),gs(s),g&8192){if(pe=s.memoizedState!==null,(s.stateNode.isHidden=pe)&&!Ne&&(s.mode&1)!==0)for(Pe=s,Ne=s.child;Ne!==null;){for(Se=Pe=Ne;Pe!==null;){switch(be=Pe,$e=be.child,be.tag){case 0:case 11:case 14:case 15:rc(4,be,be.return);break;case 1:_i(be,be.return);var Fe=be.stateNode;if(typeof Fe.componentWillUnmount=="function"){g=be,d=be.return;try{i=g,Fe.props=i.memoizedProps,Fe.state=i.memoizedState,Fe.componentWillUnmount()}catch(qe){Ft(g,d,qe)}}break;case 5:_i(be,be.return);break;case 22:if(be.memoizedState!==null){$k(Se);continue}}$e!==null?($e.return=be,Pe=$e):$k(Se)}Ne=Ne.sibling}e:for(Ne=null,Se=s;;){if(Se.tag===5){if(Ne===null){Ne=Se;try{v=Se.stateNode,pe?(_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(Z=Se.stateNode,ne=Se.memoizedProps.style,R=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,Z.style.display=pt("display",R))}catch(qe){Ft(s,s.return,qe)}}}else if(Se.tag===6){if(Ne===null)try{Se.stateNode.nodeValue=pe?"":Se.memoizedProps}catch(qe){Ft(s,s.return,qe)}}else if((Se.tag!==22&&Se.tag!==23||Se.memoizedState===null||Se===s)&&Se.child!==null){Se.child.return=Se,Se=Se.child;continue}if(Se===s)break e;for(;Se.sibling===null;){if(Se.return===null||Se.return===s)break e;Ne===Se&&(Ne=null),Se=Se.return}Ne===Se&&(Ne=null),Se.sibling.return=Se.return,Se=Se.sibling}}break;case 19:Ur(i,s),gs(s),g&4&&Ak(s);break;case 21:break;default:Ur(i,s),gs(s)}}function gs(s){var i=s.flags;if(i&2){try{e:{for(var d=s.return;d!==null;){if(Ek(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Qe(v,""),g.flags&=-33);var _=Ck(s);Qf(s,_,v);break;case 3:case 4:var R=g.stateNode.containerInfo,Z=Ck(s);Zf(s,Z,R);break;default:throw Error(n(161))}}catch(ne){Ft(s,s.return,ne)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function i$(s,i,d){Pe=s,Mk(s)}function Mk(s,i,d){for(var g=(s.mode&1)!==0;Pe!==null;){var v=Pe,_=v.child;if(v.tag===22&&g){var R=v.memoizedState!==null||Qu;if(!R){var Z=v.alternate,ne=Z!==null&&Z.memoizedState!==null||_n;Z=Qu;var pe=_n;if(Qu=R,(_n=ne)&&!pe)for(Pe=v;Pe!==null;)R=Pe,ne=R.child,R.tag===22&&R.memoizedState!==null?Ok(v):ne!==null?(ne.return=R,Pe=ne):Ok(v);for(;_!==null;)Pe=_,Mk(_),_=_.sibling;Pe=v,Qu=Z,_n=pe}Ik(s)}else(v.subtreeFlags&8772)!==0&&_!==null?(_.return=v,Pe=_):Ik(s)}}function Ik(s){for(;Pe!==null;){var i=Pe;if((i.flags&8772)!==0){var d=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:_n||Ju(5,i);break;case 1:var g=i.stateNode;if(i.flags&4&&!_n)if(d===null)g.componentDidMount();else{var v=i.elementType===i.type?d.memoizedProps:zr(i.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var _=i.updateQueue;_!==null&&$b(i,_,g);break;case 3:var R=i.updateQueue;if(R!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}$b(i,R,d)}break;case 5:var Z=i.stateNode;if(d===null&&i.flags&4){d=Z;var ne=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&d.focus();break;case"img":ne.src&&(d.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var pe=i.alternate;if(pe!==null){var Ne=pe.memoizedState;if(Ne!==null){var Se=Ne.dehydrated;Se!==null&&la(Se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}_n||i.flags&512&&Xf(i)}catch(be){Ft(i,i.return,be)}}if(i===s){Pe=null;break}if(d=i.sibling,d!==null){d.return=i.return,Pe=d;break}Pe=i.return}}function $k(s){for(;Pe!==null;){var i=Pe;if(i===s){Pe=null;break}var d=i.sibling;if(d!==null){d.return=i.return,Pe=d;break}Pe=i.return}}function Ok(s){for(;Pe!==null;){var i=Pe;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{Ju(4,i)}catch(ne){Ft(i,d,ne)}break;case 1:var g=i.stateNode;if(typeof g.componentDidMount=="function"){var v=i.return;try{g.componentDidMount()}catch(ne){Ft(i,v,ne)}}var _=i.return;try{Xf(i)}catch(ne){Ft(i,_,ne)}break;case 5:var R=i.return;try{Xf(i)}catch(ne){Ft(i,R,ne)}}}catch(ne){Ft(i,i.return,ne)}if(i===s){Pe=null;break}var Z=i.sibling;if(Z!==null){Z.return=i.return,Pe=Z;break}Pe=i.return}}var l$=Math.ceil,ed=C.ReactCurrentDispatcher,Jf=C.ReactCurrentOwner,vr=C.ReactCurrentBatchConfig,ht=0,cn=null,Vt=null,mn=0,rr=0,Si=Jn(0),Jt=0,sc=null,vo=0,td=0,ep=0,ac=null,Bn=null,tp=0,ji=1/0,Ws=null,nd=!1,np=null,va=null,rd=!1,xa=null,sd=0,oc=0,rp=null,ad=-1,od=0;function Rn(){return(ht&6)!==0?gt():ad!==-1?ad:ad=gt()}function ba(s){return(s.mode&1)===0?1:(ht&2)!==0&&mn!==0?mn&-mn:WI.transition!==null?(od===0&&(od=ou()),od):(s=nt,s!==0||(s=window.event,s=s===void 0?16:ca(s.type)),s)}function Wr(s,i,d,g){if(50<oc)throw oc=0,rp=null,Error(n(185));Rr(s,d,g),((ht&2)===0||s!==cn)&&(s===cn&&((ht&2)===0&&(td|=d),Jt===4&&ka(s,mn)),zn(s,g),d===1&&ht===0&&(i.mode&1)===0&&(ji=gt()+500,$u&&ma()))}function zn(s,i){var d=s.callbackNode;au(s,i);var g=rs(s,s===cn?mn:0);if(g===0)d!==null&&dt(d),s.callbackNode=null,s.callbackPriority=0;else if(i=g&-g,s.callbackPriority!==i){if(d!=null&&dt(d),i===1)s.tag===0?UI(Pk.bind(null,s)):kb(Pk.bind(null,s)),Ru(function(){(ht&6)===0&&ma()}),d=null;else{switch(Ha(g)){case 1:d=Ar;break;case 4:d=Ss;break;case 16:d=ns;break;case 536870912:d=Wo;break;default:d=ns}d=Wk(d,Lk.bind(null,s))}s.callbackPriority=i,s.callbackNode=d}}function Lk(s,i){if(ad=-1,od=0,(ht&6)!==0)throw Error(n(327));var d=s.callbackNode;if(Ei()&&s.callbackNode!==d)return null;var g=rs(s,s===cn?mn:0);if(g===0)return null;if((g&30)!==0||(g&s.expiredLanes)!==0||i)i=id(s,g);else{i=g;var v=ht;ht|=2;var _=Fk();(cn!==s||mn!==i)&&(Ws=null,ji=gt()+500,bo(s,i));do try{d$();break}catch(Z){Dk(s,Z)}while(!0);bf(),ed.current=_,ht=v,Vt!==null?i=0:(cn=null,mn=0,i=Jt)}if(i!==0){if(i===2&&(v=Go(s),v!==0&&(g=v,i=sp(s,v))),i===1)throw d=sc,bo(s,0),ka(s,g),zn(s,gt()),d;if(i===6)ka(s,g);else{if(v=s.current.alternate,(g&30)===0&&!c$(v)&&(i=id(s,g),i===2&&(_=Go(s),_!==0&&(g=_,i=sp(s,_))),i===1))throw d=sc,bo(s,0),ka(s,g),zn(s,gt()),d;switch(s.finishedWork=v,s.finishedLanes=g,i){case 0:case 1:throw Error(n(345));case 2:ko(s,Bn,Ws);break;case 3:if(ka(s,g),(g&130023424)===g&&(i=tp+500-gt(),10<i)){if(rs(s,0)!==0)break;if(v=s.suspendedLanes,(v&g)!==g){Rn(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=fo(ko.bind(null,s,Bn,Ws),i);break}ko(s,Bn,Ws);break;case 4:if(ka(s,g),(g&4194240)===g)break;for(i=s.eventTimes,v=-1;0<g;){var R=31-Pn(g);_=1<<R,R=i[R],R>v&&(v=R),g&=~_}if(g=v,g=gt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*l$(g/1960))-g,10<g){s.timeoutHandle=fo(ko.bind(null,s,Bn,Ws),g);break}ko(s,Bn,Ws);break;case 5:ko(s,Bn,Ws);break;default:throw Error(n(329))}}}return zn(s,gt()),s.callbackNode===d?Lk.bind(null,s):null}function sp(s,i){var d=ac;return s.current.memoizedState.isDehydrated&&(bo(s,i).flags|=256),s=id(s,i),s!==2&&(i=Bn,Bn=d,i!==null&&ap(i)),s}function ap(s){Bn===null?Bn=s:Bn.push.apply(Bn,s)}function c$(s){for(var i=s;;){if(i.flags&16384){var d=i.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],_=v.getSnapshot;v=v.value;try{if(!Qn(_(),v))return!1}catch{return!1}}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ka(s,i){for(i&=~ep,i&=~td,s.suspendedLanes|=i,s.pingedLanes&=~i,s=s.expirationTimes;0<i;){var d=31-Pn(i),g=1<<d;s[d]=-1,i&=~g}}function Pk(s){if((ht&6)!==0)throw Error(n(327));Ei();var i=rs(s,0);if((i&1)===0)return zn(s,gt()),null;var d=id(s,i);if(s.tag!==0&&d===2){var g=Go(s);g!==0&&(i=g,d=sp(s,g))}if(d===1)throw d=sc,bo(s,0),ka(s,i),zn(s,gt()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=i,ko(s,Bn,Ws),zn(s,gt()),null}function op(s,i){var d=ht;ht|=1;try{return s(i)}finally{ht=d,ht===0&&(ji=gt()+500,$u&&ma())}}function xo(s){xa!==null&&xa.tag===0&&(ht&6)===0&&Ei();var i=ht;ht|=1;var d=vr.transition,g=nt;try{if(vr.transition=null,nt=1,s)return s()}finally{nt=g,vr.transition=d,ht=i,(ht&6)===0&&ma()}}function ip(){rr=Si.current,_t(Si)}function bo(s,i){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,ff(d)),Vt!==null)for(d=Vt.return;d!==null;){var g=d;switch(gf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&At();break;case 3:ki(),_t(fn),_t(on),Tf();break;case 5:Ef(g);break;case 4:ki();break;case 13:_t(Ot);break;case 19:_t(Ot);break;case 10:kf(g.type._context);break;case 22:case 23:ip()}d=d.return}if(cn=s,Vt=s=Na(s.current,null),mn=rr=i,Jt=0,sc=null,ep=td=vo=0,Bn=ac=null,go!==null){for(i=0;i<go.length;i++)if(d=go[i],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,_=d.pending;if(_!==null){var R=_.next;_.next=v,g.next=R}d.pending=g}go=null}return s}function Dk(s,i){do{var d=Vt;try{if(bf(),Uu.current=Ku,Wu){for(var g=Lt.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Wu=!1}if(wo=0,ln=Qt=Lt=null,Ql=!1,Jl=0,Jf.current=null,d===null||d.return===null){Jt=1,sc=i,Vt=null;break}e:{var _=s,R=d.return,Z=d,ne=i;if(i=mn,Z.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var pe=ne,Ne=Z,Se=Ne.tag;if((Ne.mode&1)===0&&(Se===0||Se===11||Se===15)){var be=Ne.alternate;be?(Ne.updateQueue=be.updateQueue,Ne.memoizedState=be.memoizedState,Ne.lanes=be.lanes):(Ne.updateQueue=null,Ne.memoizedState=null)}var $e=ck(R);if($e!==null){$e.flags&=-257,uk($e,R,Z,_,i),$e.mode&1&&lk(_,pe,i),i=$e,ne=pe;var Fe=i.updateQueue;if(Fe===null){var qe=new Set;qe.add(ne),i.updateQueue=qe}else Fe.add(ne);break e}else{if((i&1)===0){lk(_,pe,i),lp();break e}ne=Error(n(426))}}else if(Rt&&Z.mode&1){var Ht=ck(R);if(Ht!==null){(Ht.flags&65536)===0&&(Ht.flags|=256),uk(Ht,R,Z,_,i),vf(Ni(ne,Z));break e}}_=ne=Ni(ne,Z),Jt!==4&&(Jt=2),ac===null?ac=[_]:ac.push(_),_=R;do{switch(_.tag){case 3:_.flags|=65536,i&=-i,_.lanes|=i;var ie=ok(_,ne,i);Ib(_,ie);break e;case 1:Z=ne;var se=_.type,ce=_.stateNode;if((_.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(va===null||!va.has(ce)))){_.flags|=65536,i&=-i,_.lanes|=i;var Ee=ik(_,Z,i);Ib(_,Ee);break e}}_=_.return}while(_!==null)}Bk(d)}catch(Be){i=Be,Vt===d&&d!==null&&(Vt=d=d.return);continue}break}while(!0)}function Fk(){var s=ed.current;return ed.current=Ku,s===null?Ku:s}function lp(){(Jt===0||Jt===3||Jt===2)&&(Jt=4),cn===null||(vo&268435455)===0&&(td&268435455)===0||ka(cn,mn)}function id(s,i){var d=ht;ht|=2;var g=Fk();(cn!==s||mn!==i)&&(Ws=null,bo(s,i));do try{u$();break}catch(v){Dk(s,v)}while(!0);if(bf(),ht=d,ed.current=g,Vt!==null)throw Error(n(261));return cn=null,mn=0,Jt}function u$(){for(;Vt!==null;)qk(Vt)}function d$(){for(;Vt!==null&&!yt();)qk(Vt)}function qk(s){var i=Uk(s.alternate,s,rr);s.memoizedProps=s.pendingProps,i===null?Bk(s):Vt=i,Jf.current=null}function Bk(s){var i=s;do{var d=i.alternate;if(s=i.return,(i.flags&32768)===0){if(d=r$(d,i,rr),d!==null){Vt=d;return}}else{if(d=s$(d,i),d!==null){d.flags&=32767,Vt=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Jt=6,Vt=null;return}}if(i=i.sibling,i!==null){Vt=i;return}Vt=i=s}while(i!==null);Jt===0&&(Jt=5)}function ko(s,i,d){var g=nt,v=vr.transition;try{vr.transition=null,nt=1,h$(s,i,d,g)}finally{vr.transition=v,nt=g}return null}function h$(s,i,d,g){do Ei();while(xa!==null);if((ht&6)!==0)throw Error(n(327));d=s.finishedWork;var v=s.finishedLanes;if(d===null)return null;if(s.finishedWork=null,s.finishedLanes=0,d===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var _=d.lanes|d.childLanes;if(af(s,_),s===cn&&(Vt=cn=null,mn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||rd||(rd=!0,Wk(ns,function(){return Ei(),null})),_=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||_){_=vr.transition,vr.transition=null;var R=nt;nt=1;var Z=ht;ht|=4,Jf.current=null,o$(s,d),Rk(d,s),df(pi),As=!!Wl,pi=Wl=null,s.current=d,i$(d),Ct(),ht=Z,nt=R,vr.transition=_}else s.current=d;if(rd&&(rd=!1,xa=s,sd=v),_=s.pendingLanes,_===0&&(va=null),Es(d.stateNode),zn(s,gt()),i!==null)for(g=s.onRecoverableError,d=0;d<i.length;d++)v=i[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(nd)throw nd=!1,s=np,np=null,s;return(sd&1)!==0&&s.tag!==0&&Ei(),_=s.pendingLanes,(_&1)!==0?s===rp?oc++:(oc=0,rp=s):oc=0,ma(),null}function Ei(){if(xa!==null){var s=Ha(sd),i=vr.transition,d=nt;try{if(vr.transition=null,nt=16>s?16:s,xa===null)var g=!1;else{if(s=xa,xa=null,sd=0,(ht&6)!==0)throw Error(n(331));var v=ht;for(ht|=4,Pe=s.current;Pe!==null;){var _=Pe,R=_.child;if((Pe.flags&16)!==0){var Z=_.deletions;if(Z!==null){for(var ne=0;ne<Z.length;ne++){var pe=Z[ne];for(Pe=pe;Pe!==null;){var Ne=Pe;switch(Ne.tag){case 0:case 11:case 15:rc(8,Ne,_)}var Se=Ne.child;if(Se!==null)Se.return=Ne,Pe=Se;else for(;Pe!==null;){Ne=Pe;var be=Ne.sibling,$e=Ne.return;if(jk(Ne),Ne===pe){Pe=null;break}if(be!==null){be.return=$e,Pe=be;break}Pe=$e}}}var Fe=_.alternate;if(Fe!==null){var qe=Fe.child;if(qe!==null){Fe.child=null;do{var Ht=qe.sibling;qe.sibling=null,qe=Ht}while(qe!==null)}}Pe=_}}if((_.subtreeFlags&2064)!==0&&R!==null)R.return=_,Pe=R;else e:for(;Pe!==null;){if(_=Pe,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:rc(9,_,_.return)}var ie=_.sibling;if(ie!==null){ie.return=_.return,Pe=ie;break e}Pe=_.return}}var se=s.current;for(Pe=se;Pe!==null;){R=Pe;var ce=R.child;if((R.subtreeFlags&2064)!==0&&ce!==null)ce.return=R,Pe=ce;else e:for(R=se;Pe!==null;){if(Z=Pe,(Z.flags&2048)!==0)try{switch(Z.tag){case 0:case 11:case 15:Ju(9,Z)}}catch(Be){Ft(Z,Z.return,Be)}if(Z===R){Pe=null;break e}var Ee=Z.sibling;if(Ee!==null){Ee.return=Z.return,Pe=Ee;break e}Pe=Z.return}}if(ht=v,ma(),Ln&&typeof Ln.onPostCommitFiberRoot=="function")try{Ln.onPostCommitFiberRoot(js,s)}catch{}g=!0}return g}finally{nt=d,vr.transition=i}}return!1}function zk(s,i,d){i=Ni(d,i),i=ok(s,i,1),s=ya(s,i,1),i=Rn(),s!==null&&(Rr(s,1,i),zn(s,i))}function Ft(s,i,d){if(s.tag===3)zk(s,s,d);else for(;i!==null;){if(i.tag===3){zk(i,s,d);break}else if(i.tag===1){var g=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(va===null||!va.has(g))){s=Ni(d,s),s=ik(i,s,1),i=ya(i,s,1),s=Rn(),i!==null&&(Rr(i,1,s),zn(i,s));break}}i=i.return}}function f$(s,i,d){var g=s.pingCache;g!==null&&g.delete(i),i=Rn(),s.pingedLanes|=s.suspendedLanes&d,cn===s&&(mn&d)===d&&(Jt===4||Jt===3&&(mn&130023424)===mn&&500>gt()-tp?bo(s,0):ep|=d),zn(s,i)}function Hk(s,i){i===0&&((s.mode&1)===0?i=1:(i=za,za<<=1,(za&130023424)===0&&(za=4194304)));var d=Rn();s=zs(s,i),s!==null&&(Rr(s,i,d),zn(s,d))}function p$(s){var i=s.memoizedState,d=0;i!==null&&(d=i.retryLane),Hk(s,d)}function m$(s,i){var d=0;switch(s.tag){case 13:var g=s.stateNode,v=s.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=s.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(i),Hk(s,d)}var Uk;Uk=function(s,i,d){if(s!==null)if(s.memoizedProps!==i.pendingProps||fn.current)qn=!0;else{if((s.lanes&d)===0&&(i.flags&128)===0)return qn=!1,n$(s,i,d);qn=(s.flags&131072)!==0}else qn=!1,Rt&&(i.flags&1048576)!==0&&Nb(i,Lu,i.index);switch(i.lanes=0,i.tag){case 2:var g=i.type;Zu(s,i),s=i.pendingProps;var v=pr(i,on.current);bi(i,d),v=Mf(null,i,g,s,v,d);var _=If();return i.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,bn(g)?(_=!0,Iu(i)):_=!1,i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Sf(i),v.updater=Yu,i.stateNode=v,v._reactInternals=i,Ff(i,g,s,d),i=Hf(null,i,g,!0,_,d)):(i.tag=0,Rt&&_&&mf(i),An(null,i,v,d),i=i.child),i;case 16:g=i.elementType;e:{switch(Zu(s,i),s=i.pendingProps,v=g._init,g=v(g._payload),i.type=g,v=i.tag=y$(g),s=zr(g,s),v){case 0:i=zf(null,i,g,s,d);break e;case 1:i=gk(null,i,g,s,d);break e;case 11:i=dk(null,i,g,s,d);break e;case 14:i=hk(null,i,g,zr(g.type,s),d);break e}throw Error(n(306,g,""))}return i;case 0:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:zr(g,v),zf(s,i,g,v,d);case 1:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:zr(g,v),gk(s,i,g,v,d);case 3:e:{if(yk(i),s===null)throw Error(n(387));g=i.pendingProps,_=i.memoizedState,v=_.element,Mb(s,i),zu(i,g,null,d);var R=i.memoizedState;if(g=R.element,_.isDehydrated)if(_={element:g,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},i.updateQueue.baseState=_,i.memoizedState=_,i.flags&256){v=Ni(Error(n(423)),i),i=wk(s,i,g,d,v);break e}else if(g!==v){v=Ni(Error(n(424)),i),i=wk(s,i,g,d,v);break e}else for(nr=Fr(i.stateNode.containerInfo.firstChild),tr=i,Rt=!0,Br=null,d=Ab(i,null,g,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(wi(),g===v){i=Us(s,i,d);break e}An(s,i,g,d)}i=i.child}return i;case 5:return Ob(i),s===null&&wf(i),g=i.type,v=i.pendingProps,_=s!==null?s.memoizedProps:null,R=v.children,Ds(g,v)?R=null:_!==null&&Ds(g,_)&&(i.flags|=32),mk(s,i),An(s,i,R,d),i.child;case 6:return s===null&&wf(i),null;case 13:return vk(s,i,d);case 4:return jf(i,i.stateNode.containerInfo),g=i.pendingProps,s===null?i.child=vi(i,null,g,d):An(s,i,g,d),i.child;case 11:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:zr(g,v),dk(s,i,g,v,d);case 7:return An(s,i,i.pendingProps,d),i.child;case 8:return An(s,i,i.pendingProps.children,d),i.child;case 12:return An(s,i,i.pendingProps.children,d),i.child;case 10:e:{if(g=i.type._context,v=i.pendingProps,_=i.memoizedProps,R=v.value,wt(Fu,g._currentValue),g._currentValue=R,_!==null)if(Qn(_.value,R)){if(_.children===v.children&&!fn.current){i=Us(s,i,d);break e}}else for(_=i.child,_!==null&&(_.return=i);_!==null;){var Z=_.dependencies;if(Z!==null){R=_.child;for(var ne=Z.firstContext;ne!==null;){if(ne.context===g){if(_.tag===1){ne=Hs(-1,d&-d),ne.tag=2;var pe=_.updateQueue;if(pe!==null){pe=pe.shared;var Ne=pe.pending;Ne===null?ne.next=ne:(ne.next=Ne.next,Ne.next=ne),pe.pending=ne}}_.lanes|=d,ne=_.alternate,ne!==null&&(ne.lanes|=d),Nf(_.return,d,i),Z.lanes|=d;break}ne=ne.next}}else if(_.tag===10)R=_.type===i.type?null:_.child;else if(_.tag===18){if(R=_.return,R===null)throw Error(n(341));R.lanes|=d,Z=R.alternate,Z!==null&&(Z.lanes|=d),Nf(R,d,i),R=_.sibling}else R=_.child;if(R!==null)R.return=_;else for(R=_;R!==null;){if(R===i){R=null;break}if(_=R.sibling,_!==null){_.return=R.return,R=_;break}R=R.return}_=R}An(s,i,v.children,d),i=i.child}return i;case 9:return v=i.type,g=i.pendingProps.children,bi(i,d),v=yr(v),g=g(v),i.flags|=1,An(s,i,g,d),i.child;case 14:return g=i.type,v=zr(g,i.pendingProps),v=zr(g.type,v),hk(s,i,g,v,d);case 15:return fk(s,i,i.type,i.pendingProps,d);case 17:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:zr(g,v),Zu(s,i),i.tag=1,bn(g)?(s=!0,Iu(i)):s=!1,bi(i,d),sk(i,g,v),Ff(i,g,v,d),Hf(null,i,g,!0,s,d);case 19:return bk(s,i,d);case 22:return pk(s,i,d)}throw Error(n(156,i.tag))};function Wk(s,i){return ze(s,i)}function g$(s,i,d,g){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xr(s,i,d,g){return new g$(s,i,d,g)}function cp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function y$(s){if(typeof s=="function")return cp(s)?1:0;if(s!=null){if(s=s.$$typeof,s===X)return 11;if(s===J)return 14}return 2}function Na(s,i){var d=s.alternate;return d===null?(d=xr(s.tag,i,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=i,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&14680064,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,i=s.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d}function ld(s,i,d,g,v,_){var R=2;if(g=s,typeof s=="function")cp(s)&&(R=1);else if(typeof s=="string")R=5;else e:switch(s){case I:return No(d.children,v,_,i);case B:R=8,v|=8;break;case q:return s=xr(12,d,i,v|2),s.elementType=q,s.lanes=_,s;case Y:return s=xr(13,d,i,v),s.elementType=Y,s.lanes=_,s;case M:return s=xr(19,d,i,v),s.elementType=M,s.lanes=_,s;case $:return cd(d,v,_,i);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case L:R=10;break e;case U:R=9;break e;case X:R=11;break e;case J:R=14;break e;case V:R=16,g=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return i=xr(R,d,i,v),i.elementType=s,i.type=g,i.lanes=_,i}function No(s,i,d,g){return s=xr(7,s,g,i),s.lanes=d,s}function cd(s,i,d,g){return s=xr(22,s,g,i),s.elementType=$,s.lanes=d,s.stateNode={isHidden:!1},s}function up(s,i,d){return s=xr(6,s,null,i),s.lanes=d,s}function dp(s,i,d){return i=xr(4,s.children!==null?s.children:[],s.key,i),i.lanes=d,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}function w$(s,i,d,g,v){this.tag=i,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ko(0),this.expirationTimes=Ko(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ko(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function hp(s,i,d,g,v,_,R,Z,ne){return s=new w$(s,i,d,Z,ne),i===1?(i=1,_===!0&&(i|=8)):i=0,_=xr(3,null,null,i),s.current=_,_.stateNode=s,_.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sf(_),s}function v$(s,i,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:g==null?null:""+g,children:s,containerInfo:i,implementation:d}}function Vk(s){if(!s)return fr;s=s._reactInternals;e:{if(On(s)!==s||s.tag!==1)throw Error(n(170));var i=s;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(bn(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(s.tag===1){var d=s.type;if(bn(d))return xb(s,d,i)}return i}function Gk(s,i,d,g,v,_,R,Z,ne){return s=hp(d,g,!0,s,v,_,R,Z,ne),s.context=Vk(null),d=s.current,g=Rn(),v=ba(d),_=Hs(g,v),_.callback=i??null,ya(d,_,v),s.current.lanes=v,Rr(s,v,g),zn(s,g),s}function ud(s,i,d,g){var v=i.current,_=Rn(),R=ba(v);return d=Vk(d),i.context===null?i.context=d:i.pendingContext=d,i=Hs(_,R),i.payload={element:s},g=g===void 0?null:g,g!==null&&(i.callback=g),s=ya(v,i,R),s!==null&&(Wr(s,v,R,_),Bu(s,v,R)),R}function dd(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function Kk(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<i?d:i}}function fp(s,i){Kk(s,i),(s=s.alternate)&&Kk(s,i)}function x$(){return null}var Yk=typeof reportError=="function"?reportError:function(s){console.error(s)};function pp(s){this._internalRoot=s}hd.prototype.render=pp.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(n(409));ud(s,i,null,null)},hd.prototype.unmount=pp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;xo(function(){ud(null,s,null,null)}),i[we]=null}};function hd(s){this._internalRoot=s}hd.prototype.unstable_scheduleHydration=function(s){if(s){var i=lu();s={blockedOn:null,target:s,priority:i};for(var d=0;d<Ir.length&&i!==0&&i<Ir[d].priority;d++);Ir.splice(d,0,s),d===0&&aa(s)}};function mp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function fd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Xk(){}function b$(s,i,d,g,v){if(v){if(typeof g=="function"){var _=g;g=function(){var pe=dd(R);_.call(pe)}}var R=Gk(i,g,s,0,null,!1,!1,"",Xk);return s._reactRootContainer=R,s[we]=R.current,lo(s.nodeType===8?s.parentNode:s),xo(),R}for(;v=s.lastChild;)s.removeChild(v);if(typeof g=="function"){var Z=g;g=function(){var pe=dd(ne);Z.call(pe)}}var ne=hp(s,0,!1,null,null,!1,!1,"",Xk);return s._reactRootContainer=ne,s[we]=ne.current,lo(s.nodeType===8?s.parentNode:s),xo(function(){ud(i,ne,d,g)}),ne}function pd(s,i,d,g,v){var _=d._reactRootContainer;if(_){var R=_;if(typeof v=="function"){var Z=v;v=function(){var ne=dd(R);Z.call(ne)}}ud(i,R,s,v)}else R=b$(d,i,s,v,g);return dd(R)}iu=function(s){switch(s.tag){case 3:var i=s.stateNode;if(i.current.memoizedState.isDehydrated){var d=na(i.pendingLanes);d!==0&&(Yo(i,d|1),zn(i,gt()),(ht&6)===0&&(ji=gt()+500,ma()))}break;case 13:xo(function(){var g=zs(s,1);if(g!==null){var v=Rn();Wr(g,s,1,v)}}),fp(s,1)}},Ua=function(s){if(s.tag===13){var i=zs(s,134217728);if(i!==null){var d=Rn();Wr(i,s,134217728,d)}fp(s,134217728)}},Wt=function(s){if(s.tag===13){var i=ba(s),d=zs(s,i);if(d!==null){var g=Rn();Wr(d,s,i,g)}fp(s,i)}},lu=function(){return nt},Mr=function(s,i){var d=nt;try{return nt=s,i()}finally{nt=d}},Nt=function(s,i,d){switch(i){case"input":if(ke(s,d),i=d.name,d.type==="radio"&&i!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<d.length;i++){var g=d[i];if(g!==s&&g.form===s.form){var v=Dt(g);if(!v)throw Error(n(90));De(g),ke(g,v)}}}break;case"textarea":Ie(s,d);break;case"select":i=d.value,i!=null&&at(s,!!d.multiple,i,!1)}},En=op,Gn=xo;var k$={usingClientEntryPoint:!1,Events:[Ke,Pt,Dt,It,Et,op]},ic={findFiberByHostInstance:ct,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},N$={bundleType:ic.bundleType,version:ic.version,rendererPackageName:ic.rendererPackageName,rendererConfig:ic.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Oe(s),s===null?null:s.stateNode},findFiberByHostInstance:ic.findFiberByHostInstance||x$,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 md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!md.isDisabled&&md.supportsFiber)try{js=md.inject(N$),Ln=md}catch{}}return Hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=k$,Hn.createPortal=function(s,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mp(i))throw Error(n(200));return v$(s,i,null,d)},Hn.createRoot=function(s,i){if(!mp(s))throw Error(n(299));var d=!1,g="",v=Yk;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=hp(s,1,!1,null,null,d,!1,g,v),s[we]=i.current,lo(s.nodeType===8?s.parentNode:s),new pp(i)},Hn.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Oe(i),s=s===null?null:s.stateNode,s},Hn.flushSync=function(s){return xo(s)},Hn.hydrate=function(s,i,d){if(!fd(i))throw Error(n(200));return pd(null,s,i,!0,d)},Hn.hydrateRoot=function(s,i,d){if(!mp(s))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,_="",R=Yk;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(_=d.identifierPrefix),d.onRecoverableError!==void 0&&(R=d.onRecoverableError)),i=Gk(i,null,s,1,d??null,v,!1,_,R),s[we]=i.current,lo(s),g)for(s=0;s<g.length;s++)d=g[s],v=d._getVersion,v=v(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,v]:i.mutableSourceEagerHydrationData.push(d,v);return new hd(i)},Hn.render=function(s,i,d){if(!fd(i))throw Error(n(200));return pd(null,s,i,!1,d)},Hn.unmountComponentAtNode=function(s){if(!fd(s))throw Error(n(40));return s._reactRootContainer?(xo(function(){pd(null,null,s,!1,function(){s._reactRootContainer=null,s[we]=null})}),!0):!1},Hn.unstable_batchedUpdates=op,Hn.unstable_renderSubtreeIntoContainer=function(s,i,d,g){if(!fd(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return pd(s,i,d,!1,g)},Hn.version="18.3.1-next-f1338f8080-20240426",Hn}var s1;function C2(){if(s1)return wp.exports;s1=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(),wp.exports=A$(),wp.exports}var a1;function R$(){if(a1)return yd;a1=1;var e=C2();return yd.createRoot=e.createRoot,yd.hydrateRoot=e.hydrateRoot,yd}var M$=R$();const I$="modulepreload",$$=function(e){return"/"+e},o1={},T2=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=$$(p),p in o1)return;o1[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":I$,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,j)=>{y.addEventListener("load",w),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};var x=Vc();const me=d0(x);function gn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=gn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var bp={exports:{}},kp={},Np={exports:{}},_p={};/**
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 i1;function O$(){if(i1)return _p;i1=1;var e=Vc();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),j=r({inst:{value:w,getSnapshot:y}}),k=j[0].inst,S=j[1];return l(function(){k.value=w,k.getSnapshot=y,f(k)&&S({inst:k})},[m,w,y]),a(function(){return f(k)&&S({inst:k}),m(function(){f(k)&&S({inst:k})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return _p.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,_p}var l1;function L$(){return l1||(l1=1,Np.exports=O$()),Np.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 c1;function P$(){if(c1)return kp;c1=1;var e=Vc(),t=L$();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return kp.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var j=l(null);if(j.current===null){var k={hasValue:!1,value:null};j.current=k}else k=j.current;j=u(function(){function b(A){if(!N){if(N=!0,E=A,A=y(A),w!==void 0&&k.hasValue){var I=k.value;if(w(I,A))return C=I}return C=A}if(I=C,r(E,A))return I;var B=y(A);return w!==void 0&&w(I,B)?(E=A,I):(E=A,C=B)}var N=!1,E,C,T=m===void 0?null:m;return[function(){return b(h())},T===null?void 0:function(){return b(T())}]},[h,m,y,w]);var S=a(p,j[0],j[1]);return c(function(){k.hasValue=!0,k.value=S},[S]),f(S),S},kp}var u1;function D$(){return u1||(u1=1,bp.exports=P$()),bp.exports}var F$=D$();const q$=d0(F$),B$={},d1=e=>{let t;const n=new Set,r=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(j=>j(t,w))}},a=()=>t,f={setState:r,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(B$?"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(r,a,f);return f},z$=e=>e?d1(e):d1,{useDebugValue:H$}=me,{useSyncExternalStoreWithSelector:U$}=q$,W$=e=>e;function A2(e,t=W$,n){const r=U$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return H$(r),r}const h1=(e,t)=>{const n=z$(e),r=(a,l=t)=>A2(n,a,l);return Object.assign(r,n),r},V$=(e,t)=>e?h1(e,t):h1;function rn(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[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var G$={value:()=>{}};function kh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Ud(n)}function Ud(e){this._=e}function K$(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ud.prototype=kh.prototype={constructor:Ud,on:function(e,t){var n=this._,r=K$(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l<c;)if((a=(e=r[l]).type)&&(a=Y$(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=r[l]).type)n[a]=f1(n[a],e.name,t);else if(t==null)for(a in n)n[a]=f1(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 Ud(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function Y$(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function f1(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=G$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Sx="http://www.w3.org/1999/xhtml";const p1={svg:"http://www.w3.org/2000/svg",xhtml:Sx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Nh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),p1.hasOwnProperty(t)?{space:p1[t],local:e}:e}function X$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Sx&&t.documentElement.namespaceURI===Sx?t.createElement(e):t.createElementNS(n,e)}}function Z$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function R2(e){var t=Nh(e);return(t.local?Z$:X$)(t)}function Q$(){}function h0(e){return e==null?Q$:function(){return this.querySelector(e)}}function J$(e){typeof e!="function"&&(e=h0(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[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 ir(r,this._parents)}function eO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function tO(){return[]}function M2(e){return e==null?tO:function(){return this.querySelectorAll(e)}}function nO(e){return function(){return eO(e.apply(this,arguments))}}function rO(e){typeof e=="function"?e=nO(e):e=M2(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(r.push(e.call(f,f.__data__,p,c)),a.push(f));return new ir(r,a)}function I2(e){return function(){return this.matches(e)}}function $2(e){return function(t){return t.matches(e)}}var sO=Array.prototype.find;function aO(e){return function(){return sO.call(this.children,e)}}function oO(){return this.firstElementChild}function iO(e){return this.select(e==null?oO:aO(typeof e=="function"?e:$2(e)))}var lO=Array.prototype.filter;function cO(){return Array.from(this.children)}function uO(e){return function(){return lO.call(this.children,e)}}function dO(e){return this.selectAll(e==null?cO:uO(typeof e=="function"?e:$2(e)))}function hO(e){typeof e!="function"&&(e=I2(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new ir(r,this._parents)}function O2(e){return new Array(e.length)}function fO(){return new ir(this._enter||this._groups.map(O2),this._parents)}function Qd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qd.prototype={constructor:Qd,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 pO(e){return function(){return e}}function mO(e,t,n,r,a,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],r[c]=u):n[c]=new Qd(e,l[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function gO(e,t,n,r,a,l,c){var u,f,p=new Map,h=t.length,m=l.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,l[u],u,l)+"",(f=p.get(w))?(r[u]=f,f.__data__=l[u],p.delete(w)):n[u]=new Qd(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function yO(e){return e.__data__}function wO(e,t){if(!arguments.length)return Array.from(this,yO);var n=t?gO:mO,r=this._parents,a=this._groups;typeof e!="function"&&(e=pO(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=r[p],m=a[p],y=m.length,w=vO(e.call(h,h&&h.__data__,p,r)),j=w.length,k=u[p]=new Array(j),S=c[p]=new Array(j),b=f[p]=new Array(y);n(h,m,k,S,b,w,t);for(var N=0,E=0,C,T;N<j;++N)if(C=k[N]){for(N>=E&&(E=N+1);!(T=S[E])&&++E<j;);C._next=T||null}}return c=new ir(c,r),c._enter=u,c._exit=f,c}function vO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function xO(){return new ir(this._exit||this._groups.map(O2),this._parents)}function bO(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function kO(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,c=Math.min(a,l),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=r[f],m=p.length,y=u[f]=new Array(m),w,j=0;j<m;++j)(w=p[j]||h[j])&&(y[j]=w);for(;f<a;++f)u[f]=n[f];return new ir(u,this._parents)}function NO(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],c;--a>=0;)(c=r[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function _O(e){e||(e=SO);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++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 ir(a,this._parents).order()}function SO(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function EO(){return Array.from(this)}function CO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var c=r[a];if(c)return c}return null}function TO(){let e=0;for(const t of this)++e;return e}function AO(){return!this.node()}function RO(e){for(var t=this._groups,n=0,r=t.length;n<r;++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 MO(e){return function(){this.removeAttribute(e)}}function IO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $O(e,t){return function(){this.setAttribute(e,t)}}function OO(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function LO(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function PO(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 DO(e,t){var n=Nh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?IO:MO:typeof t=="function"?n.local?PO:LO:n.local?OO:$O)(n,t))}function L2(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function FO(e){return function(){this.style.removeProperty(e)}}function qO(e,t,n){return function(){this.style.setProperty(e,t,n)}}function BO(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function zO(e,t,n){return arguments.length>1?this.each((t==null?FO:typeof t=="function"?BO:qO)(e,t,n??"")):Xi(this.node(),e)}function Xi(e,t){return e.style.getPropertyValue(t)||L2(e).getComputedStyle(e,null).getPropertyValue(t)}function HO(e){return function(){delete this[e]}}function UO(e,t){return function(){this[e]=t}}function WO(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function VO(e,t){return arguments.length>1?this.each((t==null?HO:typeof t=="function"?WO:UO)(e,t)):this.node()[e]}function P2(e){return e.trim().split(/^|\s+/)}function f0(e){return e.classList||new D2(e)}function D2(e){this._node=e,this._names=P2(e.getAttribute("class")||"")}D2.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 F2(e,t){for(var n=f0(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function q2(e,t){for(var n=f0(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function GO(e){return function(){F2(this,e)}}function KO(e){return function(){q2(this,e)}}function YO(e,t){return function(){(t.apply(this,arguments)?F2:q2)(this,e)}}function XO(e,t){var n=P2(e+"");if(arguments.length<2){for(var r=f0(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?YO:t?GO:KO)(n,t))}function ZO(){this.textContent=""}function QO(e){return function(){this.textContent=e}}function JO(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function e3(e){return arguments.length?this.each(e==null?ZO:(typeof e=="function"?JO:QO)(e)):this.node().textContent}function t3(){this.innerHTML=""}function n3(e){return function(){this.innerHTML=e}}function r3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function s3(e){return arguments.length?this.each(e==null?t3:(typeof e=="function"?r3:n3)(e)):this.node().innerHTML}function a3(){this.nextSibling&&this.parentNode.appendChild(this)}function o3(){return this.each(a3)}function i3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function l3(){return this.each(i3)}function c3(e){var t=typeof e=="function"?e:R2(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function u3(){return null}function d3(e,t){var n=typeof e=="function"?e:R2(e),r=t==null?u3:typeof t=="function"?t:h0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function h3(){var e=this.parentNode;e&&e.removeChild(this)}function f3(){return this.each(h3)}function p3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function m3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function g3(e){return this.select(e?m3:p3)}function y3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function w3(e){return function(t){e.call(this,t,this.__data__)}}function v3(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function x3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-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[++r]=l;++r?t.length=r:delete this.__on}}}function b3(e,t,n){return function(){var r=this.__on,a,l=w3(t);if(r){for(var c=0,u=r.length;c<u;++c)if((a=r[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},r?r.push(a):this.__on=[a]}}function k3(e,t,n){var r=v3(e+""),a,l=r.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=r[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?b3:x3,a=0;a<l;++a)this.each(u(r[a],t,n));return this}function B2(e,t,n){var r=L2(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function N3(e,t){return function(){return B2(this,e,t)}}function _3(e,t){return function(){return B2(this,e,t.apply(this,arguments))}}function S3(e,t){return this.each((typeof t=="function"?_3:N3)(e,t))}function*j3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,c;a<l;++a)(c=r[a])&&(yield c)}var z2=[null];function ir(e,t){this._groups=e,this._parents=t}function Gc(){return new ir([[document.documentElement]],z2)}function E3(){return this}ir.prototype=Gc.prototype={constructor:ir,select:J$,selectAll:rO,selectChild:iO,selectChildren:dO,filter:hO,data:wO,enter:fO,exit:xO,join:bO,merge:kO,selection:E3,order:NO,sort:_O,call:jO,nodes:EO,node:CO,size:TO,empty:AO,each:RO,attr:DO,style:zO,property:VO,classed:XO,text:e3,html:s3,raise:o3,lower:l3,append:c3,insert:d3,remove:f3,clone:g3,datum:y3,on:k3,dispatch:S3,[Symbol.iterator]:j3};function Nr(e){return typeof e=="string"?new ir([[document.querySelector(e)]],[document.documentElement]):new ir([[e]],z2)}function C3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Gr(e,t){if(e=C3(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const T3={passive:!1},Tc={capture:!0,passive:!1};function Sp(e){e.stopImmediatePropagation()}function Wi(e){e.preventDefault(),e.stopImmediatePropagation()}function H2(e){var t=e.document.documentElement,n=Nr(e).on("dragstart.drag",Wi,Tc);"onselectstart"in t?n.on("selectstart.drag",Wi,Tc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function U2(e,t){var n=e.document.documentElement,r=Nr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Wi,Tc),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const wd=e=>()=>e;function jx(e,{sourceEvent:t,subject:n,target:r,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:r,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}})}jx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function A3(e){return!e.ctrlKey&&!e.button}function R3(){return this.parentNode}function M3(e,t){return t??{x:e.x,y:e.y}}function I3(){return navigator.maxTouchPoints||"ontouchstart"in this}function $3(){var e=A3,t=R3,n=M3,r=I3,a={},l=kh("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(r).on("touchstart.drag",S).on("touchmove.drag",b,T3).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var A=E(this,t.call(this,C,T),C,T,"mouse");A&&(Nr(C.view).on("mousemove.drag",j,Tc).on("mouseup.drag",k,Tc),H2(C.view),Sp(C),p=!1,u=C.clientX,f=C.clientY,A("start",C))}}function j(C){if(Wi(C),!p){var T=C.clientX-u,A=C.clientY-f;p=T*T+A*A>m}a.mouse("drag",C)}function k(C){Nr(C.view).on("mousemove.drag mouseup.drag",null),U2(C.view,p),Wi(C),a.mouse("end",C)}function S(C,T){if(e.call(this,C,T)){var A=C.changedTouches,I=t.call(this,C,T),B=A.length,q,L;for(q=0;q<B;++q)(L=E(this,I,C,T,A[q].identifier,A[q]))&&(Sp(C),L("start",C,A[q]))}}function b(C){var T=C.changedTouches,A=T.length,I,B;for(I=0;I<A;++I)(B=a[T[I].identifier])&&(Wi(C),B("drag",C,T[I]))}function N(C){var T=C.changedTouches,A=T.length,I,B;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<A;++I)(B=a[T[I].identifier])&&(Sp(C),B("end",C,T[I]))}function E(C,T,A,I,B,q){var L=l.copy(),U=Gr(q||A,T),X,Y,M;if((M=n.call(C,new jx("beforestart",{sourceEvent:A,target:y,identifier:B,active:c,x:U[0],y:U[1],dx:0,dy:0,dispatch:L}),I))!=null)return X=M.x-U[0]||0,Y=M.y-U[1]||0,function J(V,$,z){var W=U,G;switch(V){case"start":a[B]=J,G=c++;break;case"end":delete a[B],--c;case"drag":U=Gr(z||$,T),G=c;break}L.call(V,C,new jx(V,{sourceEvent:$,subject:M,target:y,identifier:B,active:G,x:U[0]+X,y:U[1]+Y,dx:U[0]-W[0],dy:U[1]-W[1],dispatch:L}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:wd(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:wd(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:wd(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:wd(!!C),y):r},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function p0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function W2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Kc(){}var Ac=.7,Jd=1/Ac,Vi="\\s*([+-]?\\d+)\\s*",Rc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",O3=/^#([0-9a-f]{3,8})$/,L3=new RegExp(`^rgb\\(${Vi},${Vi},${Vi}\\)$`),P3=new RegExp(`^rgb\\(${ws},${ws},${ws}\\)$`),D3=new RegExp(`^rgba\\(${Vi},${Vi},${Vi},${Rc}\\)$`),F3=new RegExp(`^rgba\\(${ws},${ws},${ws},${Rc}\\)$`),q3=new RegExp(`^hsl\\(${Rc},${ws},${ws}\\)$`),B3=new RegExp(`^hsla\\(${Rc},${ws},${ws},${Rc}\\)$`),m1={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};p0(Kc,Mc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:g1,formatHex:g1,formatHex8:z3,formatHsl:H3,formatRgb:y1,toString:y1});function g1(){return this.rgb().formatHex()}function z3(){return this.rgb().formatHex8()}function H3(){return V2(this).formatHsl()}function y1(){return this.rgb().formatRgb()}function Mc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=O3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?w1(t):n===3?new Un(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vd(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=L3.exec(e))?new Un(t[1],t[2],t[3],1):(t=P3.exec(e))?new Un(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=D3.exec(e))?vd(t[1],t[2],t[3],t[4]):(t=F3.exec(e))?vd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=q3.exec(e))?b1(t[1],t[2]/100,t[3]/100,1):(t=B3.exec(e))?b1(t[1],t[2]/100,t[3]/100,t[4]):m1.hasOwnProperty(e)?w1(m1[e]):e==="transparent"?new Un(NaN,NaN,NaN,0):null}function w1(e){return new Un(e>>16&255,e>>8&255,e&255,1)}function vd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Un(e,t,n,r)}function U3(e){return e instanceof Kc||(e=Mc(e)),e?(e=e.rgb(),new Un(e.r,e.g,e.b,e.opacity)):new Un}function Ex(e,t,n,r){return arguments.length===1?U3(e):new Un(e,t,n,r??1)}function Un(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}p0(Un,Ex,W2(Kc,{brighter(e){return e=e==null?Jd:Math.pow(Jd,e),new Un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ac:Math.pow(Ac,e),new Un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Un(Ao(this.r),Ao(this.g),Ao(this.b),eh(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:v1,formatHex:v1,formatHex8:W3,formatRgb:x1,toString:x1}));function v1(){return`#${Eo(this.r)}${Eo(this.g)}${Eo(this.b)}`}function W3(){return`#${Eo(this.r)}${Eo(this.g)}${Eo(this.b)}${Eo((isNaN(this.opacity)?1:this.opacity)*255)}`}function x1(){const e=eh(this.opacity);return`${e===1?"rgb(":"rgba("}${Ao(this.r)}, ${Ao(this.g)}, ${Ao(this.b)}${e===1?")":`, ${e})`}`}function eh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ao(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Eo(e){return e=Ao(e),(e<16?"0":"")+e.toString(16)}function b1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Yr(e,t,n,r)}function V2(e){if(e instanceof Yr)return new Yr(e.h,e.s,e.l,e.opacity);if(e instanceof Kc||(e=Mc(e)),!e)return new Yr;if(e instanceof Yr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,u=l-a,f=(l+a)/2;return u?(t===l?c=(n-r)/u+(n<r)*6:n===l?c=(r-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 Yr(c,u,f,e.opacity)}function V3(e,t,n,r){return arguments.length===1?V2(e):new Yr(e,t,n,r??1)}function Yr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}p0(Yr,V3,W2(Kc,{brighter(e){return e=e==null?Jd:Math.pow(Jd,e),new Yr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ac:Math.pow(Ac,e),new Yr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Un(jp(e>=240?e-240:e+120,a,r),jp(e,a,r),jp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Yr(k1(this.h),xd(this.s),xd(this.l),eh(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=eh(this.opacity);return`${e===1?"hsl(":"hsla("}${k1(this.h)}, ${xd(this.s)*100}%, ${xd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function k1(e){return e=(e||0)%360,e<0?e+360:e}function xd(e){return Math.max(0,Math.min(1,e||0))}function jp(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 G2=e=>()=>e;function G3(e,t){return function(n){return e+n*t}}function K3(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Y3(e){return(e=+e)==1?K2:function(t,n){return n-t?K3(t,n,e):G2(isNaN(t)?n:t)}}function K2(e,t){var n=t-e;return n?G3(e,n):G2(isNaN(e)?t:e)}const N1=(function e(t){var n=Y3(t);function r(a,l){var c=n((a=Ex(a)).r,(l=Ex(l)).r),u=n(a.g,l.g),f=n(a.b,l.b),p=K2(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 r.gamma=e,r})(1);function Ta(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Cx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ep=new RegExp(Cx.source,"g");function X3(e){return function(){return e}}function Z3(e){return function(t){return e(t)+""}}function Q3(e,t){var n=Cx.lastIndex=Ep.lastIndex=0,r,a,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=Cx.exec(e))&&(a=Ep.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(r=r[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:Ta(r,a)})),n=Ep.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?Z3(f[0].x):X3(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var _1=180/Math.PI,Tx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Y2(e,t,n,r,a,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*_1,skewX:Math.atan(f)*_1,scaleX:c,scaleY:u}}var bd;function J3(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Tx:Y2(t.a,t.b,t.c,t.d,t.e,t.f)}function eL(e){return e==null||(bd||(bd=document.createElementNS("http://www.w3.org/2000/svg","g")),bd.setAttribute("transform",e),!(e=bd.transform.baseVal.consolidate()))?Tx:(e=e.matrix,Y2(e.a,e.b,e.c,e.d,e.e,e.f))}function X2(e,t,n,r){function a(p){return p.length?p.pop()+" ":""}function l(p,h,m,y,w,j){if(p!==m||h!==y){var k=w.push("translate(",null,t,null,n);j.push({i:k-4,x:Ta(p,m)},{i:k-2,x:Ta(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,r)-2,x:Ta(p,h)})):h&&m.push(a(m)+"rotate("+h+r)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,r)-2,x:Ta(p,h)}):h&&m.push(a(m)+"skewX("+h+r)}function f(p,h,m,y,w,j){if(p!==m||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");j.push({i:k-4,x:Ta(p,m)},{i:k-2,x:Ta(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),l(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var j=-1,k=y.length,S;++j<k;)m[(S=y[j]).i]=S.x(w);return m.join("")}}}var tL=X2(J3,"px, ","px)","deg)"),nL=X2(eL,", ",")",")"),rL=1e-12;function S1(e){return((e=Math.exp(e))+1/e)/2}function sL(e){return((e=Math.exp(e))-1/e)/2}function aL(e){return((e=Math.exp(2*e))-1)/(e+1)}const oL=(function e(t,n,r){function a(l,c){var u=l[0],f=l[1],p=l[2],h=c[0],m=c[1],y=c[2],w=h-u,j=m-f,k=w*w+j*j,S,b;if(k<rL)b=Math.log(y/p)/t,S=function(I){return[u+I*w,f+I*j,p*Math.exp(t*I*b)]};else{var N=Math.sqrt(k),E=(y*y-p*p+r*k)/(2*p*n*N),C=(y*y-p*p-r*k)/(2*y*n*N),T=Math.log(Math.sqrt(E*E+1)-E),A=Math.log(Math.sqrt(C*C+1)-C);b=(A-T)/t,S=function(I){var B=I*b,q=S1(T),L=p/(n*N)*(q*aL(t*B+T)-sL(T));return[u+L*w,f+L*j,p*q/S1(t*B+T)]}}return S.duration=b*1e3*t/Math.SQRT2,S}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 Zi=0,vc=0,cc=0,Z2=1e3,th,xc,nh=0,Oo=0,_h=0,Ic=typeof performance=="object"&&performance.now?performance:Date,Q2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function m0(){return Oo||(Q2(iL),Oo=Ic.now()+_h)}function iL(){Oo=0}function rh(){this._call=this._time=this._next=null}rh.prototype=J2.prototype={constructor:rh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?m0():+n)+(t==null?0:+t),!this._next&&xc!==this&&(xc?xc._next=this:th=this,xc=this),this._call=e,this._time=n,Ax()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ax())}};function J2(e,t,n){var r=new rh;return r.restart(e,t,n),r}function lL(){m0(),++Zi;for(var e=th,t;e;)(t=Oo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Zi}function j1(){Oo=(nh=Ic.now())+_h,Zi=vc=0;try{lL()}finally{Zi=0,uL(),Oo=0}}function cL(){var e=Ic.now(),t=e-nh;t>Z2&&(_h-=t,nh=e)}function uL(){for(var e,t=th,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:th=n);xc=e,Ax(r)}function Ax(e){if(!Zi){vc&&(vc=clearTimeout(vc));var t=e-Oo;t>24?(e<1/0&&(vc=setTimeout(j1,e-Ic.now()-_h)),cc&&(cc=clearInterval(cc))):(cc||(nh=Ic.now(),cc=setInterval(cL,Z2)),Zi=1,Q2(j1))}}function E1(e,t,n){var r=new rh;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var dL=kh("start","end","cancel","interrupt"),hL=[],eA=0,C1=1,Rx=2,Wd=3,T1=4,Mx=5,Vd=6;function Sh(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;fL(e,n,{name:t,index:r,group:a,on:dL,tween:hL,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:eA})}function g0(e,t){var n=es(e,t);if(n.state>eA)throw new Error("too late; already scheduled");return n}function bs(e,t){var n=es(e,t);if(n.state>Wd)throw new Error("too late; already running");return n}function es(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fL(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=J2(l,0,n.time);function l(p){n.state=C1,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==C1)return f();for(h in r)if(w=r[h],w.name===n.name){if(w.state===Wd)return E1(c);w.state===T1?(w.state=Vd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=Vd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(E1(function(){n.state===Wd&&(n.state=T1,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Rx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rx){for(n.state=Wd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Mx,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Mx&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Vd,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function Gd(e,t){var n=e.__transition,r,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((r=n[c]).name!==t){l=!1;continue}a=r.state>Rx&&r.state<Mx,r.state=Vd,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}l&&delete e.__transition}}function pL(e){return this.each(function(){Gd(this,e)})}function mL(e,t){var n,r;return function(){var a=bs(this,e),l=a.tween;if(l!==n){r=n=l;for(var c=0,u=r.length;c<u;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}a.tween=r}}function gL(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=bs(this,e),c=l.tween;if(c!==r){a=(r=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 yL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=es(this.node(),n).tween,a=0,l=r.length,c;a<l;++a)if((c=r[a]).name===e)return c.value;return null}return this.each((t==null?mL:gL)(n,e,t))}function y0(e,t,n){var r=e._id;return e.each(function(){var a=bs(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return es(a,r).value[t]}}function tA(e,t){var n;return(typeof t=="number"?Ta:t instanceof Mc?N1:(n=Mc(t))?(t=n,N1):Q3)(e,t)}function wL(e){return function(){this.removeAttribute(e)}}function vL(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xL(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===r?l:l=t(r=c,n)}}function bL(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===r?l:l=t(r=c,n)}}function kL(e,t,n){var r,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===r&&f===a?l:(a=f,l=t(r=c,u)))}}function NL(e,t,n){var r,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===r&&f===a?l:(a=f,l=t(r=c,u)))}}function _L(e,t){var n=Nh(e),r=n==="transform"?nL:tA;return this.attrTween(e,typeof t=="function"?(n.local?NL:kL)(n,r,y0(this,"attr."+e,t)):t==null?(n.local?vL:wL)(n):(n.local?bL:xL)(n,r,t))}function SL(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jL(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function EL(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&jL(e,l)),n}return a._value=t,a}function CL(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&SL(e,l)),n}return a._value=t,a}function TL(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 r=Nh(e);return this.tween(n,(r.local?EL:CL)(r,t))}function AL(e,t){return function(){g0(this,e).delay=+t.apply(this,arguments)}}function RL(e,t){return t=+t,function(){g0(this,e).delay=t}}function ML(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?AL:RL)(t,e)):es(this.node(),t).delay}function IL(e,t){return function(){bs(this,e).duration=+t.apply(this,arguments)}}function $L(e,t){return t=+t,function(){bs(this,e).duration=t}}function OL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IL:$L)(t,e)):es(this.node(),t).duration}function LL(e,t){if(typeof t!="function")throw new Error;return function(){bs(this,e).ease=t}}function PL(e){var t=this._id;return arguments.length?this.each(LL(t,e)):es(this.node(),t).ease}function DL(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;bs(this,e).ease=n}}function FL(e){if(typeof e!="function")throw new Error;return this.each(DL(this._id,e))}function qL(e){typeof e!="function"&&(e=I2(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Xs(r,this._parents,this._name,this._id)}function BL(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),c=new Array(r),u=0;u<l;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<r;++u)c[u]=t[u];return new Xs(c,this._parents,this._name,this._id)}function zL(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 HL(e,t,n){var r,a,l=zL(t)?g0:bs;return function(){var c=l(this,e),u=c.on;u!==r&&(a=(r=u).copy()).on(t,n),c.on=a}}function UL(e,t){var n=this._id;return arguments.length<2?es(this.node(),n).on.on(e):this.each(HL(n,e,t))}function WL(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function VL(){return this.on("end.remove",WL(this._id))}function GL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=h0(e));for(var r=this._groups,a=r.length,l=new Array(a),c=0;c<a;++c)for(var u=r[c],f=u.length,p=l[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,Sh(p[y],t,n,y,p,es(h,n)));return new Xs(l,this._parents,t,n)}function KL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=M2(e));for(var r=this._groups,a=r.length,l=[],c=[],u=0;u<a;++u)for(var f=r[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,j=es(h,n),k=0,S=y.length;k<S;++k)(w=y[k])&&Sh(w,t,n,k,y,j);l.push(y),c.push(h)}return new Xs(l,c,t,n)}var YL=Gc.prototype.constructor;function XL(){return new YL(this._groups,this._parents)}function ZL(e,t){var n,r,a;return function(){var l=Xi(this,e),c=(this.style.removeProperty(e),Xi(this,e));return l===c?null:l===n&&c===r?a:a=t(n=l,r=c)}}function nA(e){return function(){this.style.removeProperty(e)}}function QL(e,t,n){var r,a=n+"",l;return function(){var c=Xi(this,e);return c===a?null:c===r?l:l=t(r=c,n)}}function JL(e,t,n){var r,a,l;return function(){var c=Xi(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Xi(this,e))),c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u))}}function eP(e,t){var n,r,a,l="style."+t,c="end."+l,u;return function(){var f=bs(this,e),p=f.on,h=f.value[l]==null?u||(u=nA(t)):void 0;(p!==n||a!==h)&&(r=(n=p).copy()).on(c,a=h),f.on=r}}function tP(e,t,n){var r=(e+="")=="transform"?tL:tA;return t==null?this.styleTween(e,ZL(e,r)).on("end.style."+e,nA(e)):typeof t=="function"?this.styleTween(e,JL(e,r,y0(this,"style."+e,t))).each(eP(this._id,e)):this.styleTween(e,QL(e,r,t),n).on("end.style."+e,null)}function nP(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function rP(e,t,n){var r,a;function l(){var c=t.apply(this,arguments);return c!==a&&(r=(a=c)&&nP(e,c,n)),r}return l._value=t,l}function sP(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,rP(e,t,n??""))}function aP(e){return function(){this.textContent=e}}function oP(e){return function(){var t=e(this);this.textContent=t??""}}function iP(e){return this.tween("text",typeof e=="function"?oP(y0(this,"text",e)):aP(e==null?"":e+""))}function lP(e){return function(t){this.textContent=e.call(this,t)}}function cP(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&lP(a)),t}return r._value=e,r}function uP(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,cP(e))}function dP(){for(var e=this._name,t=this._id,n=rA(),r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=es(f,t);Sh(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Xs(r,this._parents,e,n)}function hP(){var e,t,n=this,r=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=bs(this,r),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 fP=0;function Xs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function rA(){return++fP}var Vs=Gc.prototype;Xs.prototype={constructor:Xs,select:GL,selectAll:KL,selectChild:Vs.selectChild,selectChildren:Vs.selectChildren,filter:qL,merge:BL,selection:XL,transition:dP,call:Vs.call,nodes:Vs.nodes,node:Vs.node,size:Vs.size,empty:Vs.empty,each:Vs.each,on:UL,attr:_L,attrTween:TL,style:tP,styleTween:sP,text:iP,textTween:uP,remove:VL,tween:yL,delay:ML,duration:OL,ease:PL,easeVarying:FL,end:hP,[Symbol.iterator]:Vs[Symbol.iterator]};function pP(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mP={time:null,delay:0,duration:250,ease:pP};function gP(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 yP(e){var t,n;e instanceof Xs?(t=e._id,e=e._name):(t=rA(),(n=mP).time=m0(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&Sh(f,e,t,p,c,n||gP(f,t));return new Xs(r,this._parents,e,t)}Gc.prototype.interrupt=pL;Gc.prototype.transition=yP;const kd=e=>()=>e;function wP(e,{sourceEvent:t,target:n,transform:r,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:r,enumerable:!0,configurable:!0},_:{value:a}})}function Gs(e,t,n){this.k=e,this.x=t,this.y=n}Gs.prototype={constructor:Gs,scale:function(e){return e===1?this:new Gs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Gs(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ys=new Gs(1,0,0);Gs.prototype;function Cp(e){e.stopImmediatePropagation()}function uc(e){e.preventDefault(),e.stopImmediatePropagation()}function vP(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function xP(){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 A1(){return this.__zoom||Ys}function bP(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function kP(){return navigator.maxTouchPoints||"ontouchstart"in this}function NP(e,t,n){var r=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>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function sA(){var e=vP,t=xP,n=NP,r=bP,a=kP,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=oL,p=kh("start","zoom","end"),h,m,y,w=500,j=150,k=0,S=10;function b(M){M.property("__zoom",A1).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",U).on("touchmove.zoom",X).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,J,V,$){var z=M.selection?M.selection():M;z.property("__zoom",A1),M!==z?T(M,J,V,$):z.interrupt().each(function(){A(this,arguments).event($).start().zoom(null,typeof J=="function"?J.apply(this,arguments):J).end()})},b.scaleBy=function(M,J,V,$){b.scaleTo(M,function(){var z=this.__zoom.k,W=typeof J=="function"?J.apply(this,arguments):J;return z*W},V,$)},b.scaleTo=function(M,J,V,$){b.transform(M,function(){var z=t.apply(this,arguments),W=this.__zoom,G=V==null?C(z):typeof V=="function"?V.apply(this,arguments):V,F=W.invert(G),K=typeof J=="function"?J.apply(this,arguments):J;return n(E(N(W,K),G,F),z,c)},V,$)},b.translateBy=function(M,J,V,$){b.transform(M,function(){return n(this.__zoom.translate(typeof J=="function"?J.apply(this,arguments):J,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),c)},null,$)},b.translateTo=function(M,J,V,$,z){b.transform(M,function(){var W=t.apply(this,arguments),G=this.__zoom,F=$==null?C(W):typeof $=="function"?$.apply(this,arguments):$;return n(Ys.translate(F[0],F[1]).scale(G.k).translate(typeof J=="function"?-J.apply(this,arguments):-J,typeof V=="function"?-V.apply(this,arguments):-V),W,c)},$,z)};function N(M,J){return J=Math.max(l[0],Math.min(l[1],J)),J===M.k?M:new Gs(J,M.x,M.y)}function E(M,J,V){var $=J[0]-V[0]*M.k,z=J[1]-V[1]*M.k;return $===M.x&&z===M.y?M:new Gs(M.k,$,z)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,J,V,$){M.on("start.zoom",function(){A(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event($).end()}).tween("zoom",function(){var z=this,W=arguments,G=A(z,W).event($),F=t.apply(z,W),K=V==null?C(F):typeof V=="function"?V.apply(z,W):V,de=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),H=z.__zoom,Q=typeof J=="function"?J.apply(z,W):J,O=f(H.invert(K).concat(de/H.k),Q.invert(K).concat(de/Q.k));return function(te){if(te===1)te=Q;else{var ae=O(te),he=de/ae[2];te=new Gs(he,K[0]-ae[0]*he,K[1]-ae[1]*he)}G.zoom(null,te)}})}function A(M,J,V){return!V&&M.__zooming||new I(M,J)}function I(M,J){this.that=M,this.args=J,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,J),this.taps=0}I.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,J){return this.mouse&&M!=="mouse"&&(this.mouse[1]=J.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=J.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=J.invert(this.touch1[0])),this.that.__zoom=J,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var J=Nr(this.that).datum();p.call(M,this.that,new wP(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),J)}};function B(M,...J){if(!e.apply(this,arguments))return;var V=A(this,J).event(M),$=this.__zoom,z=Math.max(l[0],Math.min(l[1],$.k*Math.pow(2,r.apply(this,arguments)))),W=Gr(M);if(V.wheel)(V.mouse[0][0]!==W[0]||V.mouse[0][1]!==W[1])&&(V.mouse[1]=$.invert(V.mouse[0]=W)),clearTimeout(V.wheel);else{if($.k===z)return;V.mouse=[W,$.invert(W)],Gd(this),V.start()}uc(M),V.wheel=setTimeout(G,j),V.zoom("mouse",n(E(N($,z),V.mouse[0],V.mouse[1]),V.extent,c));function G(){V.wheel=null,V.end()}}function q(M,...J){if(y||!e.apply(this,arguments))return;var V=M.currentTarget,$=A(this,J,!0).event(M),z=Nr(M.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",de,!0),W=Gr(M,V),G=M.clientX,F=M.clientY;H2(M.view),Cp(M),$.mouse=[W,this.__zoom.invert(W)],Gd(this),$.start();function K(H){if(uc(H),!$.moved){var Q=H.clientX-G,O=H.clientY-F;$.moved=Q*Q+O*O>k}$.event(H).zoom("mouse",n(E($.that.__zoom,$.mouse[0]=Gr(H,V),$.mouse[1]),$.extent,c))}function de(H){z.on("mousemove.zoom mouseup.zoom",null),U2(H.view,$.moved),uc(H),$.event(H).end()}}function L(M,...J){if(e.apply(this,arguments)){var V=this.__zoom,$=Gr(M.changedTouches?M.changedTouches[0]:M,this),z=V.invert($),W=V.k*(M.shiftKey?.5:2),G=n(E(N(V,W),$,z),t.apply(this,J),c);uc(M),u>0?Nr(this).transition().duration(u).call(T,G,$,M):Nr(this).call(b.transform,G,$,M)}}function U(M,...J){if(e.apply(this,arguments)){var V=M.touches,$=V.length,z=A(this,J,M.changedTouches.length===$).event(M),W,G,F,K;for(Cp(M),G=0;G<$;++G)F=V[G],K=Gr(F,this),K=[K,this.__zoom.invert(K),F.identifier],z.touch0?!z.touch1&&z.touch0[2]!==K[2]&&(z.touch1=K,z.taps=0):(z.touch0=K,W=!0,z.taps=1+!!h);h&&(h=clearTimeout(h)),W&&(z.taps<2&&(m=K[0],h=setTimeout(function(){h=null},w)),Gd(this),z.start())}}function X(M,...J){if(this.__zooming){var V=A(this,J).event(M),$=M.changedTouches,z=$.length,W,G,F,K;for(uc(M),W=0;W<z;++W)G=$[W],F=Gr(G,this),V.touch0&&V.touch0[2]===G.identifier?V.touch0[0]=F:V.touch1&&V.touch1[2]===G.identifier&&(V.touch1[0]=F);if(G=V.that.__zoom,V.touch1){var de=V.touch0[0],H=V.touch0[1],Q=V.touch1[0],O=V.touch1[1],te=(te=Q[0]-de[0])*te+(te=Q[1]-de[1])*te,ae=(ae=O[0]-H[0])*ae+(ae=O[1]-H[1])*ae;G=N(G,Math.sqrt(te/ae)),F=[(de[0]+Q[0])/2,(de[1]+Q[1])/2],K=[(H[0]+O[0])/2,(H[1]+O[1])/2]}else if(V.touch0)F=V.touch0[0],K=V.touch0[1];else return;V.zoom("touch",n(E(G,F,K),V.extent,c))}}function Y(M,...J){if(this.__zooming){var V=A(this,J).event(M),$=M.changedTouches,z=$.length,W,G;for(Cp(M),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),W=0;W<z;++W)G=$[W],V.touch0&&V.touch0[2]===G.identifier?delete V.touch0:V.touch1&&V.touch1[2]===G.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(G=Gr(G,this),Math.hypot(m[0]-G[0],m[1]-G[1])<S)){var F=Nr(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:kd(+M),b):r},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:kd(!!M),b):e},b.touchable=function(M){return arguments.length?(a=typeof M=="function"?M:kd(!!M),b):a},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:kd([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),b):t},b.scaleExtent=function(M){return arguments.length?(l[0]=+M[0],l[1]=+M[1],b):[l[0],l[1]]},b.translateExtent=function(M){return arguments.length?(c[0][0]=+M[0][0],c[1][0]=+M[1][0],c[0][1]=+M[0][1],c[1][1]=+M[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(M){return arguments.length?(n=M,b):n},b.duration=function(M){return arguments.length?(u=+M,b):u},b.interpolate=function(M){return arguments.length?(f=M,b):f},b.on=function(){var M=p.on.apply(p,arguments);return M===p?b:M},b.clickDistance=function(M){return arguments.length?(k=(M=+M)*M,b):Math.sqrt(k)},b.tapDistance=function(M){return arguments.length?(S=+M,b):S},b}var Sn=C2();const jh=x.createContext(null),_P=jh.Provider,Zs={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.`},aA=Zs.error001();function mt(e,t){const n=x.useContext(jh);if(n===null)throw new Error(aA);return A2(n,e,t)}const Gt=()=>{const e=x.useContext(jh);if(e===null)throw new Error(aA);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},SP=e=>e.userSelectionActive?"none":"all";function w0({position:e,children:t,className:n,style:r,...a}){const l=mt(SP),c=`${e}`.split("-");return me.createElement("div",{className:gn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:l},...a},t)}function jP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:me.createElement(w0,{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"},me.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const EP=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),j=gn(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const k=m.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:me.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:j,visibility:y.width?"visible":"hidden",...h},a&&me.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}),me.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var CP=x.memo(EP);const v0=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),x0=(e={x:0,y:0},t)=>({x:Qi(e.x,t[0][0],t[1][0]),y:Qi(e.y,t[0][1],t[1][1])}),R1=(e,t,n)=>e<t?Qi(Math.abs(e-t),1,50)/50:e>n?-Qi(Math.abs(e-n),1,50)/50:0,oA=(e,t)=>{const n=R1(e.x,35,t.width-35)*20,r=R1(e.y,35,t.height-35)*20;return[n,r]},iA=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},lA=(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)}),$c=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),cA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),M1=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),TP=(e,t)=>cA(lA($c(e),$c(t))),Ix=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},AP=e=>_r(e.width)&&_r(e.height)&&_r(e.x)&&_r(e.y),_r=e=>!isNaN(e)&&isFinite(e),qt=Symbol.for("internals"),uA=["Enter"," ","Escape"],RP=(e,t)=>{},MP=e=>"nativeEvent"in e;function $x(e){var a,l;const t=MP(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 dA=e=>"clientX"in e,Oa=(e,t)=>{var l,c;const n=dA(e),r=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:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},sh=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Yc=({id:e,path:t,labelX:n,labelY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>me.createElement(me.Fragment,null,me.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&me.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&_r(n)&&_r(r)?me.createElement(CP,{x:n,y:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Yc.displayName="BaseEdge";function dc(e,t,n){return n===void 0?n:r=>{const a=t().edges.find(l=>l.id===e);a&&n(r,{...a})}}function hA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(r-t)/2,u=r<t?r+c:r-c;return[l,u,a,c]}function fA({sourceX:e,sourceY:t,targetX:n,targetY:r,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+r*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var Lo;(function(e){e.Strict="strict",e.Loose="loose"})(Lo||(Lo={}));var Co;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Co||(Co={}));var Oc;(function(e){e.Partial="partial",e.Full="full"})(Oc||(Oc={}));var Ra;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ra||(Ra={}));var ah;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ah||(ah={}));var He;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(He||(He={}));function I1({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===He.Left||e===He.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function pA({sourceX:e,sourceY:t,sourcePosition:n=He.Bottom,targetX:r,targetY:a,targetPosition:l=He.Top}){const[c,u]=I1({pos:n,x1:e,y1:t,x2:r,y2:a}),[f,p]=I1({pos:l,x1:r,y1:a,x2:e,y2:t}),[h,m,y,w]=fA({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${r},${a}`,h,m,y,w]}const b0=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=He.Bottom,targetPosition:l=He.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:j,interactionWidth:k})=>{const[S,b,N]=pA({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l});return me.createElement(Yc,{path:S,labelX:b,labelY:N,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:j,interactionWidth:k})});b0.displayName="SimpleBezierEdge";const $1={[He.Left]:{x:-1,y:0},[He.Right]:{x:1,y:0},[He.Top]:{x:0,y:-1},[He.Bottom]:{x:0,y:1}},IP=({source:e,sourcePosition:t=He.Bottom,target:n})=>t===He.Left||t===He.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},O1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function $P({source:e,sourcePosition:t=He.Bottom,target:n,targetPosition:r=He.Top,center:a,offset:l}){const c=$1[t],u=$1[r],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=IP({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],j,k;const S={x:0,y:0},b={x:0,y:0},[N,E,C,T]=hA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){j=a.x??N,k=a.y??E;const I=[{x:j,y:f.y},{x:j,y:p.y}],B=[{x:f.x,y:k},{x:p.x,y:k}];c[m]===y?w=m==="x"?I:B:w=m==="x"?B:I}else{const I=[{x:f.x,y:p.y}],B=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?B:I:w=c.y===y?I:B,t===r){const Y=Math.abs(e[m]-n[m]);if(Y<=l){const M=Math.min(l-1,l-Y);c[m]===y?S[m]=(f[m]>e[m]?-1:1)*M:b[m]=(p[m]>n[m]?-1:1)*M}}if(t!==r){const Y=m==="x"?"y":"x",M=c[m]===u[Y],J=f[Y]>p[Y],V=f[Y]<p[Y];(c[m]===1&&(!M&&J||M&&V)||c[m]!==1&&(!M&&V||M&&J))&&(w=m==="x"?I:B)}const q={x:f.x+S.x,y:f.y+S.y},L={x:p.x+b.x,y:p.y+b.y},U=Math.max(Math.abs(q.x-w[0].x),Math.abs(L.x-w[0].x)),X=Math.max(Math.abs(q.y-w[0].y),Math.abs(L.y-w[0].y));U>=X?(j=(q.x+L.x)/2,k=w[0].y):(j=w[0].x,k=(q.y+L.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},n],j,k,C,T]}function OP(e,t,n,r){const a=Math.min(O1(e,t)/2,O1(t,n)/2,r),{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 Ox({sourceX:e,sourceY:t,sourcePosition:n=He.Bottom,targetX:r,targetY:a,targetPosition:l=He.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,j]=$P({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((S,b,N)=>{let E="";return N>0&&N<h.length-1?E=OP(h[N-1],b,h[N+1],c):E=`${N===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,j]}const Eh=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=He.Bottom,targetPosition:y=He.Top,markerEnd:w,markerStart:j,pathOptions:k,interactionWidth:S})=>{const[b,N,E]=Ox({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return me.createElement(Yc,{path:b,labelX:N,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:j,interactionWidth:S})});Eh.displayName="SmoothStepEdge";const k0=x.memo(e=>{var t;return me.createElement(Eh,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});k0.displayName="StepEdge";function LP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,u]=hA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,u]}const N0=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[j,k,S]=LP({sourceX:e,sourceY:t,targetX:n,targetY:r});return me.createElement(Yc,{path:j,labelX:k,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});N0.displayName="StraightEdge";function Nd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function L1({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case He.Left:return[t-Nd(t-r,l),n];case He.Right:return[t+Nd(r-t,l),n];case He.Top:return[t,n-Nd(n-a,l)];case He.Bottom:return[t,n+Nd(a-n,l)]}}function _0({sourceX:e,sourceY:t,sourcePosition:n=He.Bottom,targetX:r,targetY:a,targetPosition:l=He.Top,curvature:c=.25}){const[u,f]=L1({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[p,h]=L1({pos:l,x1:r,y1:a,x2:e,y2:t,c}),[m,y,w,j]=fA({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${r},${a}`,m,y,w,j]}const oh=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=He.Bottom,targetPosition:l=He.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:j,pathOptions:k,interactionWidth:S})=>{const[b,N,E]=_0({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:k==null?void 0:k.curvature});return me.createElement(Yc,{path:b,labelX:N,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:j,interactionWidth:S})});oh.displayName="BezierEdge";const S0=x.createContext(null),PP=S0.Provider;S0.Consumer;const DP=()=>x.useContext(S0),FP=e=>"id"in e&&"source"in e&&"target"in e,qP=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Lx=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,BP=(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)),zP=(e,t)=>{if(!e.source||!e.target)return t;let n;return FP(e)?n={...e}:n={...e,id:qP(e)},BP(n,t)?t:t.concat(n)},Px=({x:e,y:t},[n,r,a],l,[c,u])=>{const f={x:(e-n)/a,y:(t-r)/a};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},mA=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r}),Ro=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-r};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:a}},Ch=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const{x:l,y:c}=Ro(a,t).positionAbsolute;return lA(r,$c({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 cA(n)},gA=(e,t,[n,r,a]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-r)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:j=!1}=h;if(c&&!w||j)return!1;const{positionAbsolute:k}=Ro(h,u),S={x:k.x,y:k.y,width:m||0,height:y||0},b=Ix(f,S),N=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(N||E||b>=C||h.dragging)&&p.push(h)}),p},yA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},wA=(e,t,n,r,a,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=Qi(f,r,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},So=(e,t=0)=>e.transition().duration(t);function P1(e,t,n,r){return(t[n]||[]).reduce((a,l)=>{var c,u;return`${e.id}-${l.id}-${n}`!==r&&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 HP(e,t,n,r,a,l){const{x:c,y:u}=Oa(e),p=t.elementsFromPoint(c,u).find(j=>j.classList.contains("react-flow__handle"));if(p){const j=p.getAttribute("data-nodeid");if(j){const k=j0(void 0,p),S=p.getAttribute("data-handleid"),b=l({nodeId:j,id:S,type:k});if(b){const N=a.find(E=>E.nodeId===j&&E.type===k&&E.id===S);return{handle:{id:S,type:k,nodeId:j,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(j=>{const k=Math.sqrt((j.x-n.x)**2+(j.y-n.y)**2);if(k<=r){const S=l(j);k<=m&&(k<m?h=[{handle:j,validHandleResult:S}]:k===m&&h.push({handle:j,validHandleResult:S}),m=k)}}),!h.length)return{handle:null,validHandleResult:vA()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:j})=>j.isValid),w=h.some(({handle:j})=>j.type==="target");return h.find(({handle:j,validHandleResult:k})=>w?j.type==="target":y?k.isValid:!0)||h[0]}const UP={source:null,target:null,sourceHandle:null,targetHandle:null},vA=()=>({handleDomNode:null,isValid:!1,connection:UP,endHandle:null});function xA(e,t,n,r,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={...vA(),handleDomNode:f};if(f){const h=j0(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),j=f.classList.contains("connectableend"),k={source:u?m:n,sourceHandle:u?y:r,target:u?n:m,targetHandle:u?r:y};p.connection=k,w&&j&&(t===Lo.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==r)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=l(k))}return p}function WP({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((a,l)=>{if(l[qt]){const{handleBounds:c}=l[qt];let u=[],f=[];c&&(u=P1(l,c,"source",`${t}-${n}-${r}`),f=P1(l,c,"target",`${t}-${n}-${r}`)),a.push(...u,...f)}return a},[])}function j0(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Tp(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function VP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function bA({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:a,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=iA(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:j,onConnectStart:k,panBy:S,getNodes:b,cancelConnection:N}=l();let E=0,C;const{x:T,y:A}=Oa(e),I=h==null?void 0:h.elementFromPoint(T,A),B=j0(f,I),q=y==null?void 0:y.getBoundingClientRect();if(!q||!B)return;let L,U=Oa(e,q),X=!1,Y=null,M=!1,J=null;const V=WP({nodes:b(),nodeId:n,handleId:t,handleType:B}),$=()=>{if(!w)return;const[G,F]=oA(U,q);S({x:G,y:F}),E=requestAnimationFrame($)};c({connectionPosition:U,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:B,connectionStartHandle:{nodeId:n,handleId:t,type:B},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:B});function z(G){const{transform:F}=l();U=Oa(G,q);const{handle:K,validHandleResult:de}=HP(G,h,Px(U,F,!1,[1,1]),j,V,H=>xA(H,m,n,t,a?"target":"source",u,h));if(C=K,X||($(),X=!0),J=de.handleDomNode,Y=de.connection,M=de.isValid,c({connectionPosition:C&&M?mA({x:C.x,y:C.y},F):U,connectionStatus:VP(!!C,M),connectionEndHandle:de.endHandle}),!C&&!M&&!J)return Tp(L);Y.source!==Y.target&&J&&(Tp(L),L=J,J.classList.add("connecting","react-flow__handle-connecting"),J.classList.toggle("valid",M),J.classList.toggle("react-flow__handle-valid",M))}function W(G){var F,K;(C||J)&&Y&&M&&(r==null||r(Y)),(K=(F=l()).onConnectEnd)==null||K.call(F,G),f&&(p==null||p(G)),Tp(L),N(),cancelAnimationFrame(E),X=!1,M=!1,Y=null,J=null,h.removeEventListener("mousemove",z),h.removeEventListener("mouseup",W),h.removeEventListener("touchmove",z),h.removeEventListener("touchend",W)}h.addEventListener("mousemove",z),h.addEventListener("mouseup",W),h.addEventListener("touchmove",z),h.addEventListener("touchend",W)}const D1=()=>!0,GP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),KP=(e,t,n)=>r=>{const{connectionStartHandle:a,connectionEndHandle:l,connectionClickStartHandle:c}=r;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}},kA=x.forwardRef(({type:e="source",position:t=He.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var q,L;const j=c||null,k=e==="target",S=Gt(),b=DP(),{connectOnClick:N,noPanClassName:E}=mt(GP,rn),{connecting:C,clickConnecting:T}=mt(KP(b,j,e),rn);b||(L=(q=S.getState()).onError)==null||L.call(q,"010",Zs.error010());const A=U=>{const{defaultEdgeOptions:X,onConnect:Y,hasDefaultEdges:M}=S.getState(),J={...X,...U};if(M){const{edges:V,setEdges:$}=S.getState();$(zP(J,V))}Y==null||Y(J),u==null||u(J)},I=U=>{if(!b)return;const X=dA(U);a&&(X&&U.button===0||!X)&&bA({event:U,handleId:j,nodeId:b,onConnect:A,isTarget:k,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||D1}),X?h==null||h(U):m==null||m(U)},B=U=>{const{onClickConnectStart:X,onClickConnectEnd:Y,connectionClickStartHandle:M,connectionMode:J,isValidConnection:V}=S.getState();if(!b||!M&&!a)return;if(!M){X==null||X(U,{nodeId:b,handleId:j,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:j}});return}const $=iA(U.target),z=n||V||D1,{connection:W,isValid:G}=xA({nodeId:b,id:j,type:e},J,M.nodeId,M.handleId||null,M.type,z,$);G&&A(W),Y==null||Y(U),S.setState({connectionClickStartHandle:null})};return me.createElement("div",{"data-handleid":j,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${j}-${e}`,className:gn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!k,target:k,connectable:r,connectablestart:a,connectableend:l,connecting:T,connectionindicator:r&&(a&&!C||l&&C)}]),onMouseDown:I,onTouchStart:I,onClick:N?B:void 0,ref:w,...y},f)});kA.displayName="Handle";var Po=x.memo(kA);const NA=({data:e,isConnectable:t,targetPosition:n=He.Top,sourcePosition:r=He.Bottom})=>me.createElement(me.Fragment,null,me.createElement(Po,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,me.createElement(Po,{type:"source",position:r,isConnectable:t}));NA.displayName="DefaultNode";var Dx=x.memo(NA);const _A=({data:e,isConnectable:t,sourcePosition:n=He.Bottom})=>me.createElement(me.Fragment,null,e==null?void 0:e.label,me.createElement(Po,{type:"source",position:n,isConnectable:t}));_A.displayName="InputNode";var SA=x.memo(_A);const jA=({data:e,isConnectable:t,targetPosition:n=He.Top})=>me.createElement(me.Fragment,null,me.createElement(Po,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);jA.displayName="OutputNode";var EA=x.memo(jA);const E0=()=>null;E0.displayName="GroupNode";const YP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),_d=e=>e.id;function XP(e,t){return rn(e.selectedNodes.map(_d),t.selectedNodes.map(_d))&&rn(e.selectedEdges.map(_d),t.selectedEdges.map(_d))}const CA=x.memo(({onSelectionChange:e})=>{const t=Gt(),{selectedNodes:n,selectedEdges:r}=mt(YP,XP);return x.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,r,e]),null});CA.displayName="SelectionListener";const ZP=e=>!!e.onSelectionChange;function QP({onSelectionChange:e}){const t=mt(ZP);return e||t?me.createElement(CA,{onSelectionChange:e}):null}const JP=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 Ci(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function it(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const e4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:j,minZoom:k,maxZoom:S,nodeExtent:b,onNodesChange:N,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:A,snapToGrid:I,translateExtent:B,connectOnClick:q,defaultEdgeOptions:L,fitView:U,fitViewOptions:X,onNodesDelete:Y,onEdgesDelete:M,onNodeDrag:J,onNodeDragStart:V,onNodeDragStop:$,onSelectionDrag:z,onSelectionDragStart:W,onSelectionDragStop:G,noPanClassName:F,nodeOrigin:K,rfId:de,autoPanOnConnect:H,autoPanOnNodeDrag:Q,onError:O,connectionRadius:te,isValidConnection:ae,nodeDragThreshold:he})=>{const{setNodes:ge,setEdges:Te,setDefaultNodesAndEdges:De,setMinZoom:Ve,setMaxZoom:je,setTranslateExtent:ve,setNodeExtent:Ue,reset:ke}=mt(JP,rn),xe=Gt();return x.useEffect(()=>{const Ge=r==null?void 0:r.map(rt=>({...rt,...L}));return De(n,Ge),()=>{ke()}},[]),it("defaultEdgeOptions",L,xe.setState),it("connectionMode",T,xe.setState),it("onConnect",a,xe.setState),it("onConnectStart",l,xe.setState),it("onConnectEnd",c,xe.setState),it("onClickConnectStart",u,xe.setState),it("onClickConnectEnd",f,xe.setState),it("nodesDraggable",p,xe.setState),it("nodesConnectable",h,xe.setState),it("nodesFocusable",m,xe.setState),it("edgesFocusable",y,xe.setState),it("edgesUpdatable",w,xe.setState),it("elementsSelectable",C,xe.setState),it("elevateNodesOnSelect",j,xe.setState),it("snapToGrid",I,xe.setState),it("snapGrid",A,xe.setState),it("onNodesChange",N,xe.setState),it("onEdgesChange",E,xe.setState),it("connectOnClick",q,xe.setState),it("fitViewOnInit",U,xe.setState),it("fitViewOnInitOptions",X,xe.setState),it("onNodesDelete",Y,xe.setState),it("onEdgesDelete",M,xe.setState),it("onNodeDrag",J,xe.setState),it("onNodeDragStart",V,xe.setState),it("onNodeDragStop",$,xe.setState),it("onSelectionDrag",z,xe.setState),it("onSelectionDragStart",W,xe.setState),it("onSelectionDragStop",G,xe.setState),it("noPanClassName",F,xe.setState),it("nodeOrigin",K,xe.setState),it("rfId",de,xe.setState),it("autoPanOnConnect",H,xe.setState),it("autoPanOnNodeDrag",Q,xe.setState),it("onError",O,xe.setState),it("connectionRadius",te,xe.setState),it("isValidConnection",ae,xe.setState),it("nodeDragThreshold",he,xe.setState),Ci(e,ge),Ci(t,Te),Ci(k,Ve),Ci(S,je),Ci(B,ve),Ci(b,Ue),null},F1={display:"none"},t4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},TA="react-flow__node-desc",AA="react-flow__edge-desc",n4="react-flow__aria-live",r4=e=>e.ariaLiveMessage;function s4({rfId:e}){const t=mt(r4);return me.createElement("div",{id:`${n4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:t4},t)}function a4({rfId:e,disableKeyboardA11y:t}){return me.createElement(me.Fragment,null,me.createElement("div",{id:`${TA}-${e}`,style:F1},"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."," "),me.createElement("div",{id:`${AA}-${e}`,style:F1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&me.createElement(s4,{rfId:e}))}var Lc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&$x(w))return!1;const k=B1(w.code,u);l.current.add(w[k]),q1(c,l.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&$x(w))return!1;const k=B1(w.code,u);q1(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(w[k]),w.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,r]),n};function q1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function B1(e,t){return t.includes(e)?"code":"key"}function RA(e,t,n,r){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Ro(l,r);return RA(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[qt])==null?void 0:u.z)??0)>(n.z??0)?((f=l[qt])==null?void 0:f.z)??0:n.z??0},r)}function MA(e,t,n){e.forEach(r=>{var l;const a=r.parentNode||r.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[r.id]){const{x:c,y:u,z:f}=RA(r,e,{...r.position,z:((l=r[qt])==null?void 0:l.z)??0},t);r.positionAbsolute={x:c,y:u},r[qt].z=f,n!=null&&n[r.id]&&(r[qt].isParent=!0)}})}function Ap(e,t,n,r){const a=new Map,l={},c=r?1e3:0;return e.forEach(u=>{var w;const f=(_r(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,qt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[qt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),MA(a,n,l),a}function IA(e,t={}){const{getNodes:n,width:r,height:a,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const j=n().filter(S=>{var N;const b=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(N=t.nodes)!=null&&N.length?b&&t.nodes.some(E=>E.id===S.id):b}),k=j.every(S=>S.width&&S.height);if(j.length>0&&k){const S=Ch(j,m),{x:b,y:N,zoom:E}=wA(S,r,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=Ys.translate(b,N).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(So(f,t.duration),C):u.transform(f,C),!0}}return!1}function o4(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[qt]:r[qt],selected:n.selected})}),new Map(t)}function i4(e,t){return t.map(n=>{const r=e.find(a=>a.id===n.id);return r&&(n.selected=r.selected),n})}function Sd({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&r({nodeInternals:o4(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:i4(t,l)}),u==null||u(t))}const Ti=()=>{},l4={zoomIn:Ti,zoomOut:Ti,zoomTo:Ti,getZoom:()=>1,setViewport:Ti,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ti,fitBounds:Ti,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},c4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),u4=()=>{const e=Gt(),{d3Zoom:t,d3Selection:n}=mt(c4,rn);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(So(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(So(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(So(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,u,f]=e.getState().transform,p=Ys.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(So(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=>IA(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,m=u/2-a*h,y=f/2-l*h,w=Ys.translate(m,y).scale(h);t.transform(So(n,c==null?void 0:c.duration),w)},fitBounds:(a,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=wA(a,c,u,f,p,(l==null?void 0:l.padding)??.1),w=Ys.translate(h,m).scale(y);t.transform(So(n,l==null?void 0:l.duration),w)},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"),Px(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(),m={x:a.x-p,y:a.y-h};return Px(m,l,c,u)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=mA(a,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:l4,[t,n])};function Th(){const e=u4(),t=Gt(),n=x.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),r=x.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=x.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(S=>({...S}))},[]),l=x.useCallback(k=>{const{edges:S=[]}=t.getState();return S.find(b=>b.id===k)},[]),c=x.useCallback(k=>{const{getNodes:S,setNodes:b,hasDefaultNodes:N,onNodesChange:E}=t.getState(),C=S(),T=typeof k=="function"?k(C):k;if(N)b(T);else if(E){const A=T.length===0?C.map(I=>({type:"remove",id:I.id})):T.map(I=>({item:I,type:"reset"}));E(A)}},[]),u=x.useCallback(k=>{const{edges:S=[],setEdges:b,hasDefaultEdges:N,onEdgesChange:E}=t.getState(),C=typeof k=="function"?k(S):k;if(N)b(C);else if(E){const T=C.length===0?S.map(A=>({type:"remove",id:A.id})):C.map(A=>({item:A,type:"reset"}));E(T)}},[]),f=x.useCallback(k=>{const S=Array.isArray(k)?k:[k],{getNodes:b,setNodes:N,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const A=[...b(),...S];N(A)}else if(C){const T=S.map(A=>({item:A,type:"add"}));C(T)}},[]),p=x.useCallback(k=>{const S=Array.isArray(k)?k:[k],{edges:b=[],setEdges:N,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)N([...b,...S]);else if(C){const T=S.map(A=>({item:A,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:k,edges:S=[],transform:b}=t.getState(),[N,E,C]=b;return{nodes:k().map(T=>({...T})),edges:S.map(T=>({...T})),viewport:{x:N,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:k,edges:S})=>{const{nodeInternals:b,getNodes:N,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:A,onEdgesDelete:I,onNodesChange:B,onEdgesChange:q}=t.getState(),L=(k||[]).map(J=>J.id),U=(S||[]).map(J=>J.id),X=N().reduce((J,V)=>{const $=V.parentNode||V.parentId,z=!L.includes(V.id)&&$&&J.find(G=>G.id===$);return(typeof V.deletable=="boolean"?V.deletable:!0)&&(L.includes(V.id)||z)&&J.push(V),J},[]),Y=E.filter(J=>typeof J.deletable=="boolean"?J.deletable:!0),M=Y.filter(J=>U.includes(J.id));if(X||M){const J=yA(X,Y),V=[...M,...J],$=V.reduce((z,W)=>(z.includes(W.id)||z.push(W.id),z),[]);if((T||C)&&(T&&t.setState({edges:E.filter(z=>!$.includes(z.id))}),C&&(X.forEach(z=>{b.delete(z.id)}),t.setState({nodeInternals:new Map(b)}))),$.length>0&&(I==null||I(V),q&&q($.map(z=>({id:z,type:"remove"})))),X.length>0&&(A==null||A(X),B)){const z=X.map(W=>({id:W.id,type:"remove"}));B(z)}}},[]),y=x.useCallback(k=>{const S=AP(k),b=S?null:t.getState().nodeInternals.get(k.id);return!S&&!b?[null,null,S]:[S?k:M1(b),b,S]},[]),w=x.useCallback((k,S=!0,b)=>{const[N,E,C]=y(k);return N?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const A=M1(T),I=Ix(A,N);return S&&I>0||I>=N.width*N.height}):[]},[]),j=x.useCallback((k,S,b=!0)=>{const[N]=y(k);if(!N)return!1;const E=Ix(N,S);return b&&E>0||E>=N.width*N.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:a,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:j}),[e,n,r,a,l,c,u,f,p,h,m,w,j])}const d4={actInsideInputWithModifier:!1};var h4=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Gt(),{deleteElements:r}=Th(),a=Lc(e,d4),l=Lc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);r({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function f4(e){const t=Gt();x.useEffect(()=>{let n;const r=()=>{var l,c;if(!e.current)return;const a=v0(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",Zs.error004())),t.setState({width:a.width||500,height:a.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const C0={position:"absolute",width:"100%",height:"100%",top:0,left:0},p4=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,jd=e=>({x:e.x,y:e.y,zoom:e.k}),Ai=(e,t)=>e.target.closest(`.${t}`),z1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),H1=e=>{const t=e.ctrlKey&&sh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},m4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),g4=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Co.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:j,maxZoom:k,zoomActivationKeyCode:S,preventScrolling:b=!0,children:N,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),A=Gt(),I=x.useRef(!1),B=x.useRef(!1),q=x.useRef(null),L=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:U,d3Selection:X,d3ZoomHandler:Y,userSelectionActive:M}=mt(m4,rn),J=Lc(S),V=x.useRef(0),$=x.useRef(!1),z=x.useRef();return f4(q),x.useEffect(()=>{if(q.current){const W=q.current.getBoundingClientRect(),G=sA().scaleExtent([j,k]).translateExtent(w),F=Nr(q.current).call(G),K=Ys.translate(y.x,y.y).scale(Qi(y.zoom,j,k)),de=[[0,0],[W.width,W.height]],H=G.constrain()(K,de,w);G.transform(F,H),G.wheelDelta(H1),A.setState({d3Zoom:G,d3Selection:F,d3ZoomHandler:F.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:q.current.closest(".react-flow")})}},[]),x.useEffect(()=>{X&&U&&(c&&!J&&!M?X.on("wheel.zoom",W=>{if(Ai(W,E))return!1;W.preventDefault(),W.stopImmediatePropagation();const G=X.property("__zoom").k||1;if(W.ctrlKey&&l){const ae=Gr(W),he=H1(W),ge=G*Math.pow(2,he);U.scaleTo(X,ge,ae,W);return}const F=W.deltaMode===1?20:1;let K=f===Co.Vertical?0:W.deltaX*F,de=f===Co.Horizontal?0:W.deltaY*F;!sh()&&W.shiftKey&&f!==Co.Vertical&&(K=W.deltaY*F,de=0),U.translateBy(X,-(K/G)*u,-(de/G)*u,{internal:!0});const H=jd(X.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:O,onViewportChangeEnd:te}=A.getState();clearTimeout(z.current),$.current||($.current=!0,t==null||t(W,H),Q==null||Q(H)),$.current&&(e==null||e(W,H),O==null||O(H),z.current=setTimeout(()=>{n==null||n(W,H),te==null||te(H),$.current=!1},150))},{passive:!1}):typeof Y<"u"&&X.on("wheel.zoom",function(W,G){if(!b&&W.type==="wheel"&&!W.ctrlKey||Ai(W,E))return null;W.preventDefault(),Y.call(this,W,G)},{passive:!1}))},[M,c,f,X,U,Y,J,l,b,E,t,e,n]),x.useEffect(()=>{U&&U.on("start",W=>{var K,de;if(!W.sourceEvent||W.sourceEvent.internal)return null;V.current=(K=W.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:G}=A.getState(),F=jd(W.transform);I.current=!0,L.current=F,((de=W.sourceEvent)==null?void 0:de.type)==="mousedown"&&A.setState({paneDragging:!0}),G==null||G(F),t==null||t(W.sourceEvent,F)})},[U,t]),x.useEffect(()=>{U&&(M&&!I.current?U.on("zoom",null):M||U.on("zoom",W=>{var F;const{onViewportChange:G}=A.getState();if(A.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),B.current=!!(r&&z1(m,V.current??0)),(e||G)&&!((F=W.sourceEvent)!=null&&F.internal)){const K=jd(W.transform);G==null||G(K),e==null||e(W.sourceEvent,K)}}))},[M,U,e,m,r]),x.useEffect(()=>{U&&U.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:G}=A.getState();if(I.current=!1,A.setState({paneDragging:!1}),r&&z1(m,V.current??0)&&!B.current&&r(W.sourceEvent),B.current=!1,(n||G)&&p4(L.current,W.transform)){const F=jd(W.transform);L.current=F,clearTimeout(T.current),T.current=setTimeout(()=>{G==null||G(F),n==null||n(W.sourceEvent,F)},c?150:0)}})},[U,c,m,n,r]),x.useEffect(()=>{U&&U.filter(W=>{const G=J||a,F=l&&W.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&W.button===1&&W.type==="mousedown"&&(Ai(W,"react-flow__node")||Ai(W,"react-flow__edge")))return!0;if(!m&&!G&&!c&&!p&&!l||M||!p&&W.type==="dblclick"||Ai(W,E)&&W.type==="wheel"||Ai(W,C)&&(W.type!=="wheel"||c&&W.type==="wheel"&&!J)||!l&&W.ctrlKey&&W.type==="wheel"||!G&&!c&&!F&&W.type==="wheel"||!m&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(m)&&!m.includes(W.button)&&W.type==="mousedown")return!1;const K=Array.isArray(m)&&m.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&K})},[M,U,a,l,c,p,m,h,J]),me.createElement("div",{className:"react-flow__renderer",ref:q,style:C0},N)},y4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function w4(){const{userSelectionActive:e,userSelectionRect:t}=mt(y4,rn);return e&&t?me.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 U1(e,t){const n=t.parentNode||t.parentId,r=e.find(a=>a.id===n);if(r){const a=t.position.x+t.width-r.width,l=t.position.y+t.height-r.height;if(a>0||l>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,a>0&&(r.style.width+=a),l>0&&(r.style.height+=l),t.position.x<0){const c=Math.abs(t.position.x);r.position.x=r.position.x-c,r.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);r.position.y=r.position.y-c,r.style.height+=c,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function v4(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,a)=>{const l=e.filter(u=>u.id===a.id);if(l.length===0)return r.push(a),r;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&&U1(r,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&&U1(r,c);break}case"remove":return r}return r.push(c),r},n)}function x4(e,t){return v4(e,t)}const Aa=(e,t)=>({id:e,type:"select",selected:t});function qi(e,t){return e.reduce((n,r)=>{const a=t.includes(r.id);return!r.selected&&a?(r.selected=!0,n.push(Aa(r.id,!0))):r.selected&&!a&&(r.selected=!1,n.push(Aa(r.id,!1))),n},[])}const Rp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},b4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),$A=x.memo(({isSelecting:e,selectionMode:t=Oc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Gt(),j=x.useRef(0),k=x.useRef(0),S=x.useRef(),{userSelectionActive:b,elementsSelectable:N,dragging:E}=mt(b4,rn),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),j.current=0,k.current=0},T=Y=>{l==null||l(Y),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},A=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}c==null||c(Y)},I=u?Y=>u(Y):void 0,B=Y=>{const{resetSelectedElements:M,domNode:J}=w.getState();if(S.current=J==null?void 0:J.getBoundingClientRect(),!N||!e||Y.button!==0||Y.target!==y.current||!S.current)return;const{x:V,y:$}=Oa(Y,S.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:V,startY:$,x:V,y:$}}),r==null||r(Y)},q=Y=>{const{userSelectionRect:M,nodeInternals:J,edges:V,transform:$,onNodesChange:z,onEdgesChange:W,nodeOrigin:G,getNodes:F}=w.getState();if(!e||!S.current||!M)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Oa(Y,S.current),de=M.startX??0,H=M.startY??0,Q={...M,x:K.x<de?K.x:de,y:K.y<H?K.y:H,width:Math.abs(K.x-de),height:Math.abs(K.y-H)},O=F(),te=gA(J,Q,$,t===Oc.Partial,!0,G),ae=yA(te,V).map(ge=>ge.id),he=te.map(ge=>ge.id);if(j.current!==he.length){j.current=he.length;const ge=qi(O,he);ge.length&&(z==null||z(ge))}if(k.current!==ae.length){k.current=ae.length;const ge=qi(V,ae);ge.length&&(W==null||W(ge))}w.setState({userSelectionRect:Q})},L=Y=>{if(Y.button!==0)return;const{userSelectionRect:M}=w.getState();!b&&M&&Y.target===y.current&&(T==null||T(Y)),w.setState({nodesSelectionActive:j.current>0}),C(),a==null||a(Y)},U=Y=>{b&&(w.setState({nodesSelectionActive:j.current>0}),a==null||a(Y)),C()},X=N&&(e||b);return me.createElement("div",{className:gn(["react-flow__pane",{dragging:E,selection:e}]),onClick:X?void 0:Rp(T,y),onContextMenu:Rp(A,y),onWheel:Rp(I,y),onMouseEnter:X?void 0:f,onMouseDown:X?B:void 0,onMouseMove:X?q:p,onMouseUp:X?L:void 0,onMouseLeave:X?U:h,ref:y,style:C0},m,me.createElement(w4,null))});$A.displayName="Pane";function OA(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:OA(r,t):!1}function W1(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function k4(e,t,n,r){return Array.from(e.values()).filter(a=>(a.selected||a.id===r)&&(!a.parentNode||a.parentId||!OA(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 N4(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function LA(e,t,n,r,a=[0,0],l){const c=N4(e,e.extent||r);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=Ro(m,a).positionAbsolute;u=m&&_r(y)&&_r(w)&&_r(m.width)&&_r(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else l==null||l("005",Zs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=Ro(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=Ro(m,a).positionAbsolute}const h=u&&u!=="parent"?x0(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function Mp({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?r.find(a=>a.id===e):r[0],r]}const V1=(e,t,n,r)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*r[0],y:c.height*r[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,...v0(f)}})};function hc(e,t,n){return n===void 0?n:r=>{const a=t().nodeInternals.get(e);a&&n(r,{...a})}}function Fx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",Zs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):a([e])}function _4(){const e=Gt();return x.useCallback(({sourceEvent:n})=>{const{transform:r,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-r[0])/r[2],y:(u-r[1])/r[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 Ip(e){return(t,n,r)=>e==null?void 0:e(t,r)}function PA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const u=Gt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),j=x.useRef({x:0,y:0}),k=x.useRef(null),S=x.useRef(!1),b=x.useRef(!1),N=x.useRef(!1),E=_4();return x.useEffect(()=>{if(e!=null&&e.current){const C=Nr(e.current),T=({x:B,y:q})=>{const{nodeInternals:L,onNodeDrag:U,onSelectionDrag:X,updateNodePositions:Y,nodeExtent:M,snapGrid:J,snapToGrid:V,nodeOrigin:$,onError:z}=u.getState();m.current={x:B,y:q};let W=!1,G={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&M){const K=Ch(h.current,$);G=$c(K)}if(h.current=h.current.map(K=>{const de={x:B-K.distance.x,y:q-K.distance.y};V&&(de.x=J[0]*Math.round(de.x/J[0]),de.y=J[1]*Math.round(de.y/J[1]));const H=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];h.current.length>1&&M&&!K.extent&&(H[0][0]=K.positionAbsolute.x-G.x+M[0][0],H[1][0]=K.positionAbsolute.x+(K.width??0)-G.x2+M[1][0],H[0][1]=K.positionAbsolute.y-G.y+M[0][1],H[1][1]=K.positionAbsolute.y+(K.height??0)-G.y2+M[1][1]);const Q=LA(K,de,L,H,$,z);return W=W||K.position.x!==Q.position.x||K.position.y!==Q.position.y,K.position=Q.position,K.positionAbsolute=Q.positionAbsolute,K}),!W)return;Y(h.current,!0,!0),p(!0);const F=a?U:Ip(X);if(F&&k.current){const[K,de]=Mp({nodeId:a,dragItems:h.current,nodeInternals:L});F(k.current,K,de)}},A=()=>{if(!w.current)return;const[B,q]=oA(j.current,w.current);if(B!==0||q!==0){const{transform:L,panBy:U}=u.getState();m.current.x=(m.current.x??0)-B/L[2],m.current.y=(m.current.y??0)-q/L[2],U({x:B,y:q})&&T(m.current)}y.current=requestAnimationFrame(A)},I=B=>{var $;const{nodeInternals:q,multiSelectionActive:L,nodesDraggable:U,unselectNodesAndEdges:X,onNodeDragStart:Y,onSelectionDragStart:M}=u.getState();b.current=!0;const J=a?Y:Ip(M);(!c||!l)&&!L&&a&&(($=q.get(a))!=null&&$.selected||X()),a&&l&&c&&Fx({id:a,store:u,nodeRef:e});const V=E(B);if(m.current=V,h.current=k4(q,U,V,a),J&&h.current){const[z,W]=Mp({nodeId:a,dragItems:h.current,nodeInternals:q});J(B.sourceEvent,z,W)}};if(t)C.on(".drag",null);else{const B=$3().on("start",q=>{const{domNode:L,nodeDragThreshold:U}=u.getState();U===0&&I(q),N.current=!1;const X=E(q);m.current=X,w.current=(L==null?void 0:L.getBoundingClientRect())||null,j.current=Oa(q.sourceEvent,w.current)}).on("drag",q=>{var Y,M;const L=E(q),{autoPanOnNodeDrag:U,nodeDragThreshold:X}=u.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&b.current&&U&&(S.current=!0,A()),!b.current){const J=L.xSnapped-(((Y=m==null?void 0:m.current)==null?void 0:Y.x)??0),V=L.ySnapped-(((M=m==null?void 0:m.current)==null?void 0:M.y)??0);Math.sqrt(J*J+V*V)>X&&I(q)}(m.current.x!==L.xSnapped||m.current.y!==L.ySnapped)&&h.current&&b.current&&(k.current=q.sourceEvent,j.current=Oa(q.sourceEvent,w.current),T(L))}}).on("end",q=>{if(!(!b.current||N.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:L,nodeInternals:U,onNodeDragStop:X,onSelectionDragStop:Y}=u.getState(),M=a?X:Ip(Y);if(L(h.current,!1,!1),M){const[J,V]=Mp({nodeId:a,dragItems:h.current,nodeInternals:U});M(q.sourceEvent,J,V)}}}).filter(q=>{const L=q.target;return!q.button&&(!n||!W1(L,`.${n}`,e))&&(!r||W1(L,r,e))});return C.call(B),()=>{C.on(".drag",null)}}}},[e,t,n,r,l,u,a,c,E]),f}function DA(){const e=Gt();return x.useCallback(n=>{const{nodeInternals:r,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(N=>N.selected&&(N.draggable||h&&typeof N.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,j=n.isShiftPressed?4:1,k=n.x*y*j,S=n.y*w*j,b=m.map(N=>{if(N.positionAbsolute){const E={x:N.positionAbsolute.x+k,y:N.positionAbsolute.y+S};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=LA(N,E,r,a,void 0,p);N.position=T,N.positionAbsolute=C}return N});l(b,!0,!1)},[])}const Gi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var fc=e=>{const t=({id:n,type:r,data:a,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:j,onDoubleClick:k,style:S,className:b,isDraggable:N,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:A,sourcePosition:I,targetPosition:B,hidden:q,resizeObserver:L,dragHandle:U,zIndex:X,isParent:Y,noDragClassName:M,noPanClassName:J,initialized:V,disableKeyboardA11y:$,ariaLabel:z,rfId:W,hasHandleBounds:G})=>{const F=Gt(),K=x.useRef(null),de=x.useRef(null),H=x.useRef(I),Q=x.useRef(B),O=x.useRef(r),te=E||N||h||m||y||w,ae=DA(),he=hc(n,F.getState,m),ge=hc(n,F.getState,y),Te=hc(n,F.getState,w),De=hc(n,F.getState,j),Ve=hc(n,F.getState,k),je=ke=>{const{nodeDragThreshold:xe}=F.getState();if(E&&(!A||!N||xe>0)&&Fx({id:n,store:F,nodeRef:K}),h){const Ge=F.getState().nodeInternals.get(n);Ge&&h(ke,{...Ge})}},ve=ke=>{if(!$x(ke)&&!$)if(uA.includes(ke.key)&&E){const xe=ke.key==="Escape";Fx({id:n,store:F,unselect:xe,nodeRef:K})}else N&&p&&Object.prototype.hasOwnProperty.call(Gi,ke.key)&&(F.setState({ariaLiveMessage:`Moved selected node ${ke.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),ae({x:Gi[ke.key].x,y:Gi[ke.key].y,isShiftPressed:ke.shiftKey}))};x.useEffect(()=>()=>{de.current&&(L==null||L.unobserve(de.current),de.current=null)},[]),x.useEffect(()=>{if(K.current&&!q){const ke=K.current;(!V||!G||de.current!==ke)&&(de.current&&(L==null||L.unobserve(de.current)),L==null||L.observe(ke),de.current=ke)}},[q,V,G]),x.useEffect(()=>{const ke=O.current!==r,xe=H.current!==I,Ge=Q.current!==B;K.current&&(ke||xe||Ge)&&(ke&&(O.current=r),xe&&(H.current=I),Ge&&(Q.current=B),F.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,r,I,B]);const Ue=PA({nodeRef:K,disabled:q||!N,noDragClassName:M,handleSelector:U,nodeId:n,isSelectable:E,selectNodesOnDrag:A});return q?null:me.createElement("div",{className:gn(["react-flow__node",`react-flow__node-${r}`,{[J]:N},b,{selected:p,selectable:E,parent:Y,dragging:Ue}]),ref:K,style:{zIndex:X,transform:`translate(${u}px,${f}px)`,pointerEvents:te?"all":"none",visibility:V?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:he,onMouseMove:ge,onMouseLeave:Te,onContextMenu:De,onClick:je,onDoubleClick:Ve,onKeyDown:T?ve:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":$?void 0:`${TA}-${W}`,"aria-label":z},me.createElement(PP,{value:n},me.createElement(e,{id:n,data:a,type:r,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:I,targetPosition:B,dragging:Ue,dragHandle:U,zIndex:X})))};return t.displayName="NodeWrapper",x.memo(t)};const S4=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Ch(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function j4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Gt(),{width:a,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=mt(S4,rn),h=DA(),m=x.useRef(null);if(x.useEffect(()=>{var j;n||(j=m.current)==null||j.focus({preventScroll:!0})},[n]),PA({nodeRef:m}),p||!a||!l)return null;const y=e?j=>{const k=r.getState().getNodes().filter(S=>S.selected);e(j,k)}:void 0,w=j=>{Object.prototype.hasOwnProperty.call(Gi,j.key)&&h({x:Gi[j.key].x,y:Gi[j.key].y,isShiftPressed:j.shiftKey})};return me.createElement("div",{className:gn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},me.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:l,top:u,left:c}}))}var E4=x.memo(j4);const C4=e=>e.nodesSelectionActive,FA=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:j,onSelectionEnd:k,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:N,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:A,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:q,panOnDrag:L,defaultViewport:U,translateExtent:X,minZoom:Y,maxZoom:M,preventScrolling:J,onSelectionContextMenu:V,noWheelClassName:$,noPanClassName:z,disableKeyboardA11y:W})=>{const G=mt(C4),F=Lc(m),K=Lc(b),de=K||L,H=K||A,Q=F||y&&de!==!0;return h4({deleteKeyCode:u,multiSelectionKeyCode:S}),me.createElement(g4,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:H,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:q,panOnDrag:!F&&de,defaultViewport:U,translateExtent:X,minZoom:Y,maxZoom:M,zoomActivationKeyCode:N,preventScrolling:J,noWheelClassName:$,noPanClassName:z},me.createElement($A,{onSelectionStart:j,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:de,isSelecting:!!Q,selectionMode:w},e,G&&me.createElement(E4,{onSelectionContextMenu:V,noPanClassName:z,disableKeyboardA11y:W})))};FA.displayName="FlowRenderer";var T4=x.memo(FA);function A4(e){return mt(x.useCallback(n=>e?gA(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function R4(e){const t={input:fc(e.input||SA),default:fc(e.default||Dx),output:fc(e.output||EA),group:fc(e.group||E0)},n={},r=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=fc(e[l]||Dx),a),n);return{...t,...r}}const M4=({x:e,y:t,width:n,height:r,origin:a})=>!n||!r?{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-r*a[1]},I4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),qA=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,updateNodeDimensions:l,onError:c}=mt(I4,rn),u=A4(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),me.createElement("div",{className:"react-flow__nodes",style:C0},u.map(h=>{var T,A,I;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",Zs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),j=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),b=e.nodeExtent?x0(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,N=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=M4({x:N,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return me.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||He.Bottom,targetPosition:h.targetPosition||He.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:w,isSelectable:j,isConnectable:k,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[qt])==null?void 0:T.z)??0,isParent:!!((A=h[qt])!=null&&A.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[qt])!=null&&I.handleBounds)})}))};qA.displayName="NodeRenderer";var $4=x.memo(qA);const O4=(e,t,n)=>n===He.Left?e-t:n===He.Right?e+t:e,L4=(e,t,n)=>n===He.Top?e-t:n===He.Bottom?e+t:e,G1="react-flow__edgeupdater",K1=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:u})=>me.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:gn([G1,`${G1}-${u}`]),cx:O4(t,r,e),cy:L4(n,r,e),r,stroke:"transparent",fill:"transparent"}),P4=()=>!0;var Ri=e=>{const t=({id:n,className:r,type:a,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:j,labelBgBorderRadius:k,style:S,source:b,target:N,sourceX:E,sourceY:C,targetX:T,targetY:A,sourcePosition:I,targetPosition:B,elementsSelectable:q,hidden:L,sourceHandleId:U,targetHandleId:X,onContextMenu:Y,onMouseEnter:M,onMouseMove:J,onMouseLeave:V,reconnectRadius:$,onReconnect:z,onReconnectStart:W,onReconnectEnd:G,markerEnd:F,markerStart:K,rfId:de,ariaLabel:H,isFocusable:Q,isReconnectable:O,pathOptions:te,interactionWidth:ae,disableKeyboardA11y:he})=>{const ge=x.useRef(null),[Te,De]=x.useState(!1),[Ve,je]=x.useState(!1),ve=Gt(),Ue=x.useMemo(()=>`url('#${Lx(K,de)}')`,[K,de]),ke=x.useMemo(()=>`url('#${Lx(F,de)}')`,[F,de]);if(L)return null;const xe=ue=>{var vt;const{edges:kt,addSelectedEdges:pt,unselectNodesAndEdges:ut,multiSelectionActive:Bt}=ve.getState(),jt=kt.find(an=>an.id===n);jt&&(q&&(ve.setState({nodesSelectionActive:!1}),jt.selected&&Bt?(ut({nodes:[],edges:[jt]}),(vt=ge.current)==null||vt.blur()):pt([n])),c&&c(ue,jt))},Ge=dc(n,ve.getState,u),rt=dc(n,ve.getState,Y),at=dc(n,ve.getState,M),le=dc(n,ve.getState,J),_e=dc(n,ve.getState,V),Ie=(ue,kt)=>{if(ue.button!==0)return;const{edges:pt,isValidConnection:ut}=ve.getState(),Bt=kt?N:b,jt=(kt?X:U)||null,vt=kt?"target":"source",an=ut||P4,jn=kt,Nt=pt.find(st=>st.id===n);je(!0),W==null||W(ue,Nt,vt);const Yt=st=>{je(!1),G==null||G(st,Nt,vt)};bA({event:ue,handleId:jt,nodeId:Bt,onConnect:st=>z==null?void 0:z(Nt,st),isTarget:jn,getState:ve.getState,setState:ve.setState,isValidConnection:an,edgeUpdaterType:vt,onReconnectEnd:Yt})},Ze=ue=>Ie(ue,!0),We=ue=>Ie(ue,!1),Je=()=>De(!0),ye=()=>De(!1),Me=!q&&!c,Qe=ue=>{var kt;if(!he&&uA.includes(ue.key)&&q){const{unselectNodesAndEdges:pt,addSelectedEdges:ut,edges:Bt}=ve.getState();ue.key==="Escape"?((kt=ge.current)==null||kt.blur(),pt({edges:[Bt.find(vt=>vt.id===n)]})):ut([n])}};return me.createElement("g",{className:gn(["react-flow__edge",`react-flow__edge-${a}`,r,{selected:f,animated:p,inactive:Me,updating:Te}]),onClick:xe,onDoubleClick:Ge,onContextMenu:rt,onMouseEnter:at,onMouseMove:le,onMouseLeave:_e,onKeyDown:Q?Qe:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":H===null?void 0:H||`Edge from ${b} to ${N}`,"aria-describedby":Q?`${AA}-${de}`:void 0,ref:ge},!Ve&&me.createElement(e,{id:n,source:b,target:N,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:j,labelBgBorderRadius:k,data:l,style:S,sourceX:E,sourceY:C,targetX:T,targetY:A,sourcePosition:I,targetPosition:B,sourceHandleId:U,targetHandleId:X,markerStart:Ue,markerEnd:ke,pathOptions:te,interactionWidth:ae}),O&&me.createElement(me.Fragment,null,(O==="source"||O===!0)&&me.createElement(K1,{position:I,centerX:E,centerY:C,radius:$,onMouseDown:Ze,onMouseEnter:Je,onMouseOut:ye,type:"source"}),(O==="target"||O===!0)&&me.createElement(K1,{position:B,centerX:T,centerY:A,radius:$,onMouseDown:We,onMouseEnter:Je,onMouseOut:ye,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function D4(e){const t={default:Ri(e.default||oh),straight:Ri(e.bezier||N0),step:Ri(e.step||k0),smoothstep:Ri(e.step||Eh),simplebezier:Ri(e.simplebezier||b0)},n={},r=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Ri(e[l]||oh),a),n);return{...t,...r}}function Y1(e,t,n=null){const r=((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 He.Top:return{x:r+l/2,y:a};case He.Right:return{x:r+l,y:a+c/2};case He.Bottom:return{x:r+l/2,y:a+c};case He.Left:return{x:r,y:a+c/2}}}function X1(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const F4=(e,t,n,r,a,l)=>{const c=Y1(n,e,t),u=Y1(l,r,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function q4({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,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+r,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=$c({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(m*y)>0}function Z1(e){var r,a,l,c,u;const t=((r=e==null?void 0:e[qt])==null?void 0:r.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 B4=[{level:0,isMaxLevel:!0,edges:[]}];function z4(e,t,n=!1){let r=-1;const a=e.reduce((c,u)=>{var h,m;const f=_r(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),j=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[qt])==null?void 0:h.z)||0,((m=y==null?void 0:y[qt])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(j?k:0)}return c[p]?c[p].push(u):c[p]=[u],r=p>r?p:r,c},{}),l=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===r}});return l.length===0?B4:l}function H4(e,t,n){const r=mt(x.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)&&q4({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 z4(r,t,n)}const U4=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),W4=({color:e="none",strokeWidth:t=1})=>me.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Q1={[ah.Arrow]:U4,[ah.ArrowClosed]:W4};function V4(e){const t=Gt();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(Q1,e)?Q1[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Zs.error009(e)),null)},[e])}const G4=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=V4(t);return f?me.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},me.createElement(f,{color:n,strokeWidth:c})):null},K4=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Lx(c,t);r.includes(u)||(a.push({id:u,color:c.color||e,...c}),r.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},BA=({defaultColor:e,rfId:t})=>{const n=mt(x.useCallback(K4({defaultColor:e,rfId:t}),[e,t]),(r,a)=>!(r.length!==a.length||r.some((l,c)=>l.id!==a[c].id)));return me.createElement("defs",null,n.map(r=>me.createElement(G4,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};BA.displayName="MarkerDefinitions";var Y4=x.memo(BA);const X4=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}),zA=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:j,reconnectRadius:k,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:N,edgesUpdatable:E,elementsSelectable:C,width:T,height:A,connectionMode:I,nodeInternals:B,onError:q}=mt(X4,rn),L=H4(t,B,n);return T?me.createElement(me.Fragment,null,L.map(({level:U,edges:X,isMaxLevel:Y})=>me.createElement("svg",{key:U,style:{zIndex:U},width:T,height:A,className:"react-flow__edges react-flow__container"},Y&&me.createElement(Y4,{defaultColor:e,rfId:r}),me.createElement("g",null,X.map(M=>{const[J,V,$]=Z1(B.get(M.source)),[z,W,G]=Z1(B.get(M.target));if(!$||!G)return null;let F=M.type||"default";a[F]||(q==null||q("011",Zs.error011(F)),F="default");const K=a[F]||a.default,de=I===Lo.Strict?W.target:(W.target??[]).concat(W.source??[]),H=X1(V.source,M.sourceHandle),Q=X1(de,M.targetHandle),O=(H==null?void 0:H.position)||He.Bottom,te=(Q==null?void 0:Q.position)||He.Top,ae=!!(M.focusable||N&&typeof M.focusable>"u"),he=M.reconnectable||M.updatable,ge=typeof y<"u"&&(he||E&&typeof he>"u");if(!H||!Q)return q==null||q("008",Zs.error008(H,M)),null;const{sourceX:Te,sourceY:De,targetX:Ve,targetY:je}=F4(J,H,O,z,Q,te);return me.createElement(K,{key:M.id,id:M.id,className:gn([M.className,l]),type:F,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:Te,sourceY:De,targetX:Ve,targetY:je,sourcePosition:O,targetPosition:te,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:j,reconnectRadius:k,rfId:r,ariaLabel:M.ariaLabel,isFocusable:ae,isReconnectable:ge,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:b})})))),S):null};zA.displayName="EdgeRenderer";var Z4=x.memo(zA);const Q4=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function J4({children:e}){const t=mt(Q4);return me.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function e5(e){const t=Th(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const t5={[He.Left]:He.Right,[He.Right]:He.Left,[He.Top]:He.Bottom,[He.Bottom]:He.Top},HA=({nodeId:e,handleType:t,style:n,type:r=Ra.Bezier,CustomComponent:a,connectionStatus:l})=>{var A,I,B;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=mt(x.useCallback(q=>({fromNode:q.nodeInternals.get(e),handleId:q.connectionHandleId,toX:(q.connectionPosition.x-q.transform[0])/q.transform[2],toY:(q.connectionPosition.y-q.transform[1])/q.transform[2],connectionMode:q.connectionMode}),[e]),rn),m=(A=c==null?void 0:c[qt])==null?void 0:A.handleBounds;let y=m==null?void 0:m[t];if(h===Lo.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(q=>q.id===u):y[0],j=w?w.x+w.width/2:(c.width??0)/2,k=w?w.y+w.height/2:c.height??0,S=(((I=c.positionAbsolute)==null?void 0:I.x)??0)+j,b=(((B=c.positionAbsolute)==null?void 0:B.y)??0)+k,N=w==null?void 0:w.position,E=N?t5[N]:null;if(!N||!E)return null;if(a)return me.createElement(a,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:S,fromY:b,toX:f,toY:p,fromPosition:N,toPosition:E,connectionStatus:l});let C="";const T={sourceX:S,sourceY:b,sourcePosition:N,targetX:f,targetY:p,targetPosition:E};return r===Ra.Bezier?[C]=_0(T):r===Ra.Step?[C]=Ox({...T,borderRadius:0}):r===Ra.SmoothStep?[C]=Ox(T):r===Ra.SimpleBezier?[C]=pA(T):C=`M${S},${b} ${f},${p}`,me.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};HA.displayName="ConnectionLine";const n5=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function r5({containerStyle:e,style:t,type:n,component:r}){const{nodeId:a,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=mt(n5,rn);return!(a&&l&&u&&c)?null:me.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},me.createElement("g",{className:gn(["react-flow__connection",p])},me.createElement(HA,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function J1(e,t){return x.useRef(null),Gt(),x.useMemo(()=>t(e),[e])}const UA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:j,onSelectionStart:k,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:N,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:A,selectionMode:I,multiSelectionKeyCode:B,panActivationKeyCode:q,zoomActivationKeyCode:L,deleteKeyCode:U,onlyRenderVisibleElements:X,elementsSelectable:Y,selectNodesOnDrag:M,defaultViewport:J,translateExtent:V,minZoom:$,maxZoom:z,preventScrolling:W,defaultMarkerColor:G,zoomOnScroll:F,zoomOnPinch:K,panOnScroll:de,panOnScrollSpeed:H,panOnScrollMode:Q,zoomOnDoubleClick:O,panOnDrag:te,onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ge,onPaneMouseLeave:Te,onPaneScroll:De,onPaneContextMenu:Ve,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:Ue,onEdgeMouseLeave:ke,onReconnect:xe,onReconnectStart:Ge,onReconnectEnd:rt,reconnectRadius:at,noDragClassName:le,noWheelClassName:_e,noPanClassName:Ie,elevateEdgesOnSelect:Ze,disableKeyboardA11y:We,nodeOrigin:Je,nodeExtent:ye,rfId:Me})=>{const Qe=J1(e,R4),ue=J1(t,D4);return e5(l),me.createElement(T4,{onPaneClick:ae,onPaneMouseEnter:he,onPaneMouseMove:ge,onPaneMouseLeave:Te,onPaneContextMenu:Ve,onPaneScroll:De,deleteKeyCode:U,selectionKeyCode:T,selectionOnDrag:A,selectionMode:I,onSelectionStart:k,onSelectionEnd:S,multiSelectionKeyCode:B,panActivationKeyCode:q,zoomActivationKeyCode:L,elementsSelectable:Y,onMove:n,onMoveStart:r,onMoveEnd:a,zoomOnScroll:F,zoomOnPinch:K,zoomOnDoubleClick:O,panOnScroll:de,panOnScrollSpeed:H,panOnScrollMode:Q,panOnDrag:te,defaultViewport:J,translateExtent:V,minZoom:$,maxZoom:z,onSelectionContextMenu:j,preventScrolling:W,noDragClassName:le,noWheelClassName:_e,noPanClassName:Ie,disableKeyboardA11y:We},me.createElement(J4,null,me.createElement(Z4,{edgeTypes:ue,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:X,onEdgeContextMenu:je,onEdgeMouseEnter:ve,onEdgeMouseMove:Ue,onEdgeMouseLeave:ke,onReconnect:xe,onReconnectStart:Ge,onReconnectEnd:rt,reconnectRadius:at,defaultMarkerColor:G,noPanClassName:Ie,elevateEdgesOnSelect:!!Ze,disableKeyboardA11y:We,rfId:Me},me.createElement(r5,{style:N,type:b,component:E,containerStyle:C})),me.createElement("div",{className:"react-flow__edgelabel-renderer"}),me.createElement($4,{nodeTypes:Qe,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:M,onlyRenderVisibleElements:X,noPanClassName:Ie,noDragClassName:le,disableKeyboardA11y:We,nodeOrigin:Je,nodeExtent:ye,rfId:Me})))};UA.displayName="GraphView";var s5=x.memo(UA);const qx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sa={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:qx,nodeExtent:qx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Lo.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:RP,isValidConnection:void 0},a5=()=>V$((e,t)=>({...Sa,setNodes:n=>{const{nodeInternals:r,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:Ap(n,r,a,l)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(a=>({...r,...a}))})},setDefaultNodesAndEdges:(n,r)=>{const a=typeof n<"u",l=typeof r<"u",c=a?Ap(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?r:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:r,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 m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((k,S)=>{const b=a.get(S.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[qt]:{...b[qt],handleBounds:void 0}});else if(b){const N=v0(S.nodeElement);!!(N.width&&N.height&&(b.width!==N.width||b.height!==N.height||S.forceUpdate))&&(a.set(b.id,{...b,[qt]:{...b[qt],handleBounds:{source:V1(".source",S.nodeElement,y,p),target:V1(".target",S.nodeElement,y,p)}},...N}),k.push({id:b.id,type:"dimensions",dimensions:N}))}return k},[]);MA(a,p);const j=c||l&&!c&&IA(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:j}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return r&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=x4(n,u()),h=Ap(p,a,c,f);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Aa(f,!0)):(c=qi(l(),n),u=qi(a,[])),Sd({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Aa(f,!0)):(c=qi(a,n),u=qi(l(),[])),Sd({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),u=r||a,f=c.map(h=>(h.selected=!1,Aa(h.id,!1))),p=u.map(h=>Aa(h.id,!1));Sd({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:a}=t();r==null||r.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:a}=t();r==null||r.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),l=r().filter(u=>u.selected).map(u=>Aa(u.id,!1)),c=n.filter(u=>u.selected).map(u=>Aa(u.id,!1));Sd({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(a=>{a.positionAbsolute=x0(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:a,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=Ys.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Sa.connectionNodeId,connectionHandleId:Sa.connectionHandleId,connectionHandleType:Sa.connectionHandleType,connectionStatus:Sa.connectionStatus,connectionStartHandle:Sa.connectionStartHandle,connectionEndHandle:Sa.connectionEndHandle}),reset:()=>e({...Sa})}),Object.is),T0=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=a5()),me.createElement(_P,{value:t.current},e)};T0.displayName="ReactFlowProvider";const WA=({children:e})=>x.useContext(jh)?me.createElement(me.Fragment,null,e):me.createElement(T0,null,e);WA.displayName="ReactFlowWrapper";const o5={input:SA,default:Dx,output:EA,group:E0},i5={default:oh,straight:N0,step:k0,smoothstep:Eh,simplebezier:b0},l5=[0,0],c5=[15,15],u5={x:0,y:0,zoom:1},d5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},VA=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l=o5,edgeTypes:c=i5,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:j,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:A,onNodeDragStart:I,onNodeDrag:B,onNodeDragStop:q,onNodesDelete:L,onEdgesDelete:U,onSelectionChange:X,onSelectionDragStart:Y,onSelectionDrag:M,onSelectionDragStop:J,onSelectionContextMenu:V,onSelectionStart:$,onSelectionEnd:z,connectionMode:W=Lo.Strict,connectionLineType:G=Ra.Bezier,connectionLineStyle:F,connectionLineComponent:K,connectionLineContainerStyle:de,deleteKeyCode:H="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:O=!1,selectionMode:te=Oc.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:he=sh()?"Meta":"Control",zoomActivationKeyCode:ge=sh()?"Meta":"Control",snapToGrid:Te=!1,snapGrid:De=c5,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:je=!0,nodesDraggable:ve,nodesConnectable:Ue,nodesFocusable:ke,nodeOrigin:xe=l5,edgesFocusable:Ge,edgesUpdatable:rt,elementsSelectable:at,defaultViewport:le=u5,minZoom:_e=.5,maxZoom:Ie=2,translateExtent:Ze=qx,preventScrolling:We=!0,nodeExtent:Je,defaultMarkerColor:ye="#b1b1b7",zoomOnScroll:Me=!0,zoomOnPinch:Qe=!0,panOnScroll:ue=!1,panOnScrollSpeed:kt=.5,panOnScrollMode:pt=Co.Free,zoomOnDoubleClick:ut=!0,panOnDrag:Bt=!0,onPaneClick:jt,onPaneMouseEnter:vt,onPaneMouseMove:an,onPaneMouseLeave:jn,onPaneScroll:Nt,onPaneContextMenu:Yt,children:fe,onEdgeContextMenu:st,onEdgeDoubleClick:It,onEdgeMouseEnter:Et,onEdgeMouseMove:En,onEdgeMouseLeave:Gn,onEdgeUpdate:St,onEdgeUpdateStart:lr,onEdgeUpdateEnd:yn,onReconnect:Xt,onReconnectStart:Cn,onReconnectEnd:zt,reconnectRadius:In=10,edgeUpdaterRadius:Kn=10,onNodesChange:cr,onEdgesChange:$n,noDragClassName:ea="nodrag",noWheelClassName:ta="nowheel",noPanClassName:_s="nopan",fitView:On=!1,fitViewOptions:wn,connectOnClick:ee=!0,attributionPosition:Ae,proOptions:Oe,defaultEdgeOptions:Re,elevateNodesOnSelect:ze=!0,elevateEdgesOnSelect:dt=!1,disableKeyboardA11y:yt=!1,autoPanOnConnect:Ct=!0,autoPanOnNodeDrag:gt=!0,connectionRadius:xt=20,isValidConnection:Ar,onError:Ss,style:ns,id:Ba,nodeDragThreshold:Wo,...js},Ln)=>{const Es=Ba||"1";return me.createElement("div",{...js,style:{...ns,...d5},ref:Ln,className:gn(["react-flow",a]),"data-testid":"rf__wrapper",id:Ba},me.createElement(WA,null,me.createElement(s5,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:N,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:A,nodeTypes:l,edgeTypes:c,connectionLineType:G,connectionLineStyle:F,connectionLineComponent:K,connectionLineContainerStyle:de,selectionKeyCode:Q,selectionOnDrag:O,selectionMode:te,deleteKeyCode:H,multiSelectionKeyCode:he,panActivationKeyCode:ae,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Ve,selectNodesOnDrag:je,defaultViewport:le,translateExtent:Ze,minZoom:_e,maxZoom:Ie,preventScrolling:We,zoomOnScroll:Me,zoomOnPinch:Qe,zoomOnDoubleClick:ut,panOnScroll:ue,panOnScrollSpeed:kt,panOnScrollMode:pt,panOnDrag:Bt,onPaneClick:jt,onPaneMouseEnter:vt,onPaneMouseMove:an,onPaneMouseLeave:jn,onPaneScroll:Nt,onPaneContextMenu:Yt,onSelectionContextMenu:V,onSelectionStart:$,onSelectionEnd:z,onEdgeContextMenu:st,onEdgeDoubleClick:It,onEdgeMouseEnter:Et,onEdgeMouseMove:En,onEdgeMouseLeave:Gn,onReconnect:Xt??St,onReconnectStart:Cn??lr,onReconnectEnd:zt??yn,reconnectRadius:In??Kn,defaultMarkerColor:ye,noDragClassName:ea,noWheelClassName:ta,noPanClassName:_s,elevateEdgesOnSelect:dt,rfId:Es,disableKeyboardA11y:yt,nodeOrigin:xe,nodeExtent:Je}),me.createElement(e4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:j,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:ve,nodesConnectable:Ue,nodesFocusable:ke,edgesFocusable:Ge,edgesUpdatable:rt,elementsSelectable:at,elevateNodesOnSelect:ze,minZoom:_e,maxZoom:Ie,nodeExtent:Je,onNodesChange:cr,onEdgesChange:$n,snapToGrid:Te,snapGrid:De,connectionMode:W,translateExtent:Ze,connectOnClick:ee,defaultEdgeOptions:Re,fitView:On,fitViewOptions:wn,onNodesDelete:L,onEdgesDelete:U,onNodeDragStart:I,onNodeDrag:B,onNodeDragStop:q,onSelectionDrag:M,onSelectionDragStart:Y,onSelectionDragStop:J,noPanClassName:_s,nodeOrigin:xe,rfId:Es,autoPanOnConnect:Ct,autoPanOnNodeDrag:gt,onError:Ss,connectionRadius:xt,isValidConnection:Ar,nodeDragThreshold:Wo}),me.createElement(QP,{onSelectionChange:X}),fe,me.createElement(jP,{proOptions:Oe,position:Ae}),me.createElement(a4,{rfId:Es,disableKeyboardA11y:yt})))});VA.displayName="ReactFlow";const h5=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function GA(){return mt(h5,rn)}const KA=({id:e,x:t,y:n,width:r,height:a,style:l,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:j,backgroundColor:k}=l||{},S=c||j||k;return me.createElement("rect",{className:gn(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:r,height:a,fill:S,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};KA.displayName="MiniMapNode";var f5=x.memo(KA);const p5=e=>e.nodeOrigin,m5=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),$p=e=>e instanceof Function?e:()=>e;function g5({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a=2,nodeComponent:l=f5,onClick:c}){const u=mt(m5,rn),f=mt(p5),p=$p(t),h=$p(e),m=$p(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return me.createElement(me.Fragment,null,u.map(w=>{const{x:j,y:k}=Ro(w,f).positionAbsolute;return me.createElement(l,{key:w.id,x:j,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:r,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var y5=x.memo(g5);const w5=200,v5=150,x5=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?TP(Ch(t,e.nodeOrigin),n):n,rfId:e.rfId}},b5="react-flow__minimap-desc";function YA({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#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:m="bottom-right",onClick:y,onNodeClick:w,pannable:j=!1,zoomable:k=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:N=10,offsetScale:E=5}){const C=Gt(),T=x.useRef(null),{boundingRect:A,viewBB:I,rfId:B}=mt(x5,rn),q=(e==null?void 0:e.width)??w5,L=(e==null?void 0:e.height)??v5,U=A.width/q,X=A.height/L,Y=Math.max(U,X),M=Y*q,J=Y*L,V=E*Y,$=A.x-(M-A.width)/2-V,z=A.y-(J-A.height)/2-V,W=M+V*2,G=J+V*2,F=`${b5}-${B}`,K=x.useRef(0);K.current=Y,x.useEffect(()=>{if(T.current){const Q=Nr(T.current),O=he=>{const{transform:ge,d3Selection:Te,d3Zoom:De}=C.getState();if(he.sourceEvent.type!=="wheel"||!Te||!De)return;const Ve=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*N,je=ge[2]*Math.pow(2,Ve);De.scaleTo(Te,je)},te=he=>{const{transform:ge,d3Selection:Te,d3Zoom:De,translateExtent:Ve,width:je,height:ve}=C.getState();if(he.sourceEvent.type!=="mousemove"||!Te||!De)return;const Ue=K.current*Math.max(1,ge[2])*(b?-1:1),ke={x:ge[0]-he.sourceEvent.movementX*Ue,y:ge[1]-he.sourceEvent.movementY*Ue},xe=[[0,0],[je,ve]],Ge=Ys.translate(ke.x,ke.y).scale(ge[2]),rt=De.constrain()(Ge,xe,Ve);De.transform(Te,rt)},ae=sA().on("zoom",j?te:null).on("zoom.wheel",k?O:null);return Q.call(ae),()=>{Q.on("zoom",null)}}},[j,k,b,N]);const de=y?Q=>{const O=Gr(Q);y(Q,{x:O[0],y:O[1]})}:void 0,H=w?(Q,O)=>{const te=C.getState().nodeInternals.get(O);w(Q,te)}:void 0;return me.createElement(w0,{position:m,style:e,className:gn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},me.createElement("svg",{width:q,height:L,viewBox:`${$} ${z} ${W} ${G}`,role:"img","aria-labelledby":F,ref:T,onClick:de},S&&me.createElement("title",{id:F},S),me.createElement(y5,{onClick:H,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),me.createElement("path",{className:"react-flow__minimap-mask",d:`M${$-V},${z-V}h${W+V*2}v${G+V*2}h${-W-V*2}z
57
- M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}YA.displayName="MiniMap";var k5=x.memo(YA);function N5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},me.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function _5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},me.createElement("path",{d:"M0 0h32v4.2H0z"}))}function S5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},me.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 j5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.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 E5(){return me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},me.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 kr=({children:e,className:t,...n})=>me.createElement("button",{type:"button",className:gn(["react-flow__controls-button",t]),...n},e);kr.displayName="ControlButton";const C5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),XA=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Gt(),[w,j]=x.useState(!1),{isInteractive:k,minZoomReached:S,maxZoomReached:b}=mt(C5,rn),{zoomIn:N,zoomOut:E,fitView:C}=Th();if(x.useEffect(()=>{j(!0)},[]),!w)return null;const T=()=>{N(),l==null||l()},A=()=>{E(),c==null||c()},I=()=>{C(a),u==null||u()},B=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return me.createElement(w0,{className:gn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&me.createElement(me.Fragment,null,me.createElement(kr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},me.createElement(N5,null)),me.createElement(kr,{onClick:A,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},me.createElement(_5,null))),n&&me.createElement(kr,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},me.createElement(S5,null)),r&&me.createElement(kr,{className:"react-flow__controls-interactive",onClick:B,title:"toggle interactivity","aria-label":"toggle interactivity"},k?me.createElement(E5,null):me.createElement(j5,null)),h)};XA.displayName="Controls";var T5=x.memo(XA),Zr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Zr||(Zr={}));function A5({color:e,dimensions:t,lineWidth:n}){return me.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function R5({color:e,radius:t}){return me.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const M5={[Zr.Dots]:"#91919a",[Zr.Lines]:"#eee",[Zr.Cross]:"#e2e2e2"},I5={[Zr.Dots]:1,[Zr.Lines]:1,[Zr.Cross]:6},$5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ZA({id:e,variant:t=Zr.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=mt($5,rn),y=c||M5[t],w=r||I5[t],j=t===Zr.Dots,k=t===Zr.Cross,S=Array.isArray(n)?n:[n,n],b=[S[0]*h[2]||1,S[1]*h[2]||1],N=w*h[2],E=k?[N,N]:b,C=j?[N/l,N/l]:[E[0]/l,E[1]/l];return me.createElement("svg",{className:gn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},me.createElement("pattern",{id:m+e,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},j?me.createElement(R5,{color:y,radius:N/l}):me.createElement(A5,{dimensions:E,color:y,lineWidth:a})),me.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}ZA.displayName="Background";var O5=x.memo(ZA);const L5=["us-gov","global","apac","us","eu","jp","au"],P5=new RegExp(`^(?:(?:${L5.join("|")})\\.)?anthropic\\.`,"i");function cl(e){return e.replace(P5,"")}const D5=["command","cmd","file_path","path","url","pattern","notebook_path"],eN=120,Op=e=>e.length>eN?`${e.slice(0,eN-1)}…`:e;function F5(e){if(typeof e=="string")return e.trim()?Op(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of D5){const r=t[n];if(typeof r=="string"&&r.trim())return Op(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(a=>typeof a=="string")){const a=r.join(" ").trim();if(a)return Op(a)}}return null}const q5=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function tN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const nN={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function A0(e){const t=q5.exec(e);if(!t)return null;const n=tN(t[1],"status");return{label:(n&&Object.hasOwn(nN,n)?nN[n]:void 0)??"background task update",detail:tN(t[1],"summary")}}function QA(e){return e.filter(t=>!A0(t.text))}const B5=/[0-9a-f]{16,}/i,z5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function JA(e){return B5.test(e)||z5.test(e)}function H5(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!JA(t[n]))return t[n];return t[t.length-1]}function eR(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function R0(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(a??0)}}function U5(e){const t=R0(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 W5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))!n||!r||typeof r!="object"||(t[n]=U5(r));return Object.keys(t).length?t:void 0}function tR(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),...R0(n)};for(const r of Object.values(n)){const a=tR(r,t+1);if(a)return a}return null}const V5=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,G5=new Set(["tool_input","tool_response"]);function nR(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&V5.test(cl(n.model)))return n.model;for(const[r,a]of Object.entries(n)){if(G5.has(r))continue;const l=nR(a,t+1);if(l)return l}return null}function Bx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function La(e){return H5(e)}function rN(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Ji(e,t){return`${e}::${t}`}function Pa(e,t){return`${e}\0${t}`}function ih(e){const t=e.agent_type??e.subagent_type;return t&&!JA(t)?t:"subagent"}function Sc(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Bi(e,t,n,r){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:r,usage:eR()},e.agents.set(a,l),l)}function rR(e,t,n,r){const a=Ji(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&r.cwd&&(l.cwd=r.cwd,l.cwdBasename=La(r.cwd));const c=ih(r);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function K5(e,t,n){const r=t.session_id??"unknown",a=Sc(t);if(a){const f=rR(e,r,a,t);if(f)return f}const l=e.activeSubagentStack.get(r),c=l&&l.length>0?l[l.length-1]:null;if(c){const f=e.agents.get(Ji(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=La(t.cwd)),f}const u=Bi(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=La(t.cwd)),u.label==="session"&&t.cwd&&(u.label=La(t.cwd)??"session"),u}function Y5(e,t,n,r,a){const l=Ji(t,n),c=Bi(e,t,a,!0);let u=e.agents.get(l);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=La(r.cwd));const f=ih(r);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:l,sessionId:t,label:ih(r),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:r.cwd,cwdBasename:La(r.cwd),toolCount:0,childCount:0,usage:eR()},e.agents.set(l,u),c.childCount+=1,u}function X5(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function sN(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let a=r.length-1;a>=0;a--)if(r[a]===n){r.splice(a,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function Ed(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 aN=200;function Z5(e,t){for(const n of e.values()){const r=n.tools.find(a=>a.id===t);if(r)return r}return null}const Q5=25;function J5(e,t){const n=t.tools;if(n.length>aN){const r=n.splice(0,n.length-aN);for(const a of r){const l=Pa(t.sessionId,a.id);e.toolIndex.get(l)===a&&e.toolIndex.delete(l)}}for(let r=n.length-Q5-1;r>=0;r--){const a=n[r];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function eD(e,t,n){const r=e.toolIndex.get(Pa(t.sessionId,n));if(r)return r;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const oN=2e3;function tD(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const a=e.prompts[r];if(a.at<t-oN)return!1;if(a.text===n&&a.at<=t+oN)return!0}return!1}const Cd=2e3;function nD(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function sR(e,t){for(const n of t.tools){const r=Pa(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function Xc(e,t){return t&&(e.revision+=1),t}function rD(e,t,n,r,a){if(e.agents.size<=n)return!1;const l=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}l(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(sR(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!l(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return Xc(e,f>0)}function sD(e,t,n,r,a){const l=new Map;for(const[h,m]of e.agents){let y=l.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},l.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...l].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...l.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&sR(e,w),e.agents.delete(y)}a==null||a(h),f--,p=!0}return Xc(e,p)}function aD(e,t){const n=t==null?void 0:t.payload,r=n==null?void 0:n.hook_event_name;if(r!=="PostToolUse"&&r!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(Pa((n==null?void 0:n.session_id)??"unknown",a))}function oD(e){let t=!1;for(const n of e.agents.values())for(const r of n.tools)r.endedAt!=null||r.outcomeGap||(r.outcomeGap=!0,t=!0);return Xc(e,t)}function iD(e,t,n){let r=!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(Pa(a.sessionId,u.id)),r=!0)}}return Xc(e,r)}const iN=90*6e4;function lD(e,t,n){let r=!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,r=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,a.reaped=!0,r=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=l,r=!0);e.activeSubagentStack.delete(a.sessionId)}}return Xc(e,r)}function cD(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const uD=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function dD(e,t){let n=null;for(const r of e.toolIndex.values()){const a=r.agentId?e.agents.get(r.agentId):void 0;!a||a.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const hD=3e4;function fD(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>hD)&&!(e.startedAt>t))return{name:e.name,preview:F5(e.input)??""}}function pD(e,t,n,r,a){if(n!=="permission")return{kind:n,message:r,since:a};const l=dD(e,t),c={kind:n,message:r,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=fD(l,a);return u&&(c.tool=u),c}function mD(e,t,n){if(e.kind==="idle")return!0;const r=Sc(t);return r==null?!0:e.subagentId!=null&&Ji(n,r)===e.subagentId}function lN(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 r=t.payload??{},a=t.receivedAt,l=r.hook_event_name??"Unknown";if(l==="__clear")return{...Bx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=r.session_id??"unknown";if(!uD.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&mD(h.waiting,r,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 r.model_context_window=="number"&&r.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=r.model_context_window)}if(typeof r.approval_policy=="string"&&r.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=r.approval_policy)}if(typeof r.context_tokens=="number"&&r.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??rN(),currentContextTokens:r.context_tokens})}if(l==="ModelObserved"){const h=typeof r.model=="string"?r.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=r.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const j=`${c}::${y}`,k=e.agents.get(j);k&&(k.model=w)}return e}if(l==="ContextObserved"){const h=r.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??rN(),w=(k,S)=>typeof h[k]=="number"?h[k]:S,j=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:j??y.memoryFiles}}}return e}if(l==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof r.sessionName=="string"?r.sessionName.trim():"",y=typeof r.sessionTitle=="string"?r.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(l==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=r.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(l==="OutputObserved"){const h=r.kind==="thinking"||r.kind==="text"||r.kind==="tool_use"?r.kind:null,m=typeof r.at=="number"&&Number.isFinite(r.at)?r.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(j=>m-j<gD);w.push(m),y.outputs=w.length>cN?w.slice(-cN):w}return e.revision+=1,e}if(l==="UsageObserved"){const h=r.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=R0(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=W5(r.usageByModel)}}return e}const f=K5(e,r,a);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=nR(r);switch(p&&(f.model=p),l){case"SessionStart":{const h=Bi(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&r.cwd&&(h.cwd=r.cwd,h.cwdBasename=La(r.cwd)),h.label==="session"&&r.cwd&&(h.label=La(r.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=Bi(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof r.prompt=="string"?r.prompt:typeof r.message=="string"?r.message:"")??"";m&&!tD(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!A0(m)&&(h.firstPrompt=Ed(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?eD(e,f,r.tool_use_id):null;if(h){r.tool_name&&h.name==="?"&&(h.name=r.tool_name),h.endedAt==null&&!h.trimmed&&r.tool_input!==void 0&&(h.input=r.tool_input,h.inputPreview=Ed(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=Sc(r),w={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:Ed(r.tool_input),agentId:f.id,explicitSubagentId:y?Ji(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(Pa(f.sessionId,m),w),J5(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=Pa(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const k of e.agents.values()){if(k.sessionId!==c)continue;const S=k.tools.find(b=>b.id===h);if(S){y=S,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=l==="PostToolUse",y.trimmed||(y.response=r.tool_response),l==="PostToolUseFailure"?y.errorPreview=Ed(r.tool_response):w&&(y.errorPreview=void 0);const j=tR(r.tool_response);j&&(y.usage=j),e.toolIndex.delete(m);break}case"SubagentStart":{const h=Sc(r);if(!h)break;const m=Y5(e,c,h,r,a),y=ih(r);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const j=m.endedAt!=null&&a-m.endedAt<=Cd,k=w!=null&&a-w<=Cd;if(j||k){const S=k?w:m.endedAt;m.state="done",m.endedAt=S,m.startedAt=Math.min(m.startedAt,S),sN(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,X5(e,c,h);break}case"SubagentStop":{const h=Sc(r);if(!h)break;const m=rR(e,c,h,r);if(!m){for(const[y,w]of e.subagentTombstones)a-w>Cd&&e.subagentTombstones.delete(y);e.subagentTombstones.set(Ji(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),sN(e,c,h);break}case"Stop":case"SessionEnd":{const h=Bi(e,c,a,!1),m=nD(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+Cd)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const j of w.tools)j.endedAt==null&&j.explicitSubagentId==null&&(j.endedAt=a,j.ok=!1,j.errorPreview=j.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(Pa(w.sessionId,j.id)));l==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=cD(r.notification_type);if(!h)break;const m=Bi(e,c,a,!1),y=typeof r.message=="string"?r.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:pD(e,c,h,y,a);break}}return e}const gD=6e4,cN=64;function lh(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 yD={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},wD=[{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:yD},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function vD(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ul(e,t=Date.now()){if(!e)return null;const n=cl(e);for(const r of wD)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function aR(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-r),l=r+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function oR(e,t,n=Date.now()){if(!vD(t))return e.inputTokens;const r=ul(t,n),a=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function To(e,t,n=Date.now()){const r=ul(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=oR(e,t,n)*r.input/1e6,l=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=aR(e,r),f=u.usd5m+u.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:f,total:a+l+c+f}}const uN=2e5,xD=1e6,bD=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],kD=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function ND(e){if(!e)return uN;const t=cl(e);for(const n of bD)if(n.test(t))return xD;for(const n of kD)if(n.match.test(t))return n.window;return uN}function iR(e,t){return typeof e=="number"&&e>0?e:ND(t)}const Fi="not priced";function lt(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}¢`}if(e<100){const t=e.toFixed(2);if(Number(t)<100)return`$${t}`}if(e<1e4){const t=e.toFixed(0);if(Number(t)<1e4)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function M0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${lt(r)}/min`:`${lt(n*3600)}/hr`}function _D(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 SD(e,t){let n=0,r=0,a=0,l=0,c=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,r),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 Zc(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const r=n.map(l=>({model:l,usage:t[l]})),a=SD(e.usage,r.map(l=>l.usage));if(a){const l=r.findIndex(c=>c.model===e.model);l>=0?r[l]={model:r[l].model,usage:_D(r[l].usage,a)}:r.push({model:e.model,usage:a})}return r}function Vn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Zc(e)){const a=To(r.usage,r.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 Pc(e,t=Date.now()){let n=0;for(const r of Zc(e))ul(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function lR(e){const t=[];for(const n of Zc(e)){if(!n.model||t.includes(n.model))continue;const r=n.usage;r.inputTokens+r.outputTokens+r.cacheReadTokens+r.cacheCreateTokens<=0||t.push(n.model)}return t}function cR(e){return lR(e).filter(t=>t!==e.model)}const jD=new Set(["untrusted","on-request","on-failure"]);function ED(e){return typeof e!="string"||!e?null:jD.has(e)?!0:e==="never"?!1:null}function CD(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=ED(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 dN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Da(e){const t=cl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=dN(n[1]),l=n[2].replace(/[-_]/g,".");return`${a} ${l}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const a=r[1].replace(/[-_]/g,"."),l=r[2].split(/[-_]/).filter(Boolean).map(dN);return[`GPT-${a}`,...l].join(" ")}return e}function Ah(e){const t=cl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Sr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Lp(e){const t=[];for(const n of e)n.kind==="root"&&Sr(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,r)=>n.waiting.since-r.waiting.since)}function TD(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function AD(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Rh(e,t){return`${e}@${t.since}`}function uR(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?a?r:`${n} · ${r}`:a?null:n}function RD(e){const t=e.message||"Needs your permission",n=uR(e,t);return n?`${t}
60
- Likely on: ${n}`:t}function MD(e,t,n,r=!0){if(!r)return[];if(n)return[];const a=[];for(const l of e){if(!Sr(l.waiting))continue;const c=Rh(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:RD(l.waiting),sessionId:l.id})}return a}function ID(e,t,n){const r=new Set;for(const l of e)r.add(Rh(l.id,l.waiting));const a=new Set;for(const l of n)r.has(l)&&a.add(l);for(const l of t)a.add(l.key);return a}function Pp(e){return new Set(e.map(t=>Rh(t.id,t.waiting)))}function $D(e,t){return e!==t}function OD(e,t){return!e&&t!=null}function LD(e,t){return e!==null&&t!=null}function Ut(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 el(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const a=Math.floor(r/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 dR(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 I0(e,t){const n=typeof e=="string"?e.trim():"",r=typeof t=="string"?t.trim():"";return{face:n||r||void 0,tooltip:r||n||void 0}}const PD=1;function DD(){const e=[];let t=0;function n(){let r;for(const a of e)(!r||a.layer>r.layer||a.layer===r.layer&&a.seq>r.seq)&&(r=a);return r}return{push(r,a=0,l="dialog"){const c={dismiss:r,layer:a,kind:l,seq:t++};return e.push(c),()=>{const u=e.indexOf(c);u!==-1&&e.splice(u,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const a=n();return a!=null&&a.dismiss===r},depth(){return e.length},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const jc=DD();function FD(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function hN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function qD(e,t){return!e||!e.isConnected||hN(e)?!1:t==null||hN(t)}const fN="a[href], button, input, select, textarea, [tabindex]";function BD(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function zD(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function HD({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 Mh(e){return e.ctrlKey||e.metaKey||e.altKey}const UD=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),WD=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),VD=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function $0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function GD(e){return $0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function O0(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=$0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!UD.has(String(e.type??"text").toLowerCase())}function KD(e,t){if(!e)return!1;if(O0(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&GD(e))return!1;if(WD.has($0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>VD.has(r))}function YD({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function XD({appModal:e,dialogDepth:t}){return e||t>0}function hR(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(fN))return BD({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&zD({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(fN)!=null})}):[]}function ZD(e,t){const n=hR(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function sn(e,t={}){const{focusRef:n,layer:r,popover:a}=t,l=a?"popover":"dialog",c=x.useRef(null),u=x.useRef(e);u.current=e;const f=x.useRef(null);f.current===null&&(f.current=()=>u.current());const p=f.current;return x.useEffect(()=>jc.push(p,r,l),[p,r,l]),x.useEffect(()=>{var m;const h=document.activeElement;return(m=(n==null?void 0:n.current)??hR(c.current)[0])==null||m.focus(),()=>{qD(h,document.activeElement)&&h.focus()}},[]),x.useEffect(()=>{const h=m=>{var b;if(m.key!=="Tab"||Mh(m))return;const y=c.current;if(!y)return;const w=document.activeElement;if(!(w!=null&&y.contains(w))&&!jc.isTop(p))return;const k=ZD(y,w),S=HD({count:k.length,index:w?k.indexOf(w):-1,shiftKey:m.shiftKey});S.kind!=="allow"&&(m.preventDefault(),S.kind==="focus"&&((b=k[S.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[p]),c}function QD(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 br(e){return e.toLocaleString()}function JD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const e6=60;function t6(e,t=e6){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),r=n.search(/[/\\]/);return"…"+(r===-1?n:n.slice(r))}function n6({agent:e,onClose:t}){var y;const n=x.useRef(null),r=sn(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=iR(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Vn(e),h=e.provider==="codex"?l.inputTokens+l.outputTokens:l.inputTokens+l.outputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=QD(e.provider);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[o.jsxs("header",{className:"ctx-modal-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),o.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),o.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"ctx-window-row",children:[o.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:o.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),o.jsxs("div",{className:"ctx-window-meta",children:[o.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),o.jsxs("span",{children:[br(c)," / ",br(u)," tok (",m.windowScope,")"]})]})]}),o.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),o.jsxs("div",{className:"ctx-grid",children:[o.jsx(Vr,{label:"input tokens",val:br(l.inputTokens)}),o.jsx(Vr,{label:"output tokens",val:br(l.outputTokens)}),o.jsx(Vr,{label:"cache reads",val:br(l.cacheReadTokens)}),o.jsx(Vr,{label:"cache writes",val:br(l.cacheCreateTokens)}),o.jsx(Vr,{label:"cumulative total",val:br(h)}),o.jsx(Vr,{label:"estimated cost",val:lt(p.total),accent:!0})]}),o.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?o.jsxs("div",{className:"ctx-grid",children:[o.jsx(Vr,{label:"user messages",val:br((a==null?void 0:a.msgsUser)??0)}),o.jsx(Vr,{label:"assistant messages",val:br((a==null?void 0:a.msgsAssistant)??0)}),o.jsx(Vr,{label:"tool uses",val:br((a==null?void 0:a.toolUses)??0)}),o.jsx(Vr,{label:"tool results",val:br((a==null?void 0:a.toolResults)??0)}),o.jsx(Vr,{label:"system-reminders",val:br((a==null?void 0:a.systemReminders)??0)})]}):o.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),o.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?o.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):o.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>o.jsxs("li",{children:[o.jsx("span",{className:"ctx-md-path",title:w.path,children:t6(w.path)}),o.jsx("span",{className:"ctx-md-size",children:JD(w.bytes)})]},w.path))})]})})}function Vr({label:e,val:t,accent:n}){return o.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[o.jsx("span",{className:"ctx-row-label",children:e}),o.jsx("span",{className:"ctx-row-val",children:t})]})}function r6({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:a}){const l=iR(n,t),c=Math.min(1,e/l),u=r/2-3,f=r/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return o.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${l.toLocaleString()} tokens — show breakdown`,children:o.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[o.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),o.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),o.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const pN=new Map;function fR(e){let t=pN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},pN.set(e,t)),t}function s6(e,t){const n=fR(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const r of n.listeners)r()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function a6(e){return fR(e).now}const mN=new Map,gN=new Map;function dl(e=1e3){let t=mN.get(e);t||(t=r=>s6(e,r),mN.set(e,t));let n=gN.get(e);return n||(n=()=>a6(e),gN.set(e,n)),x.useSyncExternalStore(t,n,n)}function Ih(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const o6="1",yN="agent-dag.schema",i6=["agent-dag.layout","agent-dag.viewport"];function ks(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function l6(e,t=o6){let n=null;try{n=e.getItem(yN)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const a of i6)try{e.getItem(a)!==null&&(e.removeItem(a),r.push(a))}catch{}try{e.setItem(yN,t)}catch{}return r}const pR="agent-dag.recapsDismissed",wN=200;function c6(){const e=ks(pR);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let tl=new Set(c6());const zx=new Set;let mR=0;function gR(e){return zx.add(e),()=>{zx.delete(e)}}function yR(e){if(tl=e,mR++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(pR,JSON.stringify(t.length>wN?t.slice(-wN):t))}catch{}for(const t of zx)t()}function wR(e,t){return`${e}@${t}`}function u6(e){return tl.has(e)}function d6(e){if(tl.has(e))return;const t=new Set(tl);t.add(e),yR(t)}function h6(e){const t=new Set(tl);t.delete(e)||t.add(e),yR(t)}function f6(e){return x.useSyncExternalStore(gR,()=>e!=null&&tl.has(e),()=>!1)}function L0(e){return`recap:${e}`}function p6(e){return e.startsWith("recap:")}function m6(){return x.useSyncExternalStore(gR,()=>mR,()=>0)}function g6(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.exitAt!=null)continue;let r=t.get(n.sessionId);r||(r={total:0,live:0,done:0,err:0,failed:0},t.set(n.sessionId,r)),r.total+=1,n.state==="active"?r.live+=1:n.state==="err"?r.err+=1:r.done+=1;for(const a of n.tools)a.ok===!1&&(r.failed+=1)}return t}function vR(e){return[`${e.total} ${e.total===1?"subagent":"subagents"}`,e.live>0?`${e.live} live`:null,e.done>0?`${e.done} done`:null,e.err>0?`${e.err} err`:null].filter(Boolean).join(" · ")}function xR(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function y6(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&Sr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const l=n.sayWaiting(r);return{tone:"idle",long:l,short:l}}const a=e.tools.filter(l=>l.ok===!1).length;if(a>0)return{tone:"err",long:`${a} tool ${a===1?"call":"calls"} failed`,short:`${a} failed`};if(t&&t.total>0)return{tone:"muted",long:vR(t),short:xR(t)};if(e.state==="active")for(let l=e.tools.length-1;l>=0;l--){const c=e.tools[l];if(c.endedAt!=null)continue;const{name:u,subject:f}=n.describeCall(c);return{tone:"muted",long:f?`${u} · ${f}`:u,short:u}}return null}function Hx(e){return e==="active"?"live":e==="done"?"done":"err"}const Qc={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"}},w6=Object.fromEntries(Object.entries(Qc).map(([e,t])=>[e,t.category])),v6=Object.fromEntries(Object.entries(Qc).map(([e,t])=>[e,t.emoji])),x6=Object.fromEntries(Object.entries(Qc).map(([e,t])=>[e,t.label])),b6=new Set(Object.keys(Qc)),k6=new Set(Object.entries(Qc).filter(([,e])=>e.shell).map(([e])=>e)),vN={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",...w6};function bR(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(vN,e)?vN[e]:"other"}const N6=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,_6=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function S6(e){if(typeof e!="string"||!e)return null;const t=N6.exec(e);if(t){const r=j6(t[2]);if(r.trim())return r}const n=_6.exec(e);return n?n[1]:null}function j6(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
61
- `:n==="r"?"\r":n==="t"?" ":n)}const kR=600,E6=4,C6=36,Ux=16,T6=60,A6=6,xN=220,bN=96,R6=28,kN={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:"📡",...v6};function NN(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(kN,e)?kN[e]:"✨"}const _N={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 NR(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 NR(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 r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let a=r[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 M6(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=S6(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 r=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const I6=new Set(["Bash","PowerShell",...k6]),$6=b6;function O6(e,t){return $6.has(e)||e.startsWith("mcp__")?Math.max(bN,34+t.length*7.5):bN}function L6(e,t){if(!I6.has(e))return null;const n=M6(t);if(!n)return null;const r=NR(n);return r?{emoji:Object.hasOwn(_N,r)?_N[r]:"⚙️",label:r,category:"shell",detail:n}:null}const P6=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),SN={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:"🗄️"},jN={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 D6(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function F6(e){const t=e.toLowerCase();if(Object.hasOwn(jN,t))return jN[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 r=t.slice(n+1);if(Object.hasOwn(SN,r))return SN[r]}return"📄"}function q6(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const r=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return r?r[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 B6(e,t){if(!P6.has(e))return null;const n=q6(e,t);if(!n)return null;const r=D6(n);return r?{emoji:e==="LS"?"📂":F6(r),label:r,category:"file",detail:n}:null}const EN={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 P0(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 z6(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 _R(e){const t=e.toLowerCase();return Object.hasOwn(EN,t)?EN[t]:void 0}function H6(e,t){const n=P0(e);if(!n)return null;const{server:r,method:a}=n;if(!a)return null;const l=_R(r);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${r} · ${a}`}}function SR(e,t){return L6(e,t)??B6(e,t)??H6(e)}function U6(e,t){var n;return((n=SR(e,t))==null?void 0:n.label)??null}const CN=x6,TN=18;function W6(e){const t=[...e];return t.length<=TN?e:t.slice(0,TN-1).join("")+"…"}function D0(e){const t=P0(e);if(t){const r=_R(t.server);return r?{emoji:r.emoji,label:r.name}:{emoji:"🔌",label:W6(t.server),hue:z6(t.server)}}const n=Object.hasOwn(CN,e)?CN[e]:"";return n?{emoji:NN(e),label:n}:{emoji:NN(e),label:e}}function V6(e){let t=null,n="";for(const r of e){const a=P0(r);if(a){if(!a.server)return null;if(t===null)t=a.server,n=r;else if(a.server!==t)return null}}return t===null?null:D0(n)}function G6(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function K6(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/kR)}function Y6(e,t){const n=[],r=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];r.has(l.id)||(r.add(l.id),n.push(l))}return n.reverse()}function X6(e,t,n,r,a,l){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&l-u.exitAt>kR)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=Y6(u.tools,E6);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??xN,xN),w=(m==null?void 0:m.height)??130,j=f.x,k=f.y,S=j+y,b=k+w/2;p.forEach((N,E)=>{const C=E*C6,T=j+y+T6,A=k+A6+C,I=K6(l,h),B=N.inputPreview??"",q=G6(N),L=I<.999,U=D0(N.name);c.push({id:`${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:U.label,emoji:U.emoji,status:q,category:bR(N.name),mcpHue:U.hue,inputPreview:B,fade:I,fading:L,worldX:T,worldY:A,anchorX:S,anchorY:b,spawnDx:S-T,spawnDy:b-(A+Ux)});const X=SR(N.name,N.input);if(X){const Y=O6(N.name,U.label),M=T+Y+R6,J=A,V=T+Y,$=A+Ux;c.push({id:`sub:${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:X.label,emoji:X.emoji,isSub:!0,status:q,category:X.category,inputPreview:X.detail??B,fade:I,fading:L,worldX:M,worldY:J,anchorX:V,anchorY:$,spawnDx:V-M,spawnDy:0})}})}return c}function Z6({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:a,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=X6(e,t,n,r,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return o.jsx(Q6,{bursts:h,spotlight:l,onOpenTool:f})}function Q6({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:a,zoom:l}=GA();return o.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[o.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*l+r,f=c.anchorY*l+a,p=(c.worldX+6)*l+r,h=(c.worldY+Ux)*l+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),j=t!=null&&!t.has(c.agentId),k=c.fade*(j?.14:1);return o.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:k},`l:${c.id}`)})}),e.map(c=>o.jsx(eF,{b:c,x:r,y:a,zoom:l,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function J6(e,t){const n=e.b,r=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===r.id&&n.toolId===r.toolId&&n.worldX===r.worldX&&n.worldY===r.worldY&&n.spawnDx===r.spawnDx&&n.spawnDy===r.spawnDy&&n.status===r.status&&n.fading===r.fading&&n.category===r.category&&n.mcpHue===r.mcpHue&&n.isSub===r.isSub&&n.emoji===r.emoji&&n.name===r.name&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const eF=x.memo(function({b:t,x:n,y:r,zoom:a,dim:l,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+r,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},j=l?" dim":"";return o.jsx("div",{className:"tool-burst-wrap",style:p,children:o.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${j}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[o.jsx("span",{className:"tb-emoji",children:t.emoji}),o.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&o.jsx("span",{className:"tb-spin"}),t.status==="done"&&o.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&o.jsx("span",{className:"tb-mark err",children:"×"})]})})},J6);function jR({kind:e}){return o.jsxs("svg",{className:"state-mark","data-kind":e,viewBox:"0 0 10 10",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[e==="live"&&o.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&o.jsx("path",{d:"M2.2 5.3l1.9 1.9 3.8-4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e==="err"&&o.jsx("path",{d:"M2.8 2.8l4.4 4.4M7.2 2.8l-4.4 4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"})]})}function F0(){return o.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),o.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),o.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function AN(e,t){const n=ul(t);if(!n)return`model: ${t}
62
- no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,l=To(e,t),c=aR(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${lt(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${lt(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${lt(c.usd5m)}`],f=oR(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${lt(l.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${lt(l.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${lt(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${lt(l.total)}`].join(`
63
- `)}function RN(e){const t=Zc(e);return t.length<=1?AN(e.usage,e.model):[...t.map(n=>AN(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${lt(Vn(e).total)}`].join(`
64
- `)}function tF({data:e,selected:t}){var S,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(N=>!N.endedAt).length,a=e.tools.filter(N=>N.ok===!1).length,l=lh(e.sessionId),c=((S=e.context)==null?void 0:S.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
65
- ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=cR(e),h=p.length>0?`${e.model}
66
- spend on this card also covers:
67
- ${p.join(`
68
- `)}`:e.model,m=I0(e.sessionName,e.sessionTitle),y=Ih(e),w=y?wR(e.sessionId,y.at):null,j=f6(w),k=y!=null&&!j;return o.jsxs("div",{className:n,style:{"--session-hue":l},children:[o.jsx("span",{className:"accent-stripe"}),o.jsx(Po,{type:"target",position:He.Left,style:{background:"transparent",border:"none"}}),o.jsxs("div",{className:"head",children:[o.jsxs("div",{className:"title",children:[o.jsx(aF,{state:e.state}),o.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&o.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&o.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":k,title:k?"Hide the recap":"Show Claude Code's recap",onClick:N=>{N.stopPropagation(),h6(w)},children:o.jsx(Dc,{})})]}),o.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&o.jsx(r6,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),o.jsxs("div",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",o.jsx(sF,{start:e.startedAt,end:e.endedAt})]})]})]}),o.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&o.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?o.jsxs("span",{className:"model-chip","data-family":Ah(e.model),title:h,children:[Da(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?o.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&o.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&o.jsx(lF,{waiting:e.waiting}),(()=>{const N=CD(e);return N?o.jsxs("div",{className:"approval-blind-row",title:N.detail,children:[o.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),o.jsx("span",{className:"approval-blind-said",children:N.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&o.jsx(cF,{tools:e.tools,outputs:e.outputs}),o.jsxs("div",{className:"meta",children:[o.jsxs("span",{children:[o.jsx("b",{children:e.toolCount})," tools"]}),a>0&&o.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[o.jsx("b",{children:a})," err"]}),r>0&&o.jsxs("span",{className:"inflight-meta",children:[o.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&o.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:[o.jsx("b",{children:Ut(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const N=ul(e.model),E=Vn(e),C=Pc(e);if(!N&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:o.jsx("span",{className:"cost-unpriced",title:RN(e),children:Fi});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),A=e.state==="active"&&!e.synthetic?M0(E.total,T):null,I=RN(e)+(A?`
69
- burn: ${A}`:"");return o.jsx("span",{className:"cost-meta",title:I,children:o.jsxs("b",{children:[lt(E.total),C>0?"+":""]})})})()]}),o.jsx(rF,{data:e,title:e.kind==="root"?m.face:void 0}),o.jsx(Po,{type:"source",position:He.Right,style:{background:"transparent",border:"none"}})]})}const nF=x.memo(tF);function rF({data:e,title:t}){const n=e.kind==="root"&&Sr(e.waiting),r=y6(e,e.branch,{sayWaiting:q0,describeCall:a=>({name:D0(a.name).label,subject:U6(a.name,a.input)})});return o.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsx(jR,{kind:Hx(e.state)}),o.jsx("span",{className:"lod-name",children:e.label}),r&&o.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&o.jsx(F0,{})]}),t&&o.jsx("div",{className:"lod-title",children:t}),r&&o.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[o.jsx("span",{className:"lod-long",children:r.long}),o.jsx("span",{className:"lod-short",children:r.short})]})]})}function sF({start:e,end:t}){const n=dl(1e3);return o.jsx(o.Fragment,{children:el(e,t,n)})}function nl(e){return e==="active"?"live":e==="done"?"done":"err"}function aF({state:e}){return o.jsx("span",{className:`state-pill state-${e}`,children:nl(e)})}function rl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function oF(e,t=Date.now()){const n=e.tools.filter(a=>a.ok===!1).length,r=Vn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",nl(e.state),Sr(e.waiting)?rl(e.waiting):null,e.model?Da(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,n>0?`${n} failed`:null,r>0?`${lt(r)}${Pc(e,t)>0?"+":""}`:null].filter(Boolean).join(", ")}function iF(e,t){const n=uR(e,t);return n?`Likely on: ${n}`:null}function q0(e){return e.kind==="idle"?"Your turn":rl(e)}function lF({waiting:e}){const t=dl(1e3),n=Sr(e),r=rl(e);return o.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
70
- Blocked for ${el(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?o.jsx("span",{className:"ap-pulse","aria-hidden":!0}):o.jsx("span",{className:"waiting-dot","aria-hidden":!0}),o.jsx("span",{className:"waiting-said",children:q0(e)}),o.jsx("b",{children:el(e.since,void 0,t)})]})}function Dc(){return o.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M3.3 3.3l5.4 5.4M8.7 3.3l-5.4 5.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",fill:"none"}),o.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function cF({tools:e,outputs:t}){const n=dl(1e3),r=6e4,a=24,l=r/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=r)return;const T=a-1-Math.floor(C/l);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,j=h/(l/1e3),k=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,S=u-k,b=[k>0?`${k} tool ${k===1?"call":"calls"}`:"",S>0?`${S} ${S===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),N=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${j.toFixed(1)}/s`;return o.jsxs("div",{className:"tool-spark-row",title:N,children:[o.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),A=C===a-1&&E>0,B=`tool-spark-bar${E>0?" active":""}${A?" latest":""}`;return o.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:B},A?`landed:${E}`:C)})}),o.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function uF(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Dp(e){return e!=="gone"}function Fp(e,t){const[n,r]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{r(l=>uF(e,l))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>r("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&r("here")},[n]),n}async function sl(e,t=500){var r;if(!e)return!1;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}const dF=60,hF=6e3,vs=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),sr=e=>typeof e=="string"?e:null;function Do(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),r=n?e.map((l,c)=>[String(c),l]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const a=[];for(const[l,c]of r){const u=n?`${t}-`:`${t}${l}:`;if(typeof c=="string"&&c.includes(`
71
- `)){a.push(u);for(const f of c.split(`
72
- `))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=Do(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
73
- `)}function fF(e){return e.lines??e.text.split(`
74
- `).map(t=>({text:t}))}function pF(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const a of e){if(n.length===dF)return{shown:n,cut:!0};const l=hF-r;if(a.text.length>l)return n.push({...a,text:`${a.text.slice(0,Math.max(l,0))}…`}),{shown:n,cut:!0};n.push(a),r+=a.text.length+1}return{shown:n,cut:!1}}const Mn=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),ar=(e,t)=>({label:e,text:t,inline:!0}),ER=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
75
- `),lines:t});function mF(e,t){return[...e.split(`
76
- `).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
77
- `).map(n=>({text:`+ ${n}`,tone:"add"}))]}function gF(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!vs(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const r of n.lines){const a=String(r);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function MN(e){if(typeof e=="string")return[Mn(void 0,e)];if(!vs(e))return[Mn(void 0,Do(e))];const t=[],n=sr(e.type);n==="create"&&t.push(ar("result","created the file"));const r=gF(e.structuredPatch);return r&&t.push(ER("applied",r)),e.userModified===!0&&t.push(ar("note","the user changed it before it was applied")),t.length?t:[ar("result",n==="update"?"updated the file":"done")]}function yF(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const r=t??1;return n!=null?`${r}–${r+n-1}`:`from ${r}`}function wF(e){if(typeof e=="string")return[Mn(void 0,e)];const t=vs(e)&&vs(e.file)?e.file:null,n=sr(t==null?void 0:t.content);if(t&&n!=null){const a=[],l=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(l)&&Number.isFinite(c)&&c>0&&a.push(ar("lines",l>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+l-1} of ${c}`:`${l} of ${c}`)),a.push(Mn("content",n)),a}const r=vs(e)?sr(e.type):null;return r&&r!=="text"?[ar("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Mn(void 0,Do(e))]}function vF(e){if(typeof e=="string")return[Mn("output",e)];if(!vs(e))return[Mn(void 0,Do(e))];const t=sr(e.stdout),n=sr(e.stderr);if(t==null&&n==null)return[Mn(void 0,Do(e))];const r=[];return t&&r.push(Mn("output",t.replace(/\n$/,""))),n&&r.push(Mn("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(ar("note","interrupted before it finished")),r.length?r:[ar("output","none")]}function xF(e,t,n){const r=vs(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const a=sr(r.file_path),l=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(vs).filter(c=>sr(c.old_string)!=null&&sr(c.new_string)!=null);if(a&&l.length){const c=[ar("file",a)];return l.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(ER(l.length>1?`change ${f+1}${p}`:`change${p}`,mF(u.old_string,u.new_string)))}),{input:c,response:MN(n)}}}if(r&&e==="Write"){const a=sr(r.file_path),l=sr(r.content);if(a&&l!=null)return{input:[ar("file",a),Mn("content",l)],response:MN(n)}}if(r&&e==="Read"){const a=sr(r.file_path);if(a){const l=yF(r);return{input:l?[ar("file",a),ar("lines",l)]:[ar("file",a)],response:wF(n)}}}if(r&&e==="Bash"){const a=sr(r.command);if(a!=null){const l=sr(r.description);return{input:l?[Mn("command",a),ar("why",l)]:[Mn("command",a)],response:vF(n)}}}return{input:[Mn(void 0,Do(t))],response:[Mn(void 0,Do(n))]}}function IN(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(vs(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
78
- `);if(e==="Read"&&t==="response"&&vs(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function bF({tool:e,onClose:t}){const n=sn(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,l=e.response??e.errorPreview,c=xF(e.name,a,l);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),o.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),o.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",children:dR(e,"in-flight…")}),o.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("section",{className:"modal-body",children:[e.trimmed&&o.jsx("div",{className:"modal-section",children:o.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsx("h4",{children:"Input"}),o.jsx(ON,{text:IN(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>o.jsx($N,{block:u},f))]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsxs("h4",{children:["Response ",r==="err"&&o.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&o.jsx(ON,{text:IN(e.name,"response",l),what:"response"})]}),e.endedAt==null?o.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>o.jsx($N,{block:u},f))]})]})]})})}const kF={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function $N({block:e}){const[t,n]=x.useState(!1);if(e.inline)return o.jsxs("p",{className:"tm-inline",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("code",{children:e.text})]});const{shown:r,cut:a}=pF(fF(e),t);return o.jsxs("div",{className:"tm-block",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((l,c)=>o.jsxs("span",{className:l.tone?kF[l.tone]:void 0,children:[l.text,c<r.length-1?`
79
- `:""]},c)):r.map(l=>l.text).join(`
80
- `)}),a&&o.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function ON({text:e,what:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),o.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void sl(e).then(l=>{!l||!a.current||(r(!0),window.setTimeout(()=>{a.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const Td=18,LN=26,NF=12,_F=240;function SF(e,t){return(e+_F)*(t||1)}function jF(e){return EF(e.nodeInternals.values())}function EF(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")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=qN(l)??h.label),l.kind==="root"&&(h.name=BN(l)),l.kind==="root"&&(h.alarm=Sr(l.waiting)),l.kind==="root"&&(h.branch=FN(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:qN(l)??l.sessionId,name:BN(l),alarm:l.kind==="root"&&Sr(l.waiting),branch:FN(l)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const r=[];for(const[a,l]of t){const c=(n.get(l.label)??0)>1;r.push({sessionId:a,...AF(l.label,l.name,a,c),x:l.minX-Td,y:l.minY-Td-LN,w:l.maxX-l.minX+Td*2,h:l.maxY-l.minY+Td*2+LN,...l.alarm?{alarm:!0}:null,...l.branch?{branch:l.branch}:null})}return r}const Kd=" · ",CF=32,TF=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function PN(e){return TF.test(e)?2:1}function DN(e,t=CF){const n=[...e];let r=0;for(const c of n)r+=PN(c);if(r<=t)return e;const a=[];let l=0;for(const c of n){const u=PN(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 AF(e,t,n,r){const a=(t==null?void 0:t.trim())??"",l=r?RF(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:DN(e),name:a?DN(a):void 0,shortId:l,fullLabel:c.join(Kd)}}function RF(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function FN(e){if(e.kind!=="root")return;const t=e.branch;return t&&t.total>0?xR(t):void 0}function qN(e){if(e.kind==="root")return e.label}function BN(e){if(e.kind==="root")return I0(e.sessionName,e.sessionTitle).face}function MF({onFocusSession:e}){const{x:t,y:n,zoom:r}=GA(),a=mt(jF,IF);if(a.length<=1)return null;const l=u=>{try{e==null||e(u)}catch{}},c={transform:`translate(${t}px, ${n}px) scale(${r})`};return o.jsx("div",{className:"session-clusters",style:c,children:a.map(u=>{const f=lh(u.sessionId),p={position:"absolute",left:0,top:0,transform:`translate(${u.x}px, ${u.y}px)`,width:u.w,height:u.h,"--session-hue":f},h={position:"absolute",left:u.x+16,top:u.y-NF/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:SF(u.w,r),"--session-hue":f};return o.jsxs(me.Fragment,{children:[o.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),o.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
81
- `:""}Zoom to ${u.fullLabel}
82
- drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:[u.alarm?o.jsxs(o.Fragment,{children:[o.jsx(F0,{}),o.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?o.jsx("span",{className:"cluster-label-branch",children:Kd+u.branch}):null,u.name?o.jsx("span",{className:"cluster-label-name",children:Kd+u.name}):null,u.shortId?o.jsx("span",{className:"cluster-label-id",children:Kd+u.shortId}):null]})]},u.sessionId)})})}function IF(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],a=t[n];if(r.sessionId!==a.sessionId||r.label!==a.label||r.name!==a.name||r.shortId!==a.shortId||r.alarm!==a.alarm||r.branch!==a.branch||r.fullLabel!==a.fullLabel||r.x!==a.x||r.y!==a.y||r.w!==a.w||r.h!==a.h)return!1}return!0}function $F({data:e}){return o.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function CR(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 Yd(e){return CR(Math.floor(e/1e3))}function TR(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return r>0?`${r}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function OF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ch(e,t,n){const r=new Date(e),a=Yd(t-e);return{label:OF(r,new Date(t))?a:`${a} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function LF({data:e}){const t=dl(3e4),n=ch(e.recap.at,t);return o.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"recap-note-head",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Dc,{}),"recap"]}),o.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),o.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":"Hide the recap",title:"Hide — the ※ on the card brings it back",onClick:r=>{r.stopPropagation(),d6(e.noteKey)},children:"×"})]}),o.jsx("p",{className:"recap-note-text",children:e.recap.text}),o.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Dc,{}),"recap"]}),o.jsx("span",{className:"recap-face-age",children:n.label})]}),o.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),o.jsx(Po,{type:"source",position:He.Right,style:{background:"transparent",border:"none"}})]})}function PF({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a,targetPosition:l,style:c}){const[u]=_0({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:.35});return o.jsxs("g",{className:"recap-tie",style:c,children:[o.jsx("path",{className:"recap-tie-thread",d:u}),o.jsx("path",{className:"recap-tie-beads",d:u}),o.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),o.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}function DF(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,a=0,l=0;for(const c of e){const u=Vn(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,r+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:a,cacheCreateTokens:l,sum:n+r}}const FF="spend on this board",qF="on this board",zN=`Everything on the board right now, and only that.
83
- 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.
84
- Press H for the totals ccusage reads off the logs on disk, which do not forget.`,AR="session spend",Wx="__unknown__",BF=12;function zF(e,t=Date.now()){const n=new Map;for(const r of e)for(const a of Zc(r)){const l=a.model??Wx,c=To(a.usage,a.model,t),u=n.get(l);u?(u.inputTokens+=a.usage.inputTokens,u.outputTokens+=a.usage.outputTokens,u.cacheReadTokens+=a.usage.cacheReadTokens,u.cacheCreateTokens+=a.usage.cacheCreateTokens,u.cost.total+=c.total,u.cost.input+=c.input,u.cost.output+=c.output,u.cost.cacheRead+=c.cacheRead,u.cost.cacheWrite+=c.cacheWrite,u.agentCount++):n.set(l,{model:l,inputTokens:a.usage.inputTokens,outputTokens:a.usage.outputTokens,cacheReadTokens:a.usage.cacheReadTokens,cacheCreateTokens:a.usage.cacheCreateTokens,cost:{...c},agentCount:1,priced:ul(a.model,t)!=null})}return Array.from(n.values()).sort((r,a)=>a.cost.total-r.cost.total||a.inputTokens+a.outputTokens-(r.inputTokens+r.outputTokens))}function HF(e,t=Date.now()){const n=[...e],r=[];for(const a of n){if(a.kind!=="root")continue;let l=Vn(a,t).total,c=a.usage.inputTokens,u=a.usage.outputTokens,f=Pc(a,t);for(const p of n)p.sessionId!==a.sessionId||p.kind==="root"||(l+=Vn(p,t).total,c+=p.usage.inputTokens,u+=p.usage.outputTokens,f+=Pc(p,t));r.push({sessionId:a.sessionId,label:a.label||a.cwdBasename||"session",state:a.state,cost:l,inputTokens:c,outputTokens:u,unpricedTokens:f})}return r.sort((a,l)=>l.cost-a.cost||l.inputTokens+l.outputTokens-(a.inputTokens+a.outputTokens)).slice(0,BF)}function B0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(l,c,u)=>{if(l<=0)return null;const f=l/n*100;return o.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${lt(l)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return o.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function UF({state:e,sessionId:t,onClose:n}){const r=x.useMemo(()=>WF(e,t),[e,t]),a=x.useRef(null),l=sn(n,{focusRef:a});return r?o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),o.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),o.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),o.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("div",{className:"modal-body",children:[o.jsxs("section",{className:"ss-hero",children:[o.jsxs("div",{className:"ss-hero-left",children:[o.jsx("div",{className:"ss-cost-label",children:AR}),o.jsx("div",{className:"ss-cost",children:lt(r.cost.total)}),r.modelChips.length>0&&o.jsx("div",{className:"ss-models",children:r.modelChips.map(c=>o.jsx("span",{className:"model-chip","data-family":Ah(c),title:c,children:Da(c)},c))})]}),o.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&o.jsxs(o.Fragment,{children:[o.jsx(B0,{cost:r.cost,size:"lg"}),o.jsxs("div",{className:"ss-cost-legend",children:[o.jsxs("span",{className:"ssl ssl-in",children:["input ",o.jsx("b",{children:lt(r.cost.input)})]}),o.jsxs("span",{className:"ssl ssl-out",children:["output ",o.jsx("b",{children:lt(r.cost.output)})]}),o.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",o.jsx("b",{children:lt(r.cost.cacheRead)})]}),o.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",o.jsx("b",{children:lt(r.cost.cacheWrite)})]})]})]})})]}),o.jsxs("section",{className:"ss-stats",children:[o.jsx(Mi,{label:"agents",value:r.agentCount}),o.jsx(Mi,{label:"subagents",value:r.subagentCount}),o.jsx(Mi,{label:"tool calls",value:r.toolCount}),o.jsx(Mi,{label:"prompts",value:r.promptCount}),o.jsx(Mi,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&o.jsx(Mi,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Most-used tools"}),o.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([c,u])=>o.jsxs("div",{className:"ss-tt",children:[o.jsx("span",{className:"ss-tt-name",children:c}),o.jsx("span",{className:"ss-tt-bar",children:o.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),o.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),r.firstPrompt&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Opening prompt"}),o.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function Mi({label:e,value:t,tone:n}){return o.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[o.jsx("div",{className:"ss-stat-value",children:t}),o.jsx("div",{className:"ss-stat-label",children:e})]})}function WF(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const E of e.agents.values())E.sessionId===t&&r.push(E);if(r.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,m=0,y,w=1/0,j=0;for(const E of r){const C=Vn(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const A of lR(E))l.add(A);E.model&&l.add(E.model),E.kind==="subagent"&&m++;const T=QA(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),j=Math.max(j,E.endedAt??Date.now());for(const A of E.tools)c.set(A.name,(c.get(A.name)??0)+1),A.ok===!1&&h++}const k=Math.max(0,j-w),S=Math.floor(k/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,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:b,cost:a,modelChips:Array.from(l),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:N,firstPrompt:y}}function HN(e){return e.waiting?Sr(e.waiting)?0:1:e.state==="active"?2:3}function VF(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let a=r.toolCount,l=Vn(r).total,c=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;a+=u.toolCount,l+=Vn(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:Ih(r),modelId:r.model,toolCount:a,cost:l,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,a)=>{const l=HN(r),c=HN(a);return l!==c?l-c:r.waiting&&a.waiting?r.waiting.since-a.waiting.since:a.lastActivity-r.lastActivity}),n}function UN(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const a=Math.floor(r/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 GF({state:e,now:t,selectedIds:n,onSelect:r,onClose:a}){const l=x.useMemo(()=>VF(e),[e,e.revision,t]),c=l.filter(f=>f.state==="active").length,u=l.filter(f=>Sr(f.waiting)).length;return o.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[o.jsxs("div",{className:"sl-header",children:[o.jsxs("h2",{children:["Sessions ",o.jsx("span",{className:"sl-count",children:l.length})]}),u>0&&o.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&o.jsxs("span",{className:"sl-live-count",children:[c," live"]}),o.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),o.jsxs("div",{className:"sl-rows",children:[l.length===0&&o.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(f=>{const p=n.has(f.sessionId);return o.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>r(f.sessionId),title:`Focus ${f.label}`,children:[o.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:nl(f.state)}),o.jsxs("div",{className:"sl-row-body",children:[o.jsxs("div",{className:"sl-row-head",children:[o.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&o.jsx("span",{className:"model-chip","data-family":Ah(f.modelId),title:f.modelId,children:Da(f.modelId)})]}),o.jsxs("div",{className:"sl-row-meta",children:[o.jsxs("span",{title:"tool calls",children:[o.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&o.jsx("span",{className:"sl-cost",title:AR,children:o.jsx("b",{children:lt(f.cost)})}),f.waiting?o.jsxs("span",{className:"sl-waiting",title:[rl(f.waiting),iF(f.waiting,rl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
85
- `),children:["waiting ",UN(f.waiting.since,void 0,t),f.waiting.tool&&o.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):o.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:UN(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&o.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[o.jsx(Dc,{}),f.recap.text]})]})]},f.sessionId)})]})]})}const KF=e=>1-Math.pow(1-e,5),RR=420;function YF(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 r=Math.max(Math.abs(e),Math.abs(t));return r===0||n/r>=.005}function XF(e,t,n,r=RR){return n>=r?t:n<=0?e:e+(t-e)*KF(n/r)}function ZF(e,t,n,r={}){const a=r.now??(()=>performance.now()),l=r.raf??(w=>requestAnimationFrame(w)),c=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!YF(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(XF(e,t,w)),w<RR&&(h=l(y))};return h=l(y),()=>{m=!1,h&&c(h)}}const Vx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function QF(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function qp(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||QF(r))continue;const a=Vn(r,t);n.set(r.sessionId,{cost:a.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function JF(e,t){if(!e)return Vx;const n={...Vx};for(const[r,a]of t){const l=e.get(r);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 MR(e,t,n){const r=tq*Math.max(1,n/$R);let a=0;for(const[l,c]of t){const u=e.get(l);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=r&&(a+=f)}return a}const WN={samples:[],last:new Map,watched:0},IR=10*6e4,eq=6e4,$R=5e3,tq=20;function nq(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<$R)return e;const a=e.watched+MR(e.last,n,r?t-r.t:0),l=e.samples.filter(c=>t-c.t<=IR);return l.push({t,watched:a}),{samples:l,last:n,watched:a}}function rq(e,t,n){const r=e.samples[0];if(!r)return null;const a=t-r.t;if(a<eq)return null;const l=e.samples[e.samples.length-1].t,c=e.watched+MR(e.last,n,t-l)-r.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(IR/6e4,Math.ceil(a/6e4))}:null}function VN(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const $h=[{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 sq(e,t,n=$h.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 aq(e,t=new Date){return e==="today"?VN(1,t):e==="month"?VN(t.getDate(),t):"20200101"}const or=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Xd=e=>typeof e=="string"?e:"";function OR(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const a=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const l of a){const c=Xd(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+=or(l==null?void 0:l.cost),u.inputTokens+=or(l==null?void 0:l.inputTokens),u.outputTokens+=or(l==null?void 0:l.outputTokens),u.cacheReadTokens+=or(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=or(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((r,a)=>a.cost-r.cost||a.tokens-r.tokens)}const oq=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function iq(e){var t;return((t=oq.exec(e))==null?void 0:t[0])??e}function lq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const a of n){const l=Xd(a==null?void 0:a.period);if(!l)continue;const c=iq(l),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:c,label:t.get(c)??null,agent:Xd(a==null?void 0:a.agent)||"claude",cost:or(a==null?void 0:a.totalCost),tokens:or(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Xd).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function LR(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=or(t.cacheReadTokens),p=or(t.cacheCreationTokens),h=or(t.inputTokens),m=or(t.outputTokens);return{cost:or(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:or(t.totalTokens)||h+m+f+p}}const n=OR(e),r=f=>n.reduce((p,h)=>p+f(h),0),a=r(f=>f.inputTokens),l=r(f=>f.outputTokens),c=r(f=>f.cacheReadTokens),u=r(f=>f.cacheCreateTokens);return{cost:r(f=>f.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+l+c+u}}function cq(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 GN(e,t){var n;return((n=$h.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function uq(e,t,n){const r=e!=null,a=LR(e);return{fromRange:r,cost:r?a.cost+n.cost:t.cost.total,inputTokens:r?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?a.cost>0:t.cost.total>0,tokenSum:r?a.tokens:t.sum,showCostBar:!r}}const nn="ccdeck";function Fa(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Oh(e){return e==null}const Gx="self";function Ma(e,t=!1){const n=Fa(e?Gx:null,Gx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Ks(e){return Oh(e?Gx:null)}function uh({armedFor:e,target:t,armedAt:n,now:r,gapMs:a}){return e!==t?"arm":r-n<a?"ignore":"fire"}function dq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function KN(e){return e==null||e==="BODY"||e==="HTML"}const PR="agent-dag.usagePeriod";function hq(){const e=ks(PR);return $h.some(t=>t.key===e)?e:"today"}function fq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PR,e)}catch{}}const DR="agent-dag.usageSessionsOpen";function pq(){return ks(DR)==="1"}function mq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(DR,e?"1":"0")}catch{}}function YN(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 gq(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"}function yq(e,t,n,r){const a=Math.max(0,t-r),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,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function ja({pct:e,label:t,reset:n,resetAt:r,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}%`,m=u===0?2:u,y=r?TR(r,c):null,w=r&&a?yq(u,r,a,c):null,[j,k]=x.useState(!1),S=x.useId();return o.jsxs("div",{className:"qb-row",children:[o.jsxs("div",{className:"qb-meta",children:[o.jsxs("span",{className:"qb-label",children:[t,l&&o.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),o.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),o.jsxs("div",{className:"qb-track",children:[o.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&o.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:o.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),o.jsxs("div",{className:"qb-reset-row",children:[y?o.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?o.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&o.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":j,"aria-controls":j?S:void 0,onClick:()=>k(b=>!b),children:[o.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),j&&w&&o.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const wq=6e4,vq=2e4;function xq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ks(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(vq)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),wq),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function bq(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 kq(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 FR=6e4,XN=6e4;function Nq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Ks(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),FR),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function _q(e){const[t,n]=x.useState(null),r=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),r.current=window.setInterval(a,FR),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function Sq(e,t,n){const[r,a]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(k=>k+1)},w=window.setInterval(y,XN),j=()=>{m()&&Date.now()-p.current>=XN&&f(k=>k+1)};return document.addEventListener("visibilitychange",j),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",j)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,j=aq(w);return c(!0),fetch(`/api/ccusage?since=${j}${y?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!m||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...cq(r,e),loading:l}}function pc(e){const[t,n]=x.useState(e),r=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,r.current=e,n(e);return}return ZF(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function jq({state:e,now:t,providers:n,leaving:r,onClose:a,liveSince:l=null}){var We,Je;const{quota:c,loading:u,refresh:f}=xq(n.claude),{data:p,loading:h,refresh:m}=Nq(n.codex),{data:y}=_q(n.codex),[w,j]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ye=window.setInterval(()=>j(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ye)},[]);const k=x.useRef(WN),S=x.useRef(null),{byModel:b,totalCost:N,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ye=zF(e.agents.values()),Me=DF(e.agents.values());S.current!==l&&(S.current=l,k.current=WN);const Qe=qp(e.agents.values(),t);l!=null&&(k.current=nq(k.current,t,Qe));const ue=l==null?null:rq(k.current,t,Qe),kt=ue?{label:M0(ue.spent,ue.spanSec),spanMin:ue.spanMin}:null;return{byModel:ye,totalCost:Me.cost,totalTokens:Me,burnRate:kt}},[e,e.revision,t,l]),T=x.useMemo(()=>HF(e.agents.values()),[e,e.revision]),[A,I]=x.useState(hq);x.useEffect(()=>{fq(A)},[A]);const[B,q]=x.useState(pq);x.useEffect(()=>{mq(B)},[B]);const L=x.useRef([]),[U,X]=x.useState(0),Y=x.useRef(()=>new Map);Y.current=()=>qp(e.agents.values(),t);const M=x.useCallback(()=>Y.current(),[]),{data:J,shown:V,stale:$,loading:z,baseline:W}=Sq(A,U,M),G=J!=null,F=z&&$,K=x.useMemo(()=>{const ye=new Map;for(const Me of e.agents.values()){if(Me.kind!=="root"||!Me.sessionId)continue;const Qe=Me.label||Me.cwdBasename;Qe&&ye.set(Me.sessionId,Qe)}return ye},[e,e.revision]),de=x.useMemo(()=>{const ye=new Map;for(const Me of e.agents.values())Me.kind!=="root"||!Me.sessionId||ye.set(Me.sessionId,Me.state);return ye},[e,e.revision]),H=x.useMemo(()=>G?OR(J):[],[J,G]),Q=x.useMemo(()=>{if(!G)return[];const ye=lq(J,K).slice(0,12),Me=new Map;for(const Qe of ye)Qe.label&&Me.set(Qe.label,(Me.get(Qe.label)??0)+1);return ye.map(Qe=>Qe.label&&(Me.get(Qe.label)??0)>1?{...Qe,label:`${Qe.label} ${Qe.sessionId.slice(0,4)}`}:Qe)},[J,G,K]),O=x.useMemo(()=>LR(J),[J]),te=GN(V,A),ae=$?" up-stale":"",he=x.useMemo(()=>G?JF(W,qp(e.agents.values(),t)):Vx,[e,e.revision,W,G,t]),ge=uq(J,{...E,cost:N},he),Te=ge.hasCost,De=ge.tokenSum,Ve=pc(ge.cost),je=pc(ge.inputTokens),ve=pc(ge.outputTokens),Ue=pc(ge.cacheReadTokens),ke=pc(ge.cacheCreateTokens),xe=b.filter(ye=>ye.cost.total>0||ye.inputTokens+ye.outputTokens>0),Ge=T.filter(ye=>ye.cost>0||ye.inputTokens+ye.outputTokens>0),rt=G?H.some(ye=>ye.cost<=0&&ye.tokens>0):xe.some(ye=>!ye.priced),at=u||h,le=YN(c==null?void 0:c.fetchedAt,w),_e=YN(p==null?void 0:p.fetchedAt,w),Ie=()=>{f(),m(),X(ye=>ye+1)},Ze=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return o.jsxs("aside",{className:`usage-panel${r?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[o.jsxs("div",{className:"up-header",children:[o.jsx("h2",{children:"Usage"}),C&&o.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,o.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),o.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&o.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Ie,...Ma(at),"aria-label":Ze,title:Ze,children:at?"…":"↻"}),o.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Claude quota",le&&!u&&o.jsx("span",{className:"up-section-age",title:gq(c==null?void 0:c.source),children:le})]}),c!=null&&c.ok?o.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&o.jsx(ja,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&o.jsx(ja,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&o.jsx(ja,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&o.jsx(ja,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?o.jsx(ja,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&o.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:bq(c.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&o.jsx("span",{className:"up-plan-badge",children:p.planLabel}),_e&&!h&&o.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:_e})]}),p!=null&&p.ok?o.jsxs("div",{className:"up-quota-bars",children:[(We=p.windows)==null?void 0:We.map(ye=>o.jsx(ja,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,limitReached:p.limitReached&&ye.pct>=100,nowSec:w},ye.id)),(Je=p.extraWindows)==null?void 0:Je.map(ye=>o.jsx(ja,{label:ye.label,pct:ye.pct,reset:ye.reset??void 0,resetAt:ye.resetAt??void 0,windowSec:ye.windowSec??void 0,nowSec:w},ye.id)),p.creditLimit&&o.jsx(ja,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&o.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&o.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&o.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${nn} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&o.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&o.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:kq(p.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&o.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
86
- last 5h: ${Ut(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[Ut(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),G&&o.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":F||void 0,onKeyDown:ye=>{var ue;const Me=L.current.indexOf(ye.target);if(Me<0)return;const Qe=sq(ye.key,Me);Qe!==null&&(ye.preventDefault(),(ue=L.current[Qe])==null||ue.focus())},children:$h.map((ye,Me)=>o.jsx("button",{type:"button",ref:Qe=>{L.current[Me]=Qe},tabIndex:A===ye.key?0:-1,"aria-pressed":A===ye.key,"data-pending":A===ye.key&&F?"":void 0,title:A===ye.key&&F?`Reading ${ye.noun} from the transcripts on this machine…`:ye.hint,className:"uh-range-btn",onClick:()=>I(ye.key),children:ye.label},ye.key))}),G&&o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:F?`Reading ${GN(A,A)}…`:""}),De>0?o.jsxs(o.Fragment,{children:[Te&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`up-total${ae}`,title:G?void 0:zN,children:[o.jsx("span",{className:"up-total-value",children:lt(Ve)}),o.jsx("span",{className:"up-total-label",children:G?te:FF})]}),ge.showCostBar&&o.jsx(B0,{cost:N})]}),o.jsxs("div",{className:`up-tokens-row${ae}`,title:G?void 0:zN,children:[o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"in"}),Ut(je)]}),o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"out"}),Ut(ve)]}),ge.cacheReadTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache r"}),Ut(Ue)]}),ge.cacheCreateTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache c"}),Ut(ke)]}),!Te&&o.jsx("span",{className:"up-tok up-scope",children:qF})]}),(G?H.length:xe.length)>0&&o.jsxs("section",{className:`up-section${ae}`,children:[o.jsx("h3",{className:"up-section-title",children:"By model"}),o.jsxs("table",{className:"up-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Model"}),o.jsx("th",{children:"Tokens"}),o.jsx("th",{children:"Cost"})]})}),o.jsx("tbody",{children:G?H.map(ye=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ye.model,children:Da(ye.model)}),o.jsx("td",{className:"up-num",children:Ut(ye.tokens)}),ye.cost>0?o.jsx("td",{className:"up-num up-cost-val",children:lt(ye.cost)}):o.jsx("td",{className:"up-num up-unpriced",children:Fi})]},ye.model)):xe.map(ye=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ye.model===Wx?"no model reported yet":ye.model,children:ye.model===Wx?"unknown":Da(ye.model)}),o.jsx("td",{className:"up-num",children:Ut(ye.inputTokens+ye.outputTokens)}),ye.priced?o.jsx("td",{className:"up-num up-cost-val",children:lt(ye.cost.total)}):o.jsx("td",{className:"up-num up-unpriced",children:Fi})]},ye.model))})]})]}),G&&Q.length===0&&O.tokens>0&&o.jsxs("section",{className:"up-section",children:[o.jsx("h3",{className:"up-section-title",children:"By session"}),o.jsxs("div",{className:"up-hint",children:["No session is dated ",te," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(G?Q.length:Ge.length)>0&&(()=>{const ye=G?Q.length:Ge.length;return o.jsxs("section",{className:`up-section${ae}`,children:[o.jsx("h3",{className:"up-section-title",children:o.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":B,"aria-controls":"up-sessions",title:B?"Hide the per-session breakdown":`Show the per-session breakdown — ${ye} session${ye===1?"":"s"}`,onClick:()=>q(Me=>!Me),children:["By session",G&&o.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${te}, each showing what that session has cost since it started.
87
- 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 ",te]}),o.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:o.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),o.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!B,children:[G&&Q.map(Me=>{const Qe=de.get(Me.sessionId);return o.jsxs("div",{className:"up-session-row",children:[Qe?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`sl-dot state-${Qe}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:nl(Qe)})]}):o.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),o.jsx("span",{className:`up-session-label${Me.label?"":" up-session-id"}`,title:Me.label?`${Me.label}
88
- ${Me.sessionId}`:Me.sessionId,children:Me.label??Me.sessionId.slice(0,8)}),o.jsx("span",{className:"up-session-tokens",children:Ut(Me.tokens)}),Me.cost>0?o.jsx("span",{className:"up-session-cost",title:Me.models.join(", ")||void 0,children:lt(Me.cost)}):o.jsx("span",{className:"up-session-cost up-unpriced",children:Fi})]},Me.sessionId)}),!G&&Ge.map(Me=>o.jsxs("div",{className:"up-session-row",children:[o.jsx("span",{className:`sl-dot state-${Me.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:nl(Me.state)}),o.jsx("span",{className:"up-session-label",children:Me.label}),o.jsx("span",{className:"up-session-tokens",children:Ut(Me.inputTokens+Me.outputTokens)}),Me.cost>0?o.jsxs("span",{className:"up-session-cost",title:Me.unpricedTokens>0?`${Ut(Me.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[lt(Me.cost),Me.unpricedTokens>0?"+":""]}):o.jsx("span",{className:"up-session-cost up-unpriced",children:Fi})]},Me.sessionId))]})]})})(),rt&&o.jsxs("div",{className:"up-hint",children:["“",Fi,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):o.jsx("div",{className:"up-empty",children:G?o.jsxs(o.Fragment,{children:["No usage ",te,".",o.jsx("br",{}),"Try a longer period."]}):o.jsxs(o.Fragment,{children:["No usage data yet.",o.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}function Bp(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function z0(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:Bp(t/1e3),unit:"KB/s"}:t<9995e5?{value:Bp(t/1e6),unit:"MB/s"}:{value:Bp(t/1e9),unit:"GB/s"}}function Lh(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<999.5?{value:String(Math.round(t)),unit:"ms"}:{value:(t/1e3).toFixed(1),unit:"s"}}function Fc(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function zp(e,t){return t==="B/s"?z0(e):t==="ms"?Lh(e):{value:String(e),unit:t==="C"?"°C":t}}const en={l:30,r:6,t:6,b:2},Ea={l:0,r:0,t:2,b:1},Ph=104,Eq=64;function Xr(e,t=100,n=Ph,r=en){const a=n-r.t-r.b;return r.t+a*(1-Math.max(0,Math.min(t,e))/t)}function qR(e,t,n,r=100,a=Ph,l=en){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-l.l-l.r;return l.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${Xr(h.v,r,a,l).toFixed(1)}`,p=h}return f}function BR(e,t,n,r=100,a=Ph,l=en){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=w=>l.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const j of m)w+=`L${p(j.t).toFixed(1)} ${Xr(j.v,r,a,l).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function Cq(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 zR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Tq(e,t,n=r=>jo(r)){const r=e.filter(c=>c.v>0);if(!e.length)return null;if(!r.length)return"never held back";const a=r.length*(t/6e4),l=r[r.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function jo(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function H0(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 r=Math.floor(n/60),a=n%60;return a?`${r}h ${a}m`:`${r}h`}function Aq({group:e,title:t,onClose:n}){const r=sn(n),[a,l]=x.useState(null);x.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&l(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[c,a==null?void 0:a.sinceMs]);return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&o.jsxs("span",{className:"hist-since",children:["since ",jo(u)," · ",H0(u,f||Date.now())]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"hist-body",children:a==null?o.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?o.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>o.jsx(Rq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function Rq({series:e,stepMs:t}){const n=x.useRef(null),[r,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const q=n.current;if(!q||typeof ResizeObserver>"u")return;const L=new ResizeObserver(([U])=>a(Math.max(160,U.contentRect.width)));return L.observe(q),()=>L.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w,changes:j}=e,k=w?Eq:Ph,{now:S,peak:b}=Cq(u),N=S!=null?zp(S,f):null,E=b!=null?zp(b,f):null,C=m==="Throttling"?Tq(u,t):null,T=l!=null?u[l]:null,A=u.length>1?u[u.length-1].t-u[0].t:0,I=q=>{const L=r-en.l-en.r;return en.l+(A>0?L*(q-u[0].t)/A:L/2)},B=q=>{if(u.length<2)return;const L=q.currentTarget.getBoundingClientRect(),U=(q.clientX-L.left-en.l)/Math.max(1,L.width-en.l-en.r),X=u[0].t+A*Math.max(0,Math.min(1,U));let Y=0;for(let M=1;M<u.length;M++)Math.abs(u[M].t-X)<Math.abs(u[Y].t-X)&&(Y=M);c(Y)};return o.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[o.jsxs("div",{className:"hist-head",children:[o.jsx("span",{className:"hist-label",children:m}),o.jsxs("span",{className:"hist-stats",children:[N&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:N.value}),o.jsxs("span",{children:[N.unit," now"]})]}),b!=null&&E&&o.jsxs(o.Fragment,{children:[o.jsx("b",{className:zR(b,p,h),children:E.value}),o.jsxs("span",{children:[E.unit," peak"]})]})]})]}),o.jsx("div",{className:"hist-plot",ref:n,children:o.jsxs("svg",{className:"hist-chart",width:"100%",height:k,viewBox:`0 0 ${r} ${k}`,preserveAspectRatio:"none",role:"img","aria-label":N==null||E==null?`${m}: nothing measured yet`:`${m}: ${Fc(N)} now, peak ${Fc(E)}, over ${H0(u[0].t,u[u.length-1].t)}`,onPointerMove:B,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([q,L])=>L==null||L>y?null:o.jsxs("g",{children:[o.jsx("line",{className:`hist-rule ${q}`,x1:en.l,x2:r-en.r,y1:Xr(L,y,k),y2:Xr(L,y,k)}),o.jsx("text",{className:`hist-rule-tag ${q}`,x:2,y:Xr(L,y,k)+3,children:L})]},q)),o.jsx("line",{className:"hist-floor",x1:en.l,x2:r-en.r,y1:k-en.b,y2:k-en.b}),(j??[]).filter(q=>q.from!=null&&u.length>1&&q.t>=u[0].t&&q.t<=u[u.length-1].t).map(q=>o.jsx("line",{className:"hist-mark",x1:I(q.t),x2:I(q.t),y1:en.t,y2:k-en.b},q.t)),o.jsx("path",{className:"hist-area",d:BR(u,r,t,y,k)}),o.jsx("path",{className:"hist-line",d:qR(u,r,t,y,k)}),u.length===1&&o.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:Xr(u[0].v,y,k),r:3}),T&&o.jsxs("g",{children:[o.jsx("line",{className:"hist-cross",x1:I(T.t),x2:I(T.t),y1:en.t,y2:k-en.b}),o.jsx("circle",{className:"hist-dot",cx:I(T.t),cy:Xr(T.v,y,k),r:3})]})]})}),o.jsx("div",{className:"hist-axis",children:T?o.jsxs("span",{className:"hist-at",children:[jo(T.t)," — ",(()=>{const q=zp(T.v,f);return o.jsxs(o.Fragment,{children:[o.jsx("b",{children:q.value}),q.unit==="%"||q.unit==="°C"||!q.unit?q.unit:` ${q.unit}`]})})()]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:u.length?jo(u[0].t):""}),o.jsx("span",{children:u.length?jo(u[u.length-1].t):""})]})}),C&&o.jsx("div",{className:"hist-note",children:C}),j==null?void 0:j.slice(-3).map(q=>o.jsx("div",{className:"hist-note hist-route",children:q.from==null?`Since ${jo(q.t)} — ${q.label}`:`${jo(q.t)} — ${q.label.charAt(0).toUpperCase()+q.label.slice(1)}`},q.t))]})}function Mq(e,t,n){if(n<=0||Mh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:r===-1?0:(r+1)%n};case"ArrowUp":return{kind:"focus",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const Ia=4,Kr=8;function U0(e,t,n){const r=n.width-Kr-(e.right+Ia),a=e.left-Ia-Kr,l=t.width<=r||r>=a?"right":"left",c=l==="right"?e.right+Ia:e.left-Ia-t.width,u=n.height-Kr*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(Kr,Math.min(e.top,n.height-Kr-p)),left:Math.max(Kr,c),side:l,maxHeight:f?null:p}}function Iq(e,t,n){const r=n.height-Kr-(e.bottom+Ia),a=e.top-Ia-Kr,l=t.height<=r||r>=a?"below":"above",c=l==="below"?r:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=l==="below"?e.bottom+Ia:e.top-Ia-f,h=Math.max(Kr,Math.min(e.right-t.width,n.width-Kr-t.width));return{top:Math.max(Kr,p),left:h,side:l,maxHeight:u?null:f}}const HR='[role="menuitem"]';function ZN(e){return e?Array.from(e.querySelectorAll(HR)).filter(t=>!t.disabled):[]}function Kx({anchorId:e,boundaryId:t,id:n,className:r,role:a,labelledBy:l,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=sn(()=>{var k;(k=document.getElementById(e))==null||k.focus(),p.current()},{popover:!0}),m=x.useCallback(()=>{var C;const k=h.current;if(!k)return;const S=document.getElementById(e);if(!S){p.current();return}const b=S.getBoundingClientRect(),N=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(N&&(b.bottom<=N.top||b.top>=N.bottom)){k.contains(document.activeElement)&&S.focus({preventScroll:!0}),p.current();return}k.style.maxHeight="";const E=Iq(b,{width:k.offsetWidth,height:k.offsetHeight},{width:window.innerWidth,height:window.innerHeight});k.style.top=`${E.top}px`,k.style.left=`${E.left}px`,k.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,k.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const k=S=>{var b;(b=h.current)!=null&&b.contains(S.target)||m()};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const k=S=>{var N,E;const b=S.target;!b||(N=h.current)!=null&&N.contains(b)||(E=document.getElementById(e))!=null&&E.contains(b)||p.current()};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[e,h]),x.useEffect(()=>{var S;if(a!=="menu")return;const k=ZN(h.current);(S=c==="last"?k[k.length-1]:k[0])==null||S.focus()},[]);const y=k=>{var S;if(a==="menu"&&k.key==="Tab"){k.stopPropagation(),(S=document.getElementById(e))==null||S.focus(),k.shiftKey&&k.preventDefault(),p.current();return}if(a==="menu"){const b=ZN(h.current),N=Mq(k,b.indexOf(document.activeElement),b.length);N.kind==="focus"&&(k.preventDefault(),b[N.index].focus())}k.key.length===1&&k.stopPropagation()},w=k=>{k.target.closest("button, input, select, textarea, code")||k.preventDefault()},j=k=>{if(a!=="menu"||k.pointerType==="touch")return;const S=k.target.closest(HR);S&&!S.disabled&&document.activeElement!==S&&S.focus({preventScroll:!0})};return Sn.createPortal(o.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:a,"aria-labelledby":l,onKeyDown:y,onMouseDown:w,onPointerMove:j,children:f}),document.body)}const $q="thermal:Throttling";function Oq(e){var n,r,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),(r=e.loadavg)!=null&&r.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[$q]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ec(e,t){return t==="B/s"?Fc(z0(e)):t==="ms"?Fc(Lh(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Ad(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?Ec(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const QN=["cores","memory","load","thermal"],_o=116,ys=24,Lq=60,Pq=6e4;function Dq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Fq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function qq(e,t=Lq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Bq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(QN.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),Pq);return()=>{c=!1,clearInterval(f)}},[]);const r=x.useMemo(()=>Oq(e),[e]),a=x.useMemo(()=>QN.flatMap(c=>{const u=t[c];return u?u.series.filter(Dq).map(f=>({series:qq(f),stepMs:u.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?H0(c,u):"less than a minute"},[a]);return Object.keys(r).length?o.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:u})=>o.jsx(zq,{series:c,stepMs:u,now:r[c.key],span:l},c.key))}):null}function zq({series:e,stepMs:t,now:n,span:r}){var w;const{points:a,top:l,unit:c,warnAt:u,critAt:f}=e,p=Fq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":zR(h,u,f),y=Math.max(...a.map(j=>j.v));return o.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Ec(y,c)} over the last ${r}`,u!=null?`over ${Ad(u,c)} is uncomfortable`:"",f!=null?`over ${Ad(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[o.jsxs("div",{className:"pl-cell-head",children:[o.jsx("span",{className:"pl-cell-label",children:p}),o.jsx("span",{className:"pl-cell-now",children:h==null?"—":Ec(h,c)})]}),o.jsxs("svg",{className:"pl-spark",width:_o,height:ys,viewBox:`0 0 ${_o} ${ys}`,preserveAspectRatio:"none","aria-hidden":!0,children:[o.jsx("line",{className:"pl-spark-floor",x1:0,x2:_o,y1:ys-Ea.b,y2:ys-Ea.b}),o.jsx("path",{className:"pl-spark-area",d:BR(a,_o,t,l,ys,Ea)}),u!=null&&o.jsx("line",{className:"pl-rule warn",x1:0,x2:_o,y1:Xr(u,l,ys,Ea),y2:Xr(u,l,ys,Ea)}),f!=null&&o.jsx("line",{className:"pl-rule hot",x1:0,x2:_o,y1:Xr(f,l,ys,Ea),y2:Xr(f,l,ys,Ea)}),o.jsx("path",{className:"pl-spark-line",d:qR(a,_o,t,l,ys,Ea)})]}),o.jsxs("span",{className:"vis-hidden",children:["peak ",Ec(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${Ad(u,c)}`,f!=null&&`, the machine acts over ${Ad(f,c)}`]})]})}const Hq={key:"cpu",dir:"desc"};function Uq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function Wq(e,t){const n=t.dir==="asc"?1:-1,r=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=r(l),f=r(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 Vq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Gq=4e3;function Kq(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const r=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{}};r();const a=window.setInterval(r,Gq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Yq(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,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Xq(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 Zq({sys:e,onClose:t}){const n=sn(t),[r,a]=x.useState(Hq),l=Kq(),c=l?Wq(l.procs,r):null;return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&o.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("div",{className:"pl-split",children:[o.jsx("div",{className:"pl-body",children:c==null?o.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?o.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):o.jsxs("table",{className:"sd-procs pl-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx(Ii,{col:"cpu",label:"cpu",sort:r,onSort:a}),o.jsx(Ii,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:r,onSort:a}),o.jsx(Ii,{col:"threads",label:"threads",sort:r,onSort:a}),o.jsx(Ii,{col:"uptime",label:"up",sort:r,onSort:a}),o.jsx(Ii,{col:"user",label:"user",sort:r,onSort:a}),o.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),o.jsx(Ii,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:a})]})}),o.jsx("tbody",{children:c.map(u=>o.jsxs("tr",{children:[o.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),o.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:Yq(u.rssBytes)}),o.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),o.jsx("td",{className:"sd-num sd-dim",children:Xq(u.uptimeSec)}),o.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),o.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),o.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&o.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),o.jsx(Bq,{sys:e})]})]})}),document.body)}function Ii({col:e,label:t,note:n,sort:r,onSort:a}){const l=Vq(r,e);return o.jsx("th",{scope:"col","aria-sort":l,children:o.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
89
-
90
- ${n}`:`Sort by ${t}`,onClick:()=>a(Uq(r,e)),children:[t,o.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const Qq=3e3;function Jq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function e8(e,t,n=Date.now()){const r=Math.max(0,Math.min(100,100-e));return{pct:r,value:`${r}%`,tone:r===0?"calm":r>=30?"hot":"warn",note:r>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${t8(t.lastMs,n)}`:"running at full speed, and never held back"}}function t8(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 r=Math.floor(n/60);return r===1?"an hour ago":`${r} hours ago`}function mc(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 n8(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`}function r8(e){var n,r,a;const t=(r=(n=e.thermal)==null?void 0:n.throttle)==null?void 0:r.speedLimit;return t!=null&&t<100?`throttled to ${t}% of full speed`:e.memory&&e.memory.usedPct>=90?`physical memory ${Math.round(e.memory.usedPct)}% full`:(a=e.network)!=null&&a.api&&e.network.api.ms==null?"the Claude API is not answering":null}function s8(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let r=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();r&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,Qq))},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),()=>{r=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function JN({usageOpen:e,leaving:t,sub:n,flag:r,onClose:a,children:l}){return o.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[o.jsxs("div",{className:"sd-top",children:[o.jsxs("div",{className:"sd-head",children:[o.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&o.jsx("span",{className:"sd-sub",children:n}),o.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:a,"aria-label":"Close",title:"Close",children:"×"})]}),r&&o.jsx("p",{className:"sd-flag",children:r})]}),l]})}function a8({usageOpen:e,leaving:t,onClose:n}){const r=s8();if(!r||r.cpu==null||!r.memory)return o.jsx(JN,{usageOpen:e,leaving:t,onClose:n,children:o.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m,network:y,cpu:w}=r;return o.jsxs(JN,{usageOpen:e,leaving:t,sub:`up ${n8(p)} · ${f} cores`,flag:r8(r),onClose:n,children:[o.jsx(o8,{cpu:w,perCore:c,loadavg:u,cores:f}),o.jsx(i8,{memory:a,swap:l,platform:h}),y&&o.jsx(l8,{network:y}),o.jsx(d8,{thermal:m}),o.jsx(h8,{sys:r})]})}function o8({cpu:e,perCore:t,loadavg:n,cores:r}){const a=!!t&&t.length>0;return!a&&!n?null:o.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[a&&o.jsx(qc,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:o.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((l,c)=>o.jsx("span",{className:"sd-core",title:`logical core ${c+1} · ${l}% busy`,children:o.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,l)/100})`}})},c))})}),n&&o.jsxs(qc,{group:"load",title:"Load history",action:"Show load history",label:"Load average",hint:"the queue for the cores, counted in tasks rather than as a share of them",children:[o.jsx("div",{className:"sd-figs",title:"The queue for this machine's cores, averaged over one, five and fifteen minutes. A count of tasks, not a share of the CPU.",children:n.map((l,c)=>o.jsx(Yx,{value:l.toFixed(2),cap:["1m","5m","15m"][c]},c))}),n[0]>r&&o.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function i8({memory:e,swap:t,platform:n}){const r=e.total-e.available,a=n==="win32"?"Commit":"Swap",l=t&&t.total>0?t.used/t.total*100:0;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:o.jsxs(qc,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[o.jsx(dh,{label:"Physical",value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:mc(r)})," of ",mc(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${mc(e.available)} available`}),t&&t.total>0&&o.jsx(dh,{label:a,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:mc(t.used)})," of ",mc(t.total)]}),pct:l,tone:l>=90?"warn":"calm"})]})})}function l8({network:e}){const{down:t,up:n,api:r,route:a}=e,[l,c]=x.useState(!1),u=r&&r.ms!=null?Lh(r.ms):null,f=t!=null&&n!=null;return o.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[o.jsxs(qc,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(f||u)&&o.jsxs("div",{className:"sd-figs sd-figs-named",children:[f&&[["Download",t],["Upload",n]].map(([p,h])=>{const m=z0(h);return o.jsx(Yx,{value:m.value,unit:m.unit,cap:p},p)}),u&&o.jsx(Yx,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!f&&o.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&o.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":l,"aria-haspopup":"dialog",onClick:()=>c(p=>!p),children:["Connection details",a.relay&&o.jsx("span",{className:"sd-route-relay",children:" · relayed"}),o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l&&o.jsx(u8,{route:a,api:r,onClose:()=>c(!1)})]})]})}function Yx({value:e,unit:t,cap:n}){return t?o.jsxs("span",{className:"sd-fig",children:[o.jsx("span",{className:"sd-fig-cap",children:n}),o.jsxs("span",{className:"sd-fig-read",children:[o.jsx("b",{children:e})," ",o.jsx("span",{className:"sd-fig-unit",children:t})]})]}):o.jsxs("span",{className:"sd-fig",children:[o.jsx("b",{children:e}),o.jsx("span",{className:"sd-fig-cap",children:n})]})}function c8(e){return e.kind==="tailscale-exit"?e.node?`Tailscale exit node ${e.node}`:"a Tailscale exit node":e.kind==="tailscale"?"Tailscale":`${e.name?`${e.name} `:""}VPN${e.iface?` (${e.iface})`:""}`}function u8({route:e,api:t,onClose:n}){return o.jsxs(Kx,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[o.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),o.jsxs("dl",{className:"sd-pop-rows",children:[o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),o.jsxs("dd",{children:["through ",c8(e)]})]}),e.relay&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Relay"}),o.jsxs("dd",{children:[o.jsx("span",{className:"sd-route-relay",children:e.relay})," — not a direct path, so every packet carries one more round trip than it has to"]})]}),t&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Round trip"}),o.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Fc(Lh(t.ms))} to open a connection to ${t.host}`})]}),o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Throughput"}),o.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function qc({group:e,title:t,action:n,label:r,value:a,hint:l,children:c}){const[u,f]=x.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-open",onClick:()=>f(!0),title:n,"aria-label":a==null?n:`${n}, now ${a}`,"aria-describedby":l?`sd-hint-${e}`:void 0,children:[o.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",o.jsx("i",{className:"sd-row-more",children:"›"}),a!=null&&o.jsx("span",{className:"sd-h-val",children:a})]}),c]}),l&&o.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:l}),u&&o.jsx(Aq,{group:e,title:t,onClose:()=>f(!1)})]})}function d8({thermal:e}){if(!e)return null;const t=e.throttle?e8(e.throttle.speedLimit,e.heldBack):null;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:o.jsxs(qc,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>o.jsx(dh,{label:n.label,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:Jq(n.celsius,n.warnAt,n.critAt),title:`bar runs 0–${n.critAt} °C · amber from ${n.warnAt} °C, red at ${n.critAt} °C`,trackLabel:`${n.celsius} °C on a bar that runs to ${n.critAt} °C, amber from ${n.warnAt} °C`},n.label)),t&&o.jsx(dh,{label:"Throttling",value:o.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function h8({sys:e}){const[t,n]=x.useState(!1);return o.jsxs("div",{className:"sd-section sd-door-section",children:[o.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:o.jsxs("span",{className:"sd-door-plate",children:[o.jsxs("span",{className:"sd-door-name",children:["Busiest processes",o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),o.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&o.jsx(Zq,{sys:e,onClose:()=>n(!1)})]})}function dh({label:e,value:t,pct:n,tone:r="calm",note:a,mark:l,title:c,trackLabel:u}){return o.jsxs("div",{className:"sd-row",title:c,children:[o.jsxs("div",{className:"sd-row-head",children:[o.jsx("span",{className:"sd-row-label",children:e}),o.jsx("span",{className:"sd-row-val",children:t})]}),o.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[o.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),l!=null&&l>0&&l<100&&o.jsx("span",{className:"sd-mark",style:{left:`${l}%`},"aria-hidden":!0})]}),a&&o.jsx("div",{className:"sd-note",children:a})]})}function e_(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function t_(e){let t=0;for(const n of Object.values(e))t+=n.i+n.o+n.cr+n.cc;return t}function f8(e,t,n,r=Date.now()){const a=n.size>0,l=new Map;for(const[E,C]of n){const T=E.indexOf("|"),A=E.slice(0,T),I=E.slice(T+1),B=To(C.usage,I,r).total,q=B>0?C.cost/B:1;let L=l.get(A);L||(L=new Map,l.set(A,L)),L.set(I,q)}const c=(E,C)=>{const T=l.get(E);return(T==null?void 0:T.get(C))??(T==null?void 0:T.get(cl(C)))??1},u=(E,C)=>{let T=0;for(const[A,I]of Object.entries(E))T+=To(e_(I),A,r).total*c(C,A);return T},f=new Map,p=[];for(const E of e){const C=new Map;let T=0;for(const A of E.projects){const I=u(A.models,E.day);C.set(A.path,(C.get(A.path)??0)+I),T+=I;let B=f.get(A.path);B||(B={path:A.path,cost:0,tokens:0},f.set(A.path,B)),B.cost+=I,B.tokens+=t_(A.models)}p.push({day:E.day,total:T,byPath:C})}const h=[...f.values()].sort((E,C)=>C.cost-E.cost||C.tokens-E.tokens),m=h.reduce((E,C)=>E+C.cost,0),y=h.reduce((E,C)=>E+C.tokens,0);let w=0,j=0;for(const E of n.values())w+=E.cost;for(const[E,C]of n)j+=To(C.usage,E.slice(E.indexOf("|")+1),r).total;const k=j>0?w/j:1,S=t?t_(t):0;let b=0;if(t)for(const[E,C]of Object.entries(t))b+=To(e_(C),E,r).total*k;const N=b>0||S>0?{cost:b,tokens:S}:null;return{projects:h,totalCost:m,totalTokens:y,perDay:p,unattributed:N,reconciled:a}}const p8=[{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],$i=["var(--usage-blue)","var(--usage-green)","var(--usage-amber)","var(--usage-purple)","var(--usage-indigo)","var(--usage-red)","var(--usage-orange)","var(--usage-zinc)"],m8="var(--usage-zinc)",Hp=6;function n_(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function g8(e){const t=lt(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function r_(e,t){if(t<=0||e<=0)return"0%";const n=e/t*100;return n<.01?"<0.01%":n<1?`${n.toFixed(2)}%`:n<10?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function y8(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function w8(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function Up(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function v8({num:e,name:t,onClose:n}){const[r,a]=x.useState(7),[l,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(null),[m,y]=x.useState(!0),[w,j]=x.useState(null),k=x.useRef(null),S=sn(n,{focusRef:k}),b=x.useRef(0);x.useEffect(()=>{const T=++b.current;y(!0),j(null),h(null);const A=r===0?60:r,I=n_(new Date(Date.now()-(A-1)*864e5)),B=n_(new Date),q=fetch(`/api/account-projects?num=${e}&days=${r}`,{credentials:"same-origin"}).then(U=>U.ok?U.json():Promise.reject(new Error(`HTTP ${U.status}`))),L=fetch(`/api/ccusage?since=${I}&until=${B}`,{credentials:"same-origin"}).then(U=>U.ok?U.json():null).catch(()=>null);Promise.all([q,L]).then(([U,X])=>{if(T!==b.current)return;c(U);const Y=X;f(Y&&Y.ok!==!1?Y:null),y(!1)}).catch(U=>{T===b.current&&(j(U.message||"Could not load"),y(!1))})},[e,r]);const N=x.useMemo(()=>{const T=Date.now();if(!l)return null;const A=H=>typeof H=="number"&&Number.isFinite(H)?H:0,I=new Map;if(u){const H=Array.isArray(u.days)?u.days:[];for(const Q of H){const O=typeof Q.period=="string"?Q.period:"",te=Array.isArray(Q.modelBreakdowns)?Q.modelBreakdowns:[];for(const ae of te){const he=typeof ae.modelName=="string"?ae.modelName:"";if(!O||!/claude/i.test(he))continue;const ge=`${O}|${he}`,Te=I.get(ge),De=Te?Te.usage:{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,cacheCreate1hTokens:0,cacheCreate5mTokens:0};De.inputTokens+=A(ae.inputTokens),De.outputTokens+=A(ae.outputTokens),De.cacheReadTokens+=A(ae.cacheReadTokens),De.cacheCreateTokens+=A(ae.cacheCreationTokens),Te?Te.cost+=A(ae.cost):I.set(ge,{cost:A(ae.cost),usage:De})}}}const B=f8(l.daily??[],l.unattributed,I,T),q=H=>H.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||H||"(unknown)",L=new Map;for(const H of B.projects)L.set(q(H.path),(L.get(q(H.path))??0)+1);const U=H=>{const Q=q(H);if((L.get(Q)??0)<=1)return Q;const O=H.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return O?`${O}/${Q}`:Q},X=$i[Hp%$i.length],Y=new Map,M=[],J=B.projects.slice(0,Hp),V=B.projects.slice(Hp);J.forEach((H,Q)=>{Y.set(H.path,$i[Q%$i.length]),M.push({key:H.path,label:U(H.path),title:H.path,cost:H.cost,tokens:H.tokens,color:$i[Q%$i.length]})}),V.length&&M.push({key:"__other__",label:`Other · ${V.length} project${V.length>1?"s":""}`,title:V.map(H=>q(H.path)).join(", "),cost:V.reduce((H,Q)=>H+Q.cost,0),tokens:V.reduce((H,Q)=>H+Q.tokens,0),color:X,muted:!0});const $=B.totalCost,z=B.totalTokens,W=$>0?"cost":"tokens",G=W==="cost"?$:z,F=M.map(H=>H.color),K=B.perDay.map(H=>{const Q=new Map;for(const[O,te]of H.byPath){const ae=Y.get(O)??X;Q.set(ae,(Q.get(ae)??0)+te)}return{day:H.day,total:H.total,costByColor:Q}}),de=K.reduce((H,Q)=>Math.max(H,Q.total),0);return{rows:M,totalCost:$,totalTokens:z,basis:W,denom:G,un:B.unattributed,reconciled:B.reconciled,chart:K,maxDay:de,colorOrder:F}},[l,u]),E=l!=null&&l.trackedSince?`Tracked since ${Up(l.trackedSince)}`:"Tracking starts with this version",C=r===0?"all time":`the last ${r} days`;return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:S,className:"modal ap-proj-modal",onClick:T=>T.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-proj-title ap-proj-sub",children:[o.jsxs("header",{className:"ap-proj-head",children:[o.jsxs("div",{className:"ap-proj-titlewrap",children:[o.jsx("div",{className:"ap-proj-title",id:"ap-proj-title",children:"Projects"}),o.jsx("div",{className:"ap-proj-sub",id:"ap-proj-sub",title:t,children:t})]}),o.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:p8.map(T=>o.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===T.days,onClick:()=>a(T.days),children:T.label},T.days))}),o.jsx("button",{ref:k,className:"glyph-btn ap-proj-close",onClick:n,"aria-label":"Close",children:"×"})]}),o.jsxs("div",{className:"ap-proj-body",children:[m&&o.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!m&&w&&o.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",w]}),!m&&!w&&N&&o.jsx(o.Fragment,{children:N.rows.length===0?o.jsxs("div",{className:"ap-proj-state",children:["No work attributed to this account in ",C,".",o.jsxs("div",{className:"ap-proj-note",children:[E,". Only work from this version onward can be tied to an account."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"ap-proj-bar",role:"img","aria-label":`Share of ${lt(N.totalCost)} across ${N.rows.length} projects`,children:N.rows.map(T=>{const A=N.basis==="cost"?T.cost:T.tokens,I=N.denom>0?A/N.denom*100:0;return I<=0?null:o.jsx("span",{className:"ap-proj-seg",style:{width:`${I}%`,background:T.color},title:`${T.label} · ${lt(T.cost)} · ${r_(T.cost,N.totalCost)}${T.tokens?` · ${Ut(T.tokens)} tokens`:""}`},T.key)})}),o.jsxs("div",{className:"ap-proj-totals",children:[o.jsx("span",{className:"ap-proj-total-cost",children:lt(N.totalCost)}),o.jsxs("span",{className:"ap-proj-total-tok",children:[Ut(N.totalTokens)," tokens"]}),o.jsxs("span",{className:"ap-proj-total-win",children:["· ",C]})]}),N.chart.length>0&&o.jsxs("div",{className:"ap-proj-days",children:[o.jsxs("div",{className:"ap-proj-days-cap",children:["By day",N.chart.length>1?" · click a bar":""]}),o.jsx("div",{className:"ap-proj-days-plot",role:"img","aria-label":`Spend across ${N.chart.length} day${N.chart.length>1?"s":""}`,children:N.chart.map(T=>{const A=N.maxDay>0?T.total/N.maxDay*100:0,I=p===T.day,B=N.rows.map(L=>({label:L.label,c:T.costByColor.get(L.color)??0})).filter(L=>L.c>0),q=`${Up(Date.parse(`${T.day}T00:00:00`))}, ${lt(T.total)}. ${B.map(L=>`${L.label} ${lt(L.c)}`).join(", ")}`;return o.jsx("button",{type:"button",className:`ap-proj-day${I?" selected":""}`,"aria-pressed":I,"aria-label":q,title:`${T.day} · ${lt(T.total)}`,onClick:()=>h(L=>L===T.day?null:T.day),children:o.jsx("span",{className:"ap-proj-col",style:{height:`${A}%`},children:N.colorOrder.map((L,U)=>{const X=T.costByColor.get(L)??0;return X<=0||T.total<=0?null:o.jsx("span",{className:"ap-proj-colseg",style:{height:`${X/T.total*100}%`,background:L}},U)})})},T.day)})}),(()=>{const T=w8(N.chart.length);return o.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:N.chart.map((A,I)=>o.jsx("div",{className:"ap-proj-axis-cell",children:T(I)?y8(A.day):""},A.day))})})(),(()=>{const T=p?N.chart.find(I=>I.day===p):null;if(!T)return null;const A=N.rows.map(I=>({r:I,c:T.costByColor.get(I.color)??0})).filter(I=>I.c>0);return o.jsxs("div",{className:"ap-proj-day-detail",children:[o.jsxs("div",{className:"ap-proj-day-detail-head",children:[o.jsx("span",{children:Up(Date.parse(`${T.day}T00:00:00`))}),o.jsx("span",{className:"ap-proj-day-detail-total",children:lt(T.total)})]}),A.map(({r:I,c:B})=>o.jsxs("div",{className:"ap-proj-day-detail-row",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:I.color},"aria-hidden":"true"}),o.jsx("span",{className:"ap-proj-day-detail-name",children:I.label}),o.jsx("span",{className:"ap-proj-day-detail-cost",children:lt(B)})]},I.key))]})})()]}),o.jsx("ul",{className:"ap-proj-list",children:N.rows.map(T=>{const A=N.basis==="cost"?T.cost:T.tokens,I=N.denom>0?A/N.denom*100:0;return o.jsxs("li",{className:`ap-proj-row${T.muted?" muted":""}`,children:[o.jsx("span",{className:"ap-proj-dot",style:{background:T.color},"aria-hidden":"true"}),o.jsx("span",{className:"ap-proj-name",title:T.title??T.label,children:T.label}),o.jsx("span",{className:"ap-proj-track",title:`${r_(T.cost,N.totalCost)} of tracked cost`,children:o.jsx("span",{className:"ap-proj-fill",style:{width:`${I}%`,background:T.color}})}),o.jsx("span",{className:"ap-proj-cost",children:lt(T.cost)}),o.jsx("span",{className:"ap-proj-tok",children:Ut(T.tokens)})]},T.key)})}),N.un&&o.jsxs("div",{className:"ap-proj-unattributed",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:m8},"aria-hidden":"true"}),o.jsxs("div",{className:"ap-proj-un-labels",children:[o.jsx("span",{className:"ap-proj-un-title",children:"Unattributed usage"}),o.jsx("span",{className:"ap-proj-un-tag",children:"Excluded from the project totals"})]}),o.jsx("span",{className:"ap-proj-un-cost",children:g8(N.un.cost)}),o.jsx("span",{className:"ap-proj-un-tok",children:Ut(N.un.tokens)}),o.jsx("div",{className:"ap-proj-note",children:"Work no account could be tied to — from before tracking, or a gap."})]}),o.jsxs("div",{className:"ap-proj-foot",children:[N.reconciled?"Dollars from ccusage · split by activity":"Dollars estimated · ccusage unavailable"," · ",E]})]})})]})]})}),document.body)}const s_=18,x8=1100,Oi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},b8=Array.from({length:s_},(e,t)=>{const n=-72+144*t/(s_-1)+(Oi(t,1)-.5)*9,r=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Oi(t,2)*.52);return{dx:Math.cos(r)*a,dy:Math.sin(r)*a,rot:(t%2?1:-1)*(100+Oi(t,3)*260),delay:Math.round(Oi(t,4)*90),dur:760+Math.round(Oi(t,5)*260),scale:.8+Oi(t,6)*.45,hue:t%4,round:t%3===0}});function a_({anchor:e}){var a;const[t,n]=x.useState(null),r=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(r)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),x8);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:Sn.createPortal(o.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:b8.map((l,c)=>o.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 UR=new Set(["awaiting_url","awaiting_code","registering"]);function k8(e){return e!=null&&UR.has(e)}function WR(e){return e!=null&&e!=="done"&&!UR.has(e)}const N8="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",_8="the sign-in did not complete";function S8({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?N8:_8)}}function j8({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}function E8({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}const C8="done";function T8(){let e=!1;return{shouldAnnounce(t){return t!==C8?(e=!1,!1):e?!1:(e=!0,!0)}}}function W0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const A8={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 ${nn}`,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"},R8={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"},M8=`claude-swap could not read the login keychain — start ${nn} from a Terminal window rather than a background service`,VR={401:"this deck did not accept the page as its own, so nothing was changed",403:"this deck refused a change from this address — open it on the address the deck prints, not through a proxy"};function Xx(e,t,n){const r=n==null?null:VR[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Bc(e)))return M8;const a=W0(R8,e==null?void 0:e.reason);return a||(e==null?void 0:e.reason)||t}function Bc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const I8={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"},$8="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 O8(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const L8="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",P8="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",D8=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),F8=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,q8=/[\\/]_npx[\\/]/i,B8=`the copy of ccusage ${nn} installed for itself`;function z8(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function VK(e,t){const n=H8(e,t),r=z8(e);switch(e==null?void 0:e.stage){case"npx":return r?`ccusage failed on both of its paths. The managed install failed first — ${r} — and the deck then fell back to npx, where ${gc(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${gc(n)}`;case"managed":return`${B8} failed to run: ${gc(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${gc(n)}`:`the ccusage this deck found on your PATH failed to run: ${gc(n)}`;default:return n}}const gc=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function H8(e,t){const n=Bc(e);if(D8(n)){if(q8.test(n))return P8;if(F8.test(n))return L8}if(O8(n))return $8;const r=W0(I8,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function zi(e,t,n){const r=n==null?null:VR[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&WR(e.state))return e.error;const a=W0(A8,e==null?void 0:e.reason);return a||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function U8(e,t,n){if(n<=0||Mh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:r===-1?0:(r+1)%n};case"ArrowLeft":return{kind:"select",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function GR(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 W8(e){const t=new Map;for(const n of e){const r=(n.email??"").trim().toLowerCase();r&&t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=(n.email??"").trim(),a=n.alias||r||`account ${n.num}`,l=[];return n.alias&&r&&l.push(r),r&&(t.get(r.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function V8(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function G8(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function K8(e){return e.length?{action:"share",accounts:[...e]}:null}function Y8(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 Zx(e){return`${e.email}|${e.org??""}`}function X8(e,t,n){return e&&e.map(r=>Zx(r)===t?n:r)}function Z8(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 Q8(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,r=[],a=n("imported");a&&r.push(`${a} of ${t} imported`);const l=n("healed");l&&r.push(`${l} had a dead token replaced`);const c=n("updated");c&&r.push(`${c} updated`);const u=n("present");u&&r.push(`${u} already here`);const f=n("failed");return f&&r.push(`${f} did not arrive`),`${r.join(", ")}.`}const J8=1500,Rd=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],o_="aa-panel",i_=e=>`aa-tab-${e}`;async function yc(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Qx=me.forwardRef((e,t)=>o.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[o.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),o.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Qx.displayName="SuccessMark";function eB({onClose:e,onChanged:t}){const[n,r]=x.useState("login"),[a,l]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[j,k]=x.useState(null),[S,b]=x.useState(null),[N,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),A=x.useRef(!1),I=x.useRef(null),B=x.useRef(null),q=x.useRef(null),L=x.useRef(null),U=x.useRef([]),X=x.useRef(!1),Y=x.useCallback(()=>{const O=E8({started:T.current,state:a==null?void 0:a.state});O&&yc(O).catch(()=>{}),e()},[e,a==null?void 0:a.state]),M=sn(Y,{focusRef:q}),J=x.useCallback(async()=>{if(!Ks(A.current))return;A.current=!0,m(!0),w(null),T.current=!0;const O=await yc({action:"login"}).catch(()=>null);if(A.current=!1,m(!1),!(O!=null&&O.ok)){w(zi(O,"could not start the sign-in"));return}l(O)},[]);x.useEffect(()=>{if(!k8(a==null?void 0:a.state))return;const O=window.setInterval(async()=>{try{const te=await fetch("/api/claude-accounts/login");te.ok&&l(await te.json())}catch{}},J8);return()=>window.clearInterval(O)},[a]);const V=x.useRef(t);V.current=t;const $=x.useState(T8)[0];x.useEffect(()=>{var O;(a==null?void 0:a.state)==="awaiting_code"&&((O=I.current)==null||O.focus()),$.shouldAnnounce(a==null?void 0:a.state)&&V.current()},[a==null?void 0:a.state,$]),x.useEffect(()=>{var O;n==="paste"&&!X.current&&((O=B.current)==null||O.focus()),X.current=!1},[n]);const z=x.useCallback(O=>{var ae;const te=U8(O,Rd.findIndex(he=>he.id===n),Rd.length);te.kind!=="pass"&&(O.preventDefault(),X.current=!0,r(Rd[te.index].id),(ae=U.current[te.index])==null||ae.focus())},[n]),W=x.useCallback(async()=>{var te;if(!Ks(A.current))return;A.current=!0,m(!0),w(null);const O=await yc({action:"login-code",code:c}).catch(()=>null);if(A.current=!1,m(!1),!(O!=null&&O.ok)){w(zi(O,"the code was not accepted")),O!=null&&O.state&&l(O),(te=I.current)==null||te.select();return}u(""),l(O)},[c,a]),G=x.useCallback(async()=>{if(!Ks(A.current))return;A.current=!0,m(!0),w(null);const O=await yc({action:"import",blob:f}).catch(()=>null);if(A.current=!1,m(!1),!(O!=null&&O.ok)){w(zi(O,"the import failed"));return}C.current=f,p(""),E(null),k(O.results??[]),t()},[f,t]),F=x.useCallback(async O=>{const te=Zx(O);if(!Ks(A.current)||!C.current)return;A.current=!0,m(!0),b(te),E(null);const ae=await yc({action:"import",blob:C.current,force:!0,only:{email:O.email,org:O.org??""}}).catch(()=>null);if(A.current=!1,m(!1),b(null),!(ae!=null&&ae.ok)){E({key:te,text:zi(ae,"that account could not be updated")});return}const he=(ae.results??[])[0];he&&k(ge=>X8(ge,te,he)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,de=j8({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),H=WR(a==null?void 0:a.state)||!!(y&&T.current&&!h),Q=S8({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:o.jsxs("div",{ref:M,className:"modal aa-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:z,children:Rd.map((O,te)=>o.jsx("button",{type:"button",role:"tab",id:i_(O.id),ref:ae=>{U.current[te]=ae},"aria-selected":n===O.id,"aria-controls":o_,tabIndex:n===O.id?0:-1,className:`aa-tab${n===O.id?" on":""}`,onClick:()=>{X.current=!1,r(O.id)},children:O.label},O.id))})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:Y,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body aa-body",id:o_,role:"tabpanel","aria-labelledby":i_(n),children:n==="login"?K?o.jsxs("div",{className:"aa-done",children:[o.jsx(Qx,{ref:L}),o.jsx(a_,{anchor:L}),o.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),o.jsxs("p",{className:"aa-note",children:[o.jsx("strong",{children:K.email}),K.added?de?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),de?o.jsx("p",{className:"aa-note aa-warn",role:"status",children:de}):null,o.jsx("button",{type:"button",className:"btn primary",onClick:Y,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"1 · Approve in the browser"}),o.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),o.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),o.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."}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:I,type:"text",value:c,onChange:O=>u(O.target.value),onKeyDown:O=>{O.key==="Enter"&&c.trim()&&!h&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),o.jsx("button",{type:"button",className:"btn primary",...Ma(h,!c.trim()||a.state==="registering"),onClick:W,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&o.jsx("p",{className:"aa-err",children:y??a.error}),o.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."})]})]}):H?o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:Q.title}),o.jsx("p",{className:"aa-err",children:Q.message}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),w(null),J()},children:"Try again"})]}):h||T.current?o.jsx("div",{className:"aa-step",children:o.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):o.jsxs("div",{className:"aa-step aa-primer",children:[o.jsx("h4",{children:"Sign in to Anthropic"}),o.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."}),o.jsx("div",{className:"aa-actions",children:o.jsx("button",{type:"button",ref:q,className:"btn primary",onClick:J,children:"Open the sign-in page"})})]}):j?(()=>{const O=j.filter(te=>te.state==="imported").length;return o.jsxs("div",{className:"aa-done",children:[o.jsx(Qx,{ref:L}),O>0&&o.jsx(a_,{anchor:L}),o.jsx("h4",{children:Q8(j)}),j.length>0&&o.jsx("ul",{className:"aa-results",children:j.map(te=>{const ae=Zx(te);return o.jsxs("li",{className:`aa-result ${te.state}`,children:[o.jsx("span",{className:"aa-result-who",children:te.email||(te.num?`slot ${te.num}`:"an account")}),o.jsx("span",{className:"aa-result-what",children:Z8(te.state)}),te.state==="present"&&o.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===ae,title:`Overwrite the stored login for ${te.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>F(te),children:S===ae?"updating…":"update anyway"}),(N==null?void 0:N.key)===ae&&o.jsx("span",{className:"aa-result-err",children:N.text})]},ae)})}),o.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",o.jsx("strong",{children:" update anyway"}),"."]}),o.jsxs("div",{className:"aa-actions",children:[o.jsx("button",{type:"button",className:"btn primary",onClick:Y,children:"Done"}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),k(null)},children:"Import another"})]})]})})():o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"Paste an account shared from another deck"}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:B,type:"text",value:f,onChange:O=>p(O.target.value),onKeyDown:O=>{O.key==="Enter"&&f.trim()&&!h&&G()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),o.jsx("button",{type:"button",className:"btn primary",...Ma(h,!f.trim()),onClick:G,children:h?"importing…":"Import"})]}),y&&o.jsx("p",{className:"aa-err",children:y}),o.jsxs("p",{className:"aa-note",children:["Use ",o.jsx("strong",{children:"share"})," on one account in the other deck, or ",o.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})}),document.body)}const tB=6;function nB(e,t){const n=e.filter(u=>u.ready);if(t.armed&&e.length>0&&n.length===0)return{text:"Auto-switch has nowhere to go",tone:"bad",free:null};const r=n.length===e.length?`${e.length} ready`:n.length===0?e.length===1?"not ready":`none of ${e.length} ready`:`${n.length} of ${e.length} ready`,a=n.length?"ok":"idle",l=t.strained&&!t.armed?rB(n):null,c=[r];return l!=null&&c.push(`${l}% free`),c.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:c.join(" · "),tone:a,free:l}}function rB(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function sB(e){const t=[...e].sort((a,l)=>{if(a.ready!==l.ready)return a.ready?-1:1;if(!a.ready)return a.name.localeCompare(l.name);const c=a.headroom,u=l.headroom;return c==null&&u==null?a.name.localeCompare(l.name):c==null?1:u==null?-1:u-c}),n=t.slice(0,tB),r=t.length-n.length;return{title:e.some(a=>a.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function KR({title:e,steps:t,finish:n,aside:r,onClose:a}){const l=x.useRef(null),c=sn(a,{focusRef:l}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=j=>f(Math.max(0,Math.min(t.length-1,j))),y=j=>{j.key!=="ArrowRight"&&j.key!=="ArrowLeft"||(j.preventDefault(),j.stopPropagation(),m(j.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:o.jsxs("div",{ref:c,className:"modal guide",onClick:j=>j.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),o.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsx("div",{className:"guide-stage",children:h.art},u),o.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),o.jsx("p",{className:"guide-tip",children:h.tip??""}),o.jsxs("div",{className:"guide-foot",children:[o.jsx("div",{className:"guide-dots",children:t.map((j,k)=>o.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${k+1} of ${t.length}`,"aria-current":k===u?"step":void 0,onClick:()=>m(k)},k))}),p&&r&&o.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&o.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),o.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Jx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Er({children:e}){return o.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function jr({x:e,y:t=34,w:n=176,h:r=132,label:a}){return o.jsxs(o.Fragment,{children:[a&&o.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),o.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function Qr({x:e,y:t,email:n,state:r,tone:a,bars:l}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Jx[a]}),o.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),o.jsx("text",{x:e+12,y:t+16,className:`ga-s ${Jx[a]}`,children:r}),l==null?void 0:l.map((c,u)=>o.jsxs("g",{children:[o.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),o.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function YR({x:e,y:t,on:n}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),o.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function Md({x:e,y:t,name:n,here:r=!0}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),o.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function l_({x:e,y:t,on:n}){return n?o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),o.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):o.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function c_({x:e,y:t,d:n}){return o.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function V0({x:e,y:t}){return o.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 G0(){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{r:9,className:"ga-key-bed"}),o.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[o.jsx("circle",{cx:4.6,cy:7,r:2.6}),o.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Hi({x:e,y:t,w:n,title:r,sub:a,tone:l}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),o.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:Jx[l]}),o.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),o.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function Ki({x:e,y:t,label:n,live:r}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),o.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function hh({x:e,y:t}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),o.jsx(YR,{x:e+118,y:t-13,on:!0})]})}function aB(){return o.jsxs(Er,{children:[o.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),o.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),o.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),o.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),o.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),o.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),o.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),o.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),o.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),o.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),o.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),o.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),o.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),o.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),o.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),o.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),o.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),o.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),o.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),o.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),o.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function oB(){return o.jsxs(Er,{children:[o.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),o.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),o.jsx(Hi,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),o.jsx(Hi,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),o.jsx(Hi,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),o.jsx(Hi,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),o.jsx(Ki,{x:326,y:28,label:"Read"}),o.jsx(Ki,{x:380,y:28,label:"Grep",live:!0}),o.jsx(Ki,{x:326,y:90,label:"Bash",live:!0})]})}function u_({x:e,y:t,label:n,pct:r,note:a}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-s",children:n}),o.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),o.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function iB(){return o.jsxs(Er,{children:[o.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),o.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),o.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),o.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),o.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),o.jsx(u_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),o.jsx(u_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function lB(){return o.jsxs(Er,{children:[o.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),o.jsx(Hi,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),o.jsx(V0,{x:156,y:106}),o.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),o.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),o.jsx(jr,{x:200,y:22,w:226,h:160}),o.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),o.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),o.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),o.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),o.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),o.jsx(Ki,{x:214,y:122,label:"Read"}),o.jsx(Ki,{x:266,y:122,label:"Edit"}),o.jsx(Ki,{x:318,y:122,label:"Bash",live:!0}),o.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),o.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function cB(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return o.jsxs(Er,{children:[o.jsx(jr,{x:14,y:20,w:412,h:160}),o.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),o.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),o.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>o.jsxs("g",{children:[o.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),o.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),o.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),o.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),o.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),o.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),o.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),o.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),o.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),o.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),o.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),o.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function uB(){return o.jsxs(Er,{children:[o.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),o.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),o.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[o.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),o.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),o.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),o.jsx("path",{d:"M210 100H238",className:"ga-arc"}),o.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),o.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),o.jsx("g",{className:"ga-pop",children:o.jsx(Hi,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function dB(){return o.jsxs(Er,{children:[o.jsx(jr,{x:14,y:16,w:232,h:170}),o.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),o.jsx(c_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),o.jsx(c_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),o.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),o.jsx(Qr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),o.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),o.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),o.jsx(Qr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),o.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),o.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),o.jsx(V0,{x:221,y:161}),o.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),o.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),o.jsx(jr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),o.jsx("g",{className:"ga-pop",children:o.jsx(Qr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function hB(){return o.jsxs(Er,{children:[o.jsx(jr,{x:14,label:"THIS MACHINE"}),o.jsx(hh,{x:28,y:60}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(Qr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(Qr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(jr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(hh,{x:264,y:60}),o.jsx(Qr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),o.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:o.jsx(G0,{})})]})}const fB=[{art:o.jsx(aB,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:o.jsx(oB,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:o.jsx(lB,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:o.jsx(iB,{}),line:"What each session costs, and how much quota is left."},{art:o.jsx(cB,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:o.jsx(dB,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:o.jsx(hB,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:o.jsx(uB,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function pB(){return o.jsxs(Er,{children:[o.jsx(jr,{x:14,label:"THIS MACHINE"}),o.jsx(Qr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),o.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),o.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),o.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),o.jsx(jr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(Qr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function mB(){return o.jsxs(Er,{children:[o.jsx(jr,{x:14,label:"THIS MACHINE"}),o.jsx(hh,{x:28,y:60}),o.jsx(Md,{x:28,y:92,name:"Ana's MacBook"}),o.jsx(Md,{x:28,y:114,name:"Dorin's PC"}),o.jsx(jr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(hh,{x:264,y:60}),o.jsx(Md,{x:264,y:92,name:"Your MacBook"}),o.jsx(Md,{x:264,y:114,name:"Dorin's PC"}),o.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),o.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function gB(){return o.jsxs(Er,{children:[o.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),o.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),o.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),o.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),o.jsx(l_,{x:106,y:88,on:!0}),o.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),o.jsx(l_,{x:106,y:112}),o.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),o.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),o.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),o.jsx(YR,{x:304,y:157,on:!0}),o.jsx(V0,{x:115,y:97})]})}function yB(){return o.jsxs(Er,{children:[o.jsx(jr,{x:14,label:"THIS MACHINE"}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(Qr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(Qr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(jr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(Qr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),o.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:o.jsx(G0,{})})]})}const wB=[{art:o.jsx(pB,{}),line:"A login can expire on one machine while it still works on another."},{art:o.jsx(mB,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:o.jsx(gB,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:o.jsx(yB,{}),line:"An expired login is copied from a paired machine within a minute."}];function vB(){return o.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),o.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),o.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),o.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),o.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),o.jsx("g",{transform:"translate(116 13)",children:o.jsx(G0,{})})]})}const xB={panel:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it behind the + above, where an address can be typed too.",dialog:"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."},bB=1600;function XR({reach:e,where:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);x.useEffect(()=>()=>{a.current=!1},[]);const l=(e==null?void 0:e.steps)??[],c=x.useCallback(async()=>{await sl(l.join(`
91
- `))&&a.current&&(r(!0),window.setTimeout(()=>{a.current&&r(!1)},bB))},[l]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return o.jsxs("div",{className:"ap-lan-reach",children:[o.jsx("p",{className:"lan-warn",children:e.text}),o.jsx("p",{className:"lan-note",children:xB[t]}),l.length>0&&o.jsxs("details",{className:"ap-lan-reach-fix",children:[o.jsx("summary",{children:"or let them find this deck on their own"}),o.jsxs("p",{className:"lan-note",children:[u?o.jsx(o.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):o.jsxs(o.Fragment,{children:["Run this in PowerShell ",o.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&o.jsx(o.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."}),e.unsure&&o.jsxs(o.Fragment,{children:[" ",e.unsure]})]}),o.jsx("pre",{className:"ap-lan-cmd",children:o.jsx("code",{children:l.join(`
92
- `)})}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void c(),title:u?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:n?"copied":"copy command"})]})]})}async function Wp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const kB={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."},NB={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function d_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||tn(n,t)}function _B({status:e,manual:t,onClose:n,onChanged:r}){const a=x.useRef(null),l=sn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[j,k]=x.useState(null),[S,b]=x.useState(null),[N,E]=x.useState(()=>Date.now());x.useEffect(()=>{const $=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval($)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),A=x.useCallback($=>Oh(T.current)?(T.current=$,k($),!0):!1,[]),I=x.useCallback(()=>{T.current=null,C.current&&k(null)},[]),B=$=>{const z=Fa(j,$);return{disabled:z.disabled,"aria-busy":z.busy}},q=$=>(h==null?void 0:h.field)===$?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},L=$=>m(z=>z&&z.field===$?null:z),U=x.useCallback(async()=>{const $=qB(c);if(!$){m({text:SB(c),field:"addr"});return}const z=`${$.addr}:${$.port}`,W=e.peers.find(G=>G.addr===$.addr&&G.port===$.port&&G.paired);if(W){m({text:`Already paired with ${W.name} at that address.`,field:"addr"});return}if(t.includes(z)){m({text:"This deck already calls that address.",field:"addr"});return}if(A("add"))try{const G=await Wp("/api/prefs",{lan:{manual:[...t,z]}});if(!C.current)return;G!=null&&G.ok?(m(null),u(""),r(),n()):m({text:tn("add that address",G),field:"addr"})}catch{C.current&&m({text:tn("add that address",null),field:"addr"})}finally{I()}},[c,t,e.peers,r,n,A,I]),X=x.useCallback(async $=>{if(!A(`invite:${$}`))return;const z=$==="make"?"make an invite":"cancel that invite";try{const W=await Wp("/api/lan/invite",{action:$});if(!C.current)return;W!=null&&W.ok?(m(null),w(null),r()):m({text:d_(NB,W,z)})}catch{C.current&&m({text:tn(z,null)})}finally{I()}},[r,A,I]),Y=x.useCallback(async()=>{const $=f.trim();if(!(!$||!A("join"))){b(null);try{const z=await Wp("/api/lan/invite",{action:"join",token:$});if(!C.current)return;z!=null&&z.ok?(p(""),m(null),r(),n()):(z==null?void 0:z.reason)==="unreachable"&&Array.isArray(z.tried)&&z.tried.length?(b(z.tried),m(null)):(b(null),m({text:d_(kB,z,"use that invite"),field:"join"}))}catch{C.current&&m({text:tn("use that invite",null),field:"join"})}finally{I()}}},[f,r,n,A,I]),M=x.useCallback(async($,z)=>{try{await navigator.clipboard.writeText($),w(z),window.setTimeout(()=>{C.current&&w(W=>W===z?null:W)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),J=e.invite&&e.invite.expiresAt>N?e.invite:null,V=e.port!=null?(e.addrs??[]).map($=>`${$}:${e.port}`):[];return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:l,className:"modal lan-add",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[h&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsx(XR,{reach:e.reach,where:"dialog"}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"By address"}),o.jsxs("div",{className:"ap-lan-row",children:[o.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,...q("addr"),onChange:$=>{u($.target.value),L("addr")},onKeyDown:$=>{$.key==="Enter"&&U()}}),c.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...B("add"),onClick:()=>void U(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),o.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&V.length>0&&o.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",V.map(($,z)=>o.jsxs("span",{children:[z>0&&" or ",o.jsx("code",{className:"ap-lan-code",children:$})]},$)),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...B("copy:mine"),onClick:()=>void M(V.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:y==="mine"?"copied":"copy"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:["With an invite",!J&&o.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...B("invite:make"),onClick:()=>void X("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:j==="invite:make"?"making…":"make one to send"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.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,...q("join"),onChange:$=>{p($.target.value),b(null),L("join")},onKeyDown:$=>{$.key==="Enter"&&Y()}}),f.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...B("join"),onClick:()=>void Y(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:j==="join"?"joining…":"join"})]}),o.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&o.jsxs("div",{className:"ap-lan-tried",children:[o.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),S.map($=>o.jsxs("span",{className:"ap-lan-tried-row",children:[o.jsx("code",{className:"ap-lan-code",children:$.addr}),o.jsx("span",{className:"ap-lan-bad",children:$.why})]},$.addr))]}),J&&o.jsxs("div",{className:"ap-lan-invite",children:[o.jsxs("div",{className:"ap-lan-invite-head",children:[o.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),o.jsxs("span",{className:"ap-lan-invite-left",children:[HB(J.expiresAt,N)," left"]})]}),o.jsx("code",{className:"ap-lan-token",children:J.token}),o.jsxs("div",{className:"ap-lan-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",...B("copy:invite"),onClick:()=>void M(J.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...B("invite:withdraw"),onClick:()=>void X("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),o.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function SB(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 jB=1e3;function EB(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=xs(e,t);return`${n} · ${r==="now"?"just now":r}`}function h_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function CB(){return o.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:[o.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),o.jsx("path",{d:"M8.4 3.6l2 2"})]})}function f_(){return o.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),o.jsx("path",{d:"M1 13h14"})]})}function Id({dir:e,gate:t=!1}){const n=t?12:8;return o.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const TB={works:"works here",expired:"expired here",missing:"not on this deck"},AB={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function RB(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${TB[e.here]}, ${AB[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function MB({row:e,source:t,status:n,accounts:r,now:a,busy:l,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var vt,an,jn,Nt,Yt;const w=x.useRef(null),j=sn(c,{focusRef:w}),[k,S]=x.useState(null),[b,N]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[A,I]=x.useState(null),[B,q]=x.useState(!1),[L,U]=x.useState(0),X=x.useRef(null),Y=x.useRef(!0);x.useEffect(()=>()=>{Y.current=!1},[]);const M=k!=null;x.useEffect(()=>{var fe;M&&((fe=X.current)==null||fe.select())},[M]),x.useEffect(()=>{if(!E)return;const fe=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(fe)},[E]),x.useEffect(()=>{if(!A)return;const fe=window.setTimeout(()=>I(null),4e3);return()=>window.clearTimeout(fe)},[A]);const J=fe=>{const st=Fa(l,fe);return{disabled:st.disabled,"aria-busy":st.busy}},V=async fe=>{const st=await fe();return Y.current&&N(st),st==null},{peer:$,stranger:z}=t,W=e.kind==="paired",G=e.self??e.name,F=e.kind!=="dialling",K=e.kind==="dialling"?null:e.fp,de=$?$.addr?`${$.addr}:${$.port}`:"":z?z.port?`${z.addr}:${z.port}`:z.addr:e.addr,H=($==null?void 0:$.about)??null,Q=((vt=n.about)==null?void 0:vt.version)??null,O=async fe=>{const st=fe.trim()===G?"":fe;await V(()=>u(st))&&S(null)},te=async()=>{if(K)try{if(await navigator.clipboard.writeText(K),!Y.current)return;q(!0),window.setTimeout(()=>{Y.current&&q(!1)},1600)}catch{Y.current&&N("Could not copy it — select the fingerprint and copy it by hand.")}},ae=W?$!=null&&$.waiting?$.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":$!=null&&$.offers?"not said — it runs an older version":"not reached yet":"shown once paired",he=h_(n.about),ge=h_(H),Te=H!=null&&H.version&&Q?QB(H.version,Q):null,De=$?ZR($.last,a):null,Ve=$&&((an=$.last)!=null&&an.error)?FB({error:$.last.error,host:$.addr,port:$.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(fe=>!fe.manual&&fe.addr).map(fe=>({fp:fe.fp,name:fe.name,addr:fe.addr,port:fe.port,at:fe.lastSeen??0}))],a):null,je=(jn=$==null?void 0:$.last)!=null&&jn.error&&De&&De.text!==$.last.error?$.last.error:null,ve=((Nt=$==null?void 0:$.last)==null?void 0:Nt.done)??[],Ue=!!De&&!!je&&!e.quiet&&e.state.startsWith(De.text),ke=W||e.kind==="dialling",xe=(($==null?void 0:$.via)??e.via)==="tailscale",Ge=$?$.waiting?null:$.manual?xe?"added by its Tailscale address":"added by address":xe?"over Tailscale":"on this network":e.kind==="nearby"?xe?"heard over Tailscale":"heard on this network":xe?"asked this deck to pair, over Tailscale":"asked this deck to pair",rt=e.tone==="bad"?"bad":W?e.here?"up":"down":"loose",at=l===`check:${e.fp}`,le=($==null?void 0:$.offers)??null,_e=rt==="up"?(le==null?void 0:le.current)??null:null,Ie=_e&&"key"in _e?_e.key:null,Ze=!!_e&&"hidden"in _e,We=!!_e&&"other"in _e,Je=W?ez((le==null?void 0:le.accounts)??null,r,n.shared??[],Ie):[],ye=Je.filter(fe=>fe.in==null&&fe.out==="cut"),Me=Je.some(fe=>fe.in!=null),Qe=Je.some(fe=>fe.out!=null),ue=new Map(ve.map(fe=>[fe.email,fe])),kt=ve.filter(fe=>!Je.some(st=>st.email===fe.email)),pt=W?le?le.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:$!=null&&$.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(Yt=$==null?void 0:$.last)!=null&&Yt.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,ut=le&&($!=null&&$.last)&&$.last.at-le.at>jB?xs(le.at,a):null,Bt=[];W&&($!=null&&$.pairedAt)?Bt.push({label:"Paired",value:EB($.pairedAt,a),tone:"meta"}):e.kind==="declined"&&z&&Bt.push({label:"Paired",value:`no · you said no ${Y0(z.at,a)}`,tone:"meta"}),Bt.push({label:"Fingerprint",value:K?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:K}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void te(),"aria-label":B?"Fingerprint copied":"Copy the fingerprint",children:B?"copied":"copy"})]}):"not known — nothing has answered there",tone:K?void 0:"quiet"});const jt=m.length?[{row:e,peer:$??null},...m]:[];return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:j,className:"modal lan-peer","data-tone":e.tone,onClick:fe=>fe.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[o.jsxs("header",{className:"modal-head lan-peer-head",children:[o.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("div",{className:"lan-peer-id",children:[M?o.jsxs("form",{className:"lan-peer-edit",onSubmit:fe=>{fe.preventDefault(),O(k??"")},children:[o.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),o.jsx("input",{ref:X,className:"ap-manage-input lan-peer-input",value:k??"",maxLength:48,placeholder:G,"aria-label":"Name for this deck, shown on this deck only",onChange:fe=>S(fe.target.value)}),o.jsx("button",{type:"submit",className:"ap-manage-btn",...J(`alias:${e.fp}`),children:"save"}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>S(null),children:"cancel"})]}):o.jsxs("span",{className:"lan-peer-title",children:[o.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),F&&o.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{N(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:o.jsx(CB,{})})]}),o.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&o.jsxs(o.Fragment,{children:["calls itself ",o.jsx("span",{className:"lan-peer-self",children:e.self}),M&&o.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...J(`alias:${e.fp}`),onClick:()=>void O(""),children:"use this name"}),o.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&o.jsx("span",{"aria-hidden":!0,children:" · "})]}),o.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body lan-peer-body",children:[b&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:b}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>N(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"lan-map","data-link":rt,"data-asking":at||void 0,"data-bus":Je.length>0||void 0,children:[o.jsxs("div",{className:"lan-ends",children:[o.jsxs("p",{className:"lan-end",children:[o.jsx("span",{className:"lan-end-name",children:"This deck"}),he&&o.jsx("span",{className:"lan-end-runs",children:he}),W&&n.shareActive===!1&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),o.jsxs("p",{className:"lan-end","data-side":"there",children:[o.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&o.jsxs("span",{className:"lan-end-runs",children:[ge??(H?"not said":ae),Te?` · ${Te<0?"older":"newer"}`:null]}),Ze&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"}),We&&o.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),o.jsxs("div",{className:"lan-link",children:[o.jsx(f_,{}),o.jsxs("span",{className:"lan-span",children:[o.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[o.jsx("i",{className:"lan-glint","data-dir":"out"}),o.jsx("i",{className:"lan-glint","data-dir":"in"})]}),o.jsx("span",{className:"lan-link-label",children:de?o.jsx("code",{className:"ap-lan-code",children:de}):"none here — it calls this deck"})]}),o.jsx(f_,{}),(de&&Ge||ke)&&o.jsxs("p",{className:"lan-link-sub",children:[de&&Ge,de&&Ge&&ke&&" · ",ke&&(De?Ue?o.jsx("code",{className:"ap-lan-code",children:je}):o.jsx("span",{className:"lan-round","data-tone":De.tone,children:De.text.replace(/ · now$/," · just now")}):"not asked yet"),ke&&je&&!Ue&&o.jsx("code",{className:"lan-fact-raw",children:je})]}),kt.length>0&&o.jsx("ul",{className:"lan-done",children:kt.map(fe=>o.jsxs("li",{"data-ok":fe.ok,children:[fe.email," ",o.jsx("span",{className:"lan-done-what",children:fe.ok?"arrived":"did not arrive"})]},`${fe.email}:${fe.action}`))}),Ve&&o.jsx("p",{className:"lan-note lan-link-note",children:Ve}),($==null?void 0:$.waiting)&&o.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),Je.length>0&&o.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:Je.map((fe,st)=>{const It=ue.get(fe.email),Et=fe.out==="live"||fe.in!=null&&fe.in!=="cut";return o.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":fe.tone,"data-draw":fe.in&&fe.out?"both":fe.in?"in":"out","data-used-there":fe.usedThere||void 0,style:{"--i":st},children:[o.jsx("i",{className:"lan-pip","data-end":"here","data-state":fe.here,"aria-hidden":!0}),o.jsxs("span",{className:"lan-track",children:[o.jsxs("span",{className:"lan-wire","data-flow":Et?"live":"cut","aria-hidden":!0,children:[(fe.in==="live"||fe.in==="wait")&&o.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":fe.in}),fe.out==="live"&&o.jsx("i",{className:"lan-glint","data-dir":"out"})]}),fe.in&&fe.in!=="cut"&&o.jsx(Id,{dir:"in",gate:fe.in==="blocked"}),fe.out==="live"&&o.jsx(Id,{dir:"out"}),o.jsx("span",{className:"lan-lane-email",children:fe.email})]}),o.jsx("i",{className:"lan-pip","data-end":"there","data-state":fe.there,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:RB(fe)}),(fe.caption||It)&&o.jsxs("span",{className:"lan-lane-note",children:[fe.caption,fe.caption&&It&&" · ",It&&o.jsx("span",{className:"lan-lane-done","data-ok":It.ok,children:It.ok?"arrived last round":"did not arrive last round"})]})]},fe.key)})},L),W&&o.jsxs(o.Fragment,{children:[ye.length>0&&o.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",ye.length===1?ye[0].email:"the expired ones"," until you sign in again here."]}),pt&&o.jsx("p",{className:"lan-empty",children:pt}),ut&&o.jsxs("p",{className:"lan-stale",children:["As of ",ut==="now"?"just now":ut,", when it last answered."]}),o.jsxs("div",{className:"lan-legend",children:[Me&&o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:o.jsx(Id,{dir:"in"})}),"from ",e.name]}),Qe?o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:o.jsx(Id,{dir:"out"})}),"from this deck, to every paired deck"]}):o.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),o.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),o.jsx("dl",{className:"lan-facts",children:Bt.map(fe=>o.jsxs("div",{className:"lan-fact","data-tone":fe.tone,children:[o.jsx("dt",{children:fe.label}),o.jsx("dd",{children:fe.value})]},fe.label))}),jt.length>1&&o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:[jt.length," decks on this machine"]}),o.jsx("ul",{className:"lan-twins",role:"list",children:jt.map((fe,st)=>{var lr,yn,Xt,Cn;const It=(lr=fe.peer)!=null&&lr.addr?`${fe.peer.addr}:${fe.peer.port}`:fe.row.addr,Et=It||fe.row.fp,En=(yn=fe.peer)!=null&&yn.pairedAt?xs(fe.peer.pairedAt,a):null,Gn=[(Cn=(Xt=fe.peer)==null?void 0:Xt.about)!=null&&Cn.version?`runs ${fe.peer.about.version}`:null,En?`paired ${En==="now"?"just now":En}`:null,fe.row.state].filter(Boolean).join(" · "),St=fe.row.fp;return o.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":fe.row.tone,children:[o.jsx("i",{className:fe.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),It?o.jsx("code",{className:"ap-lan-code lan-twin-at",children:It}):o.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),o.jsx("code",{className:"ap-lan-code lan-twin-fp",children:St}),st>0&&y&&o.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${A===St?" armed":""}`,...J(`unpair:${St}`),onKeyDown:zt=>{zt.repeat&&zt.preventDefault()},onClick:()=>{const zt=Date.now(),In=uh({armedFor:A,target:St,armedAt:T.current,now:zt,gapMs:fh});if(In==="arm"){I(St),T.current=zt;return}In!=="ignore"&&(I(null),V(()=>y(St)))},"aria-label":A===St?`Confirm unpairing ${Et}`:`Unpair ${Et}`,title:A===St?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${St}`?"unpairing…":A===St?"confirm":"unpair"}),o.jsx("span",{className:"lan-twin-meta",children:st===0?`${Gn} · shown above`:Gn})]},St)})})]})]}),o.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&o.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),W&&!($!=null&&$.waiting)&&o.jsx("button",{type:"button",className:"btn",...J(`check:${e.fp}`),onClick:()=>void V(f).then(fe=>{fe&&Y.current&&U(st=>st+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&o.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...J(`unpair:${e.fp}`),onKeyDown:fe=>{fe.repeat&&fe.preventDefault()},onClick:()=>{const fe=Date.now(),st=uh({armedFor:E?e.fp:null,target:e.fp,armedAt:T.current,now:fe,gapMs:fh});if(st==="arm"){C(!0),T.current=fe;return}st!=="ignore"&&(C(!1),V(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&o.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...J(`accept:${e.fp}`),onClick:()=>void V(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"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...J(`drop:${e.fp}`),onClick:()=>void V(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...J(`allow:${e.fp}`),onClick:()=>void V(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function IB(e){if(!e.running)return`Tailscale is ${e.state==="Stopped"?"turned off":e.state==="NeedsLogin"||e.state==="NeedsMachineAuth"?"signed out":e.state==="Starting"?"still starting":"not answering"} on this machine`;const t=e.login??"your Tailscale account";return e.on?`${e.devices} online · ${t}`:t}function $B({status:e,accounts:t,onClose:n,onChanged:r}){const a=sn(n),[l,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null),w=x.useRef(null),j=X=>{const Y=Fa(m,X);return{disabled:Y.disabled,"aria-busy":Y.busy}},k=x.useRef(null),S=x.useRef(!0);x.useEffect(()=>()=>{S.current=!1},[]),x.useEffect(()=>{k.current=p_(k.current,e.shared??[],null)},[e.shared]);const b=x.useCallback(async(X,Y,M="write")=>{w.current=M,y(M);try{const V=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:X})})).json().catch(()=>null);return S.current?(V!=null&&V.ok?f(null):f(tn(Y,V)),r(),(V==null?void 0:V.ok)===!0):!1}catch{return S.current&&f(tn(Y,null)),!1}finally{w.current=null,S.current&&y(null)}},[r]),N=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await b({name:l},"save the name","name"))return;S.current&&c(null)}n()},[l,e.name,b,n]),E=async()=>{if(!e.fp)return;const X=await sl(e.fp);if(S.current){if(!X){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{S.current&&h(!1)},1600)}},C=new Set(k.current??e.shared??[]),T=e.autoAsk!==!1,A=e.autoAccept!==!1,I=e.shareActive!==!1,B=e.tailscale??null,q=!!(B!=null&&B.on),L=(B==null?void 0:B.ask)!==!1,U=(B==null?void 0:B.accept)!==!1;return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:a,className:"modal lan-modal",onClick:X=>X.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[u&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:u}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Name"}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"appear as"}),o.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:X=>c(X.target.value),onKeyDown:X=>{X.key!=="Enter"||l==null||(b({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&o.jsx("button",{type:"button",className:"ap-manage-btn",...j("name"),onClick:()=>{b({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:e.fp}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):o.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Share these accounts"}),o.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&o.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(X=>o.jsxs("label",{className:"ap-lan-pick",title:X.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:[o.jsx("input",{type:"checkbox",checked:C.has(X.key),onChange:Y=>{const M=zB(k.current,e.shared??[],X.key,Y.target.checked);k.current=M,b({shared:M},Y.target.checked?"share that account":"stop sharing that account").then(J=>{k.current===M&&(k.current=p_(M,e.shared??[],{ok:J}))})}}),o.jsx("span",{className:"ap-lan-pick-name",children:X.email}),!X.alive&&o.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},X.key))]}),t.length>0&&o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":I,"aria-label":"Show paired decks which of these this deck is using",...j("current"),onClick:()=>void b({shareActive:!I},I?"stop showing which account this deck is using":"show which account this deck is using","current"),title:I?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:o.jsx("span",{className:"switch-knob"})})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Pairing"}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",...j("ask"),onClick:()=>void b({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":A,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...j("accept"),onKeyDown:X=>{X.repeat&&X.preventDefault()},onClick:()=>void b({autoAccept:!A},A?"stop accepting automatically":"accept every deck that asks","accept"),title:A?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:o.jsx("span",{className:"switch-knob"})})]})]})]}),(B==null?void 0:B.found)&&o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Tailscale"}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch",children:[o.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",o.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:IB(B)})]}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":q,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",...j("tailscale"),onClick:()=>void b({tailscale:!q},q?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:q?"Stop. Nothing is looked for or answered over the tailnet; decks already paired stay paired.":"Find the decks on your other machines on Tailscale, wherever they are. Only machines signed in to your Tailscale account are asked.",children:o.jsx("span",{className:"switch-knob"})})]}),q&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":L,"aria-label":"Ask each of my devices it finds over Tailscale",...j("tailscale-ask"),onClick:()=>void b({tailscaleAsk:!L},L?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:L?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck found on your devices over Tailscale.",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to each device that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":U,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",...j("tailscale-accept"),onKeyDown:X=>{X.repeat&&X.preventDefault()},onClick:()=>void b({tailscaleAccept:!U},U?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:U?"Stop saying yes for you. A device that asks waits in the panel again.":"Say yes for you when a deck on one of your own devices asks. Anybody else on the tailnet still waits for a press.",children:o.jsx("span",{className:"switch-knob"})})]})]})]})]})]}),o.jsxs("footer",{className:"lan-setup-foot",children:[o.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),o.jsx("button",{type:"button",className:"btn primary",...j("name"),onClick:()=>void N(),children:"Done"})]})]})}),document.body)}function xs(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const a=Math.round(r/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const K0={"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"}},OB={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 LB(e){var r;const t=PB[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&OB[n]||e}const PB={"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 ZR(e,t){if(!e)return null;if(e.error)return K0[e.error]??{text:LB(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${xs(e.at,t)}`,tone:"idle"};const r=n.filter(l=>l.ok),a=r.length===1?"login":"logins";return r.length===n.length?{text:`${r.length} ${a} arrived · ${xs(e.at,t)}`,tone:"ok"}:{text:`${r.length} of ${n.length} logins arrived · ${xs(e.at,t)}`,tone:"bad"}}const DB=9e4;function FB({error:e,host:t,port:n},r,a,l=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=r.filter(p=>p.addr===c&&p.port&&p.at>0&&a-p.at<DB);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${l} and TCP ${n??f[0]}.`}const e0=5e3,QR=6e4,fh=400;function qB(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!r||!Number.isInteger(a)||a<1||a>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,port:a}}function tn(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 BB(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function zB(e,t,n,r){const a=new Set(e??t);return r?a.add(n):a.delete(n),[...a]}function p_(e,t,n){return e==null||n!=null&&!n.ok||BB(e,t)?null:e}function HB(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function JR(e,t){var n,r;return(n=e.last)!=null&&n.error&&!K0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<ph||e.lastSeen!=null&&t-e.lastSeen<ph)}const ph=95e3,eM=160,UB=6,tM=140;function WB(e,t){const n=[],r=[];for(const a of e??[])(JR(a,t)?n:r).push(a);return{online:n,offline:r}}function VB(e){var t;return(t=e.tailscale)!=null&&t.exitNode?"Tailscale sends this machine's local network through an exit node, so decks on this network cannot find this one. Turn on Allow local network access in Tailscale's exit node menu to bring them back.":"This machine sends its local network through a VPN, so decks on this network cannot find this one. Allowing local network access in the VPN brings them back."}function GB(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 r=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const a=r.filter(w=>w.waiting),l=r.filter(w=>!w.waiting),c=a.filter(w=>{var j;return!((j=w.last)!=null&&j.error)&&w.lastSeen!=null&&t-w.lastSeen<ph}),{online:u,offline:f}=WB(l,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var j;return((j=w.last)==null?void 0:j.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function KB(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=xs(e,t);return r==="now"?"checked just now":`checked ${r}`}function Y0(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}function YB(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<ph;return{text:n?"online · one-way, it calls in":`one-way · last online ${xs(e,t)}`,here:n}}function m_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${xs(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function XB(e,t){var y,w,j,k,S;if(!e)return[];const n=[],r=new Set,a=(b,N)=>b.name.localeCompare(N.name,void 0,{numeric:!0}),l=e.aliases??{},c=(b,N)=>{const E=b?l[b]:void 0;return E&&E!==N?{name:E,self:N}:{name:N}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const N=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:N.name,...N.self?{self:N.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${Y0(b.at,t)}`,tone:"wait",here:!0,hint:`${N.name} at ${b.addr}${b.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}const u=[],f=[];for(const b of e.peers??[]){const N=b.peerFp??b.fp;if(!N||r.has(N))continue;r.add(N);const E=ZR(b.last,t),C=JR(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||N,addr:b.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=b.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${b.last.error}.`:`Dialling ${T} until something answers.`,...b.via==="tailscale"?{via:"tailscale"}:{}});continue}const A=b.waiting?YB(b.lastSeen,t):null,I=A?A.here:C,B=!A&&E?I?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${m_(b,I,t)}`:A?A.text:m_(b,I,t),q=(w=b.last)!=null&&w.error?K0[b.last.error]:null,L=!A&&I&&!((j=b.last)!=null&&j.error)&&!(((k=b.last)==null?void 0:k.done)??[]).length,U=b.manual&&!b.met?{name:T}:c(N,b.name||N);u.push({fp:N,name:U.name,...U.self?{self:U.self}:{},addr:b.addr??"",kind:"paired",state:B,quiet:L,tone:q?q.tone==="bad"?"bad":"wait":E?E.tone:I?"ok":"idle",here:A?A.here:C,...b.via==="tailscale"?{via:"tailscale"}:{},hint:A?`${U.name} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${b.lastSeen==null?"It has not called since this deck started.":`It last called ${xs(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${U.name}${T?` at ${T}`:""}${(S=b.last)!=null&&S.error?` — ${b.last.error}`:""}`})}n.push(...ZB(u).sort(a),...f.sort(a));const p=[];for(const b of e.strangers??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const N=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:N.name,...N.self?{self:N.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:b.via==="tailscale"?`${N.name} at ${b.addr} is on your tailnet and nothing is shared with it.`:`${N.name} at ${b.addr} is on this network and nothing is shared with it.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}n.push(...p.sort(a));const h=[];for(const b of e.declined??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const N=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:N.name,...N.self?{self:N.self}:{},addr:b.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 m=new Map;for(const b of n)m.set(b.name,(m.get(b.name)??0)+1);for(const b of n)(m.get(b.name)??0)<2||!b.addr||(b.state=b.quiet||!b.state?b.addr:`${b.addr} · ${b.state}`,b.quiet=!1);return n}function ZB(e){const t=new Map;for(const r of e){const a=t.get(r.name);a?a.push(r):t.set(r.name,[r])}const n=[];for(const r of t.values()){const a=[...new Set(r.filter(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push(g_(r.filter(c=>c.addr===l)));n.push(...r.filter(l=>!l.addr))}else n.push(g_(r))}return n}function g_(e){const[t,...n]=[...e].sort((r,a)=>Number(a.here)-Number(r.here)||+!!a.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function y_(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function w_(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 QB(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let a=1;a<=3;a++){const l=Number(n[a])-Number(r[a]);if(l)return Math.sign(l)}return 0}function JB(e,t,n){const r=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:r,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:r,note:null,tone:"ok"}:n?{there:"works there",here:r,note:"repairs next round",tone:"wait"}:{there:"works there",here:r,note:"share it to repair",tone:"bad"}:{there:"works there",here:r,note:"arrives next round",tone:"wait"}}function ez(e,t,n,r=null){const a=new Map(t.map(f=>[f.key,f])),l=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=l.has(f.key),m=JB(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:r===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function Li(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function tz({anchorId:e,id:t,rows:n,onHold:r,onLet:a}){const l=x.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,UB),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=x.useCallback(()=>{const y=l.current,w=document.getElementById(e);if(!y||!w)return;const j=U0(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${j.top}px`,y.style.left=`${j.left}px`,y.style.maxHeight=j.maxHeight==null?"":`${j.maxHeight}px`,y.dataset.side=j.side},[e]);return x.useLayoutEffect(()=>{m()}),x.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),Sn.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[o.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&o.jsx("div",{className:"ap-peek-list",children:f.map(y=>o.jsxs("span",{className:"ap-peek-who",children:[o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),o.jsxs("span",{children:[y.name,y.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${y.kind}:${y.fp}`))}),h&&o.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function nz(e,t){var l;if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(c=>c.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((l=e.reach)!=null&&l.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(c=>c.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const a=r.filter(c=>c.here).length;return a?a===r.length?{text:`${a} online`,tone:"ok",live:!0}:{text:`${a} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function rz({accounts:e,onChanged:t,view:n,onOpen:r,onBack:a,closeButton:l}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[j,k]=x.useState(null),S=x.useRef(0),[b,N]=x.useState(!1),[E,C]=x.useState(!1),[T,A]=x.useState(!1),I=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(I.current),[]);const[B,q]=x.useState(!1),[L,U]=x.useState(null),X=x.useRef(null),Y=x.useCallback(le=>Oh(X.current)?(X.current=le,m(le),!0):!1,[]),M=x.useCallback(()=>{X.current=null,z.current&&m(null)},[]),J=le=>{const _e=Fa(h,le);return{disabled:_e.disabled,"aria-busy":_e.busy}},[V,$]=x.useState(()=>Date.now()),z=x.useRef(!0),W=x.useRef(e0),G=x.useCallback(async()=>{var le,_e;try{const[Ie,Ze]=await Promise.all([fetch("/api/lan").then(We=>We.json()),fetch("/api/prefs").then(We=>We.json())]);if(!z.current)return;Ie!=null&&Ie.ok&&u(Ie),Ze!=null&&Ze.ok&&p(Array.isArray((_e=(le=Ze.prefs)==null?void 0:le.lan)==null?void 0:_e.manual)?Ze.prefs.lan.manual:[]),W.current=(Ie==null?void 0:Ie.enabled)===!0?e0:QR}catch{}},[]);x.useEffect(()=>{z.current=!0;let le=0;const _e=async()=>{$(Date.now()),await G(),z.current&&(le=window.setTimeout(_e,W.current))};return _e(),()=>{z.current=!1,window.clearTimeout(le)}},[G]);const F=x.useCallback(async()=>{const le=(c==null?void 0:c.enabled)===!0;if(Y("switch"))try{const _e=await Li("/api/prefs",{lan:{enabled:!le}});if(!z.current)return;_e!=null&&_e.ok?(U(null),le||w(!0)):U(tn(le?"turn this off":"turn this on",_e)),await G()}catch{z.current&&U(tn(le?"turn this off":"turn this on",null))}finally{M()}},[c==null?void 0:c.enabled,G,Y,M]),K=x.useCallback(async(le,_e,Ie)=>{if(!Y(`${le}:${_e}`))return null;let Ze=null;try{const We=await Li("/api/lan/peer",{action:le,fp:_e});if(!z.current)return null;We!=null&&We.ok?(u(We),U(null)):(Ze=tn(Ie,We),U(Ze)),await G()}catch{Ze=tn(Ie,null),z.current&&U(Ze)}finally{M()}return Ze},[G,Y,M]),de=x.useCallback(async le=>{if(!Y(`drop:${le}`))return null;let _e=null;try{const Ie=await Li("/api/prefs",{lan:{manual:f.filter(Ze=>Ze!==le)}});if(!z.current)return null;Ie!=null&&Ie.ok?(U(null),t()):(_e=tn("stop dialling that address",Ie),U(_e)),await G()}catch{_e=tn("stop dialling that address",null),z.current&&U(_e)}finally{M()}return _e},[f,G,t,Y,M]),[H,Q]=x.useState(null),O=x.useCallback(async(le,_e)=>{if(!Y(`alias:${le}`))return"Something else is still being saved. Try again in a moment.";try{const Ie=await Li("/api/lan/peer",{action:"alias",fp:le,name:_e});return z.current?Ie!=null&&Ie.ok?(u(Ie),null):tn("rename that deck",Ie):null}catch{return tn("rename that deck",null)}finally{M()}},[Y,M]),te=x.useCallback(async le=>{if(!Y(`check:${le}`))return null;try{const _e=await Li("/api/lan/sync",{fp:le});return z.current?_e!=null&&_e.ok?(u(_e),t(),null):(_e==null?void 0:_e.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.":tn("check that deck",_e):null}catch{return tn("check that deck",null)}finally{M()}},[Y,M,t]),ae=x.useCallback(async()=>{if(Y("check"))try{const le=await Li("/api/lan/sync",{});if(!z.current)return;le!=null&&le.ok?(u(le),U(null)):U(tn("check the other decks",le)),t()}catch{z.current&&U(tn("check the other decks",null))}finally{M()}},[Y,M,t]),he=(c==null?void 0:c.enabled)===!0,ge=XB(c,V),Te=H?ge.find(le=>{var _e;return le.fp===H||((_e=le.twins)==null?void 0:_e.some(Ie=>Ie.fp===H))})??null:null;x.useEffect(()=>{H&&c&&!Te&&Q(null)},[H,c,Te]);const De=ge.filter(le=>le.kind==="asks"),Ve=ge.filter(le=>le.kind!=="asks"),je=Ve.filter(le=>le.here),ve=Ve.filter(le=>!le.here),Ue=ve.filter(le=>le.tone==="bad").length,ke=B||je.length===0,xe=GB(c,V),Ge=Ve.filter(le=>le.kind==="paired").length,rt=nz(c,ge),at=o.jsxs(o.Fragment,{children:[b&&c&&o.jsx(_B,{status:c,manual:f,onClose:()=>N(!1),onChanged:()=>{G(),t()}}),E&&o.jsx(KR,{title:"How Local network works",steps:wB,finish:he?void 0:{label:"Turn it on",act:()=>{C(!1),F()}},onClose:()=>C(!1)}),y&&c&&o.jsx($B,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{G(),t()}}),Te&&c&&o.jsx(MB,{row:Te,source:w_(c,Te),status:c,accounts:e,now:V,busy:h,onClose:()=>Q(null),onRename:le=>O(Te.fp,le),onCheck:()=>te(Te.fp),onVerb:()=>{switch(Te.kind){case"paired":return K("unpair",Te.fp,"unpair that deck");case"nearby":return K("accept",Te.fp,"reach that deck");case"declined":return K("allow",Te.fp,"let that deck ask again");case"dialling":return de(Te.fp);default:return Promise.resolve(null)}},onSettings:()=>{Q(null),w(!0)},twins:(Te.twins??[]).map(le=>({row:le,peer:w_(c,le).peer??null})),onUnpair:le=>K("unpair",le,"unpair that deck")})]});if(!n){const le=We=>{window.clearTimeout(I.current),I.current=window.setTimeout(()=>A(!0),We)},_e=()=>{window.clearTimeout(I.current),I.current=window.setTimeout(()=>A(!1),tM)},Ie=()=>window.clearTimeout(I.current),Ze=()=>{window.clearTimeout(I.current),A(!1)};return o.jsxs("div",{className:"ap-foot",children:[o.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{Ze(),r()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:We=>{We.pointerType==="mouse"&&le(eM)},onPointerLeave:_e,onFocus:We=>{We.target.matches(":focus-visible")&&le(0)},onBlur:_e,children:[o.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),o.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Local network"}),o.jsxs("span",{className:"ap-nav-state","data-tone":rt.tone,children:[rt.live&&o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),rt.text]})]}),o.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),T&&o.jsx(tz,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:ge,onHold:Ie,onLet:_e}),o.jsx("p",{className:"vis-hidden",role:"status",children:xe.tone==="ok"?"":xe.text}),at]})}return o.jsxs("div",{className:"ap-lan-view",children:[o.jsxs("div",{className:"ap-header",children:[o.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),o.jsx("h2",{id:"ap-lan-title",children:"Local network"}),o.jsxs("div",{className:"ap-header-right",children:[he&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>N(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:o.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:[o.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),o.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),he&&Ge>0&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...J("check"),onClick:()=>void ae(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:o.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:[o.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),o.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),he&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...J("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),o.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),o.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),l]})]}),o.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:o.jsxs("div",{className:"ap-lan",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":he,"aria-label":"Sync with paired decks",...J("switch"),onClick:()=>void F(),title:he?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:o.jsx("span",{className:"switch-knob"})})]}),he&&o.jsx(XR,{reach:c==null?void 0:c.reach,where:"panel"}),he&&(c==null?void 0:c.deaf)&&o.jsx("p",{className:"ap-lan-fine",children:c.deaf}),he&&(c==null?void 0:c.lanTunneled)&&o.jsx("p",{className:"ap-lan-fine",children:VB(c)}),!he&&o.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[o.jsx(vB,{}),o.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),o.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),o.jsx("p",{className:`ap-lan-status ${xe.tone}`,role:"status",children:xe.tone==="ok"?"":xe.text}),L&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:L}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>U(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),he&&o.jsxs(o.Fragment,{children:[De.length>0&&o.jsx("div",{className:"ap-lan-asks",role:"alert",children:De.map(le=>o.jsxs("div",{className:"ap-lan-ask",children:[o.jsxs("span",{className:"ap-lan-ask-what",children:[o.jsx("strong",{className:"ap-lan-peer-name",children:le.name})," at ",o.jsx("code",{className:"ap-lan-code",children:le.addr})," wants to pair"]}),o.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",o.jsx("code",{className:"ap-lan-code",children:le.fp})]}),o.jsxs("span",{className:"ap-lan-ask-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",...J(`accept:${le.fp}`),onClick:()=>void K("accept",le.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${le.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...J(`dismiss:${le.fp}`),onClick:()=>void K("dismiss",le.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},le.fp))}),(ke?[...je,...ve]:je).length>0&&o.jsx("ul",{className:"ap-lan-here",children:(ke?[...je,...ve]:je).map((le,_e)=>o.jsxs("li",{className:"ap-lan-who","data-tone":le.tone,children:[o.jsx("i",{className:le.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[le.name,le.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),o.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${_e}`,onClick:()=>Q(le.fp),children:o.jsxs("span",{className:"vis-hidden",children:[le.name,le.via==="tailscale"?", over Tailscale":"",", details"]})}),o.jsx("span",{id:`lan-who-state-${_e}`,className:le.quiet?"vis-hidden":"ap-lan-who-when",children:le.state}),le.kind==="nearby"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...J(`accept:${le.fp}`),onClick:()=>void K("accept",le.fp,"reach that deck"),"aria-label":`Ask ${le.name} to pair`,title:`Send ${le.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${le.fp}.`,children:"ask"}),le.kind==="paired"&&o.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${j===le.fp?" armed":""}`,...J(`unpair:${le.fp}`),onClick:()=>{const Ie=Date.now(),Ze=uh({armedFor:j,target:le.fp,armedAt:S.current,now:Ie,gapMs:fh});if(Ze==="arm"){k(le.fp),S.current=Ie,window.setTimeout(()=>k(We=>We===le.fp?null:We),4e3);return}Ze!=="ignore"&&(k(null),K("unpair",le.fp,"unpair that deck"))},"aria-label":j===le.fp?`Confirm unpairing ${le.name}`:`Unpair ${le.name}`,title:j===le.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:j===le.fp?"confirm":"unpair"}),le.kind==="dialling"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...J(`drop:${le.fp}`),onClick:()=>void de(le.fp),"aria-label":`Stop dialling ${le.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),le.kind==="declined"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...J(`allow:${le.fp}`),onClick:()=>void K("allow",le.fp,"let that deck ask again"),"aria-label":`Let ${le.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${le.kind}:${le.fp}`))}),(je.length>0&&ve.length>0||he&&Ge>0)&&o.jsxs("div",{className:"ap-lan-tail",children:[je.length>0&&ve.length>0&&o.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":B,onClick:()=>q(le=>!le),title:B?"Show only the decks that are on":`Show the ${ve.length} deck${ve.length===1?"":"s"} that are not responding right now`,children:[o.jsx("span",{className:`ap-lan-chev${B?" open":""}`,"aria-hidden":!0,children:"›"}),B?"fewer":`${ve.length} more`,!B&&Ue>0&&o.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",Ue," not responding"]})]}),he&&Ge>0&&o.jsx("span",{className:"ap-lan-checked",children:KB(c==null?void 0:c.checkedAt,V,h==="check")})]}),Ve.length===0&&De.length===0&&!(c!=null&&c.stalled)&&!(c!=null&&c.deaf)&&!(c!=null&&c.lanTunneled)&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"ap-lan-fine",children:"No other deck yet. Decks on one network usually find each other on their own; when that has not happened, the link at the top of this view reaches one by address or by invite."}),o.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),at]})}function sz({anchorId:e,id:t,peers:n,onHold:r,onLet:a}){const l=x.useRef(null),{title:c,shown:u,rest:f}=sB(n),p=x.useCallback(()=>{const h=l.current,m=document.getElementById(e);if(!h||!m)return;const y=U0(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${y.top}px`,h.style.left=`${y.left}px`,h.style.maxHeight=y.maxHeight==null?"":`${y.maxHeight}px`,h.dataset.side=y.side},[e]);return x.useLayoutEffect(()=>{p()}),x.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),Sn.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[o.jsx("p",{className:"ap-peek-title",children:c}),o.jsx("div",{className:"ap-peek-list",children:u.map(h=>o.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[o.jsx("span",{className:"ap-fold-name",children:h.name}),o.jsx("span",{className:"ap-fold-state","data-tone":h.ready?"ok":h.warn?"warn":"idle",children:h.ready?h.headroom==null?"not read yet":`${h.headroom}% free`:h.why})]},h.key))}),f&&o.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function az({peers:e,strained:t,armed:n,threshold:r,open:a,onToggle:l}){const[c,u]=x.useState(!1),f=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(f.current),[]),x.useEffect(()=>{a&&(window.clearTimeout(f.current),u(!1))},[a]);const p=j=>{a||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),j))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),tM)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},w=nB(e,{strained:t&&!a,armed:n,threshold:r});return o.jsxs("div",{className:"ap-rest",children:[o.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":a,"aria-controls":a?"ap-rest-panel":void 0,"aria-describedby":c?"ap-rest-peek":void 0,onClick:()=>{y(),l()},onPointerEnter:j=>{j.pointerType==="mouse"&&p(eM)},onPointerLeave:h,onFocus:j=>{j.target.matches(":focus-visible")&&p(0)},onBlur:h,children:[o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),o.jsx("span",{className:"ap-nav-state","data-tone":w.tone,children:w.text})]}),o.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),c&&o.jsx(sz,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function oz(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const iz=1800;function lz({accounts:e,onClose:t,copyText:n}){const[r,a]=x.useState([]),[l,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,j]=x.useState(()=>Math.floor(Date.now()/1e3)),k=x.useRef(null),S=x.useRef(!1),b=sn(t,{focusRef:k});x.useEffect(()=>{if(!l)return;j(Math.floor(Date.now()/1e3));const L=window.setInterval(()=>j(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(L)},[l]);const N=W8(e),E=V8(e,r),C=E.length===e.length,T=L=>a(U=>G8(U,L)),A=x.useCallback(async()=>{const L=K8(E);if(!Ks(S.current)||!L)return;S.current=!0,f(!0),h(null),y(!1);const U=await oz(L).catch(()=>null);if(S.current=!1,f(!1),!(U!=null&&U.ok)){h(zi(U,"the share could not be made"));return}c({blob:U.blob,expiresAt:U.expiresAt,shared:U.shared??[],failed:U.failed??[]})},[e,E]),I=l?GR(l.expiresAt,w):null,B=(I==null?void 0:I.tone)==="gone",q=(l==null?void 0:l.shared.length)??0;return Sn.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:b,className:"modal sa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("h3",{children:"Share accounts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body sa-body",children:l?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:B?"This share has expired":q===1?"1 account, ready to paste":`${q} accounts, ready to paste`}),o.jsx("code",{className:`ap-share-blob${B?" sa-dead":""}`,children:l.blob}),o.jsxs("div",{className:"ap-share-foot",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(B){c(null),A();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),iz))},children:B?"make a new share":m?"copied":`copy ${q===1?"the share":"all "+q}`}),o.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:[o.jsx("span",{className:"ap-share-warn",children:q===1?"this is the password":`this is ${q} passwords`})," · ",o.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),l.failed.length>0&&o.jsxs("div",{className:"sa-failed",role:"alert",children:[o.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:`}),o.jsx("ul",{className:"sa-list",children:l.failed.map(L=>{var X;const U=!!(L.email&&((X=L.detail)!=null&&X.includes(L.email)));return o.jsxs("li",{children:[!U&&o.jsx("span",{className:"sa-who",children:L.email||`account ${L.num}`}),o.jsx("span",{className:"sa-why",children:L.detail||"could not be exported"})]},`${L.num}-${L.email}`)})})]}),o.jsx("p",{className:"sa-note",children:B?o.jsx(o.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):o.jsxs(o.Fragment,{children:["Paste it into the other deck with ",o.jsx("strong",{children:"+"})," → ",o.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),o.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:"Nothing to share"}),o.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",o.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),o.jsx("div",{className:"sa-actions",children:o.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):o.jsxs("div",{className:"sa-step",children:[o.jsxs("h4",{children:["Which accounts go to the other ",nn,"?"]}),o.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:Y8(E.length)}),o.jsx("ul",{className:"sa-list sa-pick",children:N.map(L=>o.jsx("li",{children:o.jsxs("label",{className:"sa-row",children:[o.jsx("input",{type:"checkbox",checked:E.includes(L.num),onChange:()=>T(L.num)}),o.jsx("span",{className:"sa-who",children:L.label}),L.sub&&o.jsx("span",{className:"sa-sub",children:L.sub})]})},L.num))}),p&&o.jsx("p",{className:"aa-err",children:p}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(L=>L.num):[]),children:C?"Clear all":"Select all"}),o.jsx("button",{type:"button",className:"btn primary",ref:k,...Ma(u,!E.length),onClick:A,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function cz(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+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 uz(e,t,n){if(!(n!=null&&n.ok))return null;const r=Number.isInteger(n.to)?n.to:null;if(r==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:a&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:r,displaced:t}:null}}function dz(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function hz(e,t,n){var a;const r=((a=e.find(l=>l.slot===t))==null?void 0:a.kind)??"here";return r==="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}.`}:r==="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 fz(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 v_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function pz(e){const t=e.filter(u=>!v_(u)),n=e.filter(u=>v_(u)),r=t.length?t:n,a=t.length?n:[],l=r.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:r,rest:a,fuller:c,peak:c??l}}const mz="\0";function mh(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}${mz}${n}`}function gz(e,t){const n=mh(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function yz(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(mh)),r=e.filter(a=>n.has(a));return r.length===e.length?e:r}const wz=64;function vz(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const xz=Object.freeze({text:"couldn't reach the deck server",reload:!0}),bz=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function x_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function kz(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Bc(t.body);return{text:Xx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function b_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const k_=15e3,Nz=8e3,_z=1800,Sz=3e4,Vp=[70,80,85,90,95];function Gp(e,t){return CR(t-Math.floor(e/1e3))}function jz(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 bc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ez(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 r=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 ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function Cz(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 Tz(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 $d(e,t){if(e.staleCopy){const n=Ez(e.repair??null,t);return{text:bc(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=Tz(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const r=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:bc(n.text),hint:n.hint,fix:n.fix?bc(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=Cz(e.error);return{text:bc(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function Kp(){return o.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),o.jsx("path",{d:"M7 5.6v2.9"}),o.jsx("path",{d:"M7 10.3v.05"})]})}function Az(e){return e>=90?"hi":e>=70?"mid":void 0}function Rz(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!Vp.includes(t)?[...Vp,t]:Vp].sort((r,a)=>r-a)}function Mz({lane:e,nowSec:t,frozen:n}){const r=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?TR(e.resetAt,t):null;return o.jsxs("div",{className:"ap-lane",children:[o.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),o.jsx("div",{className:"ap-lane-track",children:o.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:a,opacity:r===0||n?.4:1}})}),o.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[r,"%"]}),o.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}function Iz({onClose:e,leaving:t}){var _s,On,wn;const[n,r]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[j,k]=x.useState("accounts"),[S,b]=x.useState(!1),[N,E]=x.useState(null),C=x.useRef(N);C.current=N;const[T,A]=x.useState(()=>Math.floor(Date.now()/1e3)),I=x.useRef(null),[B,q]=x.useState(null),L=(B==null?void 0:B.num)??null,U=x.useRef(B);U.current=B;const[X,Y]=x.useState(null),[M,J]=x.useState(!1),[V,$]=x.useState(""),[z,W]=x.useState(null),G=x.useRef(0),[F,K]=x.useState(null),[de,H]=x.useState(!1),[Q,O]=x.useState(!1),[te,ae]=x.useState(null),[he,ge]=x.useState(null),[Te,De]=x.useState(null),[Ve,je]=x.useState(null),[ve,Ue]=x.useState(!1),ke=x.useRef(null),xe=x.useRef(null),[Ge,rt]=x.useState([]),[at,le]=x.useState(!1),_e=x.useRef(null),Ie=x.useCallback(ee=>Oh(_e.current)?(_e.current=ee,u(ee),!0):!1,[]),Ze=x.useCallback(()=>{_e.current=null,u(null)},[]),We=(ee,Ae=!1)=>{const Oe=Fa(c,ee);return{disabled:Oe.disabled,"aria-busy":Oe.busy||Ae}},Je=x.useCallback(ee=>{window.requestAnimationFrame(()=>{var Ae;if(KN(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Oe of dq(ee)){const Re=document.querySelector(Oe);if(Re){Re.focus();return}}})},[]),ye=x.useCallback(async(ee=!1)=>{ee&&p(!0);const Ae=new AbortController,Oe=window.setTimeout(()=>Ae.abort(),Sz);try{const[Re,ze]=await Promise.all([fetch(`/api/claude-accounts${ee?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Re.ok){const yt=await Re.json();r(yt),rt(Ct=>yz(Ct,yt.accounts))}ze.ok&&l(await ze.json());const dt=kz([await x_(Re),await x_(ze)]);m(yt=>b_(yt,dt))}catch{m(Re=>b_(Re,Ae.signal.aborted?bz:xz))}finally{window.clearTimeout(Oe),ee&&p(!1)}},[]),Me=x.useCallback(async(ee,Ae,Oe="panel")=>{if(!Ie(Ae))return null;const Re=Oe==="menu"?Y:m;Re(null);try{const ze=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),dt=await ze.json().catch(()=>null);return dt!=null&&dt.ok||Re({text:Xx(dt,"command failed",ze.status),raw:Bc(dt)}),dt}catch{return Re({text:"server unreachable"}),null}finally{Ze()}},[Ie,Ze]),Qe=x.useCallback(async(ee,Ae)=>{if(!Ie(Ae))return null;m(null),Y(null);try{const Oe=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),Re=await Oe.json().catch(()=>null);return Re!=null&&Re.ok||Y({text:zi(Re,"command failed",Oe.status)}),Re}catch{return Y({text:"server unreachable"}),null}finally{Ze()}},[Ie,Ze]);x.useEffect(()=>(ye(!0),I.current=window.setInterval(()=>ye(!1),k_),()=>{I.current!=null&&window.clearInterval(I.current)}),[ye]),x.useEffect(()=>{const ee=window.setInterval(()=>A(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ee)},[]);const ue=((_s=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:_s.value)??"90",kt=Ve??ue,pt=fz(kt,ue),ut=(On=n==null?void 0:n.accounts)==null?void 0:On.find(ee=>ee.active),Bt=ut?$d(ut,T):null,jt=(n==null?void 0:n.accounts)??[],vt=ut?jt.filter(ee=>!ee.active):[],an=vt.length?jt.filter(ee=>ee.active):jt,jn=vt.map(ee=>{const Ae=$d(ee,T);return{key:mh(ee),name:ee.alias??ee.email??`account ${ee.num}`,ready:!ee.disabled&&!(Ae!=null&&Ae.blocksSwitch),why:ee.disabled?"held out":Ae!=null&&Ae.blocksSwitch?Ae.text:null,warn:(Ae==null?void 0:Ae.tone)==="warn",headroom:ee.headroom}}),Nt=Number(ue),Yt=(ut==null?void 0:ut.headroom)!=null&&Number.isFinite(Nt)&&100-ut.headroom>=Nt,fe=(a==null?void 0:a.ok)===!0&&(a.enabled||a.external),st=ee=>at&&vt.some(Ae=>Ae.num===ee)?"ap-rest-list":"ap-scroll",It=async(ee,Ae)=>{if(Ie(`switch-${ee}`)){m(null),w(null);try{const Re=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ee})})).json().catch(()=>null);Re!=null&&Re.ok?w({num:ee,name:Ae}):m({text:Xx(Re,"the switch failed"),raw:Bc(Re),row:ee}),await ye(!0)}catch{m({text:"server unreachable",row:ee})}finally{Ze(),Je(ee)}}},Et=x.useCallback(()=>{q(null),Y(null),W(null),K(null),O(!1)},[]),En=(ee,Ae="first")=>{Et(),E(null),De(null),q({num:ee,view:"menu",start:Ae})},Gn=(ee,Ae)=>{Et(),E(Oe=>(Oe==null?void 0:Oe.anchor)===Ae?null:{num:ee,anchor:Ae})},St=x.useCallback((ee=!1)=>{var Oe;const Ae=C.current;ee&&Ae&&((Oe=document.getElementById(Ae.anchor))==null||Oe.focus()),E(null)},[]),lr=()=>{Et(),E(null),k("lan")},yn=x.useRef(j);x.useEffect(()=>{yn.current!==j&&(yn.current=j,window.requestAnimationFrame(()=>{var ee;(ee=document.getElementById(j==="lan"?"ap-lan-back":"ap-lan-entry"))==null||ee.focus()}))},[j]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const Xt=x.useCallback(ee=>{var Re,ze;const Ae=U.current;if(!Ae||ee!=null&&Ae.num!==ee)return;const Oe=document.getElementById(`ap-menu-${Ae.num}`);(Oe!=null&&Oe.contains(document.activeElement)||KN(((Re=document.activeElement)==null?void 0:Re.tagName)??null))&&((ze=document.getElementById(`ap-more-${Ae.num}`))==null||ze.focus()),Et()},[Et]);x.useEffect(()=>{t&&(Et(),E(null))},[t,Et]),x.useEffect(()=>{B&&(n!=null&&n.accounts)&&!n.accounts.some(ee=>ee.num===B.num)&&Et(),N&&(n!=null&&n.accounts)&&!n.accounts.some(ee=>ee.num===N.num)&&E(null)},[n,B,N,Et]);const Cn=async ee=>{var Oe;O(!1);const Ae=await Qe({action:"share",account:ee},`share-${ee}`);!(Ae!=null&&Ae.ok)||((Oe=U.current)==null?void 0:Oe.num)!==ee||(K({num:ee,blob:Ae.blob,expiresAt:Ae.expiresAt}),q({num:ee,view:"share"}))},zt=async(ee,Ae)=>{const{commit:Oe,alias:Re}=vz(V,Ae);if(Oe){const ze=await Qe({action:"alias",account:ee,alias:Re},`alias-${ee}`);if(await ye(!0),!(ze!=null&&ze.ok))return}Xt(ee)},In=async(ee,Ae)=>{var ze,dt;const Oe=await Qe({action:"move",account:ee,slot:Ae},`move-${ee}`),Re=uz({menuFor:((ze=U.current)==null?void 0:ze.num)??null,shareFor:(F==null?void 0:F.num)??null},ee,Oe);if(await ye(!0),Re){((dt=U.current)==null?void 0:dt.num)===ee&&Et(),W(Re.confirmRemove),Re.shareFor==null&&(K(null),O(!1)),ge(Re.swapNote);const yt=Re.swapNote;yt&&window.setTimeout(()=>ge(Ct=>Ct===yt?null:Ct),Nz),De(null),Je(Re.menuFor)}return Oe},Kn=async(ee,Ae,Oe)=>{if(!Oe.sends){Xt(ee);return}await In(ee,Ae)},cr=async(ee,Ae)=>{if(Ae.sends){const Oe=await Me({action:"setting",key:"autoswitch.threshold",value:ee},"threshold");if(await ye(!0),!(Oe!=null&&Oe.ok))return;je(null)}Ue(!0),window.setTimeout(()=>{var Oe;document.activeElement===xe.current&&((Oe=ke.current)==null||Oe.focus()),Ue(!1)},_z)},$n=o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),ea=ee=>{const{shown:Ae,fuller:Oe}=pz(ee.lanes),Re=$d(ee,T),ze=ee.active||Ge.includes(mh(ee)),dt=ee.alias??ee.email??`account ${ee.num}`,yt=ee.stale||(Re==null?void 0:Re.blocksSwitch)===!0,Ct=Oe?[...Ae,Oe]:Ae,gt=ee.fetchedAt?Gp(ee.fetchedAt,T):null;return o.jsxs("li",{className:`ap-account${ee.active?" active":""}`,"aria-current":ee.active?"true":void 0,"data-open":ze?"":void 0,"data-frozen":yt?"":void 0,children:[!ee.active&&o.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${ee.num}`,"aria-expanded":ze,"aria-controls":ze?`ap-detail-${ee.num}`:void 0,"aria-describedby":!ze&&!(Re!=null&&Re.blocksSwitch)?`ap-quota-${ee.num}`:void 0,onClick:()=>rt(xt=>gz(xt,ee)),children:o.jsxs("span",{className:"vis-hidden",children:[dt,", ",ze?"hide details":"details"]})}),o.jsxs("div",{className:"ap-account-head",children:[ee.active?o.jsx("span",{className:"ap-live",title:`Active account · slot ${ee.num}`,children:o.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",ee.num,":"]})}):o.jsx("span",{className:"ap-num",children:ee.num}),ee.alias&&o.jsx("span",{className:"ap-alias",title:ee.alias,children:ee.alias}),o.jsx("span",{className:"ap-email",title:ee.email??void 0,children:ee.email}),ee.disabled&&o.jsx("span",{className:"ap-held",children:"held out"}),!ee.active&&!ee.disabled&&!(Re!=null&&Re.blocksSwitch)&&o.jsx("button",{type:"button",className:"ap-switch",...We(`switch-${ee.num}`),onClick:()=>It(ee.num,dt),"aria-label":`Switch to ${dt}`,title:`Switch to ${ee.alias??ee.email}`,children:c===`switch-${ee.num}`?"…":"Switch"}),o.jsx("button",{type:"button",id:`ap-more-${ee.num}`,className:"ap-more","aria-label":`More actions for ${ee.email??ee.alias??`account ${ee.num}`}`,"aria-haspopup":"menu","aria-expanded":L===ee.num,"aria-controls":L===ee.num?`ap-menu-${ee.num}`:void 0,title:"More actions",onClick:()=>L===ee.num?Xt():En(ee.num),onKeyDown:xt=>{xt.key!=="ArrowDown"&&xt.key!=="ArrowUp"||(xt.preventDefault(),En(ee.num,xt.key==="ArrowUp"?"last":"first"))},children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[o.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===ee.num&&o.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),ee.active&&(y==null?void 0:y.num)===ee.num&&o.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(he==null?void 0:he.at)===ee.num&&(()=>{const xt=jt.find(Ss=>Ss.num===he.displaced),Ar=(xt==null?void 0:xt.alias)??(xt==null?void 0:xt.email)??"the account that was there";return o.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${he.at} was taken, so the two accounts traded places: ${Ar} now holds slot ${he.displaced}.`,children:["swapped with slot ",he.displaced]})})(),Re&&o.jsxs("div",{className:"ap-issue-line",children:[o.jsxs("button",{type:"button",id:`ap-issue-${ee.num}`,className:"ap-issue","data-tone":Re.tone,"aria-haspopup":"dialog","aria-expanded":(N==null?void 0:N.anchor)===`ap-issue-${ee.num}`,"aria-controls":(N==null?void 0:N.anchor)===`ap-issue-${ee.num}`?"ap-issue-pop":void 0,onClick:()=>Gn(ee.num,`ap-issue-${ee.num}`),children:[Re.tone==="warn"&&o.jsx(Kp,{}),o.jsx("span",{className:"ap-issue-text",children:Re.text})]}),!ze&&o.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:gt??"never collected"})]}),!ze&&!(Re!=null&&Re.blocksSwitch)&&o.jsxs("p",{className:"ap-quota",id:`ap-quota-${ee.num}`,children:[Ct.length?Ct.map(xt=>o.jsxs("span",{className:"ap-q",children:[o.jsx("span",{className:"ap-q-label",children:xt.label})," ",o.jsxs("span",{className:"ap-q-pct","data-level":yt?void 0:Az(xt.pct),children:[Math.round(xt.pct),"%"]})]},xt.id)):o.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),ee.stale&&!Re&&o.jsx("span",{className:"ap-q-age","data-never":gt?void 0:"",title:"When claude-swap last read this account's usage",children:gt??"never collected"})]}),ze&&o.jsxs("div",{className:"ap-detail",id:`ap-detail-${ee.num}`,children:[o.jsx("div",{className:"ap-lanes",children:ee.lanes.length?ee.lanes.map(xt=>o.jsx(Mz,{lane:xt,nowSec:T,frozen:yt},xt.id)):o.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),o.jsx("div",{className:"ap-meta",children:ee.fetchedAt?o.jsxs("span",{className:`ap-age${ee.stale&&!Re?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",Gp(ee.fetchedAt,T),Re!=null&&Re.blocksSwitch?"":jz(ee.nextAt,T)]}):o.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},ee.num)},ta=n!=null&&n.ok&&(a!=null&&a.ok)?o.jsxs("div",{className:"ap-policy-block",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),o.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:o.jsx("select",{ref:ke,"aria-label":"Switch threshold",value:kt,...We("threshold"),onChange:ee=>je(ee.target.value),children:Rz(ue).map(ee=>o.jsxs("option",{value:ee,children:[ee,"%"]},ee))})}),(pt.sends||ve)&&o.jsx("button",{ref:xe,type:"button",className:"ap-manage-btn",...We("threshold"),title:pt.title,onClick:()=>cr(kt,pt),children:ve&&!pt.sends?pt.done:pt.label}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...We("enable"),onClick:()=>Me({action:"enable",enabled:!a.enabled},"enable").then(()=>ye(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:o.jsx("span",{className:"switch-knob"})})]}),a.external&&o.jsxs("p",{className:"ap-auto-note",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",o.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}):null;return o.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[j==="accounts"&&o.jsxs("div",{className:"ap-header",children:[o.jsx("h2",{children:"Claude accounts"}),o.jsxs("div",{className:"ap-header-right",children:[o.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>J(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((wn=n==null?void 0:n.accounts)==null?void 0:wn.length)??0)>0&&o.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>H(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${nn} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:o.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:[o.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),o.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),o.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ye(!0),...We("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:o.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:[o.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),o.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),$n]})]}),j==="accounts"&&o.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?o.jsxs("div",{className:"ap-empty",role:"alert",children:[o.jsx("span",{title:h.raw||void 0,children:h.text}),o.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",k_/1e3," seconds."]}),o.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>ye(!0),children:f?"trying…":"try again"})]}):o.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?o.jsxs(o.Fragment,{children:[ut&&(Bt==null?void 0:Bt.tone)==="warn"&&o.jsxs("div",{className:"ap-notice",children:[o.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(N==null?void 0:N.anchor)==="ap-notice","aria-controls":(N==null?void 0:N.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>Gn(ut.num,"ap-notice"),children:[o.jsx(Kp,{}),o.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),Bt.fix&&o.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>J(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),o.jsx("ul",{className:"ap-list",children:an.map(ea)}),vt.length>0&&o.jsx(az,{peers:jn,strained:Yt,armed:fe,threshold:a!=null&&a.ok?ue:null,open:at,onToggle:()=>le(ee=>!ee)}),vt.length>0&&at&&o.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[o.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",children:vt.map(ea)}),ta]}),vt.length===0&&ta,h&&h.row==null&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),B&&(()=>{var Re;const ee=(Re=n.accounts)==null?void 0:Re.find(ze=>ze.num===B.num);if(!ee)return null;const Ae=`ap-pop-title-${ee.num}`,Oe=X&&o.jsx("p",{className:"ap-pop-error",role:"alert",title:X.raw||void 0,children:X.text});return o.jsxs(Kx,{anchorId:`ap-more-${ee.num}`,boundaryId:st(ee.num),id:`ap-menu-${ee.num}`,className:"ap-pop",role:B.view==="menu"?"menu":"dialog",labelledBy:B.view==="menu"?`ap-more-${ee.num}`:Ae,start:B.start,onClose:Et,children:[B.view==="menu"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{$(ee.alias??""),Y(null),q({num:ee.num,view:"rename"})},children:"Rename"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{De(null),Y(null),q({num:ee.num,view:"move"})},children:"Move to slot…"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...We(`share-${ee.num}`),title:`Copy this account to another ${nn}. 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:()=>Cn(ee.num),children:c===`share-${ee.num}`?"Sharing…":"Share"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",title:"See how much this account worked in each project",onClick:()=>{ae(ee.num),Xt(ee.num)},children:"Projects"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!ee.active||ee.disabled)&&o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...We(`rot-${ee.num}`),title:ee.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>Me({action:"account",account:ee.num,enabled:ee.disabled},`rot-${ee.num}`,"menu").then(ze=>{ye(!0),ze!=null&&ze.ok&&Xt(ee.num)}),children:ee.disabled?"Put back in rotation":"Hold out of rotation"}),o.jsx("div",{role:"separator",className:"ap-menu-sep"}),o.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${z===ee.num?" armed":""}`,...We(`rm-${ee.num}`),"aria-label":z===ee.num?"Confirm remove":void 0,title:z===ee.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{const ze=Date.now(),dt=uh({armedFor:z,target:ee.num,armedAt:G.current,now:ze,gapMs:fh});if(dt==="arm"){W(ee.num),G.current=ze,window.setTimeout(()=>W(yt=>yt===ee.num?null:yt),4e3);return}dt!=="ignore"&&(W(null),Qe({action:"remove",account:ee.num},`rm-${ee.num}`).then(yt=>{var Ct;ye(!0),yt!=null&&yt.ok&&(((Ct=U.current)==null?void 0:Ct.num)===ee.num&&Et(),Je(null))}))},children:c===`rm-${ee.num}`?"Removing…":z===ee.num?"Confirm":"Remove"}),Oe]}),B.view==="rename"&&o.jsxs("form",{className:"ap-pop-form",onSubmit:ze=>{ze.preventDefault(),zt(ee.num,ee.alias)},children:[o.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${ee.num}`,children:"Rename account"}),o.jsx("input",{id:`ap-alias-${ee.num}`,className:"ap-manage-input",type:"text",value:V,onChange:ze=>$(ze.target.value),maxLength:wz,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:ze=>ze.currentTarget.select()}),Oe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Xt(),children:"Cancel"}),o.jsx("button",{type:"submit",className:"btn primary",...We(`alias-${ee.num}`),title:"A short name to show instead of the email",children:c===`alias-${ee.num}`?"…":"Save"})]})]}),B.view==="move"&&(()=>{const ze=cz((n.accounts??[]).map(Ct=>Ct.num),ee.num),dt=dz(ze,Te,ee.num),yt=hz(ze,dt,ee.num);return o.jsxs("div",{className:"ap-pop-form",children:[o.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${ee.num}`,children:"Move to slot"}),o.jsx("span",{className:"ap-field",children:o.jsx("select",{id:`ap-slot-${ee.num}`,value:String(dt),...We(`move-${ee.num}`),onChange:Ct=>De(Number(Ct.target.value)),autoFocus:!0,children:ze.map(Ct=>o.jsx("option",{value:Ct.slot,children:Ct.label},Ct.slot))})}),Oe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Xt(),children:"Cancel"}),o.jsx("button",{type:"button",className:"btn primary",...We(`move-${ee.num}`),title:yt.title,onClick:()=>Kn(ee.num,dt,yt),children:c===`move-${ee.num}`?"…":bc(yt.label)})]})]})})(),B.view==="share"&&(F==null?void 0:F.num)===ee.num&&(()=>{const ze=GR(F.expiresAt,T),dt=ze.tone==="gone";return o.jsxs("div",{className:`ap-pop-form ap-share${dt?" expired":""}`,children:[o.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),o.jsx("code",{className:"ap-share-blob",children:F.blob}),o.jsxs("p",{className:"ap-pop-note",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[o.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",o.jsx("span",{className:`ap-share-expiry ${ze.tone}`,children:ze.text})]}),Oe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Xt(),children:"Done"}),o.jsx("button",{type:"button",className:"btn primary",...We(`share-${ee.num}`),autoFocus:!0,onClick:async()=>{if(dt){await Cn(ee.num);return}await sl(F.blob)&&(O(!0),window.setTimeout(()=>O(!1),1800))},children:dt?"Make a new share":Q?"Copied":"Copy"})]})]})})()]})})(),N&&(()=>{var Oe;const ee=(Oe=n.accounts)==null?void 0:Oe.find(Re=>Re.num===N.num),Ae=ee?$d(ee,T):null;return!ee||!Ae?null:o.jsx(Kx,{anchorId:N.anchor,boundaryId:N.anchor==="ap-notice"?"ap-scroll":st(ee.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>St(),children:o.jsxs("div",{className:"ap-pop-form",children:[o.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ae.tone,children:[Ae.tone==="warn"&&o.jsx(Kp,{}),Ae.text]}),o.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),o.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[o.jsx("span",{className:"ap-issue-who",children:ee.alias??ee.email??`account ${ee.num}`})," · ",ee.fetchedAt?`last collected ${Gp(ee.fetchedAt,T)}`:"never collected"]}),o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>St(!0),children:"Done"}),Ae.fix&&o.jsx("button",{type:"button",className:"btn primary",onClick:()=>{St(!0),J(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ae.fix})]})]})})})()]}):o.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"claude-swap isn't installed."}),o.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&o.jsx("code",{className:"ap-cmd",children:n.hint}),o.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",o.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"No accounts added yet."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",o.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn't read the account store."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),S&&o.jsx(rz,{accounts:((n==null?void 0:n.accounts)??[]).map(ee=>({key:`${String(ee.email??"").trim().toLowerCase()}@@${ee.orgUuid??""}`,email:ee.email??"",alive:ee.alive===!0})),onChanged:()=>ye(!0),view:j==="lan",onOpen:lr,onBack:()=>k("accounts"),closeButton:$n}),M&&o.jsx(eB,{onClose:()=>J(!1),onChanged:()=>ye(!0)}),de&&o.jsx(lz,{accounts:((n==null?void 0:n.accounts)??[]).map(ee=>({num:ee.num,email:ee.email,alias:ee.alias,org:ee.org})),onClose:()=>H(!1),copyText:sl}),te!=null&&(()=>{const ee=((n==null?void 0:n.accounts)??[]).find(Ae=>Ae.num===te);return ee?o.jsx(v8,{num:ee.num,name:ee.alias??ee.email??`account ${ee.num}`,onClose:()=>ae(null)}):(ae(null),null)})()]})}const $z=3e4;function Oz({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Lz({bundle:e,running:t,pending:n,lastTried:r}){return t?Oz({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Pz(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Dz({asked:e,reported:t}){return t?t!==e:!1}function nM(e){const t=e.thresholdMs??$z;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 Fz(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 qz(e,t){return e?t==null?"auto when idle":`auto in ${Fz(t)}`:"auto-restart off"}function N_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Bz(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 zz(e){const t=nM(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}function X0(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 Yp,__;function Hz(){if(__)return Yp;__=1;function e(){this.__data__=[],this.size=0}return Yp=e,Yp}var Xp,S_;function hl(){if(S_)return Xp;S_=1;function e(t,n){return t===n||t!==t&&n!==n}return Xp=e,Xp}var Zp,j_;function Dh(){if(j_)return Zp;j_=1;var e=hl();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Zp=t,Zp}var Qp,E_;function Uz(){if(E_)return Qp;E_=1;var e=Dh(),t=Array.prototype,n=t.splice;function r(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 Qp=r,Qp}var Jp,C_;function Wz(){if(C_)return Jp;C_=1;var e=Dh();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return Jp=t,Jp}var em,T_;function Vz(){if(T_)return em;T_=1;var e=Dh();function t(n){return e(this.__data__,n)>-1}return em=t,em}var tm,A_;function Gz(){if(A_)return tm;A_=1;var e=Dh();function t(n,r){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,r])):a[l][1]=r,this}return tm=t,tm}var nm,R_;function Fh(){if(R_)return nm;R_=1;var e=Hz(),t=Uz(),n=Wz(),r=Vz(),a=Gz();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=r,l.prototype.set=a,nm=l,nm}var rm,M_;function Kz(){if(M_)return rm;M_=1;var e=Fh();function t(){this.__data__=new e,this.size=0}return rm=t,rm}var sm,I_;function Yz(){if(I_)return sm;I_=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return sm=e,sm}var am,$_;function Xz(){if($_)return am;$_=1;function e(t){return this.__data__.get(t)}return am=e,am}var om,O_;function Zz(){if(O_)return om;O_=1;function e(t){return this.__data__.has(t)}return om=e,om}var im,L_;function rM(){if(L_)return im;L_=1;var e=typeof gd=="object"&&gd&&gd.Object===Object&&gd;return im=e,im}var lm,P_;function ts(){if(P_)return lm;P_=1;var e=rM(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return lm=n,lm}var cm,D_;function fl(){if(D_)return cm;D_=1;var e=ts(),t=e.Symbol;return cm=t,cm}var um,F_;function Qz(){if(F_)return um;F_=1;var e=fl(),t=Object.prototype,n=t.hasOwnProperty,r=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=r.call(c);return p&&(u?c[a]=f:delete c[a]),h}return um=l,um}var dm,q_;function Jz(){if(q_)return dm;q_=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return dm=n,dm}var hm,B_;function Bo(){if(B_)return hm;B_=1;var e=fl(),t=Qz(),n=Jz(),r="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:r:l&&l in Object(u)?t(u):n(u)}return hm=c,hm}var fm,z_;function Cr(){if(z_)return fm;z_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return fm=e,fm}var pm,H_;function Jc(){if(H_)return pm;H_=1;var e=Bo(),t=Cr(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==r||f==a||f==n||f==l}return pm=c,pm}var mm,U_;function eH(){if(U_)return mm;U_=1;var e=ts(),t=e["__core-js_shared__"];return mm=t,mm}var gm,W_;function tH(){if(W_)return gm;W_=1;var e=eH(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return gm=n,gm}var ym,V_;function sM(){if(V_)return ym;V_=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return ym=n,ym}var wm,G_;function nH(){if(G_)return wm;G_=1;var e=Jc(),t=tH(),n=Cr(),r=sM(),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 m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:l;return w.test(r(y))}return wm=m,wm}var vm,K_;function rH(){if(K_)return vm;K_=1;function e(t,n){return t==null?void 0:t[n]}return vm=e,vm}var xm,Y_;function zo(){if(Y_)return xm;Y_=1;var e=nH(),t=rH();function n(r,a){var l=t(r,a);return e(l)?l:void 0}return xm=n,xm}var bm,X_;function Z0(){if(X_)return bm;X_=1;var e=zo(),t=ts(),n=e(t,"Map");return bm=n,bm}var km,Z_;function qh(){if(Z_)return km;Z_=1;var e=zo(),t=e(Object,"create");return km=t,km}var Nm,Q_;function sH(){if(Q_)return Nm;Q_=1;var e=qh();function t(){this.__data__=e?e(null):{},this.size=0}return Nm=t,Nm}var _m,J_;function aH(){if(J_)return _m;J_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return _m=e,_m}var Sm,eS;function oH(){if(eS)return Sm;eS=1;var e=qh(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var u=c[l];return u===t?void 0:u}return r.call(c,l)?c[l]:void 0}return Sm=a,Sm}var jm,tS;function iH(){if(tS)return jm;tS=1;var e=qh(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return jm=r,jm}var Em,nS;function lH(){if(nS)return Em;nS=1;var e=qh(),t="__lodash_hash_undefined__";function n(r,a){var l=this.__data__;return this.size+=this.has(r)?0:1,l[r]=e&&a===void 0?t:a,this}return Em=n,Em}var Cm,rS;function cH(){if(rS)return Cm;rS=1;var e=sH(),t=aH(),n=oH(),r=iH(),a=lH();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=r,l.prototype.set=a,Cm=l,Cm}var Tm,sS;function uH(){if(sS)return Tm;sS=1;var e=cH(),t=Fh(),n=Z0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Tm=r,Tm}var Am,aS;function dH(){if(aS)return Am;aS=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Am=e,Am}var Rm,oS;function Bh(){if(oS)return Rm;oS=1;var e=dH();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Rm=t,Rm}var Mm,iS;function hH(){if(iS)return Mm;iS=1;var e=Bh();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Mm=t,Mm}var Im,lS;function fH(){if(lS)return Im;lS=1;var e=Bh();function t(n){return e(this,n).get(n)}return Im=t,Im}var $m,cS;function pH(){if(cS)return $m;cS=1;var e=Bh();function t(n){return e(this,n).has(n)}return $m=t,$m}var Om,uS;function mH(){if(uS)return Om;uS=1;var e=Bh();function t(n,r){var a=e(this,n),l=a.size;return a.set(n,r),this.size+=a.size==l?0:1,this}return Om=t,Om}var Lm,dS;function Q0(){if(dS)return Lm;dS=1;var e=uH(),t=hH(),n=fH(),r=pH(),a=mH();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=r,l.prototype.set=a,Lm=l,Lm}var Pm,hS;function gH(){if(hS)return Pm;hS=1;var e=Fh(),t=Z0(),n=Q0(),r=200;function a(l,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<r-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 Pm=a,Pm}var Dm,fS;function zh(){if(fS)return Dm;fS=1;var e=Fh(),t=Kz(),n=Yz(),r=Xz(),a=Zz(),l=gH();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=r,c.prototype.has=a,c.prototype.set=l,Dm=c,Dm}var Fm,pS;function J0(){if(pS)return Fm;pS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Fm=e,Fm}var qm,mS;function aM(){if(mS)return qm;mS=1;var e=zo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return qm=t,qm}var Bm,gS;function Hh(){if(gS)return Bm;gS=1;var e=aM();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Bm=t,Bm}var zm,yS;function Uh(){if(yS)return zm;yS=1;var e=Hh(),t=hl(),n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u){var f=l[c];(!(r.call(l,c)&&t(f,u))||u===void 0&&!(c in l))&&e(l,c,u)}return zm=a,zm}var Hm,wS;function eu(){if(wS)return Hm;wS=1;var e=Uh(),t=Hh();function n(r,a,l,c){var u=!l;l||(l={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(l[h],r[h],h,l,r):void 0;m===void 0&&(m=r[h]),u?t(l,h,m):e(l,h,m)}return l}return Hm=n,Hm}var Um,vS;function yH(){if(vS)return Um;vS=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Um=e,Um}var Wm,xS;function Ns(){if(xS)return Wm;xS=1;function e(t){return t!=null&&typeof t=="object"}return Wm=e,Wm}var Vm,bS;function wH(){if(bS)return Vm;bS=1;var e=Bo(),t=Ns(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Vm=r,Vm}var Gm,kS;function tu(){if(kS)return Gm;kS=1;var e=wH(),t=Ns(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&r.call(c,"callee")&&!a.call(c,"callee")};return Gm=l,Gm}var Km,NS;function Kt(){if(NS)return Km;NS=1;var e=Array.isArray;return Km=e,Km}var kc={exports:{}},Ym,_S;function vH(){if(_S)return Ym;_S=1;function e(){return!1}return Ym=e,Ym}kc.exports;var SS;function pl(){return SS||(SS=1,(function(e,t){var n=ts(),r=vH(),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||r;e.exports=p})(kc,kc.exports)),kc.exports}var Xm,jS;function Wh(){if(jS)return Xm;jS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var l=typeof r;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return Xm=n,Xm}var Zm,ES;function eb(){if(ES)return Zm;ES=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Zm=t,Zm}var Qm,CS;function xH(){if(CS)return Qm;CS=1;var e=Bo(),t=eb(),n=Ns(),r="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",j="[object String]",k="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",N="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",A="[object Int32Array]",I="[object Uint8Array]",B="[object Uint8ClampedArray]",q="[object Uint16Array]",L="[object Uint32Array]",U={};U[N]=U[E]=U[C]=U[T]=U[A]=U[I]=U[B]=U[q]=U[L]=!0,U[r]=U[a]=U[S]=U[l]=U[b]=U[c]=U[u]=U[f]=U[p]=U[h]=U[m]=U[y]=U[w]=U[j]=U[k]=!1;function X(Y){return n(Y)&&t(Y.length)&&!!U[e(Y)]}return Qm=X,Qm}var Jm,TS;function Vh(){if(TS)return Jm;TS=1;function e(t){return function(n){return t(n)}}return Jm=e,Jm}var Nc={exports:{}};Nc.exports;var AS;function tb(){return AS||(AS=1,(function(e,t){var n=rM(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,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})(Nc,Nc.exports)),Nc.exports}var eg,RS;function nu(){if(RS)return eg;RS=1;var e=xH(),t=Vh(),n=tb(),r=n&&n.isTypedArray,a=r?t(r):e;return eg=a,eg}var tg,MS;function oM(){if(MS)return tg;MS=1;var e=yH(),t=tu(),n=Kt(),r=pl(),a=Wh(),l=nu(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&r(p),j=!m&&!y&&!w&&l(p),k=m||y||w||j,S=k?e(p.length,String):[],b=S.length;for(var N in p)(h||u.call(p,N))&&!(k&&(N=="length"||w&&(N=="offset"||N=="parent")||j&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||a(N,b)))&&S.push(N);return S}return tg=f,tg}var ng,IS;function Gh(){if(IS)return ng;IS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return ng=t,ng}var rg,$S;function iM(){if($S)return rg;$S=1;function e(t,n){return function(r){return t(n(r))}}return rg=e,rg}var sg,OS;function bH(){if(OS)return sg;OS=1;var e=iM(),t=e(Object.keys,Object);return sg=t,sg}var ag,LS;function nb(){if(LS)return ag;LS=1;var e=Gh(),t=bH(),n=Object.prototype,r=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var u in Object(l))r.call(l,u)&&u!="constructor"&&c.push(u);return c}return ag=a,ag}var og,PS;function Qs(){if(PS)return og;PS=1;var e=Jc(),t=eb();function n(r){return r!=null&&t(r.length)&&!e(r)}return og=n,og}var ig,DS;function qa(){if(DS)return ig;DS=1;var e=oM(),t=nb(),n=Qs();function r(a){return n(a)?e(a):t(a)}return ig=r,ig}var lg,FS;function kH(){if(FS)return lg;FS=1;var e=eu(),t=qa();function n(r,a){return r&&e(a,t(a),r)}return lg=n,lg}var cg,qS;function NH(){if(qS)return cg;qS=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return cg=e,cg}var ug,BS;function _H(){if(BS)return ug;BS=1;var e=Cr(),t=Gh(),n=NH(),r=Object.prototype,a=r.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 ug=l,ug}var dg,zS;function Ho(){if(zS)return dg;zS=1;var e=oM(),t=_H(),n=Qs();function r(a){return n(a)?e(a,!0):t(a)}return dg=r,dg}var hg,HS;function SH(){if(HS)return hg;HS=1;var e=eu(),t=Ho();function n(r,a){return r&&e(a,t(a),r)}return hg=n,hg}var _c={exports:{}};_c.exports;var US;function lM(){return US||(US=1,(function(e,t){var n=ts(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,c=l?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(_c,_c.exports)),_c.exports}var fg,WS;function cM(){if(WS)return fg;WS=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return fg=e,fg}var pg,VS;function uM(){if(VS)return pg;VS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=0,c=[];++r<a;){var u=t[r];n(u,r,t)&&(c[l++]=u)}return c}return pg=e,pg}var mg,GS;function dM(){if(GS)return mg;GS=1;function e(){return[]}return mg=e,mg}var gg,KS;function rb(){if(KS)return gg;KS=1;var e=uM(),t=dM(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return r.call(c,u)}))}:t;return gg=l,gg}var yg,YS;function jH(){if(YS)return yg;YS=1;var e=eu(),t=rb();function n(r,a){return e(r,t(r),a)}return yg=n,yg}var wg,XS;function sb(){if(XS)return wg;XS=1;function e(t,n){for(var r=-1,a=n.length,l=t.length;++r<a;)t[l+r]=n[r];return t}return wg=e,wg}var vg,ZS;function Kh(){if(ZS)return vg;ZS=1;var e=iM(),t=e(Object.getPrototypeOf,Object);return vg=t,vg}var xg,QS;function hM(){if(QS)return xg;QS=1;var e=sb(),t=Kh(),n=rb(),r=dM(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return xg=l,xg}var bg,JS;function EH(){if(JS)return bg;JS=1;var e=eu(),t=hM();function n(r,a){return e(r,t(r),a)}return bg=n,bg}var kg,ej;function fM(){if(ej)return kg;ej=1;var e=sb(),t=Kt();function n(r,a,l){var c=a(r);return t(r)?c:e(c,l(r))}return kg=n,kg}var Ng,tj;function pM(){if(tj)return Ng;tj=1;var e=fM(),t=rb(),n=qa();function r(a){return e(a,n,t)}return Ng=r,Ng}var _g,nj;function CH(){if(nj)return _g;nj=1;var e=fM(),t=hM(),n=Ho();function r(a){return e(a,n,t)}return _g=r,_g}var Sg,rj;function TH(){if(rj)return Sg;rj=1;var e=zo(),t=ts(),n=e(t,"DataView");return Sg=n,Sg}var jg,sj;function AH(){if(sj)return jg;sj=1;var e=zo(),t=ts(),n=e(t,"Promise");return jg=n,jg}var Eg,aj;function mM(){if(aj)return Eg;aj=1;var e=zo(),t=ts(),n=e(t,"Set");return Eg=n,Eg}var Cg,oj;function RH(){if(oj)return Cg;oj=1;var e=zo(),t=ts(),n=e(t,"WeakMap");return Cg=n,Cg}var Tg,ij;function ml(){if(ij)return Tg;ij=1;var e=TH(),t=Z0(),n=AH(),r=mM(),a=RH(),l=Bo(),c=sM(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),j=c(t),k=c(n),S=c(r),b=c(a),N=l;return(e&&N(new e(new ArrayBuffer(1)))!=y||t&&N(new t)!=u||n&&N(n.resolve())!=p||r&&N(new r)!=h||a&&N(new a)!=m)&&(N=function(E){var C=l(E),T=C==f?E.constructor:void 0,A=T?c(T):"";if(A)switch(A){case w:return y;case j:return u;case k:return p;case S:return h;case b:return m}return C}),Tg=N,Tg}var Ag,lj;function MH(){if(lj)return Ag;lj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,l=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(l.index=r.index,l.input=r.input),l}return Ag=n,Ag}var Rg,cj;function gM(){if(cj)return Rg;cj=1;var e=ts(),t=e.Uint8Array;return Rg=t,Rg}var Mg,uj;function ab(){if(uj)return Mg;uj=1;var e=gM();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Mg=t,Mg}var Ig,dj;function IH(){if(dj)return Ig;dj=1;var e=ab();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Ig=t,Ig}var $g,hj;function $H(){if(hj)return $g;hj=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return $g=t,$g}var Og,fj;function OH(){if(fj)return Og;fj=1;var e=fl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Og=r,Og}var Lg,pj;function yM(){if(pj)return Lg;pj=1;var e=ab();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Lg=t,Lg}var Pg,mj;function LH(){if(mj)return Pg;mj=1;var e=ab(),t=IH(),n=$H(),r=OH(),a=yM(),l="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",j="[object DataView]",k="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",N="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",A="[object Uint16Array]",I="[object Uint32Array]";function B(q,L,U){var X=q.constructor;switch(L){case w:return e(q);case l:case c:return new X(+q);case j:return t(q,U);case k:case S:case b:case N:case E:case C:case T:case A:case I:return a(q,U);case u:return new X;case f:case m:return new X(q);case p:return n(q);case h:return new X;case y:return r(q)}}return Pg=B,Pg}var Dg,gj;function wM(){if(gj)return Dg;gj=1;var e=Cr(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var l=new r;return r.prototype=void 0,l}})();return Dg=n,Dg}var Fg,yj;function vM(){if(yj)return Fg;yj=1;var e=wM(),t=Kh(),n=Gh();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Fg=r,Fg}var qg,wj;function PH(){if(wj)return qg;wj=1;var e=ml(),t=Ns(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return qg=r,qg}var Bg,vj;function DH(){if(vj)return Bg;vj=1;var e=PH(),t=Vh(),n=tb(),r=n&&n.isMap,a=r?t(r):e;return Bg=a,Bg}var zg,xj;function FH(){if(xj)return zg;xj=1;var e=ml(),t=Ns(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return zg=r,zg}var Hg,bj;function qH(){if(bj)return Hg;bj=1;var e=FH(),t=Vh(),n=tb(),r=n&&n.isSet,a=r?t(r):e;return Hg=a,Hg}var Ug,kj;function xM(){if(kj)return Ug;kj=1;var e=zh(),t=J0(),n=Uh(),r=kH(),a=SH(),l=lM(),c=cM(),u=jH(),f=EH(),p=pM(),h=CH(),m=ml(),y=MH(),w=LH(),j=vM(),k=Kt(),S=pl(),b=DH(),N=Cr(),E=qH(),C=qa(),T=Ho(),A=1,I=2,B=4,q="[object Arguments]",L="[object Array]",U="[object Boolean]",X="[object Date]",Y="[object Error]",M="[object Function]",J="[object GeneratorFunction]",V="[object Map]",$="[object Number]",z="[object Object]",W="[object RegExp]",G="[object Set]",F="[object String]",K="[object Symbol]",de="[object WeakMap]",H="[object ArrayBuffer]",Q="[object DataView]",O="[object Float32Array]",te="[object Float64Array]",ae="[object Int8Array]",he="[object Int16Array]",ge="[object Int32Array]",Te="[object Uint8Array]",De="[object Uint8ClampedArray]",Ve="[object Uint16Array]",je="[object Uint32Array]",ve={};ve[q]=ve[L]=ve[H]=ve[Q]=ve[U]=ve[X]=ve[O]=ve[te]=ve[ae]=ve[he]=ve[ge]=ve[V]=ve[$]=ve[z]=ve[W]=ve[G]=ve[F]=ve[K]=ve[Te]=ve[De]=ve[Ve]=ve[je]=!0,ve[Y]=ve[M]=ve[de]=!1;function Ue(ke,xe,Ge,rt,at,le){var _e,Ie=xe&A,Ze=xe&I,We=xe&B;if(Ge&&(_e=at?Ge(ke,rt,at,le):Ge(ke)),_e!==void 0)return _e;if(!N(ke))return ke;var Je=k(ke);if(Je){if(_e=y(ke),!Ie)return c(ke,_e)}else{var ye=m(ke),Me=ye==M||ye==J;if(S(ke))return l(ke,Ie);if(ye==z||ye==q||Me&&!at){if(_e=Ze||Me?{}:j(ke),!Ie)return Ze?f(ke,a(_e,ke)):u(ke,r(_e,ke))}else{if(!ve[ye])return at?ke:{};_e=w(ke,ye,Ie)}}le||(le=new e);var Qe=le.get(ke);if(Qe)return Qe;le.set(ke,_e),E(ke)?ke.forEach(function(pt){_e.add(Ue(pt,xe,Ge,pt,ke,le))}):b(ke)&&ke.forEach(function(pt,ut){_e.set(ut,Ue(pt,xe,Ge,ut,ke,le))});var ue=We?Ze?h:p:Ze?T:C,kt=Je?void 0:ue(ke);return t(kt||ke,function(pt,ut){kt&&(ut=pt,pt=ke[ut]),n(_e,ut,Ue(pt,xe,Ge,ut,ke,le))}),_e}return Ug=Ue,Ug}var Wg,Nj;function BH(){if(Nj)return Wg;Nj=1;var e=xM(),t=4;function n(r){return e(r,t)}return Wg=n,Wg}var Vg,_j;function ob(){if(_j)return Vg;_j=1;function e(t){return function(){return t}}return Vg=e,Vg}var Gg,Sj;function zH(){if(Sj)return Gg;Sj=1;function e(t){return function(n,r,a){for(var l=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++l];if(r(c[p],p,c)===!1)break}return n}}return Gg=e,Gg}var Kg,jj;function ib(){if(jj)return Kg;jj=1;var e=zH(),t=e();return Kg=t,Kg}var Yg,Ej;function lb(){if(Ej)return Yg;Ej=1;var e=ib(),t=qa();function n(r,a){return r&&e(r,a,t)}return Yg=n,Yg}var Xg,Cj;function HH(){if(Cj)return Xg;Cj=1;var e=Qs();function t(n,r){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,u=r?c:-1,f=Object(a);(r?u--:++u<c)&&l(f[u],u,f)!==!1;);return a}}return Xg=t,Xg}var Zg,Tj;function Yh(){if(Tj)return Zg;Tj=1;var e=lb(),t=HH(),n=t(e);return Zg=n,Zg}var Qg,Aj;function Uo(){if(Aj)return Qg;Aj=1;function e(t){return t}return Qg=e,Qg}var Jg,Rj;function bM(){if(Rj)return Jg;Rj=1;var e=Uo();function t(n){return typeof n=="function"?n:e}return Jg=t,Jg}var ey,Mj;function kM(){if(Mj)return ey;Mj=1;var e=J0(),t=Yh(),n=bM(),r=Kt();function a(l,c){var u=r(l)?e:t;return u(l,n(c))}return ey=a,ey}var ty,Ij;function NM(){return Ij||(Ij=1,ty=kM()),ty}var ny,$j;function UH(){if($j)return ny;$j=1;var e=Yh();function t(n,r){var a=[];return e(n,function(l,c,u){r(l,c,u)&&a.push(l)}),a}return ny=t,ny}var ry,Oj;function WH(){if(Oj)return ry;Oj=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return ry=t,ry}var sy,Lj;function VH(){if(Lj)return sy;Lj=1;function e(t){return this.__data__.has(t)}return sy=e,sy}var ay,Pj;function _M(){if(Pj)return ay;Pj=1;var e=Q0(),t=WH(),n=VH();function r(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,ay=r,ay}var oy,Dj;function GH(){if(Dj)return oy;Dj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return oy=e,oy}var iy,Fj;function SM(){if(Fj)return iy;Fj=1;function e(t,n){return t.has(n)}return iy=e,iy}var ly,qj;function jM(){if(qj)return ly;qj=1;var e=_M(),t=GH(),n=SM(),r=1,a=2;function l(c,u,f,p,h,m){var y=f&r,w=c.length,j=u.length;if(w!=j&&!(y&&j>w))return!1;var k=m.get(c),S=m.get(u);if(k&&S)return k==u&&S==c;var b=-1,N=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++b<w;){var C=c[b],T=u[b];if(p)var A=y?p(T,C,b,u,c,m):p(C,T,b,c,u,m);if(A!==void 0){if(A)continue;N=!1;break}if(E){if(!t(u,function(I,B){if(!n(E,B)&&(C===I||h(C,I,f,p,m)))return E.push(B)})){N=!1;break}}else if(!(C===T||h(C,T,f,p,m))){N=!1;break}}return m.delete(c),m.delete(u),N}return ly=l,ly}var cy,Bj;function KH(){if(Bj)return cy;Bj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,l){r[++n]=[l,a]}),r}return cy=e,cy}var uy,zj;function cb(){if(zj)return uy;zj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return uy=e,uy}var dy,Hj;function YH(){if(Hj)return dy;Hj=1;var e=fl(),t=gM(),n=hl(),r=jM(),a=KH(),l=cb(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",j="[object Set]",k="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",N="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(A,I,B,q,L,U,X){switch(B){case N:if(A.byteLength!=I.byteLength||A.byteOffset!=I.byteOffset)return!1;A=A.buffer,I=I.buffer;case b:return!(A.byteLength!=I.byteLength||!U(new t(A),new t(I)));case f:case p:case y:return n(+A,+I);case h:return A.name==I.name&&A.message==I.message;case w:case k:return A==I+"";case m:var Y=a;case j:var M=q&c;if(Y||(Y=l),A.size!=I.size&&!M)return!1;var J=X.get(A);if(J)return J==I;q|=u,X.set(A,I);var V=r(Y(A),Y(I),q,L,U,X);return X.delete(A),V;case S:if(C)return C.call(A)==C.call(I)}return!1}return dy=T,dy}var hy,Uj;function XH(){if(Uj)return hy;Uj=1;var e=pM(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u,f,p,h){var m=u&t,y=e(l),w=y.length,j=e(c),k=j.length;if(w!=k&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in c:r.call(c,b)))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 T=m;++S<w;){b=y[S];var A=l[b],I=c[b];if(f)var B=m?f(I,A,b,c,l,h):f(A,I,b,l,c,h);if(!(B===void 0?A===I||p(A,I,u,f,h):B)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var q=l.constructor,L=c.constructor;q!=L&&"constructor"in l&&"constructor"in c&&!(typeof q=="function"&&q instanceof q&&typeof L=="function"&&L instanceof L)&&(C=!1)}return h.delete(l),h.delete(c),C}return hy=a,hy}var fy,Wj;function ZH(){if(Wj)return fy;Wj=1;var e=zh(),t=jM(),n=YH(),r=XH(),a=ml(),l=Kt(),c=pl(),u=nu(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function j(k,S,b,N,E,C){var T=l(k),A=l(S),I=T?h:a(k),B=A?h:a(S);I=I==p?m:I,B=B==p?m:B;var q=I==m,L=B==m,U=I==B;if(U&&c(k)){if(!c(S))return!1;T=!0,q=!1}if(U&&!q)return C||(C=new e),T||u(k)?t(k,S,b,N,E,C):n(k,S,I,b,N,E,C);if(!(b&f)){var X=q&&w.call(k,"__wrapped__"),Y=L&&w.call(S,"__wrapped__");if(X||Y){var M=X?k.value():k,J=Y?S.value():S;return C||(C=new e),E(M,J,b,N,C)}}return U?(C||(C=new e),r(k,S,b,N,E,C)):!1}return fy=j,fy}var py,Vj;function EM(){if(Vj)return py;Vj=1;var e=ZH(),t=Ns();function n(r,a,l,c,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,l,c,n,u)}return py=n,py}var my,Gj;function QH(){if(Gj)return my;Gj=1;var e=zh(),t=EM(),n=1,r=2;function a(l,c,u,f){var p=u.length,h=p,m=!f;if(l==null)return!h;for(l=Object(l);p--;){var y=u[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<h;){y=u[p];var w=y[0],j=l[w],k=y[1];if(m&&y[2]){if(j===void 0&&!(w in l))return!1}else{var S=new e;if(f)var b=f(j,k,w,l,c,S);if(!(b===void 0?t(k,j,n|r,f,S):b))return!1}}return!0}return my=a,my}var gy,Kj;function CM(){if(Kj)return gy;Kj=1;var e=Cr();function t(n){return n===n&&!e(n)}return gy=t,gy}var yy,Yj;function JH(){if(Yj)return yy;Yj=1;var e=CM(),t=qa();function n(r){for(var a=t(r),l=a.length;l--;){var c=a[l],u=r[c];a[l]=[c,u,e(u)]}return a}return yy=n,yy}var wy,Xj;function TM(){if(Xj)return wy;Xj=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return wy=e,wy}var vy,Zj;function eU(){if(Zj)return vy;Zj=1;var e=QH(),t=JH(),n=TM();function r(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 vy=r,vy}var xy,Qj;function gl(){if(Qj)return xy;Qj=1;var e=Bo(),t=Ns(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return xy=r,xy}var by,Jj;function ub(){if(Jj)return by;Jj=1;var e=Kt(),t=gl(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\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:r.test(l)||!n.test(l)||c!=null&&l in Object(c)}return by=a,by}var ky,eE;function tU(){if(eE)return ky;eE=1;var e=Q0(),t="Expected a function";function n(r,a){if(typeof r!="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=r.apply(this,c);return l.cache=f.set(u,p)||f,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,ky=n,ky}var Ny,tE;function nU(){if(tE)return Ny;tE=1;var e=tU(),t=500;function n(r){var a=e(r,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return Ny=n,Ny}var _y,nE;function rU(){if(nE)return _y;nE=1;var e=nU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=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 _y=r,_y}var Sy,rE;function Xh(){if(rE)return Sy;rE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=Array(a);++r<a;)l[r]=n(t[r],r,t);return l}return Sy=e,Sy}var jy,sE;function sU(){if(sE)return jy;sE=1;var e=fl(),t=Xh(),n=Kt(),r=gl(),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(r(u))return l?l.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return jy=c,jy}var Ey,aE;function AM(){if(aE)return Ey;aE=1;var e=sU();function t(n){return n==null?"":e(n)}return Ey=t,Ey}var Cy,oE;function Zh(){if(oE)return Cy;oE=1;var e=Kt(),t=ub(),n=rU(),r=AM();function a(l,c){return e(l)?l:t(l,c)?[l]:n(r(l))}return Cy=a,Cy}var Ty,iE;function ru(){if(iE)return Ty;iE=1;var e=gl();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Ty=t,Ty}var Ay,lE;function Qh(){if(lE)return Ay;lE=1;var e=Zh(),t=ru();function n(r,a){a=e(a,r);for(var l=0,c=a.length;r!=null&&l<c;)r=r[t(a[l++])];return l&&l==c?r:void 0}return Ay=n,Ay}var Ry,cE;function aU(){if(cE)return Ry;cE=1;var e=Qh();function t(n,r,a){var l=n==null?void 0:e(n,r);return l===void 0?a:l}return Ry=t,Ry}var My,uE;function oU(){if(uE)return My;uE=1;function e(t,n){return t!=null&&n in Object(t)}return My=e,My}var Iy,dE;function RM(){if(dE)return Iy;dE=1;var e=Zh(),t=tu(),n=Kt(),r=Wh(),a=eb(),l=ru();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=l(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&r(w,m)&&(n(u)||t(u)))}return Iy=c,Iy}var $y,hE;function MM(){if(hE)return $y;hE=1;var e=oU(),t=RM();function n(r,a){return r!=null&&t(r,a,e)}return $y=n,$y}var Oy,fE;function iU(){if(fE)return Oy;fE=1;var e=EM(),t=aU(),n=MM(),r=ub(),a=CM(),l=TM(),c=ru(),u=1,f=2;function p(h,m){return r(h)&&a(m)?l(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return Oy=p,Oy}var Ly,pE;function IM(){if(pE)return Ly;pE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Ly=e,Ly}var Py,mE;function lU(){if(mE)return Py;mE=1;var e=Qh();function t(n){return function(r){return e(r,n)}}return Py=t,Py}var Dy,gE;function cU(){if(gE)return Dy;gE=1;var e=IM(),t=lU(),n=ub(),r=ru();function a(l){return n(l)?e(r(l)):t(l)}return Dy=a,Dy}var Fy,yE;function Js(){if(yE)return Fy;yE=1;var e=eU(),t=iU(),n=Uo(),r=Kt(),a=cU();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?r(c)?t(c[0],c[1]):e(c):a(c)}return Fy=l,Fy}var qy,wE;function $M(){if(wE)return qy;wE=1;var e=uM(),t=UH(),n=Js(),r=Kt();function a(l,c){var u=r(l)?e:t;return u(l,n(c,3))}return qy=a,qy}var By,vE;function uU(){if(vE)return By;vE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return By=n,By}var zy,xE;function OM(){if(xE)return zy;xE=1;var e=uU(),t=RM();function n(r,a){return r!=null&&t(r,a,e)}return zy=n,zy}var Hy,bE;function dU(){if(bE)return Hy;bE=1;var e=nb(),t=ml(),n=tu(),r=Kt(),a=Qs(),l=pl(),c=Gh(),u=nu(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||u(w)||n(w)))return!w.length;var j=t(w);if(j==f||j==p)return!w.size;if(c(w))return!e(w).length;for(var k in w)if(m.call(w,k))return!1;return!0}return Hy=y,Hy}var Uy,kE;function LM(){if(kE)return Uy;kE=1;function e(t){return t===void 0}return Uy=e,Uy}var Wy,NE;function PM(){if(NE)return Wy;NE=1;var e=Yh(),t=Qs();function n(r,a){var l=-1,c=t(r)?Array(r.length):[];return e(r,function(u,f,p){c[++l]=a(u,f,p)}),c}return Wy=n,Wy}var Vy,_E;function DM(){if(_E)return Vy;_E=1;var e=Xh(),t=Js(),n=PM(),r=Kt();function a(l,c){var u=r(l)?e:n;return u(l,t(c,3))}return Vy=a,Vy}var Gy,SE;function hU(){if(SE)return Gy;SE=1;function e(t,n,r,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(r=t[++l]);++l<c;)r=n(r,t[l],l,t);return r}return Gy=e,Gy}var Ky,jE;function fU(){if(jE)return Ky;jE=1;function e(t,n,r,a,l){return l(t,function(c,u,f){r=a?(a=!1,c):n(r,c,u,f)}),r}return Ky=e,Ky}var Yy,EE;function FM(){if(EE)return Yy;EE=1;var e=hU(),t=Yh(),n=Js(),r=fU(),a=Kt();function l(c,u,f){var p=a(c)?e:r,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return Yy=l,Yy}var Xy,CE;function pU(){if(CE)return Xy;CE=1;var e=Bo(),t=Kt(),n=Ns(),r="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==r}return Xy=a,Xy}var Zy,TE;function mU(){if(TE)return Zy;TE=1;var e=IM(),t=e("length");return Zy=t,Zy}var Qy,AE;function gU(){if(AE)return Qy;AE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+l+"]");function f(p){return u.test(p)}return Qy=f,Qy}var Jy,RE;function yU(){if(RE)return Jy;RE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",j=p+"?",k="["+l+"]?",S="(?:"+w+"(?:"+[h,m,y].join("|")+")"+k+j+")*",b=k+j+S,N="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+N+b,"g");function C(T){for(var A=E.lastIndex=0;E.test(T);)++A;return A}return Jy=C,Jy}var ew,ME;function wU(){if(ME)return ew;ME=1;var e=mU(),t=gU(),n=yU();function r(a){return t(a)?n(a):e(a)}return ew=r,ew}var tw,IE;function vU(){if(IE)return tw;IE=1;var e=nb(),t=ml(),n=Qs(),r=pU(),a=wU(),l="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return r(f)?a(f):f.length;var p=t(f);return p==l||p==c?f.size:e(f).length}return tw=u,tw}var nw,$E;function xU(){if($E)return nw;$E=1;var e=J0(),t=wM(),n=lb(),r=Js(),a=Kh(),l=Kt(),c=pl(),u=Jc(),f=Cr(),p=nu();function h(m,y,w){var j=l(m),k=j||c(m)||p(m);if(y=r(y,4),w==null){var S=m&&m.constructor;k?w=j?new S:[]:f(m)?w=u(S)?t(a(m)):{}:w={}}return(k?e:n)(m,function(b,N,E){return y(w,b,N,E)}),w}return nw=h,nw}var rw,OE;function bU(){if(OE)return rw;OE=1;var e=fl(),t=tu(),n=Kt(),r=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(r&&l&&l[r])}return rw=a,rw}var sw,LE;function db(){if(LE)return sw;LE=1;var e=sb(),t=bU();function n(r,a,l,c,u){var f=-1,p=r.length;for(l||(l=t),u||(u=[]);++f<p;){var h=r[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 sw=n,sw}var aw,PE;function kU(){if(PE)return aw;PE=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return aw=e,aw}var ow,DE;function qM(){if(DE)return ow;DE=1;var e=kU(),t=Math.max;function n(r,a,l){return a=t(a===void 0?r.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(r,this,h)}}return ow=n,ow}var iw,FE;function NU(){if(FE)return iw;FE=1;var e=ob(),t=aM(),n=Uo(),r=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return iw=r,iw}var lw,qE;function _U(){if(qE)return lw;qE=1;var e=800,t=16,n=Date.now;function r(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 lw=r,lw}var cw,BE;function BM(){if(BE)return cw;BE=1;var e=NU(),t=_U(),n=t(e);return cw=n,cw}var uw,zE;function Jh(){if(zE)return uw;zE=1;var e=Uo(),t=qM(),n=BM();function r(a,l){return n(t(a,l,e),a+"")}return uw=r,uw}var dw,HE;function zM(){if(HE)return dw;HE=1;function e(t,n,r,a){for(var l=t.length,c=r+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return dw=e,dw}var hw,UE;function SU(){if(UE)return hw;UE=1;function e(t){return t!==t}return hw=e,hw}var fw,WE;function jU(){if(WE)return fw;WE=1;function e(t,n,r){for(var a=r-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return fw=e,fw}var pw,VE;function EU(){if(VE)return pw;VE=1;var e=zM(),t=SU(),n=jU();function r(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return pw=r,pw}var mw,GE;function CU(){if(GE)return mw;GE=1;var e=EU();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return mw=t,mw}var gw,KE;function TU(){if(KE)return gw;KE=1;function e(t,n,r){for(var a=-1,l=t==null?0:t.length;++a<l;)if(r(n,t[a]))return!0;return!1}return gw=e,gw}var yw,YE;function AU(){if(YE)return yw;YE=1;function e(){}return yw=e,yw}var ww,XE;function RU(){if(XE)return ww;XE=1;var e=mM(),t=AU(),n=cb(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(l){return new e(l)}:t;return ww=a,ww}var vw,ZE;function MU(){if(ZE)return vw;ZE=1;var e=_M(),t=CU(),n=TU(),r=SM(),a=RU(),l=cb(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,j=!0,k=[],S=k;if(h)j=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return l(b);j=!1,y=r,S=new e}else S=p?[]:k;e:for(;++m<w;){var N=f[m],E=p?p(N):N;if(N=h||N!==0?N:0,j&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),k.push(N)}else y(S,E,h)||(S!==k&&S.push(E),k.push(N))}return k}return vw=u,vw}var xw,QE;function HM(){if(QE)return xw;QE=1;var e=Qs(),t=Ns();function n(r){return t(r)&&e(r)}return xw=n,xw}var bw,JE;function IU(){if(JE)return bw;JE=1;var e=db(),t=Jh(),n=MU(),r=HM(),a=t(function(l){return n(e(l,1,r,!0))});return bw=a,bw}var kw,eC;function $U(){if(eC)return kw;eC=1;var e=Xh();function t(n,r){return e(r,function(a){return n[a]})}return kw=t,kw}var Nw,tC;function UM(){if(tC)return Nw;tC=1;var e=$U(),t=qa();function n(r){return r==null?[]:e(r,t(r))}return Nw=n,Nw}var _w,nC;function Tr(){if(nC)return _w;nC=1;var e;if(typeof X0=="function")try{e={clone:BH(),constant:ob(),each:NM(),filter:$M(),has:OM(),isArray:Kt(),isEmpty:dU(),isFunction:Jc(),isUndefined:LM(),keys:qa(),map:DM(),reduce:FM(),size:vU(),transform:xU(),union:IU(),values:UM()}}catch{}return e||(e=window._),_w=e,_w}var Sw,rC;function hb(){if(rC)return Sw;rC=1;var e=Tr();Sw=a;var t="\0",n="\0",r="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(j){y.length>1?w.setNode(j,m):w.setNode(j)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(k,S){h(S)&&m.setNode(S,k)}),e.each(this._edgeObjs,function(k){m.hasNode(k.v)&&m.hasNode(k.w)&&m.setEdge(k,y.edge(k))});var w={};function j(k){var S=y.parent(k);return S===void 0||m.hasNode(S)?(w[k]=S,S):S in w?w[S]:j(S)}return this._isCompound&&e.each(m.nodes(),function(k){m.setParent(k,j(k))}),m},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,m){var y=this,w=arguments;return e.reduce(h,function(j,k){return w.length>1?y.setEdge(j,k,m):y.setEdge(j,k),k}),this},a.prototype.setEdge=function(){var h,m,y,w,j=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,m=k.w,y=k.name,arguments.length===2&&(w=arguments[1],j=!0)):(h=k,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],j=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var S=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,S))return j&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=j?w:this._defaultEdgeLabelFn(h,m,y);var b=f(this._isDirected,h,m,y);return h=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,l(this._preds[m],h),l(this._sucs[h],m),this._in[m][S]=b,this._out[h][S]=b,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),j=this._edgeObjs[w];return j&&(h=j.v,m=j.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(j){return j.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(j){return j.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function l(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var j=""+m,k=""+y;if(!h&&j>k){var S=j;j=k,k=S}return j+r+k+r+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var j=""+m,k=""+y;if(!h&&j>k){var S=j;j=k,k=S}var b={v:j,w:k};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return Sw}var jw,sC;function OU(){return sC||(sC=1,jw="2.1.8"),jw}var Ew,aC;function LU(){return aC||(aC=1,Ew={Graph:hb(),version:OU()}),Ew}var Cw,oC;function PU(){if(oC)return Cw;oC=1;var e=Tr(),t=hb();Cw={write:n,read:l};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:r(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function r(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 Cw}var Tw,iC;function DU(){if(iC)return Tw;iC=1;var e=Tr();Tw=t;function t(n){var r={},a=[],l;function c(u){e.has(r,u)||(r[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 Tw}var Aw,lC;function WM(){if(lC)return Aw;lC=1;var e=Tr();Aw=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 r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){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:r}),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,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,l=a+1,c=n;a<r.length&&(c=r[a].priority<r[c].priority?a:c,l<r.length&&(c=r[l].priority<r[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,l;n!==0&&(l=n>>1,!(r[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,r){var a=this._arr,l=this._keyIndices,c=a[n],u=a[r];a[n]=u,a[r]=c,l[u.key]=n,l[c.key]=r},Aw}var Rw,cC;function VM(){if(cC)return Rw;cC=1;var e=Tr(),t=WM();Rw=r;var n=e.constant(1);function r(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,m,y,w=function(j){var k=j.v!==m?j.v:j.w,S=p[k],b=u(j),N=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+j+" Weight: "+b);N<S.distance&&(S.distance=N,S.predecessor=m,h.decrease(k,N))};for(l.nodes().forEach(function(j){var k=j===c?0:Number.POSITIVE_INFINITY;p[j]={distance:k},h.add(j,k)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Rw}var Mw,uC;function FU(){if(uC)return Mw;uC=1;var e=VM(),t=Tr();Mw=n;function n(r,a,l){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,a,l)},{})}return Mw}var Iw,dC;function GM(){if(dC)return Iw;dC=1;var e=Tr();Iw=t;function t(n){var r=0,a=[],l={},c=[];function u(f){var p=l[f]={onStack:!0,lowlink:r,index:r++};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=[],m;do m=a.pop(),l[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(l,f)||u(f)}),c}return Iw}var $w,hC;function qU(){if(hC)return $w;hC=1;var e=Tr(),t=GM();$w=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return $w}var Ow,fC;function BU(){if(fC)return Ow;fC=1;var e=Tr();Ow=n;var t=e.constant(1);function n(a,l,c){return r(a,l||t,c||function(u){return a.outEdges(u)})}function r(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 m=h.v===p?h.w:h.v,y=l(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var j=y[p],k=h[w],S=y[w],b=j.distance+k.distance;b<S.distance&&(S.distance=b,S.predecessor=k.predecessor)})})}),u}return Ow}var Lw,pC;function KM(){if(pC)return Lw;pC=1;var e=Tr();Lw=t,t.CycleException=n;function t(r){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(r.predecessors(f),u),delete l[f],c.push(f))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,Lw}var Pw,mC;function zU(){if(mC)return Pw;mC=1;var e=KM();Pw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Pw}var Dw,gC;function YM(){if(gC)return Dw;gC=1;var e=Tr();Dw=t;function t(r,a,l){e.isArray(a)||(a=[a]);var c=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],f={};return e.each(a,function(p){if(!r.hasNode(p))throw new Error("Graph does not have node: "+p);n(r,p,l==="post",f,c,u)}),u}function n(r,a,l,c,u,f){e.has(c,a)||(c[a]=!0,l||f.push(a),e.each(u(a),function(p){n(r,p,l,c,u,f)}),l&&f.push(a))}return Dw}var Fw,yC;function HU(){if(yC)return Fw;yC=1;var e=YM();Fw=t;function t(n,r){return e(n,r,"post")}return Fw}var qw,wC;function UU(){if(wC)return qw;wC=1;var e=YM();qw=t;function t(n,r){return e(n,r,"pre")}return qw}var Bw,vC;function WU(){if(vC)return Bw;vC=1;var e=Tr(),t=hb(),n=WM();Bw=r;function r(a,l){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,j=f.priority(w);if(j!==void 0){var k=l(y);k<j&&(u[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return Bw}var zw,xC;function VU(){return xC||(xC=1,zw={components:DU(),dijkstra:VM(),dijkstraAll:FU(),findCycles:qU(),floydWarshall:BU(),isAcyclic:zU(),postorder:HU(),preorder:UU(),prim:WU(),tarjan:GM(),topsort:KM()}),zw}var Hw,bC;function GU(){if(bC)return Hw;bC=1;var e=LU();return Hw={Graph:e.Graph,json:PU(),alg:VU(),version:e.version},Hw}var Uw,kC;function Jr(){if(kC)return Uw;kC=1;var e;if(typeof X0=="function")try{e=GU()}catch{}return e||(e=window.graphlib),Uw=e,Uw}var Ww,NC;function KU(){if(NC)return Ww;NC=1;var e=xM(),t=1,n=4;function r(a){return e(a,t|n)}return Ww=r,Ww}var Vw,_C;function ef(){if(_C)return Vw;_C=1;var e=hl(),t=Qs(),n=Wh(),r=Cr();function a(l,c,u){if(!r(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 Vw=a,Vw}var Gw,SC;function YU(){if(SC)return Gw;SC=1;var e=Jh(),t=hl(),n=ef(),r=Ho(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=r(y),j=-1,k=w.length;++j<k;){var S=w[j],b=u[S];(b===void 0||t(b,a[S])&&!l.call(u,S))&&(u[S]=y[S])}return u});return Gw=c,Gw}var Kw,jC;function XU(){if(jC)return Kw;jC=1;var e=Js(),t=Qs(),n=qa();function r(a){return function(l,c,u){var f=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(f[m],m,f)}}var h=a(l,c,u);return h>-1?f[p?l[h]:h]:void 0}}return Kw=r,Kw}var Yw,EC;function ZU(){if(EC)return Yw;EC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Yw=t,Yw}var Xw,CC;function QU(){if(CC)return Xw;CC=1;var e=ZU(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Xw=n,Xw}var Zw,TC;function JU(){if(TC)return Zw;TC=1;var e=QU(),t=Cr(),n=gl(),r=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 r;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?r:+p}return Zw=f,Zw}var Qw,AC;function XM(){if(AC)return Qw;AC=1;var e=JU(),t=1/0,n=17976931348623157e292;function r(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 Qw=r,Qw}var Jw,RC;function eW(){if(RC)return Jw;RC=1;var e=XM();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return Jw=t,Jw}var ev,MC;function tW(){if(MC)return ev;MC=1;var e=zM(),t=Js(),n=eW(),r=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=r(f+p,0)),e(l,t(c,3),p)}return ev=a,ev}var tv,IC;function nW(){if(IC)return tv;IC=1;var e=XU(),t=tW(),n=e(t);return tv=n,tv}var nv,$C;function ZM(){if($C)return nv;$C=1;var e=db();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return nv=t,nv}var rv,OC;function rW(){if(OC)return rv;OC=1;var e=ib(),t=bM(),n=Ho();function r(a,l){return a==null?a:e(a,t(l),n)}return rv=r,rv}var sv,LC;function sW(){if(LC)return sv;LC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return sv=e,sv}var av,PC;function aW(){if(PC)return av;PC=1;var e=Hh(),t=lb(),n=Js();function r(a,l){var c={};return l=n(l,3),t(a,function(u,f,p){e(c,f,l(u,f,p))}),c}return av=r,av}var ov,DC;function fb(){if(DC)return ov;DC=1;var e=gl();function t(n,r,a){for(var l=-1,c=n.length;++l<c;){var u=n[l],f=r(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return ov=t,ov}var iv,FC;function oW(){if(FC)return iv;FC=1;function e(t,n){return t>n}return iv=e,iv}var lv,qC;function iW(){if(qC)return lv;qC=1;var e=fb(),t=oW(),n=Uo();function r(a){return a&&a.length?e(a,n,t):void 0}return lv=r,lv}var cv,BC;function QM(){if(BC)return cv;BC=1;var e=Hh(),t=hl();function n(r,a,l){(l!==void 0&&!t(r[a],l)||l===void 0&&!(a in r))&&e(r,a,l)}return cv=n,cv}var uv,zC;function lW(){if(zC)return uv;zC=1;var e=Bo(),t=Kh(),n=Ns(),r="[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)!=r)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return uv=p,uv}var dv,HC;function JM(){if(HC)return dv;HC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return dv=e,dv}var hv,UC;function cW(){if(UC)return hv;UC=1;var e=eu(),t=Ho();function n(r){return e(r,t(r))}return hv=n,hv}var fv,WC;function uW(){if(WC)return fv;WC=1;var e=QM(),t=lM(),n=yM(),r=cM(),a=vM(),l=tu(),c=Kt(),u=HM(),f=pl(),p=Jc(),h=Cr(),m=lW(),y=nu(),w=JM(),j=cW();function k(S,b,N,E,C,T,A){var I=w(S,N),B=w(b,N),q=A.get(B);if(q){e(S,N,q);return}var L=T?T(I,B,N+"",S,b,A):void 0,U=L===void 0;if(U){var X=c(B),Y=!X&&f(B),M=!X&&!Y&&y(B);L=B,X||Y||M?c(I)?L=I:u(I)?L=r(I):Y?(U=!1,L=t(B,!0)):M?(U=!1,L=n(B,!0)):L=[]:m(B)||l(B)?(L=I,l(I)?L=j(I):(!h(I)||p(I))&&(L=a(B))):U=!1}U&&(A.set(B,L),C(L,B,E,T,A),A.delete(B)),e(S,N,L)}return fv=k,fv}var pv,VC;function dW(){if(VC)return pv;VC=1;var e=zh(),t=QM(),n=ib(),r=uW(),a=Cr(),l=Ho(),c=JM();function u(f,p,h,m,y){f!==p&&n(p,function(w,j){if(y||(y=new e),a(w))r(f,p,j,h,u,m,y);else{var k=m?m(c(f,j),w,j+"",f,p,y):void 0;k===void 0&&(k=w),t(f,j,k)}},l)}return pv=u,pv}var mv,GC;function hW(){if(GC)return mv;GC=1;var e=Jh(),t=ef();function n(r){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=r.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&&r(a,h,c,f)}return a})}return mv=n,mv}var gv,KC;function fW(){if(KC)return gv;KC=1;var e=dW(),t=hW(),n=t(function(r,a,l){e(r,a,l)});return gv=n,gv}var yv,YC;function eI(){if(YC)return yv;YC=1;function e(t,n){return t<n}return yv=e,yv}var wv,XC;function pW(){if(XC)return wv;XC=1;var e=fb(),t=eI(),n=Uo();function r(a){return a&&a.length?e(a,n,t):void 0}return wv=r,wv}var vv,ZC;function mW(){if(ZC)return vv;ZC=1;var e=fb(),t=Js(),n=eI();function r(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return vv=r,vv}var xv,QC;function gW(){if(QC)return xv;QC=1;var e=ts(),t=function(){return e.Date.now()};return xv=t,xv}var bv,JC;function yW(){if(JC)return bv;JC=1;var e=Uh(),t=Zh(),n=Wh(),r=Cr(),a=ru();function l(c,u,f,p){if(!r(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var j=a(u[h]),k=f;if(j==="__proto__"||j==="constructor"||j==="prototype")return c;if(h!=y){var S=w[j];k=p?p(S,j,w):void 0,k===void 0&&(k=r(S)?S:n(u[h+1])?[]:{})}e(w,j,k),w=w[j]}return c}return bv=l,bv}var kv,eT;function wW(){if(eT)return kv;eT=1;var e=Qh(),t=yW(),n=Zh();function r(a,l,c){for(var u=-1,f=l.length,p={};++u<f;){var h=l[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return kv=r,kv}var Nv,tT;function vW(){if(tT)return Nv;tT=1;var e=wW(),t=MM();function n(r,a){return e(r,a,function(l,c){return t(r,c)})}return Nv=n,Nv}var _v,nT;function xW(){if(nT)return _v;nT=1;var e=ZM(),t=qM(),n=BM();function r(a){return n(t(a,void 0,e),a+"")}return _v=r,_v}var Sv,rT;function bW(){if(rT)return Sv;rT=1;var e=vW(),t=xW(),n=t(function(r,a){return r==null?{}:e(r,a)});return Sv=n,Sv}var jv,sT;function kW(){if(sT)return jv;sT=1;var e=Math.ceil,t=Math.max;function n(r,a,l,c){for(var u=-1,f=t(e((a-r)/(l||1)),0),p=Array(f);f--;)p[c?f:++u]=r,r+=l;return p}return jv=n,jv}var Ev,aT;function NW(){if(aT)return Ev;aT=1;var e=kW(),t=ef(),n=XM();function r(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 Ev=r,Ev}var Cv,oT;function _W(){if(oT)return Cv;oT=1;var e=NW(),t=e();return Cv=t,Cv}var Tv,iT;function SW(){if(iT)return Tv;iT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Tv=e,Tv}var Av,lT;function jW(){if(lT)return Av;lT=1;var e=gl();function t(n,r){if(n!==r){var a=n!==void 0,l=n===null,c=n===n,u=e(n),f=r!==void 0,p=r===null,h=r===r,m=e(r);if(!p&&!m&&!u&&n>r||u&&f&&h&&!p&&!m||l&&f&&h||!a&&h||!c)return 1;if(!l&&!u&&!m&&n<r||m&&a&&c&&!l&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return Av=t,Av}var Rv,cT;function EW(){if(cT)return Rv;cT=1;var e=jW();function t(n,r,a){for(var l=-1,c=n.criteria,u=r.criteria,f=c.length,p=a.length;++l<f;){var h=e(c[l],u[l]);if(h){if(l>=p)return h;var m=a[l];return h*(m=="desc"?-1:1)}}return n.index-r.index}return Rv=t,Rv}var Mv,uT;function CW(){if(uT)return Mv;uT=1;var e=Xh(),t=Qh(),n=Js(),r=PM(),a=SW(),l=Vh(),c=EW(),u=Uo(),f=Kt();function p(h,m,y){m.length?m=e(m,function(k){return f(k)?function(S){return t(S,k.length===1?k[0]:k)}:k}):m=[u];var w=-1;m=e(m,l(n));var j=r(h,function(k,S,b){var N=e(m,function(E){return E(k)});return{criteria:N,index:++w,value:k}});return a(j,function(k,S){return c(k,S,y)})}return Mv=p,Mv}var Iv,dT;function TW(){if(dT)return Iv;dT=1;var e=db(),t=CW(),n=Jh(),r=ef(),a=n(function(l,c){if(l==null)return[];var u=c.length;return u>1&&r(l,c[0],c[1])?c=[]:u>2&&r(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return Iv=a,Iv}var $v,hT;function AW(){if(hT)return $v;hT=1;var e=AM(),t=0;function n(r){var a=++t;return e(r)+a}return $v=n,$v}var Ov,fT;function RW(){if(fT)return Ov;fT=1;function e(t,n,r){for(var a=-1,l=t.length,c=n.length,u={};++a<l;){var f=a<c?n[a]:void 0;r(u,t[a],f)}return u}return Ov=e,Ov}var Lv,pT;function MW(){if(pT)return Lv;pT=1;var e=Uh(),t=RW();function n(r,a){return t(r||[],a||[],e)}return Lv=n,Lv}var Pv,mT;function Mt(){if(mT)return Pv;mT=1;var e;if(typeof X0=="function")try{e={cloneDeep:KU(),constant:ob(),defaults:YU(),each:NM(),filter:$M(),find:nW(),flatten:ZM(),forEach:kM(),forIn:rW(),has:OM(),isUndefined:LM(),last:sW(),map:DM(),mapValues:aW(),max:iW(),merge:fW(),min:pW(),minBy:mW(),now:gW(),pick:bW(),range:_W(),reduce:FM(),sortBy:TW(),uniqueId:AW(),values:UM(),zipObject:MW()}}catch{}return e||(e=window._),Pv=e,Pv}var Dv,gT;function IW(){if(gT)return Dv;gT=1,Dv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,l=a._prev;l!==a;)r.push(JSON.stringify(l,n)),l=l._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return Dv}var Fv,yT;function $W(){if(yT)return Fv;yT=1;var e=Mt(),t=Jr().Graph,n=IW();Fv=a;var r=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||r),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,h,m){for(var y=[],w=h[h.length-1],j=h[0],k;p.nodeCount();){for(;k=j.dequeue();)c(p,h,m,k);for(;k=w.dequeue();)c(p,h,m,k);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(k=h[S].dequeue(),k){y=y.concat(c(p,h,m,k,!0));break}}}return y}function c(p,h,m,y,w){var j=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var S=p.edge(k),b=p.node(k.v);w&&j.push({v:k.v,w:k.w}),b.out-=S,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(k){var S=p.edge(k),b=k.w,N=p.node(b);N.in-=S,f(h,m,N)}),p.removeNode(y.v),j}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,N=h(S),E=b+N;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=N),y=Math.max(y,m.node(S.w).in+=N)});var j=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(m.nodes(),function(S){f(j,k,m.node(S))}),{graph:m,buckets:j,zeroIdx:k}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return Fv}var qv,wT;function OW(){if(wT)return qv;wT=1;var e=Mt(),t=$W();qv={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,u(l)):r(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 r(l){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(l.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.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 qv}var Bv,vT;function Wn(){if(vT)return Bv;vT=1;var e=Mt(),t=Jr().Graph;Bv={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:j,notime:k};function n(S,b,N,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return N.dummy=b,S.setNode(C,N),C}function r(S){var b=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(N){b.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){var E=b.edge(N.v,N.w)||{weight:0,minlen:1},C=S.edge(N);b.setEdge(N.v,N.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(S){var b=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(N){S.children(N).length||b.setNode(N,S.node(N))}),e.forEach(S.edges(),function(N){b.setEdge(N,S.edge(N))}),b}function l(S){var b=e.map(S.nodes(),function(N){var E={};return e.forEach(S.outEdges(N),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S){var b=e.map(S.nodes(),function(N){var E={};return e.forEach(S.inEdges(N),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S,b){var N=S.x,E=S.y,C=b.x-N,T=b.y-E,A=S.width/2,I=S.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var B,q;return Math.abs(T)*A>Math.abs(C)*I?(T<0&&(I=-I),B=I*C/T,q=I):(C<0&&(A=-A),B=A,q=A*T/C),{x:N+B,y:E+q}}function f(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(N){var E=S.node(N),C=E.rank;e.isUndefined(C)||(b[C][E.order]=N)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(N){return S.node(N).rank}));e.forEach(S.nodes(),function(N){var E=S.node(N);e.has(E,"rank")&&(E.rank-=b)})}function h(S){var b=e.min(e.map(S.nodes(),function(T){return S.node(T).rank})),N=[];e.forEach(S.nodes(),function(T){var A=S.node(T).rank-b;N[A]||(N[A]=[]),N[A].push(T)});var E=0,C=S.graph().nodeRankFactor;e.forEach(N,function(T,A){e.isUndefined(T)&&A%C!==0?--E:E&&e.forEach(T,function(I){S.node(I).rank+=E})})}function m(S,b,N,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=N,C.order=E),n(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var N=S.node(b).rank;if(!e.isUndefined(N))return N}))}function w(S,b){var N={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?N.lhs.push(E):N.rhs.push(E)}),N}function j(S,b){var N=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-N)+"ms")}}function k(S,b){return b()}return Bv}var zv,xT;function LW(){if(xT)return zv;xT=1;var e=Mt(),t=Wn();zv={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){r(l,c)})}function r(l,c){var u=c.v,f=l.node(u).rank,p=c.w,h=l.node(p).rank,m=c.name,y=l.edge(c),w=y.labelRank;if(h!==f+1){l.removeEdge(c);var j,k,S;for(S=0,++f;f<h;++S,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},j=t.addDummyNode(l,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),l.setEdge(u,j,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(j),u=j;l.setEdge(u,p,{weight:y.weight},m)}}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 zv}var Hv,bT;function gh(){if(bT)return Hv;bT=1;var e=Mt();Hv={longestPath:t,slack:n};function t(r){var a={};function l(c){var u=r.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(r.outEdges(c),function(p){return l(p.w)-r.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(r.sources(),l)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return Hv}var Uv,kT;function tI(){if(kT)return Uv;kT=1;var e=Mt(),t=Jr().Graph,n=gh().slack;Uv=r;function r(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=l(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function 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 Uv}var Wv,NT;function PW(){if(NT)return Wv;NT=1;var e=Mt(),t=tI(),n=gh().slack,r=gh().longestPath,a=Jr().alg.preorder,l=Jr().alg.postorder,c=Wn().simplify;Wv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=j,u.exchangeEdges=k;function u(E){E=c(E),r(E);var C=t(E);m(C),f(C,E);for(var T,A;T=w(C);)A=j(C,E,T),k(C,E,T,A)}function f(E,C){var T=l(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(A){p(E,C,A)})}function p(E,C,T){var A=E.node(T),I=A.parent;E.edge(T,I).cutvalue=h(E,C,T)}function h(E,C,T){var A=E.node(T),I=A.parent,B=!0,q=C.edge(T,I),L=0;return q||(B=!1,q=C.edge(I,T)),L=q.weight,e.forEach(C.nodeEdges(T),function(U){var X=U.v===T,Y=X?U.w:U.v;if(Y!==I){var M=X===B,J=C.edge(U).weight;if(L+=M?J:-J,b(E,T,Y)){var V=E.edge(T,Y).cutvalue;L+=M?-V:V}}}),L}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,A,I){var B=T,q=E.node(A);return C[A]=!0,e.forEach(E.neighbors(A),function(L){e.has(C,L)||(T=y(E,C,T,L,A))}),q.low=B,q.lim=T++,I?q.parent=I:delete q.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function j(E,C,T){var A=T.v,I=T.w;C.hasEdge(A,I)||(A=T.w,I=T.v);var B=E.node(A),q=E.node(I),L=B,U=!1;B.lim>q.lim&&(L=q,U=!0);var X=e.filter(C.edges(),function(Y){return U===N(E,E.node(Y.v),L)&&U!==N(E,E.node(Y.w),L)});return e.minBy(X,function(Y){return n(C,Y)})}function k(E,C,T,A){var I=T.v,B=T.w;E.removeEdge(I,B),E.setEdge(A.v,A.w,{}),m(E),f(E,C),S(E,C)}function S(E,C){var T=e.find(E.nodes(),function(I){return!C.node(I).parent}),A=a(E,T);A=A.slice(1),e.forEach(A,function(I){var B=E.node(I).parent,q=C.edge(I,B),L=!1;q||(q=C.edge(B,I),L=!0),C.node(I).rank=C.node(B).rank+(L?q.minlen:-q.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function N(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Wv}var Vv,_T;function DW(){if(_T)return Vv;_T=1;var e=gh(),t=e.longestPath,n=tI(),r=PW();Vv=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){r(f)}return Vv}var Gv,ST;function FW(){if(ST)return Gv;ST=1;var e=Mt();Gv=t;function t(a){var l=r(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,m=p.lca,y=0,w=h[y],j=!0;c!==f.w;){if(u=a.node(c),j){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(j=!1)}if(!j){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,l,c,u){var f=[],p=[],h=Math.min(l[c].low,l[u].low),m=Math.max(l[c].lim,l[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(l[y].low>h||m>l[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function r(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 Gv}var Kv,jT;function qW(){if(jT)return Kv;jT=1;var e=Mt(),t=Wn();Kv={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=l(u)+1;e.forEach(u.children(),function(w){r(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function r(u,f,p,h,m,y,w){var j=u.children(w);if(!j.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(k,w),b.borderTop=k,u.setParent(S,w),b.borderBottom=S,e.forEach(j,function(N){r(u,f,p,h,m,y,N);var E=u.node(N),C=E.borderTop?E.borderTop:N,T=E.borderBottom?E.borderBottom:N,A=E.borderTop?h:2*h,I=C!==T?1:m-y[w]+1;u.setEdge(k,C,{weight:A,minlen:I,nestingEdge:!0}),u.setEdge(T,S,{weight:A,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,k,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function 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 Kv}var Yv,ET;function BW(){if(ET)return Yv;ET=1;var e=Mt(),t=Wn();Yv=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)r(a,"borderLeft","_bl",c,f,p),r(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),l)}function r(a,l,c,u,f,p){var h={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=t.addDummyNode(a,"border",h,c);f[l][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return Yv}var Xv,CT;function zW(){if(CT)return Xv;CT=1;var e=Mt();Xv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&l(p),(h==="lr"||h==="rl")&&(u(p),r(p))}function r(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 m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Xv}var Zv,TT;function HW(){if(TT)return Zv;TT=1;var e=Mt();Zv=t;function t(n){var r={},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(r,p)){r[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 Zv}var Qv,AT;function UW(){if(AT)return Qv;AT=1;var e=Mt();Qv=t;function t(r,a){for(var l=0,c=1;c<a.length;++c)l+=n(r,a[c-1],a[c]);return l}function n(r,a,l){for(var c=e.zipObject(l,e.map(l,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(r.outEdges(y),function(w){return{pos:c[w.w],weight:r.edge(w).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}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var j=0;w>0;)w%2&&(j+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*j})),m}return Qv}var Jv,RT;function WW(){if(RT)return Jv;RT=1;var e=Mt();Jv=t;function t(n,r){return e.map(r,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 Jv}var ex,MT;function VW(){if(MT)return ex;MT=1;var e=Mt();ex=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)&&r(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 r(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 ex}var tx,IT;function GW(){if(IT)return tx;IT=1;var e=Mt(),t=Wn();tx=n;function n(l,c){var u=t.partition(l,function(k){return e.has(k,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(k){return-k.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=r(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),m+=k.barycenter*k.weight,y+=k.weight,w=r(h,p,w)});var j={vs:e.flatten(h,!0)};return y&&(j.barycenter=m/y,j.weight=y),j}function r(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 tx}var nx,$T;function KW(){if($T)return nx;$T=1;var e=Mt(),t=WW(),n=VW(),r=GW();nx=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,j=y?y.borderRight:void 0,k={};w&&(m=e.filter(m,function(T){return T!==w&&T!==j}));var S=t(u,m);e.forEach(S,function(T){if(u.children(T.v).length){var A=a(u,T.v,p,h);k[T.v]=A,e.has(A,"barycenter")&&c(T,A)}});var b=n(S,p);l(b,k);var N=r(b,h);if(w&&(N.vs=e.flatten([w,N.vs,j],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(j)[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 nx}var rx,OT;function YW(){if(OT)return rx;OT=1;var e=Mt(),t=Jr().Graph;rx=n;function n(a,l,c){var u=r(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===l||h.minRank<=l&&l<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,j=f.edge(w,p),k=e.isUndefined(j)?0:j.weight;f.setEdge(w,p,{weight:a.edge(y).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[l],borderRight:h.borderRight[l]}))}),f}function r(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return rx}var sx,LT;function XW(){if(LT)return sx;LT=1;var e=Mt();sx=t;function t(n,r,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){r.setEdge(h,f);return}f=p}})}return sx}var ax,PT;function ZW(){if(PT)return ax;PT=1;var e=Mt(),t=HW(),n=UW(),r=KW(),a=YW(),l=XW(),c=Jr().Graph,u=Wn();ax=f;function f(y){var w=u.maxRank(y),j=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),S=t(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,N,E=0,C=0;C<4;++E,++C){h(E%2?j:k,E%4>=2),S=u.buildLayerMatrix(y);var T=n(y,S);T<b&&(C=0,N=e.cloneDeep(S),b=T)}m(y,N)}function p(y,w,j){return e.map(w,function(k){return a(y,k,j)})}function h(y,w){var j=new c;e.forEach(y,function(k){var S=k.graph().root,b=r(k,S,j,w);e.forEach(b.vs,function(N,E){k.node(N).order=E}),l(k,j,b.vs)})}function m(y,w){e.forEach(w,function(j){e.forEach(j,function(k,S){y.node(k).order=S})})}return ax}var ox,DT;function QW(){if(DT)return ox;DT=1;var e=Mt(),t=Jr().Graph,n=Wn();ox={positionX:j,findType1Conflicts:r,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function r(b,N){var E={};function C(T,A){var I=0,B=0,q=T.length,L=e.last(A);return e.forEach(A,function(U,X){var Y=l(b,U),M=Y?b.node(Y).order:q;(Y||U===L)&&(e.forEach(A.slice(B,X+1),function(J){e.forEach(b.predecessors(J),function(V){var $=b.node(V),z=$.order;(z<I||M<z)&&!($.dummy&&b.node(J).dummy)&&c(E,V,J)})}),B=X+1,I=M)}),A}return e.reduce(N,C),E}function a(b,N){var E={};function C(A,I,B,q,L){var U;e.forEach(e.range(I,B),function(X){U=A[X],b.node(U).dummy&&e.forEach(b.predecessors(U),function(Y){var M=b.node(Y);M.dummy&&(M.order<q||M.order>L)&&c(E,Y,U)})})}function T(A,I){var B=-1,q,L=0;return e.forEach(I,function(U,X){if(b.node(U).dummy==="border"){var Y=b.predecessors(U);Y.length&&(q=b.node(Y[0]).order,C(I,L,X,B,q),L=X,B=q)}C(I,L,I.length,q,A.length)}),I}return e.reduce(N,T),E}function l(b,N){if(b.node(N).dummy)return e.find(b.predecessors(N),function(E){return b.node(E).dummy})}function c(b,N,E){if(N>E){var C=N;N=E,E=C}var T=b[N];T||(b[N]=T={}),T[E]=!0}function u(b,N,E){if(N>E){var C=N;N=E,E=C}return e.has(b[N],E)}function f(b,N,E,C){var T={},A={},I={};return e.forEach(N,function(B){e.forEach(B,function(q,L){T[q]=q,A[q]=q,I[q]=L})}),e.forEach(N,function(B){var q=-1;e.forEach(B,function(L){var U=C(L);if(U.length){U=e.sortBy(U,function(V){return I[V]});for(var X=(U.length-1)/2,Y=Math.floor(X),M=Math.ceil(X);Y<=M;++Y){var J=U[Y];A[L]===L&&q<I[J]&&!u(E,L,J)&&(A[J]=L,A[L]=T[L]=T[J],q=I[J])}}})}),{root:T,align:A}}function p(b,N,E,C,T){var A={},I=h(b,N,E,T),B=T?"borderLeft":"borderRight";function q(X,Y){for(var M=I.nodes(),J=M.pop(),V={};J;)V[J]?X(J):(V[J]=!0,M.push(J),M=M.concat(Y(J))),J=M.pop()}function L(X){A[X]=I.inEdges(X).reduce(function(Y,M){return Math.max(Y,A[M.v]+I.edge(M))},0)}function U(X){var Y=I.outEdges(X).reduce(function(J,V){return Math.min(J,A[V.w]-I.edge(V))},Number.POSITIVE_INFINITY),M=b.node(X);Y!==Number.POSITIVE_INFINITY&&M.borderType!==B&&(A[X]=Math.max(A[X],Y))}return q(L,I.predecessors.bind(I)),q(U,I.successors.bind(I)),e.forEach(C,function(X){A[X]=A[E[X]]}),A}function h(b,N,E,C){var T=new t,A=b.graph(),I=k(A.nodesep,A.edgesep,C);return e.forEach(N,function(B){var q;e.forEach(B,function(L){var U=E[L];if(T.setNode(U),q){var X=E[q],Y=T.edge(X,U);T.setEdge(X,U,Math.max(I(b,L,q),Y||0))}q=L})}),T}function m(b,N){return e.minBy(e.values(N),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(A,I){var B=S(b,I)/2;C=Math.max(A+B,C),T=Math.min(A-B,T)}),C-T})}function y(b,N){var E=e.values(N),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(A){e.forEach(["l","r"],function(I){var B=A+I,q=b[B],L;if(q!==N){var U=e.values(q);L=I==="l"?C-e.min(U):T-e.max(U),L&&(b[B]=e.mapValues(q,function(X){return X+L}))}})})}function w(b,N){return e.mapValues(b.ul,function(E,C){if(N)return b[N.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function j(b){var N=n.buildLayerMatrix(b),E=e.merge(r(b,N),a(b,N)),C={},T;e.forEach(["u","d"],function(I){T=I==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(B){B==="r"&&(T=e.map(T,function(X){return e.values(X).reverse()}));var q=(I==="u"?b.predecessors:b.successors).bind(b),L=f(b,T,E,q),U=p(b,T,L.root,L.align,B==="r");B==="r"&&(U=e.mapValues(U,function(X){return-X})),C[I+B]=U})});var A=m(b,C);return y(C,A),w(C,b.graph().align)}function k(b,N,E){return function(C,T,A){var I=C.node(T),B=C.node(A),q=0,L;if(q+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":L=-I.width/2;break;case"r":L=I.width/2;break}if(L&&(q+=E?L:-L),L=0,q+=(I.dummy?N:b)/2,q+=(B.dummy?N:b)/2,q+=B.width/2,e.has(B,"labelpos"))switch(B.labelpos.toLowerCase()){case"l":L=B.width/2;break;case"r":L=-B.width/2;break}return L&&(q+=E?L:-L),L=0,q}}function S(b,N){return b.node(N).width}return ox}var ix,FT;function JW(){if(FT)return ix;FT=1;var e=Mt(),t=Wn(),n=QW().positionX;ix=r;function r(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(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+h/2}),f+=h+u})}return ix}var lx,qT;function e7(){if(qT)return lx;qT=1;var e=Mt(),t=OW(),n=LW(),r=DW(),a=Wn().normalizeRanks,l=FW(),c=Wn().removeEmptyRanks,u=qW(),f=BW(),p=zW(),h=ZW(),m=JW(),y=Wn(),w=Jr().Graph;lx=j;function j(H,Q){var O=Q&&Q.debugTiming?y.time:y.notime;O("layout",function(){var te=O(" buildLayoutGraph",function(){return q(H)});O(" runLayout",function(){k(te,O)}),O(" updateInputGraph",function(){S(H,te)})})}function k(H,Q){Q(" makeSpaceForEdgeLabels",function(){L(H)}),Q(" removeSelfEdges",function(){W(H)}),Q(" acyclic",function(){t.run(H)}),Q(" nestingGraph.run",function(){u.run(H)}),Q(" rank",function(){r(y.asNonCompoundGraph(H))}),Q(" injectEdgeLabelProxies",function(){U(H)}),Q(" removeEmptyRanks",function(){c(H)}),Q(" nestingGraph.cleanup",function(){u.cleanup(H)}),Q(" normalizeRanks",function(){a(H)}),Q(" assignRankMinMax",function(){X(H)}),Q(" removeEdgeLabelProxies",function(){Y(H)}),Q(" normalize.run",function(){n.run(H)}),Q(" parentDummyChains",function(){l(H)}),Q(" addBorderSegments",function(){f(H)}),Q(" order",function(){h(H)}),Q(" insertSelfEdges",function(){G(H)}),Q(" adjustCoordinateSystem",function(){p.adjust(H)}),Q(" position",function(){m(H)}),Q(" positionSelfEdges",function(){F(H)}),Q(" removeBorderNodes",function(){z(H)}),Q(" normalize.undo",function(){n.undo(H)}),Q(" fixupEdgeLabelCoords",function(){V(H)}),Q(" undoCoordinateSystem",function(){p.undo(H)}),Q(" translateGraph",function(){M(H)}),Q(" assignNodeIntersects",function(){J(H)}),Q(" reversePoints",function(){$(H)}),Q(" acyclic.undo",function(){t.undo(H)})}function S(H,Q){e.forEach(H.nodes(),function(O){var te=H.node(O),ae=Q.node(O);te&&(te.x=ae.x,te.y=ae.y,Q.children(O).length&&(te.width=ae.width,te.height=ae.height))}),e.forEach(H.edges(),function(O){var te=H.edge(O),ae=Q.edge(O);te.points=ae.points,e.has(ae,"x")&&(te.x=ae.x,te.y=ae.y)}),H.graph().width=Q.graph().width,H.graph().height=Q.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},B=["labelpos"];function q(H){var Q=new w({multigraph:!0,compound:!0}),O=de(H.graph());return Q.setGraph(e.merge({},N,K(O,b),e.pick(O,E))),e.forEach(H.nodes(),function(te){var ae=de(H.node(te));Q.setNode(te,e.defaults(K(ae,C),T)),Q.setParent(te,H.parent(te))}),e.forEach(H.edges(),function(te){var ae=de(H.edge(te));Q.setEdge(te,e.merge({},I,K(ae,A),e.pick(ae,B)))}),Q}function L(H){var Q=H.graph();Q.ranksep/=2,e.forEach(H.edges(),function(O){var te=H.edge(O);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function U(H){e.forEach(H.edges(),function(Q){var O=H.edge(Q);if(O.width&&O.height){var te=H.node(Q.v),ae=H.node(Q.w),he={rank:(ae.rank-te.rank)/2+te.rank,e:Q};y.addDummyNode(H,"edge-proxy",he,"_ep")}})}function X(H){var Q=0;e.forEach(H.nodes(),function(O){var te=H.node(O);te.borderTop&&(te.minRank=H.node(te.borderTop).rank,te.maxRank=H.node(te.borderBottom).rank,Q=e.max(Q,te.maxRank))}),H.graph().maxRank=Q}function Y(H){e.forEach(H.nodes(),function(Q){var O=H.node(Q);O.dummy==="edge-proxy"&&(H.edge(O.e).labelRank=O.rank,H.removeNode(Q))})}function M(H){var Q=Number.POSITIVE_INFINITY,O=0,te=Number.POSITIVE_INFINITY,ae=0,he=H.graph(),ge=he.marginx||0,Te=he.marginy||0;function De(Ve){var je=Ve.x,ve=Ve.y,Ue=Ve.width,ke=Ve.height;Q=Math.min(Q,je-Ue/2),O=Math.max(O,je+Ue/2),te=Math.min(te,ve-ke/2),ae=Math.max(ae,ve+ke/2)}e.forEach(H.nodes(),function(Ve){De(H.node(Ve))}),e.forEach(H.edges(),function(Ve){var je=H.edge(Ve);e.has(je,"x")&&De(je)}),Q-=ge,te-=Te,e.forEach(H.nodes(),function(Ve){var je=H.node(Ve);je.x-=Q,je.y-=te}),e.forEach(H.edges(),function(Ve){var je=H.edge(Ve);e.forEach(je.points,function(ve){ve.x-=Q,ve.y-=te}),e.has(je,"x")&&(je.x-=Q),e.has(je,"y")&&(je.y-=te)}),he.width=O-Q+ge,he.height=ae-te+Te}function J(H){e.forEach(H.edges(),function(Q){var O=H.edge(Q),te=H.node(Q.v),ae=H.node(Q.w),he,ge;O.points?(he=O.points[0],ge=O.points[O.points.length-1]):(O.points=[],he=ae,ge=te),O.points.unshift(y.intersectRect(te,he)),O.points.push(y.intersectRect(ae,ge))})}function V(H){e.forEach(H.edges(),function(Q){var O=H.edge(Q);if(e.has(O,"x"))switch((O.labelpos==="l"||O.labelpos==="r")&&(O.width-=O.labeloffset),O.labelpos){case"l":O.x-=O.width/2+O.labeloffset;break;case"r":O.x+=O.width/2+O.labeloffset;break}})}function $(H){e.forEach(H.edges(),function(Q){var O=H.edge(Q);O.reversed&&O.points.reverse()})}function z(H){e.forEach(H.nodes(),function(Q){if(H.children(Q).length){var O=H.node(Q),te=H.node(O.borderTop),ae=H.node(O.borderBottom),he=H.node(e.last(O.borderLeft)),ge=H.node(e.last(O.borderRight));O.width=Math.abs(ge.x-he.x),O.height=Math.abs(ae.y-te.y),O.x=he.x+O.width/2,O.y=te.y+O.height/2}}),e.forEach(H.nodes(),function(Q){H.node(Q).dummy==="border"&&H.removeNode(Q)})}function W(H){e.forEach(H.edges(),function(Q){if(Q.v===Q.w){var O=H.node(Q.v);O.selfEdges||(O.selfEdges=[]),O.selfEdges.push({e:Q,label:H.edge(Q)}),H.removeEdge(Q)}})}function G(H){var Q=y.buildLayerMatrix(H);e.forEach(Q,function(O){var te=0;e.forEach(O,function(ae,he){var ge=H.node(ae);ge.order=he+te,e.forEach(ge.selfEdges,function(Te){y.addDummyNode(H,"selfedge",{width:Te.label.width,height:Te.label.height,rank:ge.rank,order:he+ ++te,e:Te.e,label:Te.label},"_se")}),delete ge.selfEdges})})}function F(H){e.forEach(H.nodes(),function(Q){var O=H.node(Q);if(O.dummy==="selfedge"){var te=H.node(O.e.v),ae=te.x+te.width/2,he=te.y,ge=O.x-ae,Te=te.height/2;H.setEdge(O.e,O.label),H.removeNode(Q),O.label.points=[{x:ae+2*ge/3,y:he-Te},{x:ae+5*ge/6,y:he-Te},{x:ae+ge,y:he},{x:ae+5*ge/6,y:he+Te},{x:ae+2*ge/3,y:he+Te}],O.label.x=O.x,O.label.y=O.y}})}function K(H,Q){return e.mapValues(e.pick(H,Q),Number)}function de(H){var Q={};return e.forEach(H,function(O,te){Q[te.toLowerCase()]=O}),Q}return lx}var cx,BT;function t7(){if(BT)return cx;BT=1;var e=Mt(),t=Wn(),n=Jr().Graph;cx={debugOrdering:r};function r(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,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return cx}var ux,zT;function n7(){return zT||(zT=1,ux="0.8.5"),ux}var dx,HT;function r7(){return HT||(HT=1,dx={graphlib:Jr(),layout:e7(),debug:t7(),util:{time:Wn().time,notime:Wn().notime},version:n7()}),dx}var s7=r7();const UT=d0(s7),Fo=240,zc=130,Yi=74,tf=72,Cc=Yi+tf;function nI(e,t){var r;let n=Fo;for(const a of e)n=Math.max(n,((r=t.get(a.id))==null?void 0:r.width)??Fo);return n}const yh=420,rI=1;function a7(e,t,n,r){return Math.min(rI,n/Math.max(1,e),r/Math.max(1,t))}function qo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function o7(e,t){return((t==null?void 0:t.get(e))??0)>0?yh:0}function i7(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Hc(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??Fo)+o7(e,n),h:Math.max((r==null?void 0:r.height)??zc,i7(e,n))}}function l7(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function c7(e,t,n,r,a,l){const c=new UT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(b=>!a.has(b)),f=new Set(u);for(const b of u){const{w:N,h:E}=Hc(b,r,l);c.setNode(b,{width:N,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);UT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of u){const N=c.node(b);if(!N)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Fo,T=(E==null?void 0:E.height)??zc,A=Hc(b,r,l),I=N.x-A.w/2,B=N.y-A.h/2;p.set(b,{x:I,y:B}),I<h&&(h=I),B<m&&(m=B),I+C>y&&(y=I+C),B+T>w&&(w=B+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,N]of p)p.set(b,{x:N.x-h,y:N.y-m});const j=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const N=a.get(b);if(!N)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Fo,T=(E==null?void 0:E.height)??zc;S=S===null?{minX:N.x,minY:N.y,maxX:N.x+C,maxY:N.y+T}:{minX:Math.min(S.minX,N.x),minY:Math.min(S.minY,N.y),maxX:Math.max(S.maxX,N.x+C),maxY:Math.max(S.maxY,N.y+T)}}return{positions:p,width:j,height:k,pinnedBox:S}}function sI(e,t,n){const r=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=qo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...c7(u.get(h),t,r,l,a,c)})),gap:nI(e,l)}}const aI=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+yh,u7=e=>e.reduce((t,n)=>t+n.height,0)+Cc*Math.max(0,e.length-1);function t0(e,t,n,r){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+Cc;return p},l=[];for(let f=0;f<e.length;f++){let p=-Cc;for(let h=f;h<e.length;h++)l.push(p+=e[h].height+Cc)}l.sort((f,p)=>f-p);const c=f=>{let p=0,h=l.length-1;for(;p<h;){const m=p+h>>1;a(l[m]).length<=f?h=m:p=m+1}return a(l[p])};let u=[e];if(n>0&&r>0){const f=h=>a7(h.reduce((m,y)=>m+aI(y),0)+t*(h.length-1),Math.max(...h.map(u7)),n,r);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function d7(e,t,n,r,a){if(!(r.width>0&&r.height>0&&a.width>0&&a.height>0))return!1;const{laid:l,gap:c}=sI(e,t,n);return l.length<2?!1:t0(l,c,r.width,r.height).length!==t0(l,c,a.width,a.height).length}function h7(e,t,n={}){const r=n.pinned??new Map,{laid:a,gap:l}=sI(e,t,n),c=t0(a,l,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=aI(p);let m=0;for(const{positions:y,height:w,pinnedBox:j}of p){for(const[S,b]of y)u.set(S,{x:b.x+f,y:b.y+m});let k=m+w;j&&j.maxY>k&&j.minX<f+h&&f<j.maxX&&(k=j.maxY),m=k+Cc}f+=h+l}return e.map(p=>{const h=r.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function f7(e,t,n,r,a){const c=Yi+tf,u=60,f=w=>Hc(w,r,a),p=new Map(e.map(w=>[w.id,qo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,j)=>w.pos.y-j.pos.y||w.pos.x-j.pos.x||w.id.localeCompare(j.id)),y=[];for(const{id:w,pos:j}of m){const{w:k,h:S}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:j.x,y:j.y,w:k,h:S,sid:b});continue}let N=j.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const A=T.sid===b?24:u,I=T.sid===b?24:c;return j.x<T.x+T.w+A&&T.x<j.x+k+A&&N<T.y+T.h+I&&T.y<N+S+I});if(!C)break;N=C.y+C.h+(C.sid===b?24:c)}N!==j.y&&(t.set(w,{x:j.x,y:N}),y.push(w)),h.push({x:j.x,y:N,w:k,h:S,sid:b})}return y}function p7(e,t,n,r,a,l,c){const u=E=>Hc(E,r,l),f=E=>n.get(E)??t.get(E),p=E=>{const C=r.get(E);return{cw:(C==null?void 0:C.width)??Fo,ch:(C==null?void 0:C.height)??zc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=qo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,j=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:A}=u(E.id),I=qo(E);y.has(I)?(w.get(I)??w.set(I,[]).get(I)).push(E):j.push({x:C.x,y:C.y,w:T,h:A,...p(E.id)})}if(w.size===0||h&&j.length===0)return[];const k=Yi+tf,S=(E,C,T,A)=>j.some(I=>E<I.x+I.w+Yi&&I.x<E+T+Yi&&C<I.y+I.h+k&&I.y<C+A+k),b=nI(e,r),N=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,A=1/0,I=-1/0,B=-1/0,q=-1/0,L=-1/0;for(const $ of C){const z=f($.id),{w:W,h:G}=u($.id),{cw:F,ch:K}=p($.id);T=Math.min(T,z.x),A=Math.min(A,z.y),I=Math.max(I,z.x+W),B=Math.max(B,z.y+G),q=Math.max(q,z.x+F),L=Math.max(L,z.y+K)}const U=I-T,X=B-A,Y=[...new Set(j.map($=>Math.round($.x)))].sort(($,z)=>$-z),M=Y.length?Y:[T],J=[0,...j.map($=>$.y+$.h+k)].sort(($,z)=>$-z);let V=null;if(h){let $=1/0,z=1/0,W=-1/0,G=-1/0;for(const O of j)$=Math.min($,O.x),z=Math.min(z,O.y),W=Math.max(W,O.x+O.cw),G=Math.max(G,O.y+O.ch);const F=(O,te)=>{const ae=c.width/(Math.max(W,O+q-T)-Math.min($,O)+yh),he=c.height/(Math.max(G,te+L-A)-Math.min(z,te));return[Math.min(rI,ae,he),Math.min(ae,he),Math.max(ae,he)]},K=(O,te)=>{for(let ae=0;ae<O.length;ae++){if(O[ae]>te[ae]+1e-9)return!0;if(O[ae]<te[ae]-1e-9)return!1}return!1},de=Math.round(W+yh+b),H=[...new Set([...J,z])].sort((O,te)=>O-te);let Q=null;for(const O of[...M,de])for(const te of H){if(S(O,te,U,X))continue;const ae=F(O,te);(Q===null||K(ae,Q))&&(Q=ae,V={x:O,y:te})}V&&V.x===T&&V.y===A&&(V=null)}else e:for(const $ of M)for(const z of J){if(z>=A)break;if(!S($,z,U,X)){V={x:$,y:z};break e}}if(V){const $=V.x-T,z=V.y-A;for(const W of C){const G=f(W.id);t.set(W.id,{x:G.x+$,y:G.y+z})}N.push(E)}for(const $ of C){const z=f($.id),{w:W,h:G}=u($.id);j.push({x:z.x,y:z.y,w:W,h:G,...p($.id)})}}return N}function m7(e,t,n){const r=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=qo(a);(r.get(l)??r.set(l,[]).get(l)).push(a)}if(r.size===0)return e;for(const a of r.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=r.get(qo(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,u=l.find(h=>h.id===c)??l[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function g7(e,t,n,r,a,l=!1,c){const p=Yi+tf+1,h=8,m=1.75,y=200,w=.7,j=.01,k=L=>Hc(L,r,c),S=L=>n.get(L)??t.get(L),b=new Map;for(const L of e){if(!S(L.id))continue;const U=qo(L),X=b.get(U);X?X.push(L):b.set(U,[L])}const N=[],E=new Set,C=new Set,T=a.size===0;for(const L of[...b.keys()].sort()){const U=b.get(L);let X=1/0,Y=1/0,M=-1/0,J=-1/0,V=!1;for(const G of U){const F=S(G.id),{w:K,h:de}=k(G.id);X=Math.min(X,F.x),Y=Math.min(Y,F.y),M=Math.max(M,F.x+K),J=Math.max(J,F.y+de),n.has(G.id)&&(V=!0)}const $=M-X,z=J-Y;C.add(L);const W=a.get(L);W&&($>W.w+h||z>W.h+h)&&E.add(L),a.set(L,{w:$,h:z}),N.push({sid:L,members:U.map(G=>G.id),x:X,y:Y,w:$,h:z,anchored:V,mass:1})}for(const L of[...a.keys()])C.has(L)||a.delete(L);if(l||T)return[];let A=!1;for(let L=0;L<N.length&&!A;L++)for(let U=L+1;U<N.length;U++){const X=N[L],Y=N[U];if(!(X.anchored&&Y.anchored)&&Math.abs(X.x+X.w/2-(Y.x+Y.w/2))<(X.w+Y.w)/2+61&&Math.abs(X.y+X.h/2-(Y.y+Y.h/2))<(X.h+Y.h)/2+p){A=!0;break}}if(E.size===0&&!A)return[];if(E.size>0)for(const L of N)E.has(L.sid)&&(L.mass=8);else for(const L of N)L.mass=Math.max(1,L.w*L.h/(Fo*zc));const I=new Map(N.map(L=>[L.sid,L.x])),B=new Map(N.map(L=>[L.sid,L.y]));for(let L=0;L<y;L++){const U=new Map,X=new Map;let Y=0;for(let M=0;M<N.length;M++)for(let J=M+1;J<N.length;J++){const V=N[M],$=N[J];if(V.anchored&&$.anchored)continue;const z=V.x+V.w/2,W=V.y+V.h/2,G=$.x+$.w/2,F=$.y+$.h/2,K=(V.w+$.w)/2+61-Math.abs(z-G),de=(V.h+$.h)/2+p-Math.abs(W-F);if(K<=0||de<=0)continue;const H=(_e,Ie)=>!_e.anchored&&!(Ie<0&&_e.x<=0),Q=(_e,Ie)=>!_e.anchored&&!(Ie<0&&_e.y<=0),O=(_e,Ie,Ze)=>{const We=_e===Ie,Je=We?V.sid<$.sid?-1:1:Math.sign(_e-Ie);return Ze(V,Je)||Ze($,-Je)?Je:We&&(Ze(V,-Je)||Ze($,Je))?-Je:0},te=O(z,G,H),ae=O(W,F,Q),he=te!==0,ge=ae!==0;if(!he&&!ge)continue;const Te=he&&(!ge||K*m<de),[De,Ve,je,ve]=Te?[te,K,U,H]:[ae,de,X,Q],Ue=ve(V,De),ke=ve($,-De),xe=V.mass,Ge=$.mass,rt=Ue?ke?Ge/(xe+Ge):1:0,at=ke?Ue?xe/(xe+Ge):1:0,le=Ve*w;je.set(V.sid,(je.get(V.sid)??0)+De*le*rt),je.set($.sid,(je.get($.sid)??0)-De*le*at),Y+=le}for(const M of N)M.anchored||(M.x=Math.max(0,M.x+(U.get(M.sid)??0)),M.y=Math.max(0,M.y+(X.get(M.sid)??0)));if(Y<j)break}const q=[];for(const L of N){const U=L.x-I.get(L.sid),X=L.y-B.get(L.sid);if(!(Math.abs(U)<1&&Math.abs(X)<1)){for(const Y of L.members){if(n.has(Y))continue;const M=t.get(Y);M&&t.set(Y,{x:M.x+U,y:M.y+X})}q.push(L.sid)}}return q}function Zd(e,t,n){return!t.has(e)||n.has(e)}function y7(e,t,n,r){return!t.has(e)&&Zd(e,n,r)}function w7(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function WT(e,t,n,r){n.set(e,t),r.delete(e)}const v7=200,x7=5*6e4,b7=6,k7=2*6e4;function Od(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function N7(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const r=new Set;for(const a of e)t.has(a)&&r.add(a);return r}function _7(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(L0(n.id));return t}function S7(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(L0(n.id));return t}function j7(e,t){let n=iD(e,t,iN);lD(e,t,iN)&&(n=!0);const r=[],a=l=>{r.push(l)};return rD(e,t,v7,x7,a)&&(n=!0),sD(e,t,b7,k7,a)&&(n=!0),{changed:n,forgotten:r}}const E7=300,VT=130,C7=160,GT=new WeakMap;function T7(e,t){let n=GT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:g6(e.agents.values())},GT.set(e,n));const{byId:r,branches:a}=n;return l=>{let c=r.get(l.id);if(!c){const u=l.kind==="root"?a.get(l.sessionId):void 0;c=u?{...l,onOpenContext:t,branch:u}:{...l,onOpenContext:t},r.set(l.id,c)}return c}}function n0(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function A7(e,t,n,r,a,l,c,u,f,p,h,m,y,w,j,k,S,b){var Y,M,J,V;const N=[],E=[],C=T7(e,b);for(const $ of e.agents.values()){if(!S.has($.id))continue;const z=$.exitAt!=null,W=k!=null&&!k.has($.id),G=[z?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,F=l.get($.id);if(N.push({id:$.id,type:"agent",position:{x:0,y:0},data:C($),className:G,ariaLabel:oF($,t),...F?{width:F.width,height:F.height}:null}),$.parentId&&S.has($.parentId)){const H=lh($.sessionId),Q=z,O=j.size>0&&(j.has($.id)||j.has($.parentId)),te=k!=null&&!k.has($.id)&&!k.has($.parentId),ae=$.state==="active"?2:1.5,he=O?ae+1.5:ae,ge=Q?.2:te?.12:1,Te=["sess-edge",$.state==="active"?"sess-live":"sess-idle",Q?"rf-edge-exiting":"",O?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${$.parentId}->${$.id}`,source:$.parentId,target:$.id,animated:($.state==="active"||O)&&!Q,type:"smoothstep",style:{"--session-hue":H,strokeWidth:`calc(${he}px * var(--edge-k, 1))`,opacity:ge,transition:"var(--edge-transition)"},className:Te})}const K=$.kind==="root"?Ih($):null,de=K?wR($.sessionId,K.at):null;if(K&&de&&!u6(de)){const H=L0($.id),Q=lh($.sessionId),O=l.get(H);N.push({id:H,type:"recapNote",position:{x:0,y:0},data:{sessionId:$.sessionId,parentId:$.id,recap:K,noteKey:de,hue:Q},className:W?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${$.label}`,...O?{width:O.width,height:O.height}:null}),E.push({id:`e:recap:${$.id}`,source:H,target:$.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":Q}})}}const T=n0(e),A=`${y}#lanes:${l7(T)}`,I=new Set(N.filter($=>$.type==="recapNote").map($=>$.id));for(const $ of Array.from(h.keys()))p6($)&&!I.has($)&&!a.has($)&&(h.delete($),m.delete($));const B=N.filter($=>y7($.id,a,h,m));if(B.length>0||A!==w.current){if(B.length>0){const $=m7(h7(N,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:r,lanes:T}),a,z=>Zd(z,h,m)?void 0:h.get(z));for(const z of $)Zd(z.id,h,m)&&WT(z.id,z.position,h,m);p7(N,h,a,l,new Set(B.filter(z=>z.type!=="recapNote").map(z=>z.id)),T,{width:n,height:r});for(const z of B){if(z.type!=="recapNote")continue;const W=(Y=z.data)==null?void 0:Y.parentId;if(!W)continue;const G=a.get(W)??(Zd(W,h,m)?void 0:h.get(W));if(!G)continue;const F=((M=l.get(z.id))==null?void 0:M.width)??E7,K=((J=l.get(z.id))==null?void 0:J.height)??VT,de=((V=l.get(W))==null?void 0:V.height)??VT;WT(z.id,{x:G.x-C7-F,y:G.y+(de-K)/2},h,m)}}f7(N,h,a,l,T),w.current=A}const q=g7(N,h,a,l,c,!f||p,T);q.length>0&&u(q);const L=S7(e.agents.values());Od(h,L),Od(m,L),Od(a,L),Od(l,_7(e.agents.values()));const U=[];let X=!1;for(const $ of N){let z=a.get($.id)??h.get($.id);z||(z=w7($.id,h,m),X=!0),U.push({...$,position:z})}return X&&(w.current=""),{nodes:U,edges:E}}const R7=1;function M7(e){return{id:e.id,name:e.name,inputPreview:e.inputPreview,startedAt:e.startedAt,endedAt:e.endedAt,ok:e.ok,errorPreview:e.errorPreview,usage:e.usage}}function I7(e,t,n){const r=e.agents.get(t);if(!r)return null;const a=[];for(const l of e.agents.values())l.sessionId===t&&a.push(l);return{schemaVersion:R7,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:a.map(l=>({id:l.id,kind:l.kind,label:l.label,parentId:l.parentId,state:l.state,startedAt:l.startedAt,endedAt:l.endedAt,model:l.model,cwd:l.cwd,usage:l.usage,prompts:l.prompts,tools:l.tools.map(M7)}))}}function $7(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${nn}-${n}-${t.slice(0,8)}.json`}function O7(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function L7(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 P7(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function D7(e,t){const n=P7(e),r=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:r("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:r(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const l=t.decks-1;return{goes:r(`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`),stays:[l===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function F7({agentCount:e,onConfirm:t,onCancel:n}){const r=x.useRef(null),a=sn(n,{focusRef:r,layer:PD}),[l,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(L7(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=D7(e,l);return o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"status-dot err","aria-hidden":!0}),o.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("dl",{className:"cc-plan",children:[o.jsx("dt",{children:"Goes"}),o.jsx("dd",{children:u.map(m=>o.jsx("span",{children:m},m))}),o.jsx("dt",{children:"Stays"}),o.jsx("dd",{children:f.length>0?f.map(m=>o.jsx("span",{children:m},m)):o.jsx("span",{children:"nothing"})})]}),p&&o.jsx("p",{className:"cc-final",children:p}),o.jsxs("div",{className:"cc-actions",children:[o.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),o.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const q7="Press Esc first if a key does nothing.",B7=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"Z",action:"zoom to the selected agent and its session",binds:["z","Z"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"a card: go to it and its session",binds:[]},{cap:"double-click",action:"a card: its prompt, every tool call, tokens and timing",binds:[]},{cap:"hover",action:"zoomed out, a card's name, state and numbers",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function z7({onClose:e,onTour:t}){const n=sn(e);return o.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[t&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),o.jsx("div",{className:"shortcuts",children:B7.map(r=>o.jsxs(x.Fragment,{children:[o.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(a=>o.jsxs("div",{className:"sc",children:[o.jsx("kbd",{children:a.cap}),o.jsx("span",{children:a.action})]},`${r.title}:${a.cap}:${a.action}`))]},r.title))}),o.jsx("p",{className:"kh-foot",children:q7})]})]})})}const H7=["done","needs-input"],U7=[{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}]}],W7=[{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}]}],pb={done:U7,"needs-input":W7},al="two";function r0(e,t){const n=pb[e];return n.find(r=>r.id===t)??n.find(r=>r.id===al)??n[0]}function oI(e,t){return pb[e].some(r=>r.id===t)?t:al}r0("done",al).notes,r0("needs-input",al).notes;const KT=.04,V7=.24,Mo=0,ol=100,wh=5,Uc=50;function Wc(e){if(!Number.isFinite(e))return Uc;const t=Math.round(e/wh)*wh;return Math.min(ol,Math.max(Mo,t))}function iI(e){if(e==null)return Uc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Wc(Number(t)):Uc}function G7(e){const t=Wc(e),n=KT+(V7-KT)*(t/ol);return Math.round(n*1e4)/1e4}function K7(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(G7(e)*r*1e4)/1e4}const Y7=160,X7="agent-dag.soundLevel.done",Z7="agent-dag.soundLevel.needs-input",Q7="agent-dag.soundFigure.done",J7="agent-dag.soundFigure.needs-input",lI={done:X7,"needs-input":Z7},cI={done:Q7,"needs-input":J7},s0={done:{level:Uc,figure:al},"needs-input":{level:Uc,figure:al}};function e9(e){const t=n=>({level:iI(e(lI[n])),figure:oI(n,e(cI[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const YT={Stop:"done",Notification:"needs-input"};function t9(e,t){var r;if(t)return null;const n=(r=e==null?void 0:e.payload)==null?void 0:r.hook_event_name;return typeof n!="string"?null:Object.hasOwn(YT,n)?YT[n]:null}function n9(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,r=!1;const a=()=>e.enabled()?r&&(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||r))try{n=n??new t,(f=n.resume)==null||f.call(n).then(l,()=>{}),r=!0,l()}catch{}}function u(f,p=!1){var j;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((j=e.prefs)==null?void 0:j.call(e))??s0)[f]??s0[f],m=r0(f,h.figure),y=K7(h.level,m),w=n.currentTime;for(const k of m.notes){const S=n.createOscillator(),b=n.createGain();S.type=m.type??"sine",S.frequency.value=k.hz;const N=w+k.at,E=N+k.ms/1e3;b.gain.setValueAtTime(1e-4,N),b.gain.exponentialRampToValueAtTime(y,N+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(b).connect(n.destination),S.start(N),S.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const r9="With no deck tab open, get a notification wherever a sound would have played.",s9="With the ccdeck window closed, get a notification wherever a sound would have played.";function a9(e){return e?s9:r9}const o9="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",XT="Get notified when you're away from this tab.";function i9(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:XT};case"default":return{status:null,ask:!0,ok:!1,note:XT};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."}}}function l9(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const ZT={done:"Turn finished","needs-input":"Claude is asking"},c9={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function u9({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:a,onFigure:l,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=i9(m),j=l9(),k=f&&!h&&!j,S=sn(e,{popover:!0}),b=x.useRef(e);return b.current=e,x.useEffect(()=>{const N=E=>{var T,A;const C=E.target;C&&((T=S.current)!=null&&T.contains(C)||(A=u.current)!=null&&A.contains(C)||b.current())};return window.addEventListener("pointerdown",N,!0),()=>window.removeEventListener("pointerdown",N,!0)},[S,u]),o.jsxs("div",{ref:S,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[o.jsxs("div",{className:"sm-switches",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),o.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"sm-setting",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications while closed"}),o.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"With no deck tab open, a notification wherever a sound would play",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsx("p",{className:"sm-note",children:h?o9:a9(j)})]})]}),k&&o.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[o.jsxs("div",{className:"sm-channel-head",children:[o.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?o.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):o.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&o.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:o.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),o.jsx("p",{className:"sm-note",children:w.note})]}),!t&&o.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."}),o.jsx("div",{className:"sm-tones",children:H7.map(N=>{const E=r[N],C=`sm-level-${N}`,T=`sm-figure-${N}`;return o.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${N}`,children:[o.jsxs("div",{className:"sm-tone-head",children:[o.jsx("h3",{className:"sm-tone-name",id:`sm-name-${N}`,children:ZT[N]}),o.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(N),"aria-label":`Hear the ${ZT[N].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:[o.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:C,children:"Volume"}),o.jsx("input",{id:C,type:"range",min:Mo,max:ol,step:wh,value:E.level,onChange:A=>a(N,Number(A.target.value)),style:{"--sm-level":`${(E.level-Mo)/(ol-Mo)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[E.level,"%"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:T,children:"Tone"}),o.jsx("select",{id:T,className:"sm-select",value:E.figure,onChange:A=>l(N,A.target.value),children:pb[N].map(A=>o.jsx("option",{value:A.id,children:A.label},A.id))})]}),o.jsx("p",{className:"sm-note",children:c9[N]})]},N)})}),o.jsxs("p",{className:"sm-foot",children:[o.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const uI="agent-dag.character-enabled",dI="agent-dag.fm-volume",hI="agent-dag.fm-source";function fI(e){return e==="lofi-relax"||e==="lofi-game"||e==="lofi-vibe"||e==="lofi-sleep"||e==="radio-mix"||e==="best-of-nostalgia"||e==="good-life-radio"||e==="cafe-music-bgm"?e:"claude-fm"}function d9(){return fI(ks(hI))}function h9(e){return e!=="0"}function f9(){return h9(ks(uI))}function p9(e){return iI(e)}function m9(){return p9(ks(dI))}const Pi=["light","dark"],g9={light:"Light",dark:"Dark"},hx=[{value:"claude-fm",label:"🎧 Claude FM"},{value:"lofi-relax",label:"📚 Relax / study",group:"📻 Lofi Girl"},{value:"lofi-game",label:"🎮 Chill / game",group:"📻 Lofi Girl"},{value:"lofi-vibe",label:"🌅 Vibe / chill",group:"📻 Lofi Girl"},{value:"lofi-sleep",label:"💤 Sleep / chill",group:"📻 Lofi Girl"},{value:"radio-mix",label:"📡 Live radio mix",group:"📻 Radio Mix"},{value:"best-of-nostalgia",label:"📼 Best of nostalgia live",group:"📻 Best of Nostalgia"},{value:"good-life-radio",label:"🌴 The Good Life Radio",group:"📻 The Good Life Radio"},{value:"cafe-music-bgm",label:"☕ Cafe music BGM",group:"☕ Cafe Music BGM"}];function y9({theme:e}){return o.jsx("span",{className:"appearance-preview","data-swatch":e,children:o.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),o.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),o.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),o.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),o.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),o.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),o.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),o.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),o.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),o.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function w9({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:a,onFmVolume:l,fmSource:c,onFmSource:u,onClose:f}){const p=sn(f),[h,m]=x.useState(!1),y=x.useRef(null),w=hx.find(S=>S.value===c)??hx[0];x.useEffect(()=>{if(!h)return;const S=b=>{var N;(N=y.current)!=null&&N.contains(b.target)||m(!1)};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[h]);const j=S=>{var E;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(S.key))return;S.preventDefault();const N=(Pi.indexOf(e)+(S.key==="ArrowLeft"||S.key==="ArrowUp"?-1:1)+Pi.length)%Pi.length;t(Pi[N]),(E=S.currentTarget.querySelectorAll('[role="radio"]')[N])==null||E.focus()},k=S=>{var N;if(S.key===" "){S.stopPropagation();return}if(S.key!=="t"&&S.key!=="T"||S.ctrlKey||S.metaKey||S.altKey)return;S.preventDefault(),S.stopPropagation();const b=e==="dark"?"light":"dark";t(b),S.target.getAttribute("role")==="radio"&&((N=S.currentTarget.querySelectorAll('[role="radio"]')[Pi.indexOf(b)])==null||N.focus())};return Sn.createPortal(o.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:f,role:"presentation",children:o.jsxs("div",{ref:p,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:S=>S.stopPropagation(),onKeyDown:k,children:[o.jsxs("div",{className:"appearance-head",children:[o.jsxs("div",{className:"appearance-heading",children:[o.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"}),o.jsx("p",{className:"appearance-subtitle",children:"Tune the deck to your workspace."})]}),o.jsx("button",{type:"button",className:"glyph-btn appearance-close",onClick:f,"aria-label":"Close appearance settings",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[o.jsxs("div",{className:"appearance-caption",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),o.jsx("p",{className:"appearance-section-note",children:"Choose how the dashboard looks."})]}),o.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),o.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:j,children:Pi.map(S=>o.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===S,tabIndex:e===S?0:-1,onClick:()=>t(S),children:[o.jsx(y9,{theme:S}),o.jsxs("span",{className:"appearance-theme-name",children:[g9[S],o.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},S))})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[o.jsx("div",{className:"appearance-caption",children:o.jsx("h3",{id:"appearance-fm-caption",children:"Music source"})}),o.jsxs("div",{className:"appearance-controls",children:[o.jsxs("div",{className:"appearance-source-row",children:[o.jsx("label",{htmlFor:"appearance-fm-source",children:"Station"}),o.jsxs("div",{ref:y,className:"appearance-source-picker",children:[o.jsxs("button",{id:"appearance-fm-source",type:"button",className:"sm-select appearance-source-trigger","aria-haspopup":"listbox","aria-expanded":h,"aria-describedby":"appearance-fm-source-note",onClick:()=>m(S=>!S),children:[o.jsx("span",{children:w.label}),o.jsx("svg",{className:"appearance-source-chevron",viewBox:"0 0 12 8","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"m1 1.5 5 5 5-5"})})]}),h&&o.jsx("div",{className:"appearance-source-list",role:"listbox","aria-label":"Music station",children:hx.map(S=>o.jsxs("button",{type:"button",role:"option","aria-selected":S.value===c,className:"appearance-source-option",onClick:()=>{u(fI(S.value)),m(!1)},children:[o.jsx("span",{children:S.label}),S.value===c&&o.jsx("span",{"aria-hidden":!0,children:"✓"})]},S.value))})]})]}),o.jsx("span",{id:"appearance-fm-source-note",className:"vis-hidden",children:"Changing station starts live playback automatically."}),o.jsxs("label",{className:"appearance-row",children:[o.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{id:"appearance-character-note",className:"vis-hidden",children:"Shows the animated minimap character and enables music playback."})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:"appearance-fm-volume",children:"Volume"}),o.jsx("input",{id:"appearance-fm-volume",type:"range",min:Mo,max:ol,step:wh,value:a,"aria-describedby":"appearance-fm-volume-note",onChange:S=>l(Number(S.target.value)),style:{"--sm-level":`${(a-Mo)/(ol-Mo)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[a,"%"]})]})]}),o.jsx("span",{id:"appearance-fm-volume-note",className:"vis-hidden",children:"Controls live music volume."})]})]})}),document.body)}const a0="https://www.youtube-nocookie.com";function v9(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${a0}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function Ld(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function x9(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const b9=[1,3],k9=[0,2],N9=[2,5,100,101,150];function _9(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:r}=t;if(n==="onReady")return{kind:"ready"};if(n==="onError"){const a=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof a!="number"||!Number.isFinite(a)?null:b9.includes(a)?{kind:"playing",playing:!0}:k9.includes(a)?{kind:"playing",playing:!1}:null}return null}const pI=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],QT=18,S9=pI.length,mI=new Set(["a","c","p"]);function nf(e=pI){const t=[];return e.forEach((n,r)=>{let a=0;for(;a<n.length;){const l=n[a];if(l==="."){a+=1;continue}let c=1;for(;a+c<n.length&&n[a+c]===l;)c+=1;t.push({x:a,y:r,w:c,cell:l}),a+=c}}),t}const Io=148,JT=6e3,j9=16e3,gI=46,$a=34;function E9(e,t,n=Io){let r=-Math.round(t()*n);if(Math.abs(r-e)<$a){const a=e-$a>=-n?-$a:$a;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:r,ms:Math.round(Math.abs(r-e)*gI)}}function C9(e){return Math.round(JT+e()*(j9-JT))}const e2=[{kind:"stroll",weight:44},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7},{kind:"fish",weight:12},{kind:"skip",weight:10}];function T9(e){const t=e2.reduce((r,a)=>r+a.weight,0);let n=e()*t;for(const r of e2)if(n-=r.weight,n<0)return r.kind;return"stroll"}const A9=720,R9=260,M9=620,I9=220,t2=520,yI=1600,n2=7e3,$9=15e3,r2=6e3,O9=14e3;function Di(e,t,n=Io){let r=-Math.round(t()*n);if(Math.abs(r-e)<$a){const a=e-$a>=-n?-$a:$a;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return r}const dn=(e,t)=>Math.round(Math.abs(t-e)*gI),Pd=0;function L9(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:dn(e,t)},{x:t,prop:n({}),act:"stoop",ms:A9},{x:Pd,prop:n({held:!0}),act:"carry",ms:dn(t,Pd)},{x:Pd,prop:n({held:!0}),act:"windup",ms:R9},{x:Pd,prop:n({held:!0,leaving:!0}),act:"toss",ms:M9}]}function P9(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),a=(l={})=>({kind:"ball",at:t,...l});return[{x:r,prop:a(),act:"walk",ms:dn(e,r)},{x:r,prop:a(),act:"windup",ms:I9,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"kick",ms:t2,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"stand",ms:yI-t2}]}const wI=640;function D9(e,t,n){const r=Math.max(-70,Math.min(-20,t)),a={x:r,prop:null,facing:"left"};return[{x:r,prop:null,act:"walk",ms:dn(e,r)},{...a,act:"sit",ms:600},{...a,act:"cast",ms:900},{...a,act:"fish",ms:6e3+Math.round(n()*4e3)},{...a,act:"reel",ms:1200},{...a,act:"stow",ms:500},{...a,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:dn(r,0)}]}function F9(e,t,n){const r=Math.max(-110,Math.min(-30,t)),a={x:r,prop:null};return[{...a,act:"walk",ms:dn(e,r)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:wI*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:dn(r,0)}]}function q9(e,t,n){return[{x:t,prop:null,act:"walk",ms:dn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(r2+n()*(O9-r2))},{x:t,prop:null,act:"stand",ms:400}]}function B9(e,t,n){t=Math.max(-110,Math.min(0,t));const r=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:dn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(n2+n()*($9-n2))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function s2(e,t,n){return e.facing?e.facing:e.act==="watch"||e.act==="scope-pack"?"left":e.x===t?n:e.x>t?"right":"left"}const z9=1500,H9=e=>Math.round(1e3*Math.sqrt(2*e/z9)),U9=115,W9=e=>Math.round(e/U9*1e3),V9=620,G9=200,K9=760,Y9=600,X9=240;function Z9(e,t,n){const a=-(t.ledgeSpan??Io),l=H9(t.ledgeH),c=W9(t.ledgeH),u=-Math.round(n()*t.floorSpan),f=-Math.round(n()*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:dn(e,a)},{x:a,act:"peer",prop:null,ms:V9},{x:a,act:"fall",prop:null,ms:l,place:"floor"},{x:a,act:"land",prop:null,ms:G9,place:"floor"},{x:u,act:"walk",prop:null,ms:dn(a,u),place:"floor"},{x:f,act:"walk",prop:null,ms:dn(u,f),place:"floor"},{x:a,act:"walk",prop:null,ms:dn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:K9,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:Y9,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:X9,place:"floor"},{x:a,act:"climb",prop:null,ms:c},{x:a,act:"pull-up",prop:null,ms:480}]}function Q9(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Io;switch(T9(t)){case"tidy":return L9(e,Di(e,t,r));case"kick":return P9(e,Di(e,t,r));case"sit":return q9(e,Di(e,t,r),t);case"watch":return B9(e,Di(e,t,r),t);case"fish":return D9(e,Di(e,t,r),t);case"skip":return F9(e,Di(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return Z9(e,n,t)}}const l=E9(e,t,r);return[{x:l.to,prop:null,act:"walk",ms:l.ms}]}const J9=[".xx.","xxxx",".xx."],eV=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],tV=["...xx...............","..xaax..............",".xaallx.............","xaallllx............",".xllllllx...........","..xllllllx..........","...xllllllx.........","....xllllllxx.......",".....xllllxsxx..xx..","......xllxsssx.xllxx",".......xxssssxxxllxx","........xssssssxx...",".........xssssx.....","..........xxxx......","..........xax.......",".........xxxxx......","........xx.x.xx.....","........xl.x.lx.....",".......xl..x..lx....",".......xl..x..lx....","......xl...x...lx...","......xl...x...lx...",".....xl....x....lx..","....xxx...xxx...xxx."],fx={litter:J9,ball:eV,scope:tV},vI=["bob","sway","groove"],a2=9e3,nV=16e3,xI=1e3,rV=.08;function sV(e,t){const n=vI.filter(l=>l!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*rV;return{dance:r,beatMs:Math.round(xI*(1+a))}}function aV(e){return Math.round(a2+e()*(nV-a2))}const oV=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],iV=3,lV=-1,o0=11,o2=9,cV=420;function uV(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(cV,Math.max(0,r))}const dV=260,hV=200;function fV(e,t,n){const r=(h,m=dn(e,h))=>({x:h,prop:null,act:"walk",ms:m,place:"floor"});if(!n||n.height<=0)return[r(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[r(t)];const c=t>e,u=c?n.left:n.right,f=c?n.right:n.left,p={place:"floor",riser:n.height,prop:null};return[r(u,dn(e,u)),{...p,x:u,act:"mount",ms:dV},{...p,x:f,act:"walk",ms:dn(u,f)},{x:f,prop:null,act:"dismount",ms:hV,place:"floor"},{x:t,prop:null,act:"walk",ms:dn(f,t),place:"floor"}]}function i2(e){let t=null,n=null,r=0,a=0,l=!1;const c=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{l||e.hidden||!n||t!==null||(a=performance.now(),t=setTimeout(()=>{t=null;const p=n;n=null,p==null||p()},r))},f=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-a)),c()):e.hidden||u()};return e.addEventListener("visibilitychange",f),{schedule(p,h){l||(c(),n=p,r=Math.max(0,h),u())},dispose(){l=!0,c(),n=null,e.removeEventListener("visibilitychange",f)}}}const wc={"claude-fm":"Claude FM","lofi-relax":"Lofi Girl relax/study","lofi-game":"Lofi Girl chill/game","lofi-vibe":"Lofi Girl vibe/chill","lofi-sleep":"Lofi Girl sleep/chill","radio-mix":"Radio Mix Live","best-of-nostalgia":"Best of Nostalgia Live","good-life-radio":"The Good Life Radio Live","cafe-music-bgm":"Cafe Music BGM Live"},pV={"claude-fm":null,"lofi-relax":null,"lofi-game":null,"lofi-vibe":null,"lofi-sleep":null,"radio-mix":"/api/live-radio-mix","best-of-nostalgia":"/api/best-of-nostalgia","good-life-radio":"/api/good-life-radio","cafe-music-bgm":"/api/cafe-music-bgm"};function px(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return o.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:nf(e).map(a=>o.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:a.cell==="s"?"var(--fm-prop-shadow, var(--bg))":a.cell==="l"?"var(--fm-prop-light, var(--text))":a.cell==="a"?"var(--accent)":void 0},`${t}${a.y}-${a.x}`))})}const mx={e:"fm-eye",s:"fm-shade",p:"fm-pad"},vh=nf().filter(e=>!mI.has(e.cell)),mV=nf().filter(e=>mI.has(e.cell)),l2=vh.filter(e=>e.cell==="e"),gV=nf(oV),yV=vh.filter(e=>e.y<o0&&e.cell!=="e").map(e=>{if(e.y!==8&&e.y!==9)return e;const t=Math.max(6,e.x);return{...e,x:t,w:Math.max(0,Math.min(12,e.x+e.w)-t)}}).filter(e=>e.w>0),wV={left:vh.filter(e=>e.y>=o0&&e.x<o2),right:vh.filter(e=>e.y>=o0&&e.x>=o2)},c2={litter:px(fx.litter,"litter"),ball:px(fx.ball,"ball"),scope:px(fx.scope,"scope")},vV=x.memo(function({fetchImpl:t,volume:n,source:r="claude-fm"}){const[a,l]=x.useState(null),[c,u]=x.useState(!1),[f,p]=x.useState(!1),[h,m]=x.useState(!1),y=x.useRef(r),[w,j]=x.useState(0),[k,S]=x.useState(0),[b,N]=x.useState(null),[E,C]=x.useState(null),[T,A]=x.useState({x:0,drop:0}),[I,B]=x.useState("ledge"),[q,L]=x.useState("left"),[U,X]=x.useState(0),Y=x.useRef(null),[M,J]=x.useState(()=>document.hidden);x.useEffect(()=>{const O=new Set,te=()=>{var ae;if(document.hidden){for(const he of((ae=Y.current)==null?void 0:ae.getAnimations({subtree:!0}))??[])if(he.playState==="running"||he.pending){const ge=he.currentTime;he.pause(),ge!==null&&(he.currentTime=ge),O.add(he)}}else{for(const he of O)he.playState==="paused"&&he.play();O.clear()}J(document.hidden)};return te(),document.addEventListener("visibilitychange",te),()=>document.removeEventListener("visibilitychange",te)},[a,c]);const[V,$]=x.useState(null),[z,W]=x.useState(xI),[G,F]=x.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});x.useEffect(()=>{var ae;const O=(ae=window.matchMedia)==null?void 0:ae.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const te=()=>F(O.matches);return te(),O.addEventListener("change",te),()=>O.removeEventListener("change",te)},[]);const K=x.useRef(null),de=x.useCallback(O=>{var te,ae;(ae=(te=K.current)==null?void 0:te.contentWindow)==null||ae.postMessage(O,a0)},[]),H=x.useRef(n);if(H.current=n,x.useEffect(()=>{f&&de(Ld("setVolume",[n]))},[n,f,de]),x.useEffect(()=>{let O=!0;const te=t??fetch,ae=y.current!==r;y.current=r,l(null),u(!1),p(ae),m(ae);const he=pV[r];if(he)te(he).then(ge=>ge.ok?ge.json():null).then(ge=>{O&&(ge!=null&&ge.video)&&l({live:!0,channel:"",video:ge.video})}).catch(()=>{});else if(r!=="claude-fm"){const ge=r.replace("lofi-","");te(`/api/lofi-girl?station=${encodeURIComponent(ge)}`).then(Te=>Te.ok?Te.json():null).then(Te=>{O&&(Te!=null&&Te.video)&&l({live:!0,channel:"",video:Te.video})}).catch(()=>{})}else te("/api/claude-fm").then(ge=>ge.ok?ge.json():null).then(ge=>{O&&(ge!=null&&ge.live)&&(ge!=null&&ge.channel)&&l({live:!0,channel:ge.channel})}).catch(()=>{});return()=>{O=!1}},[t,r]),x.useEffect(()=>{if(!f)return;const O=te=>{var he;if(te.origin!==a0||te.source!==((he=K.current)==null?void 0:he.contentWindow))return;const ae=_9(te.data);if(ae){if(ae.kind==="ready"){de(Ld("setVolume",[H.current])),de(Ld("playVideo"));return}if(ae.kind==="playing"){m(ae.playing);return}N9.includes(ae.code)&&(p(!1),m(!1),u(!0))}};return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[f,de]),x.useEffect(()=>{if(!a||c||G)return;const O=i2(document);let te=0;j(je=>te=je);const ae=je=>{var at,le;const[ve,...Ue]=je;if(!ve){N(null),C(null),Ve();return}N(ve.act),C(ve.prop),B(ve.place??"ledge"),X(ve.riser??0);const ke=De(ve),xe=te;if(ve.act==="kick"){const _e=(le=(at=Y.current)==null?void 0:at.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:le.getBoundingClientRect();_e&&A({x:uV(_e.x,s2(ve,xe,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-_e.y+24)})}const rt=ve.act==="walk"||ve.act==="carry"?dn(xe,ke):ve.ms;S(rt),L(_e=>s2({...ve,x:ke},xe,_e)),j(ke),te=ke,O.schedule(()=>ae(Ue),rt)},he=()=>{const je=Y.current,ve=je==null?void 0:je.querySelector(".fm-sprite"),Ue=je==null?void 0:je.parentElement;if(!je||!ve||!Ue)return null;const ke=je.getBoundingClientRect(),xe=Ue.getBoundingClientRect(),Ge=xe.right-ke.right,rt=xe.width-Ge*2-ve.offsetWidth;return rt>0?rt:null},ge=()=>{const je=Y.current,ve=je==null?void 0:je.querySelector(".fm-walker"),Ue=he();if(!je||!ve||Ue==null)return;const ke=je.getBoundingClientRect().bottom-ve.getBoundingClientRect().bottom;if(ke>0)return{ledgeH:ke,floorSpan:Ue}},Te=()=>{const je=Y.current,ve=document.querySelector(".autofit-chip");if(!je||!ve)return null;const Ue=je.getBoundingClientRect(),ke=ve.getBoundingClientRect();return ke.width<=0||ke.height<=0?null:{left:ke.left-Ue.right,right:ke.right-Ue.right,height:ke.height}},De=je=>{const ve=(je.place??"ledge")==="floor"?he()??Io:Io;return Math.max(-ve,Math.min(0,je.x))},Ve=()=>{O.schedule(()=>{const je=Q9(te,Math.random,ge()),ve=je.some(xe=>xe.place==="floor")?Te():null;let Ue=te;const ke=je.flatMap(xe=>{const Ge=Ue;return Ue=xe.x,xe.place==="floor"&&xe.act==="walk"?fV(Ge,xe.x,ve):[xe]});ae(ke)},C9(Math.random))};return Ve(),()=>{O.dispose(),B("ledge"),j(je=>Math.max(-Io,Math.min(0,je))),S(0),N(null),C(null),X(0)}},[a,c,G]),x.useEffect(()=>{if(!h||G){$(null);return}const O=i2(document),te=ae=>{const he=sV(ae,Math.random);$(he.dance),W(he.beatMs),O.schedule(()=>te(he.dance),aV(Math.random))};return te(null),()=>O.dispose()},[h,G]),!a||c)return null;const Q=()=>{if(!f){p(!0),m(!0);return}const O=!h;m(O),de(Ld(O?"playVideo":"pauseVideo")),O||p(!1)};return o.jsxs("div",{ref:Y,className:"fm","data-suspended":M?"":void 0,"data-place":I,style:{"--fm-beat":`${z}ms`},children:[E&&!E.held&&o.jsx("div",{className:"fm-prop","data-prop":E.kind,"data-leaving":E.leaving?"":void 0,style:{"--fm-prop-x":`${E.at}px`,"--fm-roll-to":`${T.x}px`,"--fm-ball-drop":`${T.drop}px`,"--fm-ball-flight-ms":`${yI}ms`,"--fm-ball-turn":q==="right"?"1080deg":"-1080deg"},children:c2[E.kind]}),(b==="lasso"||b==="rope-throw"||b==="rope-catch"||b==="climb"||b==="pull-up")&&o.jsxs("div",{className:"fm-rope","data-act":b,style:{"--fm-rope-x":`${w}px`,"--fm-rope-ms":`${k}ms`},children:[o.jsx("div",{className:"fm-rope-line"}),o.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),o.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),o.jsxs("div",{className:"fm-walker","data-act":b??void 0,"data-place":I,"data-facing":q,style:{"--fm-x":`${w}px`,"--fm-walk-ms":`${k}ms`,"--fm-riser":`${U}px`,"--fm-skip-beat":`${wI}ms`},children:[(E==null?void 0:E.held)&&o.jsx("div",{className:"fm-held","data-prop":E.kind,"data-toss":E.leaving?"":void 0,children:c2[E.kind]}),["cast","fish","reel","stow"].includes(b)&&o.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsxs("g",{children:[o.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),o.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),o.jsxs("g",{className:"fm-fishing-line",children:[o.jsx("path",{d:"M8 2V26"}),o.jsxs("g",{className:"fm-float",children:[o.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),o.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),o.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(b)&&o.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),o.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),o.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),o.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),o.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),o.jsx("button",{type:"button",className:"fm-sprite","data-playing":h?"":void 0,"data-dance":h?V??vI[0]:void 0,"aria-pressed":h,onClick:Q,title:h?`Stop ${wc[r]}`:`Play ${wc[r]} — streams from YouTube`,"aria-label":h?`Stop ${wc[r]}`:`Play ${wc[r]}`,children:o.jsxs("svg",{viewBox:`0 0 ${QT} ${S9}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("g",{className:"fm-gear",children:o.jsx("g",{className:"fm-gear-motion",children:mV.map(O=>o.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,className:mx[O.cell]},`g${O.y}-${O.x}`))})}),o.jsxs("g",{className:"fm-body",children:[l2.map(O=>o.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,fill:"var(--accent)"},`eye-bed-${O.x}`)),yV.map(O=>o.jsx("rect",{x:O.x,y:O.y,width:O.w,height:1,className:mx[O.cell]},`b${O.y}-${O.x}`)),o.jsxs("g",{className:"fm-arms",children:[o.jsx("rect",{x:4,y:8,width:2,height:2}),o.jsx("rect",{x:12,y:8,width:1,height:2}),o.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),l2.map(O=>o.jsx("rect",{x:O.x-(O.x>=QT/2?1:0)+(q==="right"?1:0),y:O.y,width:O.w,height:1,className:"fm-eye"},`eye-${O.x}`))]}),o.jsx("g",{className:"fm-hat",children:gV.map(O=>o.jsx("rect",{x:iV+O.x,y:lV+O.y,width:O.w,height:1,className:O.cell==="k"?"fm-hatband":void 0},`h${O.y}-${O.x}`))}),(b==="climb"||b==="rope-throw"||b==="rope-catch"||b==="pull-up")&&o.jsxs("g",{className:"fm-grip",children:[o.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),o.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),(b==="land"||b==="dismount")&&o.jsxs("g",{className:"fm-crouch-legs",children:[o.jsx("path",{d:"M6 11H8V13H6Z"}),o.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(b)&&o.jsxs("g",{className:"fm-seated-legs",children:[o.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),o.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(O=>o.jsx("g",{className:"fm-leg","data-side":O,children:wV[O].map(te=>o.jsx("rect",{x:te.x,y:te.y,width:te.w,height:1,className:mx[te.cell]},`${O}${te.y}-${te.x}`))},O))]})})]}),f&&(a.channel||a.video)&&o.jsx("iframe",{ref:K,className:"fm-frame",title:wc[r],src:v9(a.channel,window.location.origin,a.video),onLoad:()=>de(x9()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})}),xV=15e3;function bV(e){return e.visibilityState==="visible"&&e.hasFocus()}function kV(e,t){return t||e===!0}function NV(){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 _V={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4","3.26.0","3.26.1","3.26.3","3.26.4","3.26.5","3.27.6"],"3.27.0":[{title:"📊 Projects: where each account spent its work",body:"Each account card's ⋯ menu now breaks its cost down by project, over 7d / 30d / all."}],"3.27.1":[{title:"🎨 Make Appearance easier to tune",body:"The Appearance dialog now has clearer sections, stronger selection states, and a calmer layout for choosing a theme and configuring music. Your existing settings and keyboard shortcuts continue to work."}],"3.27.2":[{title:"💰 Project costs now match Usage",body:"Project cost totals no longer count the same Claude request once for every content block. Existing project history is rebuilt automatically so the totals align with the Usage panel."}],"3.27.3":[{title:"🎵 Station selection works in the desktop app",body:"The music station picker now opens inside ccdeck instead of relying on the operating system popup, so choosing a station works reliably in the Electron app."}],"3.27.4":[{title:"✅ Desktop picker release checks are green",body:"The station picker now keeps the same keyboard, motion, focus, and layout behavior as the rest of ccdeck across desktop and browser builds."}],"3.27.5":[{title:"🧭 The welcome tour stays dismissed",body:"Electron now remembers that you completed the onboarding tour at the deck level, so an update or loopback port change no longer shows the same tour again."},{title:"🎵 The station picker has a clearer finish",body:"The music selector has a tighter trigger, a purposeful chevron, and more deliberate option spacing so it reads like a native part of Appearance."}],"3.25.0":[{title:"🖱️ A click goes to the session, a double-click opens the details",body:"Clicking a card frames it with the rest of its session and leaves the detail panel shut. Double-click a card to open its details; `j`/`k`, the session list, Enter and `D` still open them too."},{title:"🔭 Cards stay readable when you zoom out",body:"At every zoom a card shows its name, its state and anything waiting on you, instead of shrinking to a coloured pill. Hover or focus a card to see it whole. Recap notes read at a distance too, and show the full recap on hover."},{title:"🌐 The Machine panel shows your network",body:"A new Network section shows download, upload and the round trip to Claude's API, and names the route when traffic goes through a VPN or a Tailscale exit node. Those checks run only while the panel is open. The panel is regrouped into CPU, Memory, Network and Thermal, with a flag at the top when something needs attention."},{title:"🎨 See each theme before you pick it",body:"The Appearance menu shows a small preview of the deck in Light and in Dark. Claude FM also keeps its volume when a notification chime plays, instead of dipping under it."}],"3.24.1":[{title:"🎛️ Appearance is one small menu now",body:"The topbar's appearance control opens a compact menu where you can choose Light or Dark and show or hide the character. The character stays on by default, and your choice is remembered."}],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
93
-
94
- A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
95
-
96
- The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
97
-
98
- Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
99
-
100
- With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
101
-
102
- Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
103
-
104
- **This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
105
-
106
- \`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.
107
-
108
- **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.
109
-
110
- 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.
111
-
112
- 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.
113
-
114
- 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.
115
-
116
- 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.
117
-
118
- 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.
119
-
120
- 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.
121
-
122
- What you are reading is the first version that does not.
123
-
124
- 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.
125
-
126
- 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.
127
-
128
- 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.
129
-
130
- 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.
131
-
132
- 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.
133
-
134
- The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
135
-
136
- **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.
137
-
138
- 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.
139
-
140
- \`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.
141
-
142
- 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.
143
-
144
- **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.
145
-
146
- **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.
147
-
148
- **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.
149
-
150
- **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.
151
-
152
- **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.
153
-
154
- **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.
155
-
156
- 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.
157
-
158
- 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.
159
-
160
- 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.
161
-
162
- 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.
163
-
164
- 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.
165
-
166
- 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.
167
-
168
- 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.
169
-
170
- 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.
171
-
172
- 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.
173
-
174
- 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.
175
-
176
- 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.
177
-
178
- 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.
179
-
180
- 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.
181
-
182
- 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.
183
-
184
- 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.
185
-
186
- 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.
187
-
188
- 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.
189
-
190
- 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.
191
-
192
- 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.
193
-
194
- 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.
195
-
196
- 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.
197
-
198
- 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.
199
-
200
- 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.
201
-
202
- 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.
203
-
204
- 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.
205
-
206
- 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.
207
-
208
- 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.
209
-
210
- 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.
211
-
212
- 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.
213
-
214
- 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.
215
-
216
- 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.
217
-
218
- 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.
219
-
220
- 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.
221
-
222
- 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.
223
-
224
- 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.
225
-
226
- 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.
227
-
228
- 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.
229
-
230
- 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.
231
-
232
- 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.
233
-
234
- 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".
235
-
236
- 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.
237
-
238
- 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.
239
-
240
- 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.
241
-
242
- 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.
243
-
244
- 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.
245
-
246
- 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.
247
-
248
- 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.
249
-
250
- 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.
251
-
252
- 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.
253
-
254
- 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.
255
-
256
- 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.
257
-
258
- 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.
259
-
260
- 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.
261
-
262
- 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.
263
-
264
- 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.
265
-
266
- 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.
267
-
268
- 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.
269
-
270
- 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.
271
-
272
- 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.
273
-
274
- 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.
275
-
276
- The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
277
-
278
- It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
279
-
280
- While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
281
-
282
- It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
283
-
284
- Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},mb="agent-dag.releaseNotesSeen";function u2(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function il(e,t){const n=u2(e),r=u2(t);for(let a=0;a<Math.max(n.length,r.length);a++){const l=(n[a]??0)-(r[a]??0);if(l!==0)return l<0?-1:1}return 0}function ll(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function SV(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 jV(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!ll(n)||!Array.isArray(r))continue;const a=r.filter(SV);a.length&&t.push({version:n,notes:a})}return t.sort((n,r)=>il(r.version,n.version))}const d2=jV(_V);function bI(e,t,n){return e.filter(r=>il(r.version,n)<=0&&(t===null||il(r.version,t)>0))}function EV(e,t){return e.filter(n=>il(n.version,t)===0)}function CV(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 TV({since:e,running:t,entries:n,firstRun:r}){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(r&&ll(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(!ll(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=il(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 AV=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function RV(e){const t=AV.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function h2(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function MV(e){if(!e)return null;let t=null;try{t=e.getItem(mb)}catch{return null}return ll(t)?t:null}function IV(e){if(!e)return!1;try{return e.getItem(mb),!0}catch{return!1}}function $V(e,t){if(!e)return!1;try{return e.setItem(mb,t),!0}catch{return!1}}const kI="agent-dag.tourSeen";function OV(e){if(!e)return!1;try{return e.getItem(kI)==="1"}catch{return!1}}function LV(e){if(!e)return!1;try{return e.setItem(kI,"1"),!0}catch{return!1}}function PV({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 DV({stored:e,running:t,notes:n,remembers:r=!0}){if(!ll(t))return{show:[],record:null,reason:"no-version"};if(!ll(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=EV(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=il(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=bI(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function FV(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const r=e.indexOf("`",n+1);if(r<0)break;n=r+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function NI(e,t=!0){const n=[];let r="";const a=()=>{r&&(n.push({kind:"text",text:r}),r="")};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=FV(e,l);if(c>0){a(),n.push({kind:"bold",kids:NI(e.slice(l+2,c),!1)}),l=c+2;continue}}r+=e[l],l+=1}return a(),n}function qV({entries:e,since:t,running:n,firstRun:r,onClose:a,onTour:l,onRestart:c}){const u=sn(a),f=CV(e);return o.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:o.jsxs("div",{ref:u,className:"modal release-notes",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),f&&o.jsx("span",{className:"modal-tool-id",children:f})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsx("p",{className:"modal-note",children:TV({since:t,running:n,firstRun:r,entries:e})}),l&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),c&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),o.jsx("button",{type:"button",className:"btn",onClick:c,children:"Restart"})]}),e.map(p=>o.jsxs("section",{className:"modal-section",children:[o.jsxs("h3",{className:"rn-version",children:["v",p.version]}),o.jsx("ul",{className:"rn-notes",children:p.notes.map((h,m)=>{const{icon:y,rest:w}=RV(h.title);return o.jsxs("li",{className:"rn-note",children:[o.jsxs("p",{className:"rn-note-title",children:[y&&o.jsx("span",{className:"rn-note-icon",children:y}),w]}),o.jsx("p",{className:"rn-note-body",children:_I(NI(h.body))})]},m)})})]},p.version))]})]})})}function _I(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?o.jsx("code",{className:"rn-code",children:t.text},n):o.jsx("strong",{className:"rn-strong",children:_I(t.kids)},n))}function BV(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function zV(e,t,n){var c;if(e.length===0)return null;const r=BV(e),a=t?r.findIndex(u=>u.id===t):-1,l=a===-1?n===1?0:r.length-1:(a+n+r.length)%r.length;return((c=r[l])==null?void 0:c.id)??null}const HV=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function UV(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:HV.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const WV=new Set(["","BODY","HTML","#DOCUMENT"]);function VV(e){return!e||O0(e)?!1:!WV.has(String(e.tagName??"").toUpperCase())}function GV(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||r.has(c.parentId))break;r.add(c.parentId),a=c.parentId}let l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&r.has(c.parentId)&&!r.has(c.id)&&(r.add(c.id),l=!0)}return r}function KV(e,t){const n=new Set;for(const r of t){const a=GV(e,r);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}const YV=40,XV=120;function ZV(e,t){let n=null,r=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(r<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));r=f,n=t.setTimeout(l,m)};return{live(f=YV){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=XV){c(),r=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const QV=1e3;function JV(e={}){const t=Math.max(1,Math.floor(e.limit??QV)),n=e.protect;let r=!1,a=[],l=new Set,c=0,u=0,f=null;return{get paused(){return r},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let j=0;if(l.size<a.length)for(;l.has(a[j]);)j++;const[k]=a.splice(j,1);l.delete(k),c++}return!1},setPaused(p){if(r=p,p)return[];const h=a;return a=[],l=new Set,c=0,h}}}const SI="agent-dag.theme";function eG(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function tG(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function nG(){return eG(ks(SI),tG())}const rG=6,sG="ccdeck-tabs";function aG(e){return e>=rG}function oG(e,t,n){const r=a=>{const l=a.data;(l==null?void 0:l.kind)==="who"&&l.from!==t&&e.postMessage({kind:"here",from:t,to:l.from,streaming:n()})};return e.addEventListener("message",r),{ask(a,l=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),l(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",r),(a=e.close)==null||a.call(e)}}}function iG({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${nn}`:nn,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Dd={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Fd(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 lG=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.idle,"idle"))}`}),cG="No sessions are waiting for you.";function uG(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const r=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${r} are waiting for your permission.`}function dG(e,t){return t!==""?t:e===""?"":cG}const f2="agent-dag.browserWatch.seenMs";function hG(e,t){return e.filter(n=>n.startMs>t)}function fG(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 r=[...n].sort((a,l)=>(a.at??0)-(l.at??0));return{request:r[0],waiting:r.length-1}}function pG({request:e,waiting:t,busy:n,now:r,onAccept:a,onDecline:l,onLater:c}){const u=x.useRef(null),f=sn(c,{focusRef:u}),p=Fa(n,"accept"),h=Fa(n,"dismiss");return o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0}),o.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("p",{className:"lan-ask-who",children:[o.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",o.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Y0(e.at,r)]}),o.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."}),o.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",o.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&o.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.`}),o.jsxs("div",{className:"lan-ask-acts",children:[o.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"}),o.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"})]})]})]})})}const mG=600;function i0(e,t){return!(e.exitAt!=null&&t-e.exitAt>mG||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function gG(e,t){const n=new Set;for(const r of e.agents.values())i0(r,t)&&n.add(r.id);return n}function yG(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 wG(e,t,n=0){if(!e)return!1;for(const r of t)if(yG(e,r,n))return!0;return!1}const jI="sessionGroup";function vG(e,t){var r,a;if(e.type===jI)return"transparent";if(Sr((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const EI=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function p2(e){const t={};for(const n of EI)t[n]=e(n);return t}function xG(e){return t=>e[t]??""}function bG(e,t){return EI.every(n=>e[n]===t[n])}function kG(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&r.set(a,l);return{positions:n,pinned:r}}function m2(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function NG(e){const t={positions:[],pins:[]};if(!e)return t;let n;try{n=JSON.parse(e)}catch{return t}if(!n||typeof n!="object")return t;if(!("v"in n)){const a=m2(n);return{positions:a,pins:a.map(([l])=>l)}}const r=n;return{positions:m2(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function _G(e,t){const n={};for(const[r,a]of e)n[r]=a;for(const[r,a]of t)n[r]=a;return JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())})}function SG(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}const CI=.2,TI=1.6;function jG(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:r,zoom:a}=t;return typeof n!="number"||typeof r!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||a<CI||a>TI?null:{x:n,y:r,zoom:a}}const EG=1200,CG=1e3;function gx(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<EG?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<CG}function qd({durationMs:e,documentHidden:t,reducedMotion:n=TG()}){return t||n?!1:Number.isFinite(e)&&e>0}function TG(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function AG(e,t,n){const r=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&&r<n.width&&c>0&&a<n.height}function RG({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 r=!1;for(const a of n)if(r=!0,AG(a,t,e))return!1;return r}const gb=11,AI=7.2,RI=6.6,MG={width:104,height:48},g2={width:96,height:44},MI={width:220,height:103};function IG(e){let t=1/0,n=1/0;for(const r of e)!(r.width>0)||!(r.height>0)||(t=Math.min(t,r.width),n=Math.min(n,r.height));return!Number.isFinite(t)||!Number.isFinite(n)?MI:{width:Math.max(160,t),height:Math.max(72,n)}}function yx(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function $G(e,t,n=MI){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=gb*t;return e==="detail"?r>=RI?"detail":yx(n,t,g2)?"compact":"overview":r>=AI?"detail":e==="compact"?yx(n,t,g2)?"compact":"overview":yx(n,t,MG)?"compact":"overview"}const OG=AI/gb,LG=RI/gb;function PG(e,t){return e>=OG?e:Math.max(e,Math.min(t,LG-.001))}const DG=.8,FG=1;function qG(e){const t=e.minZoom??DG,n=e.maxZoom??FG,r=e.fill??.9,a=e.insets.left,l=e.insets.top,c=Math.max(1,e.pane.width-e.insets.left-e.insets.right),u=Math.max(1,e.pane.height-e.insets.top-e.insets.bottom),f=e.context,p=e.anchor,h=Math.min(c/Math.max(1,f.width),u/Math.max(1,f.height))*r,m=Math.max(t,Math.min(n,h)),y=(w,j,k,S,b,N)=>{let E=w+(j-S*m)/2-k*m;const C=b*m+E,T=(b+N)*m+E;return N*m<=j?C<w?E+=w-C:T>w+j&&(E-=T-(w+j)):E+=w-C,E};return{x:y(a,c,f.x,f.width,p.x,p.width),y:y(l,u,f.y,f.height,p.y,p.height),zoom:m}}function BG(e){let t=1/0,n=1/0,r=-1/0,a=-1/0;for(const l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x+l.width),a=Math.max(a,l.y+l.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:a-n}:null}let $o=null,Ui=null;const l0=new Set,c0=()=>{for(const e of l0)e()},zG=e=>(l0.add(e),()=>{l0.delete(e)}),y2=()=>$o,HG=90;function II(e){!Ui||e!=null&&Ui.at.id!==e||(clearTimeout(Ui.timer),Ui=null)}function w2(e,t,n="pointer"){II();const r={id:e,anchor:t,by:n};if($o||n==="focus"){$o=r,c0();return}Ui={at:r,timer:setTimeout(()=>{Ui=null,$o=r,c0()},HG)}}function Ca(e){II(e),!(!$o||e!=null&&$o.id!==e)&&($o=null,c0())}function UG({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const a=x.useSyncExternalStore(zG,y2,y2),l=a?e(a.id):void 0,c=a&&!l?t(a.id):void 0,u=a!=null&&(!l&&!c||!a.anchor.isConnected);return x.useEffect(()=>{u&&a&&Ca(a.id)},[u,a]),!a||u?null:l?o.jsx(VG,{a:l,anchor:a.anchor,parentLabel:l.parentId?n(l.parentId):void 0,bounds:r},a.id):c?o.jsx(WG,{r:c,anchor:a.anchor,bounds:r},a.id):null}function $I(e,t){const n=x.useRef(null),r=x.useCallback(()=>{const a=n.current;if(!a||!e.isConnected)return;const l=U0(e.getBoundingClientRect(),{width:a.offsetWidth,height:a.offsetHeight},t());a.style.top=`${l.top}px`,a.style.left=`${l.left}px`,a.style.maxHeight=l.maxHeight==null?"":`${l.maxHeight}px`,a.dataset.side=l.side},[e,t]);return x.useLayoutEffect(()=>{r()}),n}function WG({r:e,anchor:t,bounds:n}){const r=$I(t,n),a=dl(3e4),l=ch(e.recap.at,a);return Sn.createPortal(o.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsxs("span",{className:"recap-peek-mark",children:[o.jsx(Dc,{}),"recap"]}),o.jsx("span",{className:"node-peek-time",title:l.title,children:l.label})]}),e.sessionLabel&&o.jsx("div",{className:"node-peek-kind",children:o.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),o.jsx("p",{className:"recap-peek-text",children:e.recap.text}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function VG({a:e,anchor:t,parentLabel:n,bounds:r}){const a=$I(t,r),l=dl(1e3),c=I0(e.sessionName,e.sessionTitle),u=e.tools.filter(j=>j.ok===!1).length,f=e.tools.filter(j=>!j.endedAt).length,p=Vn(e,l).total,h=e.usage.inputTokens+e.usage.outputTokens,m=e.kind==="root"&&Sr(e.waiting),y=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",w=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,f>0?`${f} in-flight`:null,h>0?`${Ut(h)} tok`:null,p>0?`${lt(p)}${Pc(e,l)>0?"+":""}`:null].filter(Boolean).join(" · ");return Sn.createPortal(o.jsxs("div",{ref:a,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsx("span",{className:"node-peek-name",children:e.label}),o.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",el(e.startedAt,e.endedAt,l)]})]}),o.jsxs("div",{className:"node-peek-kind",children:[o.jsxs("span",{className:"node-peek-state","data-kind":Hx(e.state),children:[o.jsx(jR,{kind:Hx(e.state)}),nl(e.state)]}),o.jsx("span",{children:y}),e.model?o.jsx("span",{children:Da(e.model)}):null]}),e.kind==="root"&&c.face&&o.jsx("p",{className:"node-peek-title",children:c.face}),e.kind==="root"&&e.waiting&&o.jsxs("p",{className:`node-peek-wait${m?" warn":""}`,children:[m&&o.jsx(F0,{}),o.jsx("span",{children:q0(e.waiting)}),o.jsx("b",{children:el(e.waiting.since,void 0,l)})]}),o.jsxs("p",{className:"node-peek-facts",children:[w,u>0&&o.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&o.jsx("p",{className:"node-peek-branch",children:vR(e.branch)}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}const GG="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",wx="click for what's new";function KG(e){if(e.checkDisabled)return`${GG} · ${wx}`;if(e.checking)return`Asking npm for the newest release… · ${wx}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${wx}, and to check npm now`}function YG(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function XG(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 OI(e){return e?`${e.kind}:${e.to}`:""}function ZG(e,t){return e!=null&&t!==OI(e)}function QG(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 u0={kind:"assumed",claude:!0,codex:!0};function JG(e){if(!e||typeof e!="object")return u0;const t=e.providers;if(!t||typeof t!="object")return u0;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function eK(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const v2={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function tK(e){const t=e.toLowerCase();return Object.hasOwn(v2,t)?v2[t]:t?t[0].toUpperCase()+t.slice(1):""}function nK(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function GK(e,t=[]){const n=t.length?nK(t.map(tK)):eK(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function rK(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 sK(e,t){const n=t.prefs??s0,r=Wc(n.done.level),a=Wc(n["needs-input"].level),l=r===a?`${r}%`:`${r}% 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?`
285
-
286
- 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?`
287
-
288
- 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+`
289
-
290
- Click to set the volume and the sound of each tone, and to hear either one.`}function xh(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const x2=99;function aK(e){const t=Math.max(0,Math.floor(e));return t>x2?`${x2}+`:String(t)}const oK="Pause the canvas";function iK(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 — ${xh(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)":`${xh(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function lK(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 LI="paused · full",cK=(e,t)=>t>0?LI:e>0?`paused · ${aK(e)}`:"paused";function uK(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:cK(e.held,t),widest:LI,title:t>0?`Connected — the pause is full at ${xh(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${xh(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}const dK=x.lazy(()=>T2(()=>import("./UsageHistoryModal-DuvLGQcU.js"),[])),hK=x.lazy(()=>T2(()=>import("./BrowserWatchModal-Co4YHA59.js"),[]));function b2(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const fK={agent:nF,sessionGroup:$F,recapNote:LF},pK={recapTie:PF},PI="react-flow__node";function vx(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,PI))===!0}const xx=80,bx=.86;function k2(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const r of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=r.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function mK(e){try{const t=document.querySelector(`.${PI}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const gK=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),yK=420,Bd=18,N2=400,kx=450,yb="agent-dag.layout",wb="agent-dag.layoutFrame",vb="agent-dag.viewport",DI="agent-dag.sessionListOpen",FI="agent-dag.detailOpen",qI="agent-dag.usagePanelOpen",BI="agent-dag.systemPanelOpen",_2="agent-dag.accountsPanelOpen",Nx="agent-dag.versionNoticeDismissed",S2="agent-dag.oldNameNoticeDismissed",wK=15*6e4,_x={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"},zd="agent-dag.autoRestart",j2="agent-dag.bundleReloadedFor";function vK(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(DI)==="1"}catch{return!1}}function xK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(DI,e?"1":"0")}catch{}}function bK(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(FI)==="1"}catch{return!1}}function kK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(FI,e?"1":"0")}catch{}}function NK(){const e=ks(qI);return e===null?!0:e==="1"}function _K(e){if(!(typeof window>"u"))try{window.localStorage.setItem(qI,e?"1":"0")}catch{}}function SK(){const e=ks(BI);return e===null?!0:e==="1"}function jK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(BI,e?"1":"0")}catch{}}function EK(){if(typeof window>"u")return{positions:[],pins:[]};try{return NG(window.localStorage.getItem(yb))}catch{return{positions:[],pins:[]}}}function Hd(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(yb,_G(e,t))}catch{}}function CK(){if(typeof window>"u")return null;try{return SG(window.localStorage.getItem(wb))}catch{return null}}function TK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wb,JSON.stringify(e))}catch{}}function AK(){if(typeof window>"u")return null;try{return jG(window.localStorage.getItem(vb))}catch{return null}}function RK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vb,JSON.stringify(e))}catch{}}function E2(){if(!(typeof window>"u")){try{window.localStorage.removeItem(yb)}catch{}try{window.localStorage.removeItem(vb)}catch{}try{window.localStorage.removeItem(wb)}catch{}}}function MK(e,t){const n=I7(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),a=new Blob([r],{type:"application/json"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=$7(n.label,t),document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(l),1e3)}const zI={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},IK={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function $K({cat:e}){return o.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:IK[e]})})}const bh={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},HI=bR;function OK(){return o.jsx(T0,{children:o.jsx(DK,{})})}const LK=e=>e.transform[2]>=e.maxZoom,PK=e=>e.transform[2]<=e.minZoom;function DK(){var Ru,Mu,mi,Fr;const e=Th(),t=mt(LK),n=mt(PK),r=Gt(),a=x.useState(Bx)[0],l=x.useRef(a),[,c]=x.useState(0),u=x.useCallback(()=>c(D=>D+1),[]),[f,p]=x.useState(bK);x.useEffect(()=>{kK(f)},[f]);const[h,m]=x.useState(()=>new Set),[y,w]=x.useState(null),[j,k]=x.useState(null),S=x.useCallback((D,P,re=!P)=>{m(oe=>{if(!P)return new Set([D]);const we=new Set(oe);return we.has(D)?we.delete(D):we.add(D),we}),w(oe=>P&&oe===D?oe:D),!P&&re&&p(!0)},[]),b=x.useCallback(()=>{m(new Set),w(null)},[]),[N,E]=x.useState(null),[C,T]=x.useState(null),A=x.useCallback(D=>T(D),[]),[I,B]=x.useState(!1),[q,L]=x.useState(!1),[U,X]=x.useState(!1),Y=x.useRef(null),[M,J]=x.useState(vK);x.useEffect(()=>{xK(M)},[M]);const[V,$]=x.useState(NK);x.useEffect(()=>{_K(V)},[V]);const[z,W]=x.useState(SK);x.useEffect(()=>{jK(z)},[z]);const G=x.useRef(!1),[F,K]=x.useState(()=>{const D=(()=>{try{const P=window.localStorage.getItem(_2);return P===null?!0:P==="1"}catch{return!0}})();return D&&M?(G.current=!0,!1):D});x.useEffect(()=>{if(!(!F&&G.current))try{window.localStorage.setItem(_2,F?"1":"0")}catch{}},[F]),x.useEffect(()=>{!M&&G.current&&(G.current=!1,K(!0))},[M]);const de=Fp(F,200),H=Fp(V,130),Q=Fp(z,130),[O,te]=x.useState(null);x.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}te(D===null?!0:D==="on")},[]);const ae=x.useCallback(()=>{te(D=>{var re;const P=D!==!0;try{localStorage.setItem("agent-dag.sound",P?"on":"off")}catch{}return P&&((re=Ie.current)==null||re.unlock()),P})},[]),he=x.useCallback(D=>{ae()},[ae]),ge=x.useRef(he);ge.current=he;const Te=x.useRef(O);Te.current=O;const[De,Ve]=x.useState(()=>e9(ks)),je=x.useRef(De);je.current=De;const ve=x.useRef(null),Ue=x.useCallback((D,P=!1)=>{var re,oe;if((re=Ie.current)==null||re.unlock(),ve.current!==null&&clearTimeout(ve.current),ve.current=null,!P){(oe=Ie.current)==null||oe.play(D,!0);return}ve.current=setTimeout(()=>{var we;ve.current=null,(we=Ie.current)==null||we.play(D,!0)},Y7)},[]),ke=x.useCallback((D,P)=>{Ve(re=>{const oe={level:Wc(P.level??re[D].level),figure:oI(D,P.figure??re[D].figure)};try{localStorage.setItem(lI[D],String(oe.level)),localStorage.setItem(cI[D],oe.figure)}catch{}return{...re,[D]:oe}}),Ue(D,!0)},[Ue]);x.useEffect(()=>()=>{ve.current!==null&&clearTimeout(ve.current)},[]);const[xe,Ge]=x.useState(!1),rt=x.useRef(null),[at,le]=x.useState(!1),_e=x.useRef(null);x.useEffect(()=>{xe&&le(!1)},[xe]);const Ie=x.useRef(null),[Ze,We]=x.useState("locked");x.useEffect(()=>{const D=n9({enabled:()=>Te.current===!0,prefs:()=>je.current,onState:We});Ie.current=D,We(D.state());const P=()=>D.unlock();return window.addEventListener("pointerdown",P,{once:!0,capture:!0}),window.addEventListener("keydown",P,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",P,{capture:!0}),window.removeEventListener("keydown",P,{capture:!0})}},[]);const[Je,ye]=x.useState(!1),[Me,Qe]=x.useState(!1),[ue,kt]=x.useState(null),[pt,ut]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Nx)??""}catch{return""}}),[Bt,jt]=x.useState(!1),vt=x.useRef(0),[an,jn]=x.useState(!1),Nt=x.useCallback((D=!1)=>(D&&(vt.current=Date.now(),jn(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(P=>P.ok?P.json():null).then(P=>{P&&kt(P)}).catch(()=>{}).finally(()=>{D&&jn(!1)})),[]),Yt=x.useCallback(()=>{Nt(Date.now()-vt.current>=wK)},[Nt]);x.useEffect(()=>{Nt();const D=window.setInterval(Yt,5*6e4),P=()=>{document.visibilityState==="visible"&&Yt()};return document.addEventListener("visibilitychange",P),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",P)}},[Nt,Yt]),x.useEffect(()=>{Je&&Nt()},[Je,Nt]),x.useEffect(()=>{const D=NV();let P=null;const re=Le=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:D,looking:Le}),keepalive:!0}).catch(()=>{})},oe=()=>{const Le=bV(document);kV(P,Le)&&re(Le),P=Le},we=()=>{P&&re(!1),P=!1};oe();const Ce=window.setInterval(oe,xV);return window.addEventListener("focus",oe),window.addEventListener("blur",oe),document.addEventListener("visibilitychange",oe),window.addEventListener("pagehide",we),()=>{window.clearInterval(Ce),window.removeEventListener("focus",oe),window.removeEventListener("blur",oe),document.removeEventListener("visibilitychange",oe),window.removeEventListener("pagehide",we),we()}},[]);const fe=(ue==null?void 0:ue.notice)??null,[st,It]=x.useState(null),Et=x.useRef(!1),[En,Gn]=x.useState(null);x.useEffect(()=>{fetch("/api/prefs").then(D=>D.ok?D.json():null).then(D=>{var P;return Gn(typeof((P=D==null?void 0:D.prefs)==null?void 0:P.tourSeen)=="boolean"?D.prefs.tourSeen:!1)}).catch(()=>Gn(!1))},[]),x.useEffect(()=>{if(Et.current||En===null)return;const D=h2(),P=MV(D),re=DV({stored:P,running:(ue==null?void 0:ue.running)??null,notes:d2,remembers:IV(D)});if(re.reason==="no-version")return;if(Et.current=!0,re.record&&$V(D,re.record),En)try{D==null||D.setItem("agent-dag.tourSeen","1")}catch{}const oe=PV({tourSeen:OV(D),decision:re}),we=re.show.length?{entries:re.show,since:P,firstRun:!1}:null;oe.tour&&X(!0),oe.notes==="now"?It(we):oe.notes==="after"&&(Y.current=we)},[En,ue==null?void 0:ue.running]);const St=(ue==null?void 0:ue.running)??"3.27.6",lr=x.useMemo(()=>bI(d2,null,St),[St]),yn=x.useCallback(()=>{It({entries:lr,since:null,firstRun:!1})},[lr]),[Xt,Cn]=x.useState(null),[zt,In]=x.useState(u0);x.useEffect(()=>{let D=!1;return fetch("/api/health").then(P=>P.ok?P.json():null).then(P=>{D||(In(JG(P)),!(!P||typeof P.workspace!="string")&&Cn(P.workspace))}).catch(()=>{}),()=>{D=!0}},[Je]);const Kn=x.useRef(zt);Kn.current=zt;const cr=OI(fe),$n=ZG(fe,pt),ea=x.useCallback(()=>{ut("");try{window.localStorage.setItem(Nx,"")}catch{}},[]),ta=x.useCallback(()=>{if(fe){ut(cr);try{window.localStorage.setItem(Nx,cr)}catch{}}},[fe,cr]),[_s,On]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(S2)??""}catch{return""}}),wn=ue!=null&&ue.invokedAs&&ue.invokedAs!==nn?ue.invokedAs:null,ee=wn!=null&&_s!==wn,Ae=x.useCallback(()=>{if(wn){On(wn);try{window.localStorage.setItem(S2,wn)}catch{}}},[wn]),Oe=((Ru=ue==null?void 0:ue.upgrade)==null?void 0:Ru.state)??"idle",Re=Pz(ue==null?void 0:ue.upgrade),ze=x.useRef(!1),dt=x.useCallback(async()=>{if(Ks(ze.current||Oe==="running")){ze.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Nt(),ze.current=!1}},[Oe,Nt]);x.useEffect(()=>{if(Oe!=="running")return;const D=window.setInterval(Nt,3e3);return()=>window.clearInterval(D)},[Oe,Nt]);const yt=x.useCallback(async()=>{const D=ue==null?void 0:ue.command;!D||!await sl(D)||(jt(!0),window.setTimeout(()=>jt(!1),1600))},[ue==null?void 0:ue.command]),Ct=x.useCallback(()=>{J(D=>(D||K(P=>(P&&(G.current=!0),!1)),!D))},[]),gt=x.useCallback(()=>{G.current=!1,K(D=>(D||J(!1),!D))},[]),[xt,Ar]=x.useState(!1),[Ss,ns]=x.useState(!1),[Ba,Wo]=x.useState(()=>{try{return Number(localStorage.getItem(f2))||0}catch{return 0}}),[js,Ln]=x.useState([]),[Es,Pn]=x.useState(!1);x.useEffect(()=>{let D=!0;const P=()=>{fetch("/api/browser-watch?live=0").then(oe=>oe.ok?oe.json():null).then(oe=>{var we;!D||!(oe!=null&&oe.ok)||(Ln(oe.episodes??[]),Pn(((we=oe.settings)==null?void 0:we.enabled)===!0))}).catch(()=>{})};P();const re=setInterval(P,5*6e4);return()=>{D=!1,clearInterval(re)}},[]);const[rf,Vo]=x.useState([]),su=x.useRef(new Set),[Cs,za]=x.useState(null);x.useEffect(()=>{let D=!0,P=0;const re=()=>{fetch("/api/lan").then(oe=>oe.ok?oe.json():null).then(oe=>D?(oe!=null&&oe.ok&&Vo(y_(Array.isArray(oe.pending)?oe.pending:[],oe.aliases)),oe):null).catch(()=>null).then(oe=>{D&&(P=window.setTimeout(re,(oe==null?void 0:oe.enabled)===!0?e0:QR))})};return re(),()=>{D=!1,window.clearTimeout(P)}},[]);const na=x.useCallback(async(D,P)=>{if(!Cs){za(D);try{const oe=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:P})})).json().catch(()=>null);oe&&Array.isArray(oe.pending)?Vo(y_(oe.pending,oe.aliases)):Vo(we=>we.filter(Ce=>Ce.fp!==P))}catch{}finally{za(null)}}},[Cs]),rs=x.useMemo(()=>hG(js,Ba).length,[js,Ba]),[sf,au]=x.useState(0),Go=x.useRef(null),[ou,Ko]=x.useState(!1),Rr=x.useRef(null),[af,Yo]=x.useState(0),nt=x.useState(()=>JV({protect:D=>aD(l.current,D)}))[0],[Ha,iu]=x.useState(!1),Ua=x.useCallback(()=>{const D=nt.paused&&nt.dropped>0,P=nt.setPaused(!nt.paused);D&&oD(l.current);for(const re of P)l.current=lN(l.current,re);iu(nt.paused)},[nt]),[Wt,lu]=x.useState(Date.now()),[Mr,ra]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(zd)!=="0"}catch{return!0}}),Wa=x.useRef(!1),ss=x.useCallback(()=>{const D=!Mr;Wa.current=!0;try{window.localStorage.removeItem(zd)}catch{}ra(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(P=>P.ok?P.json():null).then(P=>{var re;P!=null&&P.ok&&ra(((re=P.prefs)==null?void 0:re.autoUpdate)!==!1)}).catch(()=>{})},[Mr]),[hn,Yn]=x.useState(!1),[Va,Ga]=x.useState("restart"),[Ir,cu]=x.useState(null),Ts=x.useRef(!1),sa=x.useRef(null),uu=x.useRef(0),aa=x.useCallback(async D=>{if(!Ks(Ts.current))return;const P=(D==null?void 0:D.upgrade)===!0;Ts.current=!0,sa.current=Re;const re=++uu.current;Ga(P?"npx":"restart"),Yn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(fe==null?void 0:fe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:P})})}catch{}window.setTimeout(()=>{if(uu.current===re&&Ts.current){Ts.current=!1,Yn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},P?18e4:3e4)},[fe==null?void 0:fe.to,Re]),oa=x.useRef(null);x.useEffect(()=>{const D=N_(l.current.agents.values())>0,P=zz({enabled:Mr,kind:fe==null?void 0:fe.kind,canRestart:(ue==null?void 0:ue.canRestart)===!0,noticeOpen:$n,visible:document.visibilityState==="visible",busy:D,idleSince:oa.current,now:Wt});oa.current=P.idleSince,P.restart&&aa()},[Mr,fe==null?void 0:fe.kind,ue==null?void 0:ue.canRestart,$n,Wt,aa]);const yl=N_(l.current.agents.values()),du=Bz(yl),ia=nM({enabled:Mr,kind:fe==null?void 0:fe.kind,canRestart:(ue==null?void 0:ue.canRestart)===!0,noticeOpen:$n,visible:document.visibilityState==="visible",busy:yl>0,idleSince:oa.current,now:Wt});x.useEffect(()=>{const D=ue==null?void 0:ue.running;let P=null,re=null;try{P=window.sessionStorage.getItem("agent-dag.restartPending"),re=window.sessionStorage.getItem(j2)}catch{return}const oe=Lz({bundle:"3.27.6",running:D,pending:P,lastTried:re});if(oe==="reload"){try{window.sessionStorage.setItem(j2,D??"")}catch{return}window.location.reload();return}if(oe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ts.current=!1,Yn(!1),cu(D??null);const we=window.setTimeout(()=>cu(null),6e3);return()=>window.clearTimeout(we)},[ue==null?void 0:ue.running]),x.useEffect(()=>{if(hn&&Dz({asked:sa.current,reported:Re})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ts.current=!1,Yn(!1)}},[hn,Re]);const la=x.useState(()=>kG(EK()))[0],Tt=x.useRef(la.pinned),As=x.useRef(null),Xo=x.useState(()=>AK())[0],[wl,vl]=x.useState(()=>new Set),[$r,Zo]=x.useState(nG),[ca,as]=x.useState(f9),[ua,Qo]=x.useState(m9),[Ka,Jo]=x.useState(d9),[Or,hu]=x.useState(()=>p2(b2)),vn=x.useMemo(()=>xG(Or),[Or]),da=x.useCallback(D=>vG(D,vn),[vn]),[ei,Ya]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=$r;try{window.localStorage.setItem(SI,$r)}catch{}hu(D=>{const P=p2(b2);return bG(D,P)?D:P})},[$r]),x.useEffect(()=>{try{window.localStorage.setItem(uI,ca?"1":"0")}catch{}},[ca]),x.useEffect(()=>{try{window.localStorage.setItem(dI,String(ua))}catch{}},[ua]),x.useEffect(()=>{try{window.localStorage.setItem(hI,Ka)}catch{}},[Ka]);const Xn=x.useCallback((D,P)=>{if(qd({durationMs:P,documentHidden:document.hidden})){e.setViewport(D,{duration:P});return}const{d3Zoom:re,d3Selection:oe}=r.getState(),we=oe==null?void 0:oe.property("__zoom");if(re&&oe&&we&&we.k>0&&D.zoom>0){re.transform(oe,we.scale(D.zoom/we.k).translate((D.x-we.x)/D.zoom,(D.y-we.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,r]),os=x.useRef(null),Rs=x.useRef(0),is=x.useRef(null),Xa=x.useRef(()=>{});x.useEffect(()=>{if(!Xo)return;const D=window.setTimeout(()=>{try{Xn(Xo,0)}catch{}Lr.current=Date.now()},60);return()=>window.clearTimeout(D)},[Xn,Xo]);const xl=x.useRef(!0),[Za,fu]=x.useState(null);x.useEffect(()=>{const D=new EventSource("/events"),P=ZV(u,{now:()=>Date.now(),setTimeout:(Ce,Le)=>window.setTimeout(Ce,Le),clearTimeout:Ce=>window.clearTimeout(Ce)});let re=!1;const oe=typeof BroadcastChannel=="function"?oG(new BroadcastChannel(sG),Math.random().toString(36).slice(2),()=>re):null,we=window.setInterval(()=>{re||!oe||oe.ask(600).then(Ce=>{re||Qe(aG(Ce))})},3e3);return D.addEventListener("open",()=>{ye(!0),Ya(!0)}),D.addEventListener("error",()=>{ye(!1),fu(null)}),D.addEventListener("open",()=>{re=!0,Qe(!1)}),D.addEventListener("error",()=>{re=!1}),D.addEventListener("replay-end",()=>{xl.current=!1,P.flush(),fu(Date.now())}),D.addEventListener("hook",Ce=>{var Le;try{const et=JSON.parse(Ce.data);if(!nt.accept(et))return;l.current=lN(l.current,et);const ct=et.replay===!0||xl.current||Date.now()-et.receivedAt>3e4;ct?P.replay():P.live();const Ke=t9(et,ct);Ke&&((Le=Ie.current)==null||Le.play(Ke))}catch{}}),()=>{D.close(),P.cancel(),window.clearInterval(we),oe==null||oe.leave()}},[u]),x.useEffect(()=>{const D=setInterval(()=>{const P=Date.now();lu(P);const{changed:re,forgotten:oe}=j7(l.current,P);oe.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})}).catch(()=>{}),m(we=>N7(we,l.current.agents)),w(we=>we!=null&&!l.current.agents.has(we)?null:we),T(we=>we!=null&&!l.current.agents.has(we)?null:we),E(we=>we!=null&&!l.current.agents.has(we)?null:we),re&&u()},250);return()=>clearInterval(D)},[u]);const bl=x.useRef(null),Lr=x.useRef(0),pu=420,Dn=x.useCallback((D=500)=>{const P=xx,re=1,oe=.2,we=bx;try{const Ce=document.querySelector(".canvas-wrap"),Le=Array.from(document.querySelectorAll(".react-flow__node")).filter(At=>At.offsetWidth>0);if(!Ce||Le.length===0)return;const et=Ce.getBoundingClientRect(),ct=e.getViewport();if(!Number.isFinite(ct.zoom)||ct.zoom<=0)return;const Ke=At=>(At-et.left-ct.x)/ct.zoom,Pt=At=>(At-et.top-ct.y)/ct.zoom,Dt=Le.map(At=>At.getBoundingClientRect()),qr=Math.min(...Dt.map(At=>Ke(At.left))),hr=Math.max(...Dt.map(At=>Ke(At.right))),Jn=Math.min(...Dt.map(At=>Pt(At.top))),_t=Math.max(...Dt.map(At=>Pt(At.bottom))),wt=hr-qr,fr=_t-Jn;if(!(wt>0&&fr>0))return;const on=k2(Ce),fn=At=>Math.max(oe,Math.min(re,(et.width-on-P*2)/(wt+At)*we,(et.height-P*2)/fr*we)),er=PG(fn(pu),fn(0)),pr={x:P-qr*er,y:Math.max(P,(et.height-fr*er)/2)-Jn*er,zoom:er},bn=++Rs.current;Xn(pr,D),Lr.current=Date.now(),os.current=qd({durationMs:D,documentHidden:document.hidden})?{target:pr,until:Date.now()+D+60}:null,window.setTimeout(()=>{var At;try{if(((At=os.current)==null?void 0:At.target)===pr&&(os.current=null),Rs.current!==bn)return;const Gl=e.getViewport();(Math.abs(Gl.zoom-er)>.01||Math.abs(Gl.x-pr.x)>2)&&Xn(pr,0)}catch{}},D+60)}catch{}},[e,Xn]);x.useEffect(()=>{const D=()=>{if(!document.hidden)return;const P=os.current;if(os.current=null,!(!P||Date.now()>P.until)){try{Xn(P.target,0)}catch{}Lr.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[Xn]);const kl=x.useRef(""),Nl=x.useRef(null),mu=x.useRef(0),Qa=x.useCallback(()=>{mu.current=Date.now()},[]),_l=x.useRef(null),gu=x.useRef(0),Sl=x.useCallback(()=>{gu.current=Date.now()},[]),jl=x.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Lr.current,lastCanvasInputAt:gu.current}),[]),El="agent-dag.autoFitDisabled",Ms=x.useRef(!1),[Cl,yu]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(El)}catch{}},[]);const ha=x.useCallback(()=>{Ms.current||(Ms.current=!0,yu(!0))},[]),wu=x.useCallback(()=>{Ms.current=!1,yu(!1),Dn(400)},[e,Dn]);x.useEffect(()=>{const D=setInterval(()=>{if(Ms.current||Date.now()-mu.current<800)return;const P=l.current,re=Date.now(),oe=[];for(const Ce of P.agents.values())i0(Ce,re)&&oe.push({id:Ce.id});if(oe.length===0)return;const we=[];for(const{id:Ce}of oe){const Le=Pr.current.get(Ce),et=Tt.current.get(Ce)??$t.current.get(Ce);!Le||!et||we.push({x:et.x,y:et.y,width:Le.width,height:Le.height})}RG({pane:_l.current,viewport:e.getViewport(),boxes:we})&&Dn(600)},1500);return()=>clearInterval(D)},[e]);const ti=x.useRef(!1),Pr=x.useRef(new Map),Tl=x.useRef(0),of=x.useCallback(D=>{const P=Pr.current;let re=!1;for(const oe of D.nodeInternals.values()){const we=oe.width,Ce=oe.height;if(we==null||Ce==null)continue;const Le=P.get(oe.id);Le?(Math.abs(Le.height-Ce)>4||Math.abs(Le.width-we)>4)&&(P.set(oe.id,{width:we,height:Ce}),re=!0):(P.set(oe.id,{width:we,height:Ce}),re=!0)}return re&&(Tl.current+=1),Tl.current},[]),vu=mt(of),[xu,Al]=x.useState(0);x.useEffect(()=>{let D=0;const P=()=>{const oe=Pr.current;let we=!1;for(const Ce of document.querySelectorAll(".react-flow__node[data-id]")){const Le=Ce.getAttribute("data-id");if(!Le)continue;const et=Ce.offsetWidth,ct=Ce.offsetHeight;if(!et||!ct)continue;const Ke=oe.get(Le);(!Ke||Math.abs(Ke.width-et)>4||Math.abs(Ke.height-ct)>4)&&(oe.set(Le,{width:et,height:ct}),we=!0)}we&&Al(Ce=>Ce+1)};if(ti.current)return;let re=0;return document.visibilityState==="hidden"?re=window.setTimeout(P,32):D=requestAnimationFrame(P),()=>{cancelAnimationFrame(D),window.clearTimeout(re)}});const $t=x.useRef(la.positions),bu=x.useRef(new Set),Ja=x.useRef(""),Is=x.useMemo(()=>{const D=[];for(const P of l.current.agents.values())i0(P,Wt)&&D.push(P.id+(P.parentId?`>${P.parentId}`:""));return D.sort(),`${D.join("|")}#sv${vu}.${xu}`},[l.current,l.current.revision,Wt,vu,xu]),fa=x.useRef(null);x.useEffect(()=>(fa.current!=null&&window.clearTimeout(fa.current),fa.current=window.setTimeout(()=>{Hd($t.current,Tt.current)},1500),()=>{fa.current!=null&&window.clearTimeout(fa.current)}),[Is]),x.useEffect(()=>{if(kl.current===Is)return;const D=kl.current;if(kl.current=Is,!D||Ms.current)return;Date.now()-Lr.current>1200&&Dn(400),bl.current&&window.clearTimeout(bl.current),bl.current=window.setTimeout(()=>{Ms.current||Dn(500)},280)},[Is,e,Dn]);const ni=x.useMemo(()=>KV(l.current,h),[l.current,l.current.revision,h]),ri=x.useMemo(()=>gG(l.current,Wt),[l.current,l.current.revision,Wt]),Fn=x.useRef(null),[eo,ku]=x.useState({w:0,h:0});x.useEffect(()=>{const D=Fn.current;if(!D||typeof ResizeObserver>"u")return;const P=new ResizeObserver(re=>{var we;const oe=(we=re[0])==null?void 0:we.contentRect;oe&&(_l.current={width:oe.width,height:oe.height},ku(Ce=>Math.abs(Ce.w-oe.width)>40||Math.abs(Ce.h-oe.height)>40?{w:oe.width,h:oe.height}:Ce))});return P.observe(D),_l.current={width:D.clientWidth,height:D.clientHeight},ku({w:D.clientWidth,h:D.clientHeight}),()=>P.disconnect()},[]);const lf=x.useCallback(D=>{var re,oe;const P=D.target;!(P!=null&&P.closest)||P.closest(gK)!==D.currentTarget||(D.preventDefault(),(oe=(re=document.activeElement)==null?void 0:re.blur)==null||oe.call(re))},[]),Nu=x.useRef(new Map),[to,no]=x.useState(!1);x.useEffect(()=>{const D=window.setTimeout(()=>no(!0),2500);return()=>window.clearTimeout(D)},[]);const[ro,Rl]=x.useState(!1),Zn=x.useRef(null),[so,Ml]=x.useState(!1),[Il,$l]=x.useState("detail"),ls=x.useRef(null),si=x.useRef(null),_u=x.useCallback(()=>{var oe;const D=Tl.current;if(((oe=si.current)==null?void 0:oe.version)===D)return si.current.card;const P=[];for(const we of l.current.agents.keys()){const Ce=Pr.current.get(we);Ce&&P.push(Ce)}const re=IG(P);return si.current={version:D,card:re},re},[]),cf=x.useCallback(()=>{Zn.current&&(window.clearTimeout(Zn.current),Zn.current=null),Rl(!1)},[]),uf=x.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{Rl(!0),Zn.current&&window.clearTimeout(Zn.current),Zn.current=window.setTimeout(()=>Rl(!1),yK+80)})},[]);x.useEffect(()=>()=>{Zn.current&&window.clearTimeout(Zn.current)},[]);const xn=y?l.current.agents.get(y):null,Su=f&&xn!=null,[Ol,Qn]=x.useState(0);x.useEffect(()=>{const D=k2(Fn.current);Qn(P=>Math.abs(P-D)>40?D:P)},[Q,H,V,Su,eo.w]);const $s=x.useRef(Ol);$s.current=Ol;const ao=eo.w>0?Math.max(0,(eo.w-Ol-xx*2)*bx):0,oo=eo.h>0?Math.max(0,(eo.h-xx*2)*bx):0,ju=m6(),{nodes:Dr,edges:ai}=x.useMemo(()=>A7(l.current,Wt,ao,oo,Tt.current,Pr.current,Nu.current,uf,to,so,$t.current,bu.current,Is,Ja,h,ni,ri,A),[l.current,l.current.revision,Wt,ao,oo,to,so,Is,h,ni,ri,A,sf,ju]),df=x.useState(CK)[0],Eu=x.useRef(df);x.useEffect(()=>{if(!to||so)return;const D={width:ao,height:oo};if(!(D.width>0&&D.height>0))return;const P=Eu.current;if(Eu.current=D,TK(D),!P||P.width===D.width&&P.height===D.height)return;const re={direction:"LR",pinned:Tt.current,measured:Pr.current,lanes:n0(l.current)};if(!d7(Dr,ai,re,P,D))return;const oe=is.current&&Date.now()-is.current.at<1500?is.current.id:null,we=oe??hs.current,Ce=we?Tt.current.get(we)??$t.current.get(we):void 0;for(const Le of Array.from($t.current.keys()))Tt.current.has(Le)||$t.current.delete(Le);bu.current.clear(),Ja.current="",u(),window.setTimeout(()=>{if(Hd($t.current,Tt.current),Ms.current){if(oe){Xa.current(oe);return}const Le=we?Tt.current.get(we)??$t.current.get(we):void 0;if(Ce&&Le&&(Le.x!==Ce.x||Le.y!==Ce.y)){const et=e.getViewport();Rs.current+=1,Xn({x:et.x-(Le.x-Ce.x)*et.zoom,y:et.y-(Le.y-Ce.y)*et.zoom,zoom:et.zoom},0),Lr.current=Date.now()}return}Dn(500)},80)},[ao,oo,to,so,u,Dn,e,Xn]);const Os=x.useMemo(()=>{const D=new Map;for(const re of Dr){const oe=re.data;if(!(oe!=null&&oe.sessionId)||oe.exitAt!=null)continue;const we=re.width,Ce=re.height;if(we==null||Ce==null)continue;const Le=re.position.x,et=re.position.y,ct=Le+we,Ke=et+Ce,Pt=D.get(oe.sessionId);Pt?(Pt.minX=Math.min(Pt.minX,Le),Pt.minY=Math.min(Pt.minY,et),Pt.maxX=Math.max(Pt.maxX,ct),Pt.maxY=Math.max(Pt.maxY,Ke)):D.set(oe.sessionId,{minX:Le,minY:et,maxX:ct,maxY:Ke})}const P=[];for(const[re,oe]of D){const we=oe.maxX-oe.minX+Bd*2,Ce=oe.maxY-oe.minY+Bd*2;P.push({id:`group:${re}`,type:jI,position:{x:oe.minX-Bd,y:oe.minY-Bd},data:{sessionId:re,w:we,h:Ce},width:we,height:Ce,style:{width:we,height:Ce},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return P},[Dr]),Ll=x.useMemo(()=>{const D=[...Os,...Dr],P=Rr.current;return!P||P.size===0?D:D.map(re=>{const oe=P.get(re.id);return oe?{...re,position:oe}:re})},[Os,Dr,af]),cs=x.useMemo(()=>{const D=new Set;for(const P of l.current.agents.values())for(const re of P.tools)D.add(HI(re.name));return Object.keys(zI).filter(P=>D.has(P))},[l.current,l.current.revision]);x.useEffect(()=>{if(cs.length<=1){Ko(!1);return}let D=0;const P=()=>{const re=Go.current;if(re&&!document.hidden){const oe=re.getBoundingClientRect(),we=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Le=>Le.getBoundingClientRect()),Ce=wG(oe,we,8);Ko(Le=>Le===Ce?Le:Ce)}D=window.setTimeout(P,300)};return P(),()=>window.clearTimeout(D)},[cs.length]);const Pl=x.useCallback(D=>{vl(P=>{const re=new Set(P);return re.has(D)?re.delete(D):re.add(D),re})},[]),oi=j?Z5(l.current.agents,j):null,io=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}l.current=Bx(),Tt.current.clear(),Pr.current.clear(),$t.current.clear(),Ja.current="",E2(),b(),u()},[u,b]),Ls=x.useRef(I);Ls.current=I;const ii=x.useRef(q);ii.current=q;const li=x.useRef(!1);li.current=oi!=null||xt||C!=null||U||N!=null||Ss||q||st!=null;const Ps=x.useCallback(D=>{const P=O7(D,{confirmOpen:Ls.current,modalOpen:li.current});P==="confirm"?B(!0):P==="clear"&&(B(!1),io())},[io]),ci=x.useCallback(()=>{Tt.current.clear(),$t.current.clear(),Ja.current="",E2(),u(),window.setTimeout(()=>Dn(500),80)},[u,e,Dn]),Dl=x.useCallback(()=>Dn(500),[Dn]),us=x.useRef(Dr);us.current=Dr;const Tn=x.useCallback(D=>{var Pt;const P=Fn.current,re=l.current.agents.get(D);if(!P||!re)return;const oe=n0(l.current),we=(Dt,qr)=>{const hr=Pr.current.get(Dt.id);if(!hr)return null;const Jn=qr&&oe.has(Dt.id)?pu:0;return{x:Dt.position.x,y:Dt.position.y,width:hr.width+Jn,height:hr.height}},Ce=us.current.find(Dt=>Dt.id===D),Le=Ce?we(Ce,!1):null;if(!Le)return;const et=[];for(const Dt of us.current){if(Dt.type!=="agent"&&Dt.type!=="recapNote"||((Pt=Dt.data)==null?void 0:Pt.sessionId)!==re.sessionId)continue;const qr=we(Dt,Dt.type==="agent");qr&&et.push(qr)}const ct=P.getBoundingClientRect(),Ke=qG({pane:{width:ct.width,height:ct.height},insets:{top:56,left:72,bottom:32,right:$s.current+32},context:BG(et)??Le,anchor:Le});Ca(),ha(),is.current={id:D,at:Date.now()},Rs.current+=1,Xn(Ke,kx),Lr.current=Date.now(),os.current=qd({durationMs:kx,documentHidden:document.hidden})?{target:Ke,until:Date.now()+kx+60}:null},[Xn,ha]);Xa.current=Tn;const Cu=x.useCallback(D=>{const P=us.current.find(re=>re.id===D&&re.type==="agent");return P?P.data:void 0},[]),Tu=x.useCallback(D=>{var P;return(P=l.current.agents.get(D))==null?void 0:P.label},[]),ds=x.useCallback(D=>{var oe;const P=us.current.find(we=>we.id===D&&we.type==="recapNote");if(!P)return;const re=P.data;return{recap:re.recap,hue:re.hue,sessionLabel:(oe=l.current.agents.get(re.parentId))==null?void 0:oe.label}},[]),Fl=x.useCallback(()=>{var re;const D=(re=Fn.current)==null?void 0:re.getBoundingClientRect(),P=document.documentElement;return D?{width:D.right-$s.current,height:D.bottom}:{width:P.clientWidth,height:P.clientHeight}},[]),hs=x.useRef(y);hs.current=y;const ui=x.useCallback(D=>{const P=us.current.filter(Ce=>Ce.type==="agent"),re=zV(P.map(Ce=>({id:Ce.id,x:Ce.position.x,y:Ce.position.y})),hs.current,D),oe=re?P.find(Ce=>Ce.id===re):void 0;if(!oe)return;const we=vx(document.activeElement);S(oe.id,!1),window.setTimeout(()=>{try{Tn(oe.id)}catch{}we&&mK(oe.id)},30)},[S,Tn]),ql=x.useRef(null),ur=x.useCallback(D=>{S(D,!1),window.setTimeout(()=>{try{Tn(D)}catch{}},60)},[S,Tn]),Au=x.useRef(null);x.useEffect(()=>{let D=-1/0;const P=()=>{D=performance.now()},re=oe=>{Au.current=performance.now()-D<250?oe.target:null};return window.addEventListener("pointerdown",P,!0),window.addEventListener("focusin",re,!0),()=>{window.removeEventListener("pointerdown",P,!0),window.removeEventListener("focusin",re,!0)}},[]),x.useEffect(()=>{const D=P=>{var et,ct;const re=P.target,oe={tagName:re==null?void 0:re.tagName,isContentEditable:re==null?void 0:re.isContentEditable,role:(et=re==null?void 0:re.getAttribute)==null?void 0:et.call(re,"role"),type:re==null?void 0:re.type,pointerFocused:re!=null&&re===Au.current};if(P.key==="Escape"){const Ke=FD({overlayOpen:jc.depth()>0,typing:O0(oe)});Ke==="dismiss"?jc.dismissTop():Ke==="blur"?re==null||re.blur():(VV(oe)&&(re==null||re.blur()),b());return}if(Mh(P))return;const we=vx(re)?(ct=re==null?void 0:re.getAttribute)==null?void 0:ct.call(re,"data-id"):null,Ce=we&&us.current.some(Ke=>Ke.id===we)?we:null,Le=UV(P,Ce);if(Le.kind==="activate"){P.preventDefault(),S(Le.nodeId,Le.additive);return}if(Le.kind!=="node"&&!(Le.nodeId==null&&KD(oe,P.key))&&!YD({key:P.key,modalOpen:XD({appModal:li.current,dialogDepth:jc.dialogDepth()}),sheetOpen:ii.current})){if(P.key===" "&&(P.preventDefault(),Ua()),(P.key==="c"||P.key==="C")&&Ps("shortcut"),(P.key==="r"||P.key==="R")&&ci(),(P.key==="f"||P.key==="F")&&Dl(),(P.key==="z"||P.key==="Z")&&hs.current&&Tn(hs.current),(P.key==="l"||P.key==="L")&&Ct(),P.key==="d"||P.key==="D")if(hs.current)p(Ke=>!Ke);else{const Ke=Lp(l.current.agents.values());Ke.length>0?ur(Ke[0].id):ui(1)}if((P.key==="h"||P.key==="H")&&Ar(Ke=>!Ke),(P.key==="u"||P.key==="U")&&$(Ke=>!Ke),(P.key==="a"||P.key==="A")&&Kn.current.claude&&gt(),(P.key==="j"||P.key==="J")&&ui(1),(P.key==="k"||P.key==="K")&&ui(-1),P.key==="w"||P.key==="W"){const Ke=TD(Lp(l.current.agents.values()),ql.current);Ke&&(ql.current=Ke.id,ur(Ke.id))}(P.key==="t"||P.key==="T")&&Zo(Ke=>Ke==="dark"?"light":"dark"),(P.key==="m"||P.key==="M")&&Kn.current.claude&&Te.current!==null&&ge.current(P.shiftKey),(P.key==="s"||P.key==="S")&&W(Ke=>!Ke),(P.key==="b"||P.key==="B")&&ns(Ke=>!Ke),(P.key==="v"||P.key==="V")&&Kn.current.claude&&Te.current!==null&&Ge(Ke=>!Ke),P.key==="?"&&L(Ke=>!Ke)}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[Ps,ci,Dl,b,S,ui,ur,Tn,Ua]);const Bl=l.current.agents.size,Zt=x.useMemo(()=>Lp(l.current.agents.values()),[l.current,l.current.revision]),bt=x.useMemo(()=>AD(l.current.agents.values()),[l.current,l.current.revision]),di=x.useRef(null);x.useEffect(()=>{const D=iG({waiting:Zt.length,running:bt,connected:Je}),P=di.current;if(di.current=D,(P==null?void 0:P.title)!==D.title&&(document.title=D.title),(P==null?void 0:P.icon)!==D.icon){const re=document.querySelector('link[rel="icon"]');re&&(re.href=lG[D.icon])}},[Zt.length,bt,Je]);const[hi,lo]=x.useState(""),zl=uG(Zt);x.useEffect(()=>{lo(D=>dG(D,zl))},[zl]);const[pa,co]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[dr,fs]=x.useState(null),[uo,Hl]=x.useState(!1),[hf,Ul]=x.useState(!1);x.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(P=>P.ok?P.json():null).then(P=>{var re,oe,we;if(!(!D||!(P!=null&&P.ok))){if(!Wa.current){let Ce=!1;try{Ce=window.localStorage.getItem(zd)==="0",window.localStorage.removeItem(zd)}catch{}Ce&&((re=P.prefs)==null?void 0:re.autoUpdate)!==!1?(ra(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):ra(((oe=P.prefs)==null?void 0:oe.autoUpdate)!==!1)}Hl(((we=P.prefs)==null?void 0:we.notifications)===!0),Ul(P.notificationsVetoed===!0)}}).catch(()=>{}),()=>{D=!1}},[]);const ho=x.useRef(()=>{}),fi=x.useCallback(()=>{const D=!uo;Hl(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&ho.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(P=>P.ok?P.json():null).then(P=>{var re;P!=null&&P.ok&&(Hl(((re=P.prefs)==null?void 0:re.notifications)===!0),Ul(P.notificationsVetoed===!0))}).catch(()=>{})},[uo]),Wl=typeof Notification<"u";x.useEffect(()=>{if(!dr)return;const P=setTimeout(()=>fs(null),dr==="blocked"?8e3:4e3);return()=>clearTimeout(P)},[dr]);const pi=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const P=D;co(P),P==="granted"?fs("on"):P==="denied"&&fs("blocked")})},[]);ho.current=pi;const Ds=x.useRef(new Set),fo=x.useRef(null),ff=Zt.map(D=>Rh(D.id,D.waiting)).join("|");x.useEffect(()=>{$D(fo.current,pa)&&(fo.current=pa,Ds.current=Pp(Zt))},[pa]);const Vl=x.useRef(!1);return x.useEffect(()=>{OD(Vl.current,Za)&&(Vl.current=!0,Ds.current=Pp(Zt))},[Za]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!LD(fo.current,Za))return;const D=typeof document>"u"||!document.hidden,P=MD(Zt,Ds.current,D,uo);for(const re of P)try{const oe=new Notification(re.title,{body:re.body,tag:re.key});oe.onclick=()=>{window.focus(),ur(re.sessionId),oe.close()}}catch{}Ds.current=D?Pp(Zt):ID(Zt,P,Ds.current)},[ff,Za]),o.jsxs("div",{className:"app",children:[o.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"readout",children:[o.jsxs("div",{className:"brand",children:[o.jsx("span",{className:"logo"}),o.jsx("h1",{children:nn}),fe?o.jsxs("button",{type:"button",className:"v stale",onClick:()=>{yn(),ea()},"aria-haspopup":"dialog","aria-label":XG({...fe,open:$n}),title:fe.kind==="restart"?`Running v${fe.from}; v${fe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${fe.from}; v${fe.to} is on npm · click for what's new`,children:["v",fe.from,o.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:St,latest:ue==null?void 0:ue.latest,latestPending:ue==null?void 0:ue.latestPending,checkedAgo:ue!=null&&ue.checkedAt?Yd(Wt-ue.checkedAt):null,checkFailedAgo:ue!=null&&ue.checkFailedAt&&ue.checkFailedAt>(ue.checkedAt??0)?Yd(Wt-ue.checkFailedAt):null,checkDisabled:ue==null?void 0:ue.checkDisabled,checking:an};return o.jsxs("button",{type:"button",className:an?"v checking":"v",onClick:()=>{yn(),Nt(!0)},"aria-busy":an||void 0,"aria-haspopup":"dialog","aria-label":YG(D),title:KG(D),children:["v",D.running]})})()]}),o.jsx("span",{className:"status",children:(()=>{const D=uK({connected:Je,paused:Ha,held:nt.size,dropped:nt.dropped});return D.resting?null:o.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:o.jsxs("span",{className:"pill-box",children:[o.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),o.jsx("span",{className:"pill-label",children:D.label})]})})})()}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:hi}),Zt.length>0&&o.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{ql.current=Zt[0].id,ur(Zt[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
291
- ${Zt.map(D=>` ${D.label}: ${rl(D.waiting)} (${Yd(Wt-D.waiting.since)})`).join(`
292
- `)}`,"aria-label":`${Zt.length} session${Zt.length===1?"":"s"} waiting for you`,children:[o.jsx("span",{className:"ap-pulse","aria-hidden":!0}),o.jsx("b",{children:Zt.length})," ",o.jsx("span",{className:"ws-word",children:"waiting"})]}),dr&&o.jsx("span",{className:dr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:dr==="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:dr==="on"?"notifications on":"notifications blocked"})]}),xn&&(()=>{const D=Vn(xn),P=Math.max(0,((xn.endedAt??Wt)-xn.startedAt)/1e3),re=xn.state==="active"?M0(D.total,P):null,oe=h.size-1;return o.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${xn.label} and its session (Z)`,onClick:()=>{try{Tn(xn.id)}catch{}},children:[o.jsx("span",{className:`state-pill state-${xn.state}`,children:xn.state==="active"?"live":xn.state}),o.jsx("span",{className:"selected-label",children:xn.label}),D.total>0&&o.jsxs("span",{className:"selected-cost",children:[lt(D.total),re?o.jsxs("span",{className:"selected-rate",children:[" · ",re]}):null]}),oe>0&&o.jsxs("span",{className:"selected-extra",children:["+",oe]}),o.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:we=>{we.stopPropagation(),b()},children:"×"})]})})(),o.jsxs("div",{className:"actions",children:[o.jsxs("div",{className:"action-run",children:[o.jsxs("button",{className:"btn icon-btn",onClick:Ct,title:`${M?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":M,"aria-controls":M?"session-list":void 0,children:[o.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:[o.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),o.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),o.jsx("span",{className:"tb-word",children:"Session list"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>$(D=>!D),title:`${V?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":V,"aria-controls":V?"usage-panel":void 0,children:[o.jsxs("svg",{className:"tb-glyph-narrow",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M9.4 4.5C9 3.6 8.1 3.1 7 3.1c-1.4 0-2.4.8-2.4 1.9 0 1.2 1.2 1.6 2.4 2s2.4.8 2.4 2c0 1.1-1 1.9-2.4 1.9-1.1 0-2-.5-2.4-1.4"}),o.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),o.jsx("span",{className:"tb-word",children:"Usage"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>Ar(D=>!D),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[o.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:[o.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),o.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),o.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),o.jsx("span",{className:"tb-word",children:"History"})]})]}),o.jsxs("div",{className:"action-run",children:[zt.claude&&o.jsxs("button",{className:"btn icon-btn",onClick:gt,title:`${F?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":F,"aria-controls":F?"accounts-panel":void 0,children:[o.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:[o.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),o.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),o.jsx("span",{className:"tb-word",children:"Accounts"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>W(D=>!D),title:`${z?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":z,"aria-controls":z?"system-panel":void 0,children:[o.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:[o.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),o.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"})]}),o.jsx("span",{className:"tb-word",children:"Machine"})]}),o.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>ns(D=>!D),title:Es?"Browser watch — watching; the deck is keeping its own copy (B)":"Browser watch — not watching; reading the browser's history live (B)","aria-label":`Browser watch, ${Es?"watching":"not watching"}`+(rs>0?`, ${rs} unread`:""),"aria-haspopup":"dialog",children:[o.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:[o.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"}),Es||rs>0?o.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):o.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),o.jsx("span",{className:"tb-word",children:"Browser watch"}),rs>0&&o.jsx("span",{className:"bw-badge","aria-hidden":!0,children:rs})]})]}),o.jsxs("div",{className:"action-run action-run-utility",children:[zt.claude&&O!==null&&o.jsxs("div",{className:"sound-slot",children:[o.jsxs("button",{ref:rt,className:"btn icon-btn",onClick:()=>Ge(D=>!D),...Ma(!1),title:sK(zt,{on:O===!0,locked:Ze==="locked",prefs:De}),"aria-label":`Sound settings, ${O?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":xe,"aria-controls":xe?"sound-menu":void 0,children:[o.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:[o.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),O?o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),o.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10 5.6l2.6 2.8"}),o.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),o.jsx("span",{className:"tb-word",children:"Sound"})]}),xe&&o.jsx(u9,{onClose:()=>Ge(!1),soundOn:O===!0,onToggleSound:ae,prefs:De,onLevel:(D,P)=>ke(D,{level:P}),onFigure:(D,P)=>ke(D,{figure:P}),onPreview:D=>Ue(D),notifyOn:uo,onToggleNotify:fi,notifyVetoed:hf,notifyPermission:Wl?pa:"unsupported",onAskNotify:pi,openerRef:rt})]}),o.jsxs("div",{className:"appearance-slot",children:[o.jsx("button",{ref:_e,className:"btn icon-btn",onClick:()=>{Ge(!1),le(D=>!D)},title:"Appearance settings","aria-label":`Appearance settings, ${$r} theme, character ${ca?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":at,"aria-controls":at?"appearance-menu":void 0,children:$r==="dark"?o.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:[o.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),o.jsx("path",{d:"M7 1.5v1.2M7 11.3v1.2M1.5 7h1.2M11.3 7h1.2M3.1 3.1l.85.85M10.05 10.05l.85.85M3.1 10.9l.85-.85M10.05 3.95l.85-.85"})]}):o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),at&&o.jsx(w9,{theme:$r,onTheme:Zo,characterEnabled:ca,onToggleCharacter:()=>as(D=>!D),fmVolume:ua,onFmVolume:Qo,fmSource:Ka,onFmSource:Jo,onClose:()=>le(!1)})]})]})]})]}),Ir?o.jsxs("div",{className:"ver-banner done",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:["Restarted — now running v",Ir,"."]}),o.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):ei&&!Je?o.jsxs("div",{className:"conn-banner",role:"alert",children:[o.jsx("span",{className:"conn-dot"}),hn?Va==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${nn}…`:(()=>{const D=lK({connected:Je,paused:Ha});return o.jsxs(o.Fragment,{children:[`Lost connection to the ${nn} server. Reconnecting…`,D&&o.jsx("span",{className:"conn-sub",children:D})]})})()]}):$n&&fe?o.jsxs("div",{className:`ver-banner ${fe.kind}`,role:"status",children:[o.jsx("span",{className:`ver-dot${ia==null?"":" armed"}`}),fe.kind==="restart"?o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:["v",fe.to," is installed — this deck still runs v",fe.from,"."]}),ue!=null&&ue.canRestart?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"ver-act",onClick:()=>aa(),...Ma(hn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
293
-
294
- 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:hn?"restarting…":du.label}),!hn&&o.jsx("span",{className:"ver-sub",children:du.clause}),o.jsxs("label",{className:"ver-auto",children:[o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":Mr,onClick:ss,"aria-label":"Auto-restart when idle",title:Mr?"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:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{"aria-hidden":!0,children:qz(Mr,ia)})]})]}):o.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."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:[nn," v",fe.to," is out — you are on v",fe.from,"."]}),(ue==null?void 0:ue.upgradeMode)==="install"&&Oe!=="failed"&&o.jsx("button",{type:"button",className:"ver-act",onClick:dt,...Ma(Oe==="running",Oe==="done"),title:`Runs ${((Mu=ue==null?void 0:ue.upgrade)==null?void 0:Mu.command)??(ue==null?void 0:ue.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Oe==="running"?"installing…":Oe==="done"?"installed":"Update now"}),(ue==null?void 0:ue.upgradeMode)==="npx"&&(ue==null?void 0:ue.canRestart)&&o.jsx("button",{type:"button",className:"ver-act",onClick:()=>aa({upgrade:!0}),...Ma(hn),title:`Runs ${ue==null?void 0:ue.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:hn?"fetching…":Oe==="failed"?"Retry update":"Update & restart"}),Oe==="failed"?o.jsxs("span",{className:"ver-sub fail",title:((mi=ue==null?void 0:ue.upgrade)==null?void 0:mi.error)??"",children:[(ue==null?void 0:ue.upgradeMode)==="npx"?"update failed":"install failed",": ",((Fr=ue==null?void 0:ue.upgrade)==null?void 0:Fr.error)??"unknown error"," — run it yourself:"]}):(ue==null?void 0:ue.upgradeMode)==="npx"?o.jsx("span",{className:"ver-sub",children:ue!=null&&ue.canRestart?"npx cannot upgrade in place, so the deck re-runs:":_x.npx}):ue!=null&&ue.upgradeBlocked?o.jsx("span",{className:"ver-sub",children:Object.hasOwn(_x,ue.upgradeBlocked)?_x[ue.upgradeBlocked]:"cannot install from here"}):null,o.jsxs("button",{type:"button",className:"ver-cmd",onClick:yt,title:"Copy to clipboard",children:[o.jsx("code",{children:ue==null?void 0:ue.command}),o.jsx("span",{className:"ver-cmd-hint",children:Bt?"copied":"copy"})]})]}),o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ta,children:"×"})]}):ee&&wn?o.jsxs("div",{className:"ver-banner",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:[wn," still works — the deck is called ",nn," now."]}),ue!=null&&ue.renameFix?o.jsx("span",{className:"ver-sub",children:ue.renameFix}):null,o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ae,children:"×"})]}):null,Dp(de)&&zt.claude&&o.jsx(Iz,{leaving:de==="leaving",onClose:()=>K(!1)}),M&&o.jsx(GF,{state:l.current,now:Wt,selectedIds:h,onSelect:ur,onClose:()=>J(!1)}),o.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${ro?" bubbling":""}${so?" dragging-any":""}`,"data-lod":Il,ref:Fn,onMouseDownCapture:lf,onPointerDownCapture:Sl,onPointerUpCapture:Sl,onWheelCapture:Sl,onFocusCapture:D=>{const P=D.target;if(!vx(P)||ls.current==null||ls.current==="detail")return;const re=P.getAttribute("data-id");re&&l.current.agents.has(re)&&P.matches(":focus-visible")&&w2(re,P,"focus")},onBlurCapture:D=>{var re,oe;const P=(oe=(re=D.target).getAttribute)==null?void 0:oe.call(re,"data-id");P&&Ca(P)},children:[Bl===0&&(!Je&&Me?o.jsx(FK,{}):o.jsx(qK,{live:Je,everConnected:ei,providers:zt,workspace:Xt,onTour:()=>X(!0)})),(cs.length>1||wl.size>0)&&o.jsx("div",{ref:Go,className:`cat-filter-bar${ou?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:cs.map(D=>{const P=wl.has(D);return o.jsxs("button",{type:"button",className:`cat-filter${P?" off":""}`,onClick:()=>Pl(D),"aria-pressed":!P,title:`${P?"Show":"Hide"} ${bh[D]} tools`,children:[o.jsx($K,{cat:D}),o.jsx("span",{className:"cat-name",children:bh[D]})]},D)})}),o.jsxs(VA,{nodes:Ll,edges:ai,nodeTypes:fK,edgesFocusable:!1,edgeTypes:pK,fitView:!Xo,fitViewOptions:{padding:.25,duration:qd({durationMs:N2,documentHidden:document.hidden})?N2:0},minZoom:CI,maxZoom:TI,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(D,P)=>{if(P.type==="sessionGroup"){b();return}const re=P.type==="recapNote"?P.data.parentId:P.id;S(re,D.shiftKey,!1),!D.shiftKey&&(f&&p(!1),Su?window.setTimeout(()=>{try{Tn(re)}catch{}},80):Tn(re))},onPaneClick:()=>{Ca(),b()},onNodeDoubleClick:(D,P)=>{if(P.type!=="agent"&&P.type!=="recapNote")return;const re=P.type==="recapNote"?P.data.parentId:P.id;S(re,!1),window.setTimeout(()=>{try{Tn(re)}catch{}},80)},onNodeMouseEnter:(D,P)=>{P.type!=="agent"&&P.type!=="recapNote"||ti.current||ls.current==null||ls.current==="detail"||w2(P.id,D.currentTarget)},onNodeMouseLeave:(D,P)=>Ca(P.id),onMoveStart:D=>{Ca(),gx(jl(D))&&(Rs.current+=1),gx(jl(D))&&ha()},onMove:(D,P)=>{var oe,we;Qa(),gx(jl(D))&&ha(),(oe=Fn.current)==null||oe.style.setProperty("--zoom",String(P.zoom));const re=$G(ls.current,P.zoom,_u());re!==ls.current&&(ls.current=re,(we=Fn.current)==null||we.setAttribute("data-lod",re),$l(re),re==="detail"&&Ca()),Nl.current&&window.clearTimeout(Nl.current),Nl.current=window.setTimeout(()=>RK(P),250)},onNodeDragStart:(D,P)=>{var re;if(Ca(),cf(),ti.current=!0,Rr.current=new Map,Ml(!0),Qa(),ha(),P.type==="sessionGroup"){const oe=(re=P.data)==null?void 0:re.sessionId,we=new Map;if(oe)for(const Ce of Dr){const Le=Ce.data;(Le==null?void 0:Le.sessionId)===oe&&we.set(Ce.id,{x:Ce.position.x,y:Ce.position.y})}As.current={start:{x:P.position.x,y:P.position.y},members:we};return}Tt.current.set(P.id,{x:P.position.x,y:P.position.y})},onNodeDrag:(D,P)=>{var re;if(Qa(),P.type==="sessionGroup"){const oe=As.current;if(!oe)return;const we=P.position.x-oe.start.x,Ce=P.position.y-oe.start.y;for(const[et,ct]of oe.members){const Ke={x:ct.x+we,y:ct.y+Ce};Tt.current.set(et,Ke),$t.current.set(et,Ke)}const Le=Rr.current;if(Le){for(const[et,ct]of oe.members)Le.set(et,{x:ct.x+we,y:ct.y+Ce});Le.set(P.id,{x:P.position.x,y:P.position.y})}Yo(et=>et+1);return}Tt.current.set(P.id,{x:P.position.x,y:P.position.y}),$t.current.set(P.id,{x:P.position.x,y:P.position.y}),(re=Rr.current)==null||re.set(P.id,{x:P.position.x,y:P.position.y}),Yo(oe=>oe+1)},onNodeDragStop:(D,P)=>{if(Qa(),ti.current=!1,Rr.current=null,Ml(!1),au(re=>re+1),P.type==="sessionGroup"){const re=As.current;if(re){const oe=P.position.x-re.start.x,we=P.position.y-re.start.y;for(const[Ce,Le]of re.members){const et={x:Le.x+oe,y:Le.y+we};Tt.current.set(Ce,et),$t.current.set(Ce,et)}}As.current=null,Hd($t.current,Tt.current),au(oe=>oe+1);return}Tt.current.set(P.id,{x:P.position.x,y:P.position.y}),$t.current.set(P.id,{x:P.position.x,y:P.position.y}),Hd($t.current,Tt.current)},children:[o.jsx(O5,{gap:28,size:1,color:Or["--grid-line"]}),o.jsx(MF,{onFocusSession:Tn}),o.jsx(Z6,{agents:l.current.agents,visibleAgentIds:ri,positions:$t.current,pinned:Tt.current,measured:Pr.current,spotlight:ni,hiddenCategories:wl,now:Wt,onOpenTool:k}),Cl&&o.jsxs("div",{className:"autofit-chip",children:[o.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),o.jsx("button",{type:"button",className:"autofit-resume",onClick:wu,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),o.jsxs(T5,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[o.jsx(kr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(kr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(kr,{onClick:wu,title:Cl?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":Cl?"":void 0,children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(kr,{"data-group-start":"",onClick:Ua,title:iK({paused:Ha,held:nt.size,dropped:nt.dropped}),"aria-label":oK,"aria-pressed":Ha,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(kr,{onClick:ci,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),o.jsx(kr,{"data-group-start":"","data-danger":"",onClick:()=>Ps("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),o.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"}),o.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"}),o.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(kr,{"data-group-start":"",onClick:()=>L(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),o.jsx(k5,{zoomable:!0,pannable:!0,nodeColor:da,nodeStrokeWidth:2,maskColor:Or["--minimap-mask"],maskStrokeColor:Or["--line"]}),ca&&o.jsx(vV,{volume:ua,source:Ka})]}),o.jsx(UG,{agentFor:Cu,recapFor:ds,labelFor:Tu,bounds:Fl})]}),Dp(H)&&o.jsx(jq,{state:l.current,now:Wt,providers:zt,liveSince:Za,leaving:H==="leaving",onClose:()=>$(!1)}),Dp(Q)&&o.jsx(a8,{usageOpen:V,leaving:Q==="leaving",onClose:()=>W(!1)}),f&&xn?o.jsxs("aside",{className:"detail","aria-label":"Detail",children:[o.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>p(!1),children:"×"}),o.jsx(zK,{agent:xn,now:Wt,onOpenTool:k,onShowSummary:E,onExportSession:D=>MK(l.current,D)})]}):null,oi&&o.jsx(bF,{tool:oi,onClose:()=>k(null)}),xt&&o.jsx(x.Suspense,{fallback:null,children:o.jsx(dK,{providers:zt,onClose:()=>Ar(!1)})}),Ss&&o.jsx(x.Suspense,{fallback:null,children:o.jsx(hK,{onClose:()=>ns(!1),onSeen:D=>{Wo(D);try{localStorage.setItem(f2,String(D))}catch{}},onWatching:Pn,palette:Or})}),C&&(()=>{const D=l.current.agents.get(C);return D?o.jsx(n6,{agent:D,onClose:()=>T(null)}):null})(),N&&o.jsx(UF,{state:l.current,sessionId:N,onClose:()=>E(null)}),st&&o.jsx(qV,{entries:st.entries,since:st.since,firstRun:st.firstRun,running:St,onClose:()=>It(null),onTour:()=>{It(null),X(!0)},onRestart:ue!=null&&ue.canRestart?()=>{It(null),aa()}:void 0}),(()=>{const{request:D,waiting:P}=fG(rf,su.current);return D?o.jsx(pG,{request:D,waiting:P,busy:Cs,now:Date.now(),onAccept:()=>void na("accept",D.fp),onDecline:()=>void na("dismiss",D.fp),onLater:()=>{Cs||(su.current.add(D.fp),Vo(re=>[...re]))}}):null})(),q&&o.jsx(z7,{onClose:()=>L(!1),onTour:()=>{L(!1),X(!0)}}),U&&o.jsx(KR,{title:"What the deck shows you",steps:fB,onClose:()=>{X(!1),LV(h2()),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0})}).catch(()=>{});const D=Y.current;Y.current=null,D&&It(D)}}),I&&o.jsx(F7,{agentCount:Bl,onConfirm:()=>Ps("confirmation"),onCancel:()=>B(!1)})]})}function FK(){return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),o.jsxs("h2",{children:["Too many ",nn," tabs are open"]}),o.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",o.jsx("code",{children:nn})," tabs are holding them. Close one and this tab connects on its own."]})]})}function qK({live:e,everConnected:t,providers:n,workspace:r,onTour:a}){const l=!e;return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),l?o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),o.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",o.jsx("code",{children:nn}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):BK(n,r),!l&&o.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function BK(e,t){const n=QG(t);return o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?o.jsxs("p",{children:[n.lead," ",o.jsx("code",{children:n.workspace}),n.tail]}):o.jsxs("p",{children:["Run ",o.jsx("code",{children:"claude"})," or ",o.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."]}),rK(e).map(r=>o.jsx("p",{className:"hint-row",children:r.spans.map((a,l)=>a.code?o.jsx("code",{children:a.text},l):o.jsx("span",{children:a.text},l))},r.provider))]})}function zK({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:a}){const l=`${e.synthetic?"≥ ":""}${el(e.startedAt,e.endedAt,t)}`,c=Vn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const j of e.tools){const k=HI(j.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(j=>j.ok===!1).length,m=e.tools.filter(j=>!j.endedAt).length,y=Array.from(p.entries()).sort((j,k)=>k[1]-j[1]),w=p.has("mcp")?V6(e.tools.map(j=>j.name)):null;return o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"detail-hero",children:[o.jsxs("div",{className:"hero-line",children:[o.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),o.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),o.jsxs("div",{className:"hero-meta",children:[o.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),o.jsx("span",{className:"hero-sep",children:"·"}),o.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const j=cR(e);return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hero-sep",children:"·"}),o.jsxs("span",{className:"model-chip","data-family":Ah(e.model),title:j.length>0?`${e.model}
295
- spend on this panel also covers:
296
- ${j.join(`
297
- `)}`:e.model,children:[Da(e.model),j.length>0?` +${j.length}`:""]})]})})()]}),u&&o.jsxs("div",{className:"hero-cost",children:[o.jsxs("div",{className:"hero-cost-headline",children:[o.jsx("span",{className:"hero-cost-value",children:lt(c.total)}),o.jsx("span",{className:"hero-cost-label",children:"spend"})]}),o.jsx(B0,{cost:c})]}),o.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const j=Ih(e);if(!j)return null;const k=ch(j.at,t);return o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Recap ",o.jsx("span",{className:"section-count",title:k.title,children:k.label})]}),o.jsx("p",{className:"detail-recap",children:j.text})]})})(),e.tools.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Activity"}),o.jsxs("div",{className:"activity-row",children:[o.jsxs("div",{className:"activity-counters",children:[o.jsxs("span",{className:"ac-item",children:[o.jsx("b",{children:e.toolCount})," calls"]}),m>0&&o.jsxs("span",{className:"ac-item ac-live",children:[o.jsx("b",{children:m})," live"]}),h>0&&o.jsxs("span",{className:"ac-item ac-err",children:[o.jsx("b",{children:h})," err"]})]}),o.jsx("div",{className:"cat-strip",children:y.map(([j,k])=>{const S=j==="mcp"?w:null,b=S==null?void 0:S.hue,N=`${k} ${bh[j]} call${k===1?"":"s"}`;return o.jsxs("span",{className:`cat-chip cat-${j}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:S?`${N}, all to ${S.label}`:N,children:[o.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:zI[j]}),o.jsx("span",{className:"cat-name",children:bh[j]}),o.jsx("span",{className:"cat-count",children:k}),S&&o.jsx("span",{className:"cat-server",children:S.label})]},j)})})]})]}),f>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Tokens"}),o.jsxs("div",{className:"tokens-grid",children:[o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"in"}),o.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:Ut(e.usage.inputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"out"}),o.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:Ut(e.usage.outputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache r"}),o.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:Ut(e.usage.cacheReadTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache c"}),o.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:Ut(e.usage.cacheCreateTokens)})]})]})]}),o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Identity"}),o.jsxs("div",{children:[e.cwd&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"cwd"}),o.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"session"}),o.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"parent"}),o.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Prompts ",o.jsx("span",{className:"section-count",children:QA(e.prompts).length})]}),o.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((j,k)=>{const S=ch(j.at,t),b=A0(j.text);return b?o.jsxs("details",{className:"prompt-entry prompt-injected",children:[o.jsxs("summary",{children:[o.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),o.jsx("span",{className:"prompt-injected-label",children:b.label})]}),b.detail&&o.jsx("div",{className:"prompt-injected-detail",children:b.detail})]},k):o.jsxs("div",{className:"prompt-entry",children:[o.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),o.jsx("div",{className:"prompt-text",children:j.text})]},k)})})]}),o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Tool calls ",o.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&o.jsx("div",{className:"empty",children:"No tool calls yet."}),o.jsx("div",{children:e.tools.slice().reverse().map(j=>o.jsx(UK,{t:j,onClick:()=>n(j.id)},j.id))})]})]})}const HK={inflight:"in-flight",done:"done",err:"error"};function UK({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=dR(e,"…");return o.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[o.jsxs("span",{className:"name",children:[o.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:HK[n]}),e.name]}),o.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{l6(window.localStorage)}catch{}const WK=M$.createRoot(document.getElementById("root"));WK.render(o.jsx(OK,{}));export{f2 as S,tK as a,GK as b,Bc as c,Ut as d,VK as e,lt as f,Da as g,Ks as h,sl as i,o as j,hG as k,VN as p,x as r,Ma as s,sn as u};