agent-dag 3.20.0 → 3.21.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.
- package/README.md +113 -5
- package/dist/web/assets/{index-DVj_M279.css → index-BYMVIG6f.css} +1 -1
- package/dist/web/assets/index-G0ntHhBn.js +266 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +6 -0
- package/src/server/activity.mjs +52 -0
- package/src/server/auto-update.mjs +79 -0
- package/src/server/claude-accounts.mjs +32 -0
- package/src/server/cswap-admin.mjs +87 -11
- package/src/server/deck-prefs.mjs +51 -1
- package/src/server/index.mjs +150 -2
- package/src/server/lan-about.mjs +119 -0
- package/src/server/lan-engine.mjs +90 -7
- package/src/server/lan-sync.mjs +5 -1
- package/src/server/presence.mjs +40 -0
- package/dist/web/assets/index-Dr-bVaHM.js +0 -266
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var nu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ef={exports:{}},sl={},tf={exports:{}},Xe={};/**
|
|
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 cb;function xM(){if(cb)return Xe;cb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function w(L){return L===null||typeof L!="object"?null:(L=g&&L[g]||L["@@iterator"],typeof L=="function"?L:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,x={};function S(L,K,de){this.props=L,this.context=K,this.refs=x,this.updater=de||v}S.prototype.isReactComponent={},S.prototype.setState=function(L,K){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,K,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function _(){}_.prototype=S.prototype;function j(L,K,de){this.props=L,this.context=K,this.refs=x,this.updater=de||v}var E=j.prototype=new _;E.constructor=j,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,A=Object.prototype.hasOwnProperty,O={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function z(L,K,de){var G,I={},X=null,U=null;if(K!=null)for(G in K.ref!==void 0&&(U=K.ref),K.key!==void 0&&(X=""+K.key),K)A.call(K,G)&&!$.hasOwnProperty(G)&&(I[G]=K[G]);var oe=arguments.length-2;if(oe===1)I.children=de;else if(1<oe){for(var fe=Array(oe),me=0;me<oe;me++)fe[me]=arguments[me+2];I.children=fe}if(L&&L.defaultProps)for(G in oe=L.defaultProps,oe)I[G]===void 0&&(I[G]=oe[G]);return{$$typeof:e,type:L,key:X,ref:U,props:I,_owner:O.current}}function P(L,K){return{$$typeof:e,type:L.type,key:K,ref:L.ref,props:L.props,_owner:L._owner}}function M(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function F(L){var K={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(de){return K[de]})}var H=/\/+/g;function Z(L,K){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):K.toString(36)}function R(L,K,de,G,I){var X=typeof L;(X==="undefined"||X==="boolean")&&(L=null);var U=!1;if(L===null)U=!0;else switch(X){case"string":case"number":U=!0;break;case"object":switch(L.$$typeof){case e:case t:U=!0}}if(U)return U=L,I=I(U),L=G===""?"."+Z(U,0):G,C(I)?(de="",L!=null&&(de=L.replace(H,"$&/")+"/"),R(I,K,de,"",function(me){return me})):I!=null&&(M(I)&&(I=P(I,de+(!I.key||U&&U.key===I.key?"":(""+I.key).replace(H,"$&/")+"/")+L)),K.push(I)),1;if(U=0,G=G===""?".":G+":",C(L))for(var oe=0;oe<L.length;oe++){X=L[oe];var fe=G+Z(X,oe);U+=R(X,K,de,fe,I)}else if(fe=w(L),typeof fe=="function")for(L=fe.call(L),oe=0;!(X=L.next()).done;)X=X.value,fe=G+Z(X,oe++),U+=R(X,K,de,fe,I);else if(X==="object")throw K=String(L),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return U}function Q(L,K,de){if(L==null)return L;var G=[],I=0;return R(L,G,"","",function(X){return K.call(de,X,I++)}),G}function B(L){if(L._status===-1){var K=L._result;K=K(),K.then(function(de){(L._status===0||L._status===-1)&&(L._status=1,L._result=de)},function(de){(L._status===0||L._status===-1)&&(L._status=2,L._result=de)}),L._status===-1&&(L._status=0,L._result=K)}if(L._status===1)return L._result.default;throw L._result}var te={current:null},J={transition:null},q={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:J,ReactCurrentOwner:O};function Y(){throw Error("act(...) is not supported in production builds of React.")}return Xe.Children={map:Q,forEach:function(L,K,de){Q(L,function(){K.apply(this,arguments)},de)},count:function(L){var K=0;return Q(L,function(){K++}),K},toArray:function(L){return Q(L,function(K){return K})||[]},only:function(L){if(!M(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},Xe.Component=S,Xe.Fragment=n,Xe.Profiler=a,Xe.PureComponent=j,Xe.StrictMode=s,Xe.Suspense=f,Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q,Xe.act=Y,Xe.cloneElement=function(L,K,de){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var G=N({},L.props),I=L.key,X=L.ref,U=L._owner;if(K!=null){if(K.ref!==void 0&&(X=K.ref,U=O.current),K.key!==void 0&&(I=""+K.key),L.type&&L.type.defaultProps)var oe=L.type.defaultProps;for(fe in K)A.call(K,fe)&&!$.hasOwnProperty(fe)&&(G[fe]=K[fe]===void 0&&oe!==void 0?oe[fe]:K[fe])}var fe=arguments.length-2;if(fe===1)G.children=de;else if(1<fe){oe=Array(fe);for(var me=0;me<fe;me++)oe[me]=arguments[me+2];G.children=oe}return{$$typeof:e,type:L.type,key:I,ref:X,props:G,_owner:U}},Xe.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:i,_context:L},L.Consumer=L},Xe.createElement=z,Xe.createFactory=function(L){var K=z.bind(null,L);return K.type=L,K},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(L){return{$$typeof:d,render:L}},Xe.isValidElement=M,Xe.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:B}},Xe.memo=function(L,K){return{$$typeof:p,type:L,compare:K===void 0?null:K}},Xe.startTransition=function(L){var K=J.transition;J.transition={};try{L()}finally{J.transition=K}},Xe.unstable_act=Y,Xe.useCallback=function(L,K){return te.current.useCallback(L,K)},Xe.useContext=function(L){return te.current.useContext(L)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(L){return te.current.useDeferredValue(L)},Xe.useEffect=function(L,K){return te.current.useEffect(L,K)},Xe.useId=function(){return te.current.useId()},Xe.useImperativeHandle=function(L,K,de){return te.current.useImperativeHandle(L,K,de)},Xe.useInsertionEffect=function(L,K){return te.current.useInsertionEffect(L,K)},Xe.useLayoutEffect=function(L,K){return te.current.useLayoutEffect(L,K)},Xe.useMemo=function(L,K){return te.current.useMemo(L,K)},Xe.useReducer=function(L,K,de){return te.current.useReducer(L,K,de)},Xe.useRef=function(L){return te.current.useRef(L)},Xe.useState=function(L){return te.current.useState(L)},Xe.useSyncExternalStore=function(L,K,de){return te.current.useSyncExternalStore(L,K,de)},Xe.useTransition=function(){return te.current.useTransition()},Xe.version="18.3.1",Xe}var ub;function $l(){return ub||(ub=1,tf.exports=xM()),tf.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 db;function bM(){if(db)return sl;db=1;var e=$l(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(d,f,p){var h,g={},w=null,v=null;p!==void 0&&(w=""+p),f.key!==void 0&&(w=""+f.key),f.ref!==void 0&&(v=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(g[h]=f[h]);if(d&&d.defaultProps)for(h in f=d.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:d,key:w,ref:v,props:g,_owner:a.current}}return sl.Fragment=n,sl.jsx=l,sl.jsxs=l,sl}var hb;function kM(){return hb||(hb=1,ef.exports=bM()),ef.exports}var c=kM(),ru={},nf={exports:{}},gn={},rf={exports:{}},sf={};/**
|
|
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 fb;function _M(){return fb||(fb=1,(function(e){function t(J,q){var Y=J.length;J.push(q);e:for(;0<Y;){var L=Y-1>>>1,K=J[L];if(0<a(K,q))J[L]=q,J[Y]=K,Y=L;else break e}}function n(J){return J.length===0?null:J[0]}function s(J){if(J.length===0)return null;var q=J[0],Y=J.pop();if(Y!==q){J[0]=Y;e:for(var L=0,K=J.length,de=K>>>1;L<de;){var G=2*(L+1)-1,I=J[G],X=G+1,U=J[X];if(0>a(I,Y))X<K&&0>a(U,I)?(J[L]=U,J[X]=Y,L=X):(J[L]=I,J[G]=Y,L=G);else if(X<K&&0>a(U,Y))J[L]=U,J[X]=Y,L=X;else break e}}return q}function a(J,q){var Y=J.sortIndex-q.sortIndex;return Y!==0?Y:J.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var f=[],p=[],h=1,g=null,w=3,v=!1,N=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(J){for(var q=n(p);q!==null;){if(q.callback===null)s(p);else if(q.startTime<=J)s(p),q.sortIndex=q.expirationTime,t(f,q);else break;q=n(p)}}function C(J){if(x=!1,E(J),!N)if(n(f)!==null)N=!0,B(A);else{var q=n(p);q!==null&&te(C,q.startTime-J)}}function A(J,q){N=!1,x&&(x=!1,_(z),z=-1),v=!0;var Y=w;try{for(E(q),g=n(f);g!==null&&(!(g.expirationTime>q)||J&&!F());){var L=g.callback;if(typeof L=="function"){g.callback=null,w=g.priorityLevel;var K=L(g.expirationTime<=q);q=e.unstable_now(),typeof K=="function"?g.callback=K:g===n(f)&&s(f),E(q)}else s(f);g=n(f)}if(g!==null)var de=!0;else{var G=n(p);G!==null&&te(C,G.startTime-q),de=!1}return de}finally{g=null,w=Y,v=!1}}var O=!1,$=null,z=-1,P=5,M=-1;function F(){return!(e.unstable_now()-M<P)}function H(){if($!==null){var J=e.unstable_now();M=J;var q=!0;try{q=$(!0,J)}finally{q?Z():(O=!1,$=null)}}else O=!1}var Z;if(typeof j=="function")Z=function(){j(H)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Q=R.port2;R.port1.onmessage=H,Z=function(){Q.postMessage(null)}}else Z=function(){S(H,0)};function B(J){$=J,O||(O=!0,Z())}function te(J,q){z=S(function(){J(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(J){J.callback=null},e.unstable_continueExecution=function(){N||v||(N=!0,B(A))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(J){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var Y=w;w=q;try{return J()}finally{w=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,q){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var Y=w;w=J;try{return q()}finally{w=Y}},e.unstable_scheduleCallback=function(J,q,Y){var L=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?L+Y:L):Y=L,J){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=Y+K,J={id:h++,callback:q,priorityLevel:J,startTime:Y,expirationTime:K,sortIndex:-1},Y>L?(J.sortIndex=Y,t(p,J),n(f)===null&&J===n(p)&&(x?(_(z),z=-1):x=!0,te(C,Y-L))):(J.sortIndex=K,t(f,J),N||v||(N=!0,B(A))),J},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(J){var q=w;return function(){var Y=w;w=q;try{return J.apply(this,arguments)}finally{w=Y}}}})(sf)),sf}var pb;function SM(){return pb||(pb=1,rf.exports=_M()),rf.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 mb;function NM(){if(mb)return gn;mb=1;var e=$l(),t=SM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function i(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(a[r]=o,r=0;r<o.length;r++)s.add(o[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function w(r){return f.call(g,r)?!0:f.call(h,r)?!1:p.test(r)?g[r]=!0:(h[r]=!0,!1)}function v(r,o,u,m){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,u,m){if(o===null||typeof o>"u"||v(r,o,u,m))return!0;if(m)return!1;if(u!==null)switch(u.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function x(r,o,u,m,y,b,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=b,this.removeEmptyString=T}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new x(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new x(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new x(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new x(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){S[r]=new x(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new x(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new x(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new x(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new x(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function j(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(_,j);S[o]=new x(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(_,j);S[o]=new x(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(_,j);S[o]=new x(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new x(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new x(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,o,u,m){var y=S.hasOwnProperty(o)?S[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,u,y,m)&&(u=null),m||y===null?w(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):y.mustUseProperty?r[y.propertyName]=u===null?y.type===3?!1:"":u:(o=y.attributeName,m=y.attributeNamespace,u===null?r.removeAttribute(o):(y=y.type,u=y===3||y===4&&u===!0?"":""+u,m?r.setAttributeNS(m,o,u):r.setAttribute(o,u))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),O=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),F=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),J=Symbol.iterator;function q(r){return r===null||typeof r!="object"?null:(r=J&&r[J]||r["@@iterator"],typeof r=="function"?r:null)}var Y=Object.assign,L;function K(r){if(L===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);L=o&&o[1]||""}return`
|
|
34
|
-
`+L+r}var de=!1;function G(r,o){if(!r||de)return"";de=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ce){var m=ce}Reflect.construct(r,[],o)}else{try{o.call()}catch(ce){m=ce}r.call(o.prototype)}else{try{throw Error()}catch(ce){m=ce}r()}}catch(ce){if(ce&&m&&typeof ce.stack=="string"){for(var y=ce.stack.split(`
|
|
35
|
-
`),b=m.stack.split(`
|
|
36
|
-
`),T=y.length-1,V=b.length-1;1<=T&&0<=V&&y[T]!==b[V];)V--;for(;1<=T&&0<=V;T--,V--)if(y[T]!==b[V]){if(T!==1||V!==1)do if(T--,V--,0>V||y[T]!==b[V]){var ee=`
|
|
37
|
-
`+y[T].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=T&&0<=V);break}}}finally{de=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?K(r):""}function I(r){switch(r.tag){case 5:return K(r.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return r=G(r.type,!1),r;case 11:return r=G(r.type.render,!1),r;case 1:return r=G(r.type,!0),r;default:return""}}function X(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case $:return"Fragment";case O:return"Portal";case P:return"Profiler";case z:return"StrictMode";case Z:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case F:return(r.displayName||"Context")+".Consumer";case M:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Q:return o=r.displayName||null,o!==null?o:X(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return X(r(o))}catch{}}return null}function U(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(o);case 8:return o===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function oe(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function fe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function me(r){var o=fe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var y=u.get,b=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,b.call(this,T)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function ke(r){r._valueTracker||(r._valueTracker=me(r))}function Ye(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=fe(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function Le(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function qe(r,o){var u=o.checked;return Y({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function je(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=oe(o.value!=null?o.value:u),r._wrapperState={initialChecked:m,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Ge(r,o){o=o.checked,o!=null&&E(r,"checked",o,!1)}function be(r,o){Ge(r,o);var u=oe(o.value),m=o.type;if(u!=null)m==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ze(r,o.type,u):o.hasOwnProperty("defaultValue")&&Ze(r,o.type,oe(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function se(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Ze(r,o,u){(o!=="number"||Le(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var ht=Array.isArray;function ct(r,o,u,m){if(r=r.options,o){o={};for(var y=0;y<u.length;y++)o["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=o.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&m&&(r[u].defaultSelected=!0)}else{for(u=""+oe(u),o=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function at(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return Y({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ke(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(ht(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:oe(u)}}function pe(r,o){var u=oe(o.value),m=oe(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),m!=null&&(r.defaultValue=""+m)}function ve(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Pe(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ue(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Pe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ot,$e=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,u,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ot=ot||document.createElement("div"),ot.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ot.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function re(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var Se={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},De=["Webkit","ms","Moz","O"];Object.keys(Se).forEach(function(r){De.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Se[o]=Se[r]})});function _e(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Se.hasOwnProperty(r)&&Se[r]?(""+o).trim():o+"px"}function Be(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,y=_e(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,y):r[u]=y}}var kt=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yt(r,o){if(o){if(kt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Ne(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rt=null;function wt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var vt=null,Jt=null,en=null;function Mn(r){if(r=Ui(r)){if(typeof vt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=yc(o),vt(r.stateNode,r.type,o))}}function Oa(r){Jt?en?en.push(r):en=[r]:Jt=r}function Pa(){if(Jt){var r=Jt,o=en;if(en=Jt=null,Mn(r),o)for(r=0;r<o.length;r++)Mn(o[r])}}function La(r,o){return r(o)}function vn(){}var Fs=!1;function qa(r,o,u){if(Fs)return r(o,u);Fs=!0;try{return La(r,o,u)}finally{Fs=!1,(Jt!==null||en!==null)&&(vn(),Pa())}}function It(r,o){var u=r.stateNode;if(u===null)return null;var m=yc(u);if(m===null)return null;u=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var pr=!1;if(d)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){pr=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{pr=!1}function ci(r,o,u,m,y,b,T,V,ee){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(u,ce)}catch(ye){this.onError(ye)}}var Er=!1,Cr=null,Tr=!1,ts=null,zs={onError:function(r){Er=!0,Cr=r}};function Da(r,o,u,m,y,b,T,V,ee){Er=!1,Cr=null,ci.apply(zs,arguments)}function Bs(r,o,u,m,y,b,T,V,ee){if(Da.apply(this,arguments),Er){if(Er){var ce=Cr;Er=!1,Cr=null}else throw Error(n(198));Tr||(Tr=!0,ts=ce)}}function In(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function Fa(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Us(r){if(In(r)!==r)throw Error(n(188))}function ui(r){var o=r.alternate;if(!o){if(o=In(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,m=o;;){var y=u.return;if(y===null)break;var b=y.alternate;if(b===null){if(m=y.return,m!==null){u=m;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===u)return Us(y),r;if(b===m)return Us(y),o;b=b.sibling}throw Error(n(188))}if(u.return!==m.return)u=y,m=b;else{for(var T=!1,V=y.child;V;){if(V===u){T=!0,u=y,m=b;break}if(V===m){T=!0,m=y,u=b;break}V=V.sibling}if(!T){for(V=b.child;V;){if(V===u){T=!0,u=b,m=y;break}if(V===m){T=!0,m=b,u=y;break}V=V.sibling}if(!T)throw Error(n(189))}}if(u.alternate!==m)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function Rr(r){return r=ui(r),r!==null?Ws(r):null}function Ws(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Ws(r);if(o!==null)return o;r=r.sibling}return null}var za=t.unstable_scheduleCallback,Ar=t.unstable_cancelCallback,Hs=t.unstable_shouldYield,ns=t.unstable_requestPaint,ut=t.unstable_now,Ba=t.unstable_getCurrentPriorityLevel,$n=t.unstable_ImmediatePriority,Ua=t.unstable_UserBlockingPriority,Mr=t.unstable_NormalPriority,Gs=t.unstable_LowPriority,Wa=t.unstable_IdlePriority,Ir=null,Lt=null;function Vs(r){if(Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(Ir,r,void 0,(r.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:Cd,xn=Math.log,Ha=Math.LN2;function Cd(r){return r>>>=0,r===0?32:31-(xn(r)/Ha|0)|0}var rs=64,_t=4194304;function Ys(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function On(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,y=r.suspendedLanes,b=r.pingedLanes,T=u&268435455;if(T!==0){var V=T&~y;V!==0?m=Ys(V):(b&=T,b!==0&&(m=Ys(b)))}else T=u&~y,T!==0?m=Ys(T):b!==0&&(m=Ys(b));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,b=o&-o,y>=b||y===16&&(b&4194240)!==0))return o;if((m&4)!==0&&(m|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)u=31-on(o),y=1<<u,m|=r[u],o&=~y;return m}function Td(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rd(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes;0<b;){var T=31-on(b),V=1<<T,ee=y[T];ee===-1?((V&u)===0||(V&m)!==0)&&(y[T]=Td(V,o)):ee<=o&&(r.expiredLanes|=V),b&=~V}}function Pn(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Ks(){var r=rs;return rs<<=1,(rs&4194240)===0&&(rs=64),r}function di(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Xs(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-on(o),r[o]=u}function Xl(r,o){var u=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<u;){var y=31-on(u),b=1<<y;o[y]=0,m[y]=-1,r[y]=-1,u&=~b}}function Ga(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-on(u),y=1<<m;y&o|r[m]&o&&(r[m]|=o),u&=~y}}var Je=0;function hi(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var fi,ss,Va,pi,mi,Ya=!1,Qs=[],St=null,bn=null,kn=null,$r=new Map,Zs=new Map,ln=[],Ql="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 Kn(r,o){switch(r){case"focusin":case"focusout":St=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":$r.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zs.delete(o.pointerId)}}function Js(r,o,u,m,y,b){return r===null||r.nativeEvent!==b?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:b,targetContainers:[y]},o!==null&&(o=Ui(o),o!==null&&ss(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function Zl(r,o,u,m,y){switch(o){case"focusin":return St=Js(St,r,o,u,m,y),!0;case"dragenter":return bn=Js(bn,r,o,u,m,y),!0;case"mouseover":return kn=Js(kn,r,o,u,m,y),!0;case"pointerover":var b=y.pointerId;return $r.set(b,Js($r.get(b)||null,r,o,u,m,y)),!0;case"gotpointercapture":return b=y.pointerId,Zs.set(b,Js(Zs.get(b)||null,r,o,u,m,y)),!0}return!1}function Jl(r){var o=la(r.target);if(o!==null){var u=In(o);if(u!==null){if(o=u.tag,o===13){if(o=Fa(u),o!==null){r.blockedOn=o,mi(r.priority,function(){Va(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Ka(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=ea(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);rt=m,u.target.dispatchEvent(m),rt=null}else return o=Ui(u),o!==null&&ss(o),r.blockedOn=u,!1;o.shift()}return!0}function gi(r,o,u){Ka(r)&&u.delete(o)}function Ad(){Ya=!1,St!==null&&Ka(St)&&(St=null),bn!==null&&Ka(bn)&&(bn=null),kn!==null&&Ka(kn)&&(kn=null),$r.forEach(gi),Zs.forEach(gi)}function _n(r,o){r.blockedOn===o&&(r.blockedOn=null,Ya||(Ya=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ad)))}function Xn(r){function o(y){return _n(y,r)}if(0<Qs.length){_n(Qs[0],r);for(var u=1;u<Qs.length;u++){var m=Qs[u];m.blockedOn===r&&(m.blockedOn=null)}}for(St!==null&&_n(St,r),bn!==null&&_n(bn,r),kn!==null&&_n(kn,r),$r.forEach(o),Zs.forEach(o),u=0;u<ln.length;u++)m=ln[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<ln.length&&(u=ln[0],u.blockedOn===null);)Jl(u),u.blockedOn===null&&ln.shift()}var Or=C.ReactCurrentBatchConfig,as=!0;function Qn(r,o,u,m){var y=Je,b=Or.transition;Or.transition=null;try{Je=1,cn(r,o,u,m)}finally{Je=y,Or.transition=b}}function Md(r,o,u,m){var y=Je,b=Or.transition;Or.transition=null;try{Je=4,cn(r,o,u,m)}finally{Je=y,Or.transition=b}}function cn(r,o,u,m){if(as){var y=ea(r,o,u,m);if(y===null)Wd(r,o,m,os,u),Kn(r,m);else if(Zl(y,r,o,u,m))m.stopPropagation();else if(Kn(r,m),o&4&&-1<Ql.indexOf(r)){for(;y!==null;){var b=Ui(y);if(b!==null&&fi(b),b=ea(r,o,u,m),b===null&&Wd(r,o,m,os,u),b===y)break;y=b}y!==null&&m.stopPropagation()}else Wd(r,o,m,null,u)}}var os=null;function ea(r,o,u,m){if(os=null,r=wt(m),r=la(r),r!==null)if(o=In(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Fa(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return os=r,null}function yi(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ba()){case $n:return 1;case Ua:return 4;case Mr:case Gs:return 16;case Wa:return 536870912;default:return 16}default:return 16}}var Sn=null,ta=null,na=null;function Xa(){if(na)return na;var r,o=ta,u=o.length,m,y="value"in Sn?Sn.value:Sn.textContent,b=y.length;for(r=0;r<u&&o[r]===y[r];r++);var T=u-r;for(m=1;m<=T&&o[u-m]===y[b-m];m++);return na=y.slice(r,1<m?1-m:void 0)}function ra(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function is(){return!0}function wi(){return!1}function Ct(r){function o(u,m,y,b,T){this._reactName=u,this._targetInst=y,this.type=m,this.nativeEvent=b,this.target=T,this.currentTarget=null;for(var V in r)r.hasOwnProperty(V)&&(u=r[V],this[V]=u?u(b):b[V]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?is:wi,this.isPropagationStopped=wi,this}return Y(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=is)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=is)},persist:function(){},isPersistent:is}),o}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qa=Ct(Pr),Lr=Y({},Pr,{view:0,detail:0}),Id=Ct(Lr),sa,mr,ls,Za=Y({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eo,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==ls&&(ls&&r.type==="mousemove"?(sa=r.screenX-ls.screenX,mr=r.screenY-ls.screenY):mr=sa=0,ls=r),sa)},movementY:function(r){return"movementY"in r?r.movementY:mr}}),vi=Ct(Za),ec=Y({},Za,{dataTransfer:0}),$d=Ct(ec),un=Y({},Lr,{relatedTarget:0}),xi=Ct(un),bi=Y({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),cs=Ct(bi),aa=Y({},Pr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),ki=Ct(aa),_i=Y({},Pr,{data:0}),Si=Ct(_i),Ja={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tc={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"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Od[r])?!!o[r]:!1}function eo(){return Pd}var Ld=Y({},Lr,{key:function(r){if(r.key){var o=Ja[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ra(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?tc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eo,charCode:function(r){return r.type==="keypress"?ra(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ra(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),qd=Ct(Ld),Ni=Y({},Za,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zn=Ct(Ni),ji=Y({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eo}),nc=Ct(ji),Dd=Y({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fd=Ct(Dd),rc=Y({},Za,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),sc=Ct(rc),gr=[9,13,27,32],Ei=d&&"CompositionEvent"in window,us=null;d&&"documentMode"in document&&(us=document.documentMode);var zd=d&&"TextEvent"in window&&!us,oa=d&&(!Ei||us&&8<us&&11>=us),ac=" ",Vt=!1;function to(r,o){switch(r){case"keyup":return gr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ci(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var qr=!1;function oc(r,o){switch(r){case"compositionend":return Ci(o);case"keypress":return o.which!==32?null:(Vt=!0,ac);case"textInput":return r=o.data,r===ac&&Vt?null:r;default:return null}}function Ti(r,o){if(qr)return r==="compositionend"||!Ei&&to(r,o)?(r=Xa(),na=ta=Sn=null,qr=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return oa&&o.locale!=="ko"?null:o.data;default:return null}}var no={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 ro(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!no[r.type]:o==="textarea"}function Ri(r,o,u,m){Oa(m),o=pc(o,"onChange"),0<o.length&&(u=new Qa("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var yr=null,ds=null;function Ai(r){ys(r,0)}function hs(r){var o=yo(r);if(Ye(o))return r}function ic(r,o){if(r==="change")return o}var Bt=!1;if(d){var so;if(d){var ao="oninput"in document;if(!ao){var lc=document.createElement("div");lc.setAttribute("oninput","return;"),ao=typeof lc.oninput=="function"}so=ao}else so=!1;Bt=so&&(!document.documentMode||9<document.documentMode)}function cc(){yr&&(yr.detachEvent("onpropertychange",Mi),ds=yr=null)}function Mi(r){if(r.propertyName==="value"&&hs(ds)){var o=[];Ri(o,ds,r,wt(r)),qa(Ai,o)}}function oo(r,o,u){r==="focusin"?(cc(),yr=o,ds=u,yr.attachEvent("onpropertychange",Mi)):r==="focusout"&&cc()}function Bd(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return hs(ds)}function Dr(r,o){if(r==="click")return hs(o)}function Ii(r,o){if(r==="input"||r==="change")return hs(o)}function io(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var tn=typeof Object.is=="function"?Object.is:io;function ia(r,o){if(tn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var y=u[m];if(!f.call(o,y)||!tn(r[y],o[y]))return!1}return!0}function $i(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Oi(r,o){var u=$i(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=$i(u)}}function uc(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?uc(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function dc(){for(var r=window,o=Le();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=Le(r.document)}return o}function lo(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function co(r){var o=dc(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&uc(u.ownerDocument.documentElement,u)){if(m!==null&&lo(u)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var y=u.textContent.length,b=Math.min(m.start,y);m=m.end===void 0?b:Math.min(m.end,y),!r.extend&&b>m&&(y=m,m=b,b=y),y=Oi(u,b);var T=Oi(u,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),b>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Pi=d&&"documentMode"in document&&11>=document.documentMode,fs=null,uo=null,ps=null,ho=!1;function Li(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;ho||fs==null||fs!==Le(m)||(m=fs,"selectionStart"in m&&lo(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),ps&&ia(ps,m)||(ps=m,m=pc(uo,"onSelect"),0<m.length&&(o=new Qa("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=fs)))}function D(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var W={animationend:D("Animation","AnimationEnd"),animationiteration:D("Animation","AnimationIteration"),animationstart:D("Animation","AnimationStart"),transitionend:D("Transition","TransitionEnd")},ie={},ue={};d&&(ue=document.createElement("div").style,"AnimationEvent"in window||(delete W.animationend.animation,delete W.animationiteration.animation,delete W.animationstart.animation),"TransitionEvent"in window||delete W.transitionend.transition);function Ee(r){if(ie[r])return ie[r];if(!W[r])return r;var o=W[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in ue)return ie[r]=o[u];return r}var Ae=Ee("animationend"),He=Ee("animationiteration"),tt=Ee("animationstart"),ft=Ee("transitionend"),it=new Map,nn="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 Nn(r,o){it.set(r,o),i(o,[r])}for(var fo=0;fo<nn.length;fo++){var qi=nn[fo],hc=qi.toLowerCase(),Ud=qi[0].toUpperCase()+qi.slice(1);Nn(hc,"on"+Ud)}Nn(Ae,"onAnimationEnd"),Nn(He,"onAnimationIteration"),Nn(tt,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(ft,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ms="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(" "),Di=new Set("cancel close invalid load scroll toggle".split(" ").concat(ms));function gs(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Bs(m,o,void 0,r),r.currentTarget=null}function ys(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],y=m.event;m=m.listeners;e:{var b=void 0;if(o)for(var T=m.length-1;0<=T;T--){var V=m[T],ee=V.instance,ce=V.currentTarget;if(V=V.listener,ee!==b&&y.isPropagationStopped())break e;gs(y,V,ce),b=ee}else for(T=0;T<m.length;T++){if(V=m[T],ee=V.instance,ce=V.currentTarget,V=V.listener,ee!==b&&y.isPropagationStopped())break e;gs(y,V,ce),b=ee}}}if(Tr)throw r=ts,Tr=!1,ts=null,r}function Ve(r,o){var u=o[Xd];u===void 0&&(u=o[Xd]=new Set);var m=r+"__bubble";u.has(m)||(j0(o,r,2,!1),u.add(m))}function po(r,o,u){var m=0;o&&(m|=4),j0(u,r,m,o)}var fc="_reactListening"+Math.random().toString(36).slice(2);function Fi(r){if(!r[fc]){r[fc]=!0,s.forEach(function(u){u!=="selectionchange"&&(Di.has(u)||po(u,!1,r),po(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[fc]||(o[fc]=!0,po("selectionchange",!1,o))}}function j0(r,o,u,m){switch(yi(o)){case 1:var y=Qn;break;case 4:y=Md;break;default:y=cn}u=y.bind(null,o,u,r),y=void 0,!pr||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,u,{capture:!0,passive:y}):r.addEventListener(o,u,!0):y!==void 0?r.addEventListener(o,u,{passive:y}):r.addEventListener(o,u,!1)}function Wd(r,o,u,m,y){var b=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var V=m.stateNode.containerInfo;if(V===y||V.nodeType===8&&V.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var ee=T.tag;if((ee===3||ee===4)&&(ee=T.stateNode.containerInfo,ee===y||ee.nodeType===8&&ee.parentNode===y))return;T=T.return}for(;V!==null;){if(T=la(V),T===null)return;if(ee=T.tag,ee===5||ee===6){m=b=T;continue e}V=V.parentNode}}m=m.return}qa(function(){var ce=b,ye=wt(u),we=[];e:{var ge=it.get(r);if(ge!==void 0){var Ce=Qa,Re=r;switch(r){case"keypress":if(ra(u)===0)break e;case"keydown":case"keyup":Ce=qd;break;case"focusin":Re="focus",Ce=xi;break;case"focusout":Re="blur",Ce=xi;break;case"beforeblur":case"afterblur":Ce=xi;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ce=vi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ce=$d;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ce=nc;break;case Ae:case He:case tt:Ce=cs;break;case ft:Ce=Fd;break;case"scroll":Ce=Id;break;case"wheel":Ce=sc;break;case"copy":case"cut":case"paste":Ce=ki;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ce=Zn}var Me=(o&4)!==0,Et=!Me&&r==="scroll",ae=Me?ge!==null?ge+"Capture":null:ge;Me=[];for(var ne=ce,le;ne!==null;){le=ne;var xe=le.stateNode;if(le.tag===5&&xe!==null&&(le=xe,ae!==null&&(xe=It(ne,ae),xe!=null&&Me.push(zi(ne,xe,le)))),Et)break;ne=ne.return}0<Me.length&&(ge=new Ce(ge,Re,null,u,ye),we.push({event:ge,listeners:Me}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ce=r==="mouseout"||r==="pointerout",ge&&u!==rt&&(Re=u.relatedTarget||u.fromElement)&&(la(Re)||Re[Fr]))break e;if((Ce||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ce?(Re=u.relatedTarget||u.toElement,Ce=ce,Re=Re?la(Re):null,Re!==null&&(Et=In(Re),Re!==Et||Re.tag!==5&&Re.tag!==6)&&(Re=null)):(Ce=null,Re=ce),Ce!==Re)){if(Me=vi,xe="onMouseLeave",ae="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Me=Zn,xe="onPointerLeave",ae="onPointerEnter",ne="pointer"),Et=Ce==null?ge:yo(Ce),le=Re==null?ge:yo(Re),ge=new Me(xe,ne+"leave",Ce,u,ye),ge.target=Et,ge.relatedTarget=le,xe=null,la(ye)===ce&&(Me=new Me(ae,ne+"enter",Re,u,ye),Me.target=le,Me.relatedTarget=Et,xe=Me),Et=xe,Ce&&Re)t:{for(Me=Ce,ae=Re,ne=0,le=Me;le;le=mo(le))ne++;for(le=0,xe=ae;xe;xe=mo(xe))le++;for(;0<ne-le;)Me=mo(Me),ne--;for(;0<le-ne;)ae=mo(ae),le--;for(;ne--;){if(Me===ae||ae!==null&&Me===ae.alternate)break t;Me=mo(Me),ae=mo(ae)}Me=null}else Me=null;Ce!==null&&E0(we,ge,Ce,Me,!1),Re!==null&&Et!==null&&E0(we,Et,Re,Me,!0)}}e:{if(ge=ce?yo(ce):window,Ce=ge.nodeName&&ge.nodeName.toLowerCase(),Ce==="select"||Ce==="input"&&ge.type==="file")var Ie=ic;else if(ro(ge))if(Bt)Ie=Ii;else{Ie=Bd;var Fe=oo}else(Ce=ge.nodeName)&&Ce.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ie=Dr);if(Ie&&(Ie=Ie(r,ce))){Ri(we,Ie,u,ye);break e}Fe&&Fe(r,ge,ce),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Ze(ge,"number",ge.value)}switch(Fe=ce?yo(ce):window,r){case"focusin":(ro(Fe)||Fe.contentEditable==="true")&&(fs=Fe,uo=ce,ps=null);break;case"focusout":ps=uo=fs=null;break;case"mousedown":ho=!0;break;case"contextmenu":case"mouseup":case"dragend":ho=!1,Li(we,u,ye);break;case"selectionchange":if(Pi)break;case"keydown":case"keyup":Li(we,u,ye)}var ze;if(Ei)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else qr?to(r,u)&&(We="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(We="onCompositionStart");We&&(oa&&u.locale!=="ko"&&(qr||We!=="onCompositionStart"?We==="onCompositionEnd"&&qr&&(ze=Xa()):(Sn=ye,ta="value"in Sn?Sn.value:Sn.textContent,qr=!0)),Fe=pc(ce,We),0<Fe.length&&(We=new Si(We,r,null,u,ye),we.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=Ci(u),ze!==null&&(We.data=ze)))),(ze=zd?oc(r,u):Ti(r,u))&&(ce=pc(ce,"onBeforeInput"),0<ce.length&&(ye=new Si("onBeforeInput","beforeinput",null,u,ye),we.push({event:ye,listeners:ce}),ye.data=ze))}ys(we,o)})}function zi(r,o,u){return{instance:r,listener:o,currentTarget:u}}function pc(r,o){for(var u=o+"Capture",m=[];r!==null;){var y=r,b=y.stateNode;y.tag===5&&b!==null&&(y=b,b=It(r,u),b!=null&&m.unshift(zi(r,b,y)),b=It(r,o),b!=null&&m.push(zi(r,b,y))),r=r.return}return m}function mo(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function E0(r,o,u,m,y){for(var b=o._reactName,T=[];u!==null&&u!==m;){var V=u,ee=V.alternate,ce=V.stateNode;if(ee!==null&&ee===m)break;V.tag===5&&ce!==null&&(V=ce,y?(ee=It(u,b),ee!=null&&T.unshift(zi(u,ee,V))):y||(ee=It(u,b),ee!=null&&T.push(zi(u,ee,V)))),u=u.return}T.length!==0&&r.push({event:o,listeners:T})}var MA=/\r\n?/g,IA=/\u0000|\uFFFD/g;function C0(r){return(typeof r=="string"?r:""+r).replace(MA,`
|
|
38
|
-
`).replace(IA,"")}function mc(r,o,u){if(o=C0(o),C0(r)!==o&&u)throw Error(n(425))}function gc(){}var Hd=null,Gd=null;function Vd(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Yd=typeof setTimeout=="function"?setTimeout:void 0,$A=typeof clearTimeout=="function"?clearTimeout:void 0,T0=typeof Promise=="function"?Promise:void 0,OA=typeof queueMicrotask=="function"?queueMicrotask:typeof T0<"u"?function(r){return T0.resolve(null).then(r).catch(PA)}:Yd;function PA(r){setTimeout(function(){throw r})}function Kd(r,o){var u=o,m=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"){if(m===0){r.removeChild(y),Xn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=y}while(u);Xn(o)}function ws(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function R0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var go=Math.random().toString(36).slice(2),wr="__reactFiber$"+go,Bi="__reactProps$"+go,Fr="__reactContainer$"+go,Xd="__reactEvents$"+go,LA="__reactListeners$"+go,qA="__reactHandles$"+go;function la(r){var o=r[wr];if(o)return o;for(var u=r.parentNode;u;){if(o=u[Fr]||u[wr]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=R0(r);r!==null;){if(u=r[wr])return u;r=R0(r)}return o}r=u,u=r.parentNode}return null}function Ui(r){return r=r[wr]||r[Fr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function yo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function yc(r){return r[Bi]||null}var Qd=[],wo=-1;function vs(r){return{current:r}}function pt(r){0>wo||(r.current=Qd[wo],Qd[wo]=null,wo--)}function dt(r,o){wo++,Qd[wo]=r.current,r.current=o}var xs={},Yt=vs(xs),dn=vs(!1),ca=xs;function vo(r,o){var u=r.type.contextTypes;if(!u)return xs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},b;for(b in u)y[b]=o[b];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function hn(r){return r=r.childContextTypes,r!=null}function wc(){pt(dn),pt(Yt)}function A0(r,o,u){if(Yt.current!==xs)throw Error(n(168));dt(Yt,o),dt(dn,u)}function M0(r,o,u){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return u;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,U(r)||"Unknown",y));return Y({},u,m)}function vc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||xs,ca=Yt.current,dt(Yt,r),dt(dn,dn.current),!0}function I0(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=M0(r,o,ca),m.__reactInternalMemoizedMergedChildContext=r,pt(dn),pt(Yt),dt(Yt,r)):pt(dn),dt(dn,u)}var zr=null,xc=!1,Zd=!1;function $0(r){zr===null?zr=[r]:zr.push(r)}function DA(r){xc=!0,$0(r)}function bs(){if(!Zd&&zr!==null){Zd=!0;var r=0,o=Je;try{var u=zr;for(Je=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}zr=null,xc=!1}catch(y){throw zr!==null&&(zr=zr.slice(r+1)),za($n,bs),y}finally{Je=o,Zd=!1}}return null}var xo=[],bo=0,bc=null,kc=0,Ln=[],qn=0,ua=null,Br=1,Ur="";function da(r,o){xo[bo++]=kc,xo[bo++]=bc,bc=r,kc=o}function O0(r,o,u){Ln[qn++]=Br,Ln[qn++]=Ur,Ln[qn++]=ua,ua=r;var m=Br;r=Ur;var y=32-on(m)-1;m&=~(1<<y),u+=1;var b=32-on(o)+y;if(30<b){var T=y-y%5;b=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Br=1<<32-on(o)+y|u<<y|m,Ur=b+r}else Br=1<<b|u<<y|m,Ur=r}function Jd(r){r.return!==null&&(da(r,1),O0(r,1,0))}function eh(r){for(;r===bc;)bc=xo[--bo],xo[bo]=null,kc=xo[--bo],xo[bo]=null;for(;r===ua;)ua=Ln[--qn],Ln[qn]=null,Ur=Ln[--qn],Ln[qn]=null,Br=Ln[--qn],Ln[qn]=null}var jn=null,En=null,mt=!1,Jn=null;function P0(r,o){var u=Bn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function L0(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jn=r,En=ws(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,En=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=ua!==null?{id:Br,overflow:Ur}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Bn(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,jn=r,En=null,!0):!1;default:return!1}}function th(r){return(r.mode&1)!==0&&(r.flags&128)===0}function nh(r){if(mt){var o=En;if(o){var u=o;if(!L0(r,o)){if(th(r))throw Error(n(418));o=ws(u.nextSibling);var m=jn;o&&L0(r,o)?P0(m,u):(r.flags=r.flags&-4097|2,mt=!1,jn=r)}}else{if(th(r))throw Error(n(418));r.flags=r.flags&-4097|2,mt=!1,jn=r}}}function q0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function _c(r){if(r!==jn)return!1;if(!mt)return q0(r),mt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Vd(r.type,r.memoizedProps)),o&&(o=En)){if(th(r))throw D0(),Error(n(418));for(;o;)P0(r,o),o=ws(o.nextSibling)}if(q0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(o===0){En=ws(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}En=null}}else En=jn?ws(r.stateNode.nextSibling):null;return!0}function D0(){for(var r=En;r;)r=ws(r.nextSibling)}function ko(){En=jn=null,mt=!1}function rh(r){Jn===null?Jn=[r]:Jn.push(r)}var FA=C.ReactCurrentBatchConfig;function Wi(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var m=u.stateNode}if(!m)throw Error(n(147,r));var y=m,b=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===b?o.ref:(o=function(T){var V=y.refs;T===null?delete V[b]:V[b]=T},o._stringRef=b,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Sc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function F0(r){var o=r._init;return o(r._payload)}function z0(r){function o(ae,ne){if(r){var le=ae.deletions;le===null?(ae.deletions=[ne],ae.flags|=16):le.push(ne)}}function u(ae,ne){if(!r)return null;for(;ne!==null;)o(ae,ne),ne=ne.sibling;return null}function m(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function y(ae,ne){return ae=Ts(ae,ne),ae.index=0,ae.sibling=null,ae}function b(ae,ne,le){return ae.index=le,r?(le=ae.alternate,le!==null?(le=le.index,le<ne?(ae.flags|=2,ne):le):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function T(ae){return r&&ae.alternate===null&&(ae.flags|=2),ae}function V(ae,ne,le,xe){return ne===null||ne.tag!==6?(ne=Yh(le,ae.mode,xe),ne.return=ae,ne):(ne=y(ne,le),ne.return=ae,ne)}function ee(ae,ne,le,xe){var Ie=le.type;return Ie===$?ye(ae,ne,le.props.children,xe,le.key):ne!==null&&(ne.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&F0(Ie)===ne.type)?(xe=y(ne,le.props),xe.ref=Wi(ae,ne,le),xe.return=ae,xe):(xe=Yc(le.type,le.key,le.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,le),xe.return=ae,xe)}function ce(ae,ne,le,xe){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==le.containerInfo||ne.stateNode.implementation!==le.implementation?(ne=Kh(le,ae.mode,xe),ne.return=ae,ne):(ne=y(ne,le.children||[]),ne.return=ae,ne)}function ye(ae,ne,le,xe,Ie){return ne===null||ne.tag!==7?(ne=va(le,ae.mode,xe,Ie),ne.return=ae,ne):(ne=y(ne,le),ne.return=ae,ne)}function we(ae,ne,le){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Yh(""+ne,ae.mode,le),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case A:return le=Yc(ne.type,ne.key,ne.props,null,ae.mode,le),le.ref=Wi(ae,null,ne),le.return=ae,le;case O:return ne=Kh(ne,ae.mode,le),ne.return=ae,ne;case B:var xe=ne._init;return we(ae,xe(ne._payload),le)}if(ht(ne)||q(ne))return ne=va(ne,ae.mode,le,null),ne.return=ae,ne;Sc(ae,ne)}return null}function ge(ae,ne,le,xe){var Ie=ne!==null?ne.key:null;if(typeof le=="string"&&le!==""||typeof le=="number")return Ie!==null?null:V(ae,ne,""+le,xe);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case A:return le.key===Ie?ee(ae,ne,le,xe):null;case O:return le.key===Ie?ce(ae,ne,le,xe):null;case B:return Ie=le._init,ge(ae,ne,Ie(le._payload),xe)}if(ht(le)||q(le))return Ie!==null?null:ye(ae,ne,le,xe,null);Sc(ae,le)}return null}function Ce(ae,ne,le,xe,Ie){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ae=ae.get(le)||null,V(ne,ae,""+xe,Ie);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case A:return ae=ae.get(xe.key===null?le:xe.key)||null,ee(ne,ae,xe,Ie);case O:return ae=ae.get(xe.key===null?le:xe.key)||null,ce(ne,ae,xe,Ie);case B:var Fe=xe._init;return Ce(ae,ne,le,Fe(xe._payload),Ie)}if(ht(xe)||q(xe))return ae=ae.get(le)||null,ye(ne,ae,xe,Ie,null);Sc(ne,xe)}return null}function Re(ae,ne,le,xe){for(var Ie=null,Fe=null,ze=ne,We=ne=0,Ft=null;ze!==null&&We<le.length;We++){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var st=ge(ae,ze,le[We],xe);if(st===null){ze===null&&(ze=Ft);break}r&&ze&&st.alternate===null&&o(ae,ze),ne=b(st,ne,We),Fe===null?Ie=st:Fe.sibling=st,Fe=st,ze=Ft}if(We===le.length)return u(ae,ze),mt&&da(ae,We),Ie;if(ze===null){for(;We<le.length;We++)ze=we(ae,le[We],xe),ze!==null&&(ne=b(ze,ne,We),Fe===null?Ie=ze:Fe.sibling=ze,Fe=ze);return mt&&da(ae,We),Ie}for(ze=m(ae,ze);We<le.length;We++)Ft=Ce(ze,ae,We,le[We],xe),Ft!==null&&(r&&Ft.alternate!==null&&ze.delete(Ft.key===null?We:Ft.key),ne=b(Ft,ne,We),Fe===null?Ie=Ft:Fe.sibling=Ft,Fe=Ft);return r&&ze.forEach(function(Rs){return o(ae,Rs)}),mt&&da(ae,We),Ie}function Me(ae,ne,le,xe){var Ie=q(le);if(typeof Ie!="function")throw Error(n(150));if(le=Ie.call(le),le==null)throw Error(n(151));for(var Fe=Ie=null,ze=ne,We=ne=0,Ft=null,st=le.next();ze!==null&&!st.done;We++,st=le.next()){ze.index>We?(Ft=ze,ze=null):Ft=ze.sibling;var Rs=ge(ae,ze,st.value,xe);if(Rs===null){ze===null&&(ze=Ft);break}r&&ze&&Rs.alternate===null&&o(ae,ze),ne=b(Rs,ne,We),Fe===null?Ie=Rs:Fe.sibling=Rs,Fe=Rs,ze=Ft}if(st.done)return u(ae,ze),mt&&da(ae,We),Ie;if(ze===null){for(;!st.done;We++,st=le.next())st=we(ae,st.value,xe),st!==null&&(ne=b(st,ne,We),Fe===null?Ie=st:Fe.sibling=st,Fe=st);return mt&&da(ae,We),Ie}for(ze=m(ae,ze);!st.done;We++,st=le.next())st=Ce(ze,ae,We,st.value,xe),st!==null&&(r&&st.alternate!==null&&ze.delete(st.key===null?We:st.key),ne=b(st,ne,We),Fe===null?Ie=st:Fe.sibling=st,Fe=st);return r&&ze.forEach(function(vM){return o(ae,vM)}),mt&&da(ae,We),Ie}function Et(ae,ne,le,xe){if(typeof le=="object"&&le!==null&&le.type===$&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case A:e:{for(var Ie=le.key,Fe=ne;Fe!==null;){if(Fe.key===Ie){if(Ie=le.type,Ie===$){if(Fe.tag===7){u(ae,Fe.sibling),ne=y(Fe,le.props.children),ne.return=ae,ae=ne;break e}}else if(Fe.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&F0(Ie)===Fe.type){u(ae,Fe.sibling),ne=y(Fe,le.props),ne.ref=Wi(ae,Fe,le),ne.return=ae,ae=ne;break e}u(ae,Fe);break}else o(ae,Fe);Fe=Fe.sibling}le.type===$?(ne=va(le.props.children,ae.mode,xe,le.key),ne.return=ae,ae=ne):(xe=Yc(le.type,le.key,le.props,null,ae.mode,xe),xe.ref=Wi(ae,ne,le),xe.return=ae,ae=xe)}return T(ae);case O:e:{for(Fe=le.key;ne!==null;){if(ne.key===Fe)if(ne.tag===4&&ne.stateNode.containerInfo===le.containerInfo&&ne.stateNode.implementation===le.implementation){u(ae,ne.sibling),ne=y(ne,le.children||[]),ne.return=ae,ae=ne;break e}else{u(ae,ne);break}else o(ae,ne);ne=ne.sibling}ne=Kh(le,ae.mode,xe),ne.return=ae,ae=ne}return T(ae);case B:return Fe=le._init,Et(ae,ne,Fe(le._payload),xe)}if(ht(le))return Re(ae,ne,le,xe);if(q(le))return Me(ae,ne,le,xe);Sc(ae,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,ne!==null&&ne.tag===6?(u(ae,ne.sibling),ne=y(ne,le),ne.return=ae,ae=ne):(u(ae,ne),ne=Yh(le,ae.mode,xe),ne.return=ae,ae=ne),T(ae)):u(ae,ne)}return Et}var _o=z0(!0),B0=z0(!1),Nc=vs(null),jc=null,So=null,sh=null;function ah(){sh=So=jc=null}function oh(r){var o=Nc.current;pt(Nc),r._currentValue=o}function ih(r,o,u){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===u)break;r=r.return}}function No(r,o){jc=r,sh=So=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fn=!0),r.firstContext=null)}function Dn(r){var o=r._currentValue;if(sh!==r)if(r={context:r,memoizedValue:o,next:null},So===null){if(jc===null)throw Error(n(308));So=r,jc.dependencies={lanes:0,firstContext:r}}else So=So.next=r;return o}var ha=null;function lh(r){ha===null?ha=[r]:ha.push(r)}function U0(r,o,u,m){var y=o.interleaved;return y===null?(u.next=u,lh(o)):(u.next=y.next,y.next=u),o.interleaved=u,Wr(r,m)}function Wr(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var ks=!1;function ch(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Hr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function _s(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(nt&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Wr(r,u)}return y=m.interleaved,y===null?(o.next=o,lh(m)):(o.next=y.next,y.next=o),m.interleaved=o,Wr(r,u)}function Ec(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ga(r,u)}}function H0(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var y=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var T={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};b===null?y=b=T:b=b.next=T,u=u.next}while(u!==null);b===null?y=b=o:b=b.next=o}else y=b=o;u={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:m.shared,effects:m.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Cc(r,o,u,m){var y=r.updateQueue;ks=!1;var b=y.firstBaseUpdate,T=y.lastBaseUpdate,V=y.shared.pending;if(V!==null){y.shared.pending=null;var ee=V,ce=ee.next;ee.next=null,T===null?b=ce:T.next=ce,T=ee;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,V=ye.lastBaseUpdate,V!==T&&(V===null?ye.firstBaseUpdate=ce:V.next=ce,ye.lastBaseUpdate=ee))}if(b!==null){var we=y.baseState;T=0,ye=ce=ee=null,V=b;do{var ge=V.lane,Ce=V.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Ce,lane:0,tag:V.tag,payload:V.payload,callback:V.callback,next:null});e:{var Re=r,Me=V;switch(ge=o,Ce=u,Me.tag){case 1:if(Re=Me.payload,typeof Re=="function"){we=Re.call(Ce,we,ge);break e}we=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Me.payload,ge=typeof Re=="function"?Re.call(Ce,we,ge):Re,ge==null)break e;we=Y({},we,ge);break e;case 2:ks=!0}}V.callback!==null&&V.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[V]:ge.push(V))}else Ce={eventTime:Ce,lane:ge,tag:V.tag,payload:V.payload,callback:V.callback,next:null},ye===null?(ce=ye=Ce,ee=we):ye=ye.next=Ce,T|=ge;if(V=V.next,V===null){if(V=y.shared.pending,V===null)break;ge=V,V=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ye===null&&(ee=we),y.baseState=ee,y.firstBaseUpdate=ce,y.lastBaseUpdate=ye,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else b===null&&(y.shared.lanes=0);ma|=T,r.lanes=T,r.memoizedState=we}}function G0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=u,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var Hi={},vr=vs(Hi),Gi=vs(Hi),Vi=vs(Hi);function fa(r){if(r===Hi)throw Error(n(174));return r}function uh(r,o){switch(dt(Vi,o),dt(Gi,r),dt(vr,Hi),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Ue(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Ue(o,r)}pt(vr),dt(vr,o)}function jo(){pt(vr),pt(Gi),pt(Vi)}function V0(r){fa(Vi.current);var o=fa(vr.current),u=Ue(o,r.type);o!==u&&(dt(Gi,r),dt(vr,u))}function dh(r){Gi.current===r&&(pt(vr),pt(Gi))}var xt=vs(0);function Tc(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var hh=[];function fh(){for(var r=0;r<hh.length;r++)hh[r]._workInProgressVersionPrimary=null;hh.length=0}var Rc=C.ReactCurrentDispatcher,ph=C.ReactCurrentBatchConfig,pa=0,bt=null,$t=null,qt=null,Ac=!1,Yi=!1,Ki=0,zA=0;function Kt(){throw Error(n(321))}function mh(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!tn(r[u],o[u]))return!1;return!0}function gh(r,o,u,m,y,b){if(pa=b,bt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Rc.current=r===null||r.memoizedState===null?HA:GA,r=u(m,y),Yi){b=0;do{if(Yi=!1,Ki=0,25<=b)throw Error(n(301));b+=1,qt=$t=null,o.updateQueue=null,Rc.current=VA,r=u(m,y)}while(Yi)}if(Rc.current=$c,o=$t!==null&&$t.next!==null,pa=0,qt=$t=bt=null,Ac=!1,o)throw Error(n(300));return r}function yh(){var r=Ki!==0;return Ki=0,r}function xr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?bt.memoizedState=qt=r:qt=qt.next=r,qt}function Fn(){if($t===null){var r=bt.alternate;r=r!==null?r.memoizedState:null}else r=$t.next;var o=qt===null?bt.memoizedState:qt.next;if(o!==null)qt=o,$t=r;else{if(r===null)throw Error(n(310));$t=r,r={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},qt===null?bt.memoizedState=qt=r:qt=qt.next=r}return qt}function Xi(r,o){return typeof o=="function"?o(r):o}function wh(r){var o=Fn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=$t,y=m.baseQueue,b=u.pending;if(b!==null){if(y!==null){var T=y.next;y.next=b.next,b.next=T}m.baseQueue=y=b,u.pending=null}if(y!==null){b=y.next,m=m.baseState;var V=T=null,ee=null,ce=b;do{var ye=ce.lane;if((pa&ye)===ye)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var we={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(V=ee=we,T=m):ee=ee.next=we,bt.lanes|=ye,ma|=ye}ce=ce.next}while(ce!==null&&ce!==b);ee===null?T=m:ee.next=V,tn(m,o.memoizedState)||(fn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=ee,u.lastRenderedState=m}if(r=u.interleaved,r!==null){y=r;do b=y.lane,bt.lanes|=b,ma|=b,y=y.next;while(y!==r)}else y===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function vh(r){var o=Fn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,y=u.pending,b=o.memoizedState;if(y!==null){u.pending=null;var T=y=y.next;do b=r(b,T.action),T=T.next;while(T!==y);tn(b,o.memoizedState)||(fn=!0),o.memoizedState=b,o.baseQueue===null&&(o.baseState=b),u.lastRenderedState=b}return[b,m]}function Y0(){}function K0(r,o){var u=bt,m=Fn(),y=o(),b=!tn(m.memoizedState,y);if(b&&(m.memoizedState=y,fn=!0),m=m.queue,xh(Z0.bind(null,u,m,r),[r]),m.getSnapshot!==o||b||qt!==null&&qt.memoizedState.tag&1){if(u.flags|=2048,Qi(9,Q0.bind(null,u,m,y,o),void 0,null),Dt===null)throw Error(n(349));(pa&30)!==0||X0(u,o,y)}return y}function X0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function Q0(r,o,u,m){o.value=u,o.getSnapshot=m,J0(o)&&ex(r)}function Z0(r,o,u){return u(function(){J0(o)&&ex(r)})}function J0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!tn(r,u)}catch{return!0}}function ex(r){var o=Wr(r,1);o!==null&&rr(o,r,1,-1)}function tx(r){var o=xr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:r},o.queue=r,r=r.dispatch=WA.bind(null,bt,r),[o.memoizedState,r]}function Qi(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r)),r}function nx(){return Fn().memoizedState}function Mc(r,o,u,m){var y=xr();bt.flags|=r,y.memoizedState=Qi(1|o,u,void 0,m===void 0?null:m)}function Ic(r,o,u,m){var y=Fn();m=m===void 0?null:m;var b=void 0;if($t!==null){var T=$t.memoizedState;if(b=T.destroy,m!==null&&mh(m,T.deps)){y.memoizedState=Qi(o,u,b,m);return}}bt.flags|=r,y.memoizedState=Qi(1|o,u,b,m)}function rx(r,o){return Mc(8390656,8,r,o)}function xh(r,o){return Ic(2048,8,r,o)}function sx(r,o){return Ic(4,2,r,o)}function ax(r,o){return Ic(4,4,r,o)}function ox(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function ix(r,o,u){return u=u!=null?u.concat([r]):null,Ic(4,4,ox.bind(null,o,r),u)}function bh(){}function lx(r,o){var u=Fn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&mh(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function cx(r,o){var u=Fn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&mh(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function ux(r,o,u){return(pa&21)===0?(r.baseState&&(r.baseState=!1,fn=!0),r.memoizedState=u):(tn(u,o)||(u=Ks(),bt.lanes|=u,ma|=u,r.baseState=!0),o)}function BA(r,o){var u=Je;Je=u!==0&&4>u?u:4,r(!0);var m=ph.transition;ph.transition={};try{r(!1),o()}finally{Je=u,ph.transition=m}}function dx(){return Fn().memoizedState}function UA(r,o,u){var m=Es(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},hx(r))fx(o,u);else if(u=U0(r,o,u,m),u!==null){var y=sn();rr(u,r,m,y),px(u,o,m)}}function WA(r,o,u){var m=Es(r),y={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(hx(r))fx(o,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=o.lastRenderedReducer,b!==null))try{var T=o.lastRenderedState,V=b(T,u);if(y.hasEagerState=!0,y.eagerState=V,tn(V,T)){var ee=o.interleaved;ee===null?(y.next=y,lh(o)):(y.next=ee.next,ee.next=y),o.interleaved=y;return}}catch{}finally{}u=U0(r,o,y,m),u!==null&&(y=sn(),rr(u,r,m,y),px(u,o,m))}}function hx(r){var o=r.alternate;return r===bt||o!==null&&o===bt}function fx(r,o){Yi=Ac=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function px(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ga(r,u)}}var $c={readContext:Dn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},HA={readContext:Dn,useCallback:function(r,o){return xr().memoizedState=[r,o===void 0?null:o],r},useContext:Dn,useEffect:rx,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Mc(4194308,4,ox.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Mc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Mc(4,2,r,o)},useMemo:function(r,o){var u=xr();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=xr();return o=u!==void 0?u(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=UA.bind(null,bt,r),[m.memoizedState,r]},useRef:function(r){var o=xr();return r={current:r},o.memoizedState=r},useState:tx,useDebugValue:bh,useDeferredValue:function(r){return xr().memoizedState=r},useTransition:function(){var r=tx(!1),o=r[0];return r=BA.bind(null,r[1]),xr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=bt,y=xr();if(mt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),Dt===null)throw Error(n(349));(pa&30)!==0||X0(m,o,u)}y.memoizedState=u;var b={value:u,getSnapshot:o};return y.queue=b,rx(Z0.bind(null,m,b,r),[r]),m.flags|=2048,Qi(9,Q0.bind(null,m,b,u,o),void 0,null),u},useId:function(){var r=xr(),o=Dt.identifierPrefix;if(mt){var u=Ur,m=Br;u=(m&~(1<<32-on(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=Ki++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=zA++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},GA={readContext:Dn,useCallback:lx,useContext:Dn,useEffect:xh,useImperativeHandle:ix,useInsertionEffect:sx,useLayoutEffect:ax,useMemo:cx,useReducer:wh,useRef:nx,useState:function(){return wh(Xi)},useDebugValue:bh,useDeferredValue:function(r){var o=Fn();return ux(o,$t.memoizedState,r)},useTransition:function(){var r=wh(Xi)[0],o=Fn().memoizedState;return[r,o]},useMutableSource:Y0,useSyncExternalStore:K0,useId:dx,unstable_isNewReconciler:!1},VA={readContext:Dn,useCallback:lx,useContext:Dn,useEffect:xh,useImperativeHandle:ix,useInsertionEffect:sx,useLayoutEffect:ax,useMemo:cx,useReducer:vh,useRef:nx,useState:function(){return vh(Xi)},useDebugValue:bh,useDeferredValue:function(r){var o=Fn();return $t===null?o.memoizedState=r:ux(o,$t.memoizedState,r)},useTransition:function(){var r=vh(Xi)[0],o=Fn().memoizedState;return[r,o]},useMutableSource:Y0,useSyncExternalStore:K0,useId:dx,unstable_isNewReconciler:!1};function er(r,o){if(r&&r.defaultProps){o=Y({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function kh(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:Y({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Oc={isMounted:function(r){return(r=r._reactInternals)?In(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=sn(),y=Es(r),b=Hr(m,y);b.payload=o,u!=null&&(b.callback=u),o=_s(r,b,y),o!==null&&(rr(o,r,y,m),Ec(o,r,y))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=sn(),y=Es(r),b=Hr(m,y);b.tag=1,b.payload=o,u!=null&&(b.callback=u),o=_s(r,b,y),o!==null&&(rr(o,r,y,m),Ec(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=sn(),m=Es(r),y=Hr(u,m);y.tag=2,o!=null&&(y.callback=o),o=_s(r,y,m),o!==null&&(rr(o,r,m,u),Ec(o,r,m))}};function mx(r,o,u,m,y,b,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,b,T):o.prototype&&o.prototype.isPureReactComponent?!ia(u,m)||!ia(y,b):!0}function gx(r,o,u){var m=!1,y=xs,b=o.contextType;return typeof b=="object"&&b!==null?b=Dn(b):(y=hn(o)?ca:Yt.current,m=o.contextTypes,b=(m=m!=null)?vo(r,y):xs),o=new o(u,b),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Oc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=b),o}function yx(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&Oc.enqueueReplaceState(o,o.state,null)}function _h(r,o,u,m){var y=r.stateNode;y.props=u,y.state=r.memoizedState,y.refs={},ch(r);var b=o.contextType;typeof b=="object"&&b!==null?y.context=Dn(b):(b=hn(o)?ca:Yt.current,y.context=vo(r,b)),y.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(kh(r,o,b,u),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&Oc.enqueueReplaceState(y,y.state,null),Cc(r,u,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function Eo(r,o){try{var u="",m=o;do u+=I(m),m=m.return;while(m);var y=u}catch(b){y=`
|
|
39
|
-
Error generating stack: `+b.message+`
|
|
40
|
-
`+b.stack}return{value:r,source:o,stack:y,digest:null}}function Sh(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Nh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var YA=typeof WeakMap=="function"?WeakMap:Map;function wx(r,o,u){u=Hr(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Bc||(Bc=!0,Fh=m),Nh(r,o)},u}function vx(r,o,u){u=Hr(-1,u),u.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;u.payload=function(){return m(y)},u.callback=function(){Nh(r,o)}}var b=r.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(u.callback=function(){Nh(r,o),typeof m!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),u}function xx(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new YA;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(u)||(y.add(u),r=lM.bind(null,r,o,u),o.then(r,r))}function bx(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function kx(r,o,u,m,y){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=Hr(-1,1),o.tag=2,_s(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var KA=C.ReactCurrentOwner,fn=!1;function rn(r,o,u,m){o.child=r===null?B0(o,null,u,m):_o(o,r.child,u,m)}function _x(r,o,u,m,y){u=u.render;var b=o.ref;return No(o,y),m=gh(r,o,u,m,b,y),u=yh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Gr(r,o,y)):(mt&&u&&Jd(o),o.flags|=1,rn(r,o,m,y),o.child)}function Sx(r,o,u,m,y){if(r===null){var b=u.type;return typeof b=="function"&&!Vh(b)&&b.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=b,Nx(r,o,b,m,y)):(r=Yc(u.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(b=r.child,(r.lanes&y)===0){var T=b.memoizedProps;if(u=u.compare,u=u!==null?u:ia,u(T,m)&&r.ref===o.ref)return Gr(r,o,y)}return o.flags|=1,r=Ts(b,m),r.ref=o.ref,r.return=o,o.child=r}function Nx(r,o,u,m,y){if(r!==null){var b=r.memoizedProps;if(ia(b,m)&&r.ref===o.ref)if(fn=!1,o.pendingProps=m=b,(r.lanes&y)!==0)(r.flags&131072)!==0&&(fn=!0);else return o.lanes=r.lanes,Gr(r,o,y)}return jh(r,o,u,m,y)}function jx(r,o,u){var m=o.pendingProps,y=m.children,b=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(To,Cn),Cn|=u;else{if((u&1073741824)===0)return r=b!==null?b.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,dt(To,Cn),Cn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=b!==null?b.baseLanes:u,dt(To,Cn),Cn|=m}else b!==null?(m=b.baseLanes|u,o.memoizedState=null):m=u,dt(To,Cn),Cn|=m;return rn(r,o,y,u),o.child}function Ex(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function jh(r,o,u,m,y){var b=hn(u)?ca:Yt.current;return b=vo(o,b),No(o,y),u=gh(r,o,u,m,b,y),m=yh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Gr(r,o,y)):(mt&&m&&Jd(o),o.flags|=1,rn(r,o,u,y),o.child)}function Cx(r,o,u,m,y){if(hn(u)){var b=!0;vc(o)}else b=!1;if(No(o,y),o.stateNode===null)Lc(r,o),gx(o,u,m),_h(o,u,m,y),m=!0;else if(r===null){var T=o.stateNode,V=o.memoizedProps;T.props=V;var ee=T.context,ce=u.contextType;typeof ce=="object"&&ce!==null?ce=Dn(ce):(ce=hn(u)?ca:Yt.current,ce=vo(o,ce));var ye=u.getDerivedStateFromProps,we=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";we||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==m||ee!==ce)&&yx(o,T,m,ce),ks=!1;var ge=o.memoizedState;T.state=ge,Cc(o,m,T,y),ee=o.memoizedState,V!==m||ge!==ee||dn.current||ks?(typeof ye=="function"&&(kh(o,u,ye,m),ee=o.memoizedState),(V=ks||mx(o,u,V,m,ge,ee,ce))?(we||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),T.props=m,T.state=ee,T.context=ce,m=V):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,W0(r,o),V=o.memoizedProps,ce=o.type===o.elementType?V:er(o.type,V),T.props=ce,we=o.pendingProps,ge=T.context,ee=u.contextType,typeof ee=="object"&&ee!==null?ee=Dn(ee):(ee=hn(u)?ca:Yt.current,ee=vo(o,ee));var Ce=u.getDerivedStateFromProps;(ye=typeof Ce=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(V!==we||ge!==ee)&&yx(o,T,m,ee),ks=!1,ge=o.memoizedState,T.state=ge,Cc(o,m,T,y);var Re=o.memoizedState;V!==we||ge!==Re||dn.current||ks?(typeof Ce=="function"&&(kh(o,u,Ce,m),Re=o.memoizedState),(ce=ks||mx(o,u,ce,m,ge,Re,ee)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Re,ee),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Re,ee)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Re),T.props=m,T.state=Re,T.context=ee,m=ce):(typeof T.componentDidUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||V===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return Eh(r,o,u,m,b,y)}function Eh(r,o,u,m,y,b){Ex(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&I0(o,u,!1),Gr(r,o,b);m=o.stateNode,KA.current=o;var V=T&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=_o(o,r.child,null,b),o.child=_o(o,null,V,b)):rn(r,o,V,b),o.memoizedState=m.state,y&&I0(o,u,!0),o.child}function Tx(r){var o=r.stateNode;o.pendingContext?A0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&A0(r,o.context,!1),uh(r,o.containerInfo)}function Rx(r,o,u,m,y){return ko(),rh(y),o.flags|=256,rn(r,o,u,m),o.child}var Ch={dehydrated:null,treeContext:null,retryLane:0};function Th(r){return{baseLanes:r,cachePool:null,transitions:null}}function Ax(r,o,u){var m=o.pendingProps,y=xt.current,b=!1,T=(o.flags&128)!==0,V;if((V=T)||(V=r!==null&&r.memoizedState===null?!1:(y&2)!==0),V?(b=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),dt(xt,y&1),r===null)return nh(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,r=m.fallback,b?(m=o.mode,b=o.child,T={mode:"hidden",children:T},(m&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=T):b=Kc(T,m,0,null),r=va(r,m,u,null),b.return=o,r.return=o,b.sibling=r,o.child=b,o.child.memoizedState=Th(u),o.memoizedState=Ch,r):Rh(o,T));if(y=r.memoizedState,y!==null&&(V=y.dehydrated,V!==null))return XA(r,o,T,m,V,y,u);if(b){b=m.fallback,T=o.mode,y=r.child,V=y.sibling;var ee={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Ts(y,ee),m.subtreeFlags=y.subtreeFlags&14680064),V!==null?b=Ts(V,b):(b=va(b,T,u,null),b.flags|=2),b.return=o,m.return=o,m.sibling=b,o.child=m,m=b,b=o.child,T=r.child.memoizedState,T=T===null?Th(u):{baseLanes:T.baseLanes|u,cachePool:null,transitions:T.transitions},b.memoizedState=T,b.childLanes=r.childLanes&~u,o.memoizedState=Ch,m}return b=r.child,r=b.sibling,m=Ts(b,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=u),m.return=o,m.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=m,o.memoizedState=null,m}function Rh(r,o){return o=Kc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Pc(r,o,u,m){return m!==null&&rh(m),_o(o,r.child,null,u),r=Rh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function XA(r,o,u,m,y,b,T){if(u)return o.flags&256?(o.flags&=-257,m=Sh(Error(n(422))),Pc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(b=m.fallback,y=o.mode,m=Kc({mode:"visible",children:m.children},y,0,null),b=va(b,y,T,null),b.flags|=2,m.return=o,b.return=o,m.sibling=b,o.child=m,(o.mode&1)!==0&&_o(o,r.child,null,T),o.child.memoizedState=Th(T),o.memoizedState=Ch,b);if((o.mode&1)===0)return Pc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var V=m.dgst;return m=V,b=Error(n(419)),m=Sh(b,m,void 0),Pc(r,o,T,m)}if(V=(T&r.childLanes)!==0,fn||V){if(m=Dt,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==b.retryLane&&(b.retryLane=y,Wr(r,y),rr(m,r,y,-1))}return Gh(),m=Sh(Error(n(421))),Pc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=cM.bind(null,r),y._reactRetry=o,null):(r=b.treeContext,En=ws(y.nextSibling),jn=o,mt=!0,Jn=null,r!==null&&(Ln[qn++]=Br,Ln[qn++]=Ur,Ln[qn++]=ua,Br=r.id,Ur=r.overflow,ua=o),o=Rh(o,m.children),o.flags|=4096,o)}function Mx(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),ih(r.return,o,u)}function Ah(r,o,u,m,y){var b=r.memoizedState;b===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:y}:(b.isBackwards=o,b.rendering=null,b.renderingStartTime=0,b.last=m,b.tail=u,b.tailMode=y)}function Ix(r,o,u){var m=o.pendingProps,y=m.revealOrder,b=m.tail;if(rn(r,o,m.children,u),m=xt.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Mx(r,u,o);else if(r.tag===19)Mx(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(dt(xt,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(u=o.child,y=null;u!==null;)r=u.alternate,r!==null&&Tc(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=o.child,o.child=null):(y=u.sibling,u.sibling=null),Ah(o,!1,y,u,b);break;case"backwards":for(u=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&Tc(r)===null){o.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}Ah(o,!0,u,null,b);break;case"together":Ah(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Lc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Gr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),ma|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Ts(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Ts(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function QA(r,o,u){switch(o.tag){case 3:Tx(o),ko();break;case 5:V0(o);break;case 1:hn(o.type)&&vc(o);break;case 4:uh(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;dt(Nc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(dt(xt,xt.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?Ax(r,o,u):(dt(xt,xt.current&1),r=Gr(r,o,u),r!==null?r.sibling:null);dt(xt,xt.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Ix(r,o,u);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),dt(xt,xt.current),m)break;return null;case 22:case 23:return o.lanes=0,jx(r,o,u)}return Gr(r,o,u)}var $x,Mh,Ox,Px;$x=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Mh=function(){},Ox=function(r,o,u,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,fa(vr.current);var b=null;switch(u){case"input":y=qe(r,y),m=qe(r,m),b=[];break;case"select":y=Y({},y,{value:void 0}),m=Y({},m,{value:void 0}),b=[];break;case"textarea":y=at(r,y),m=at(r,m),b=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=gc)}yt(u,m);var T;u=null;for(ce in y)if(!m.hasOwnProperty(ce)&&y.hasOwnProperty(ce)&&y[ce]!=null)if(ce==="style"){var V=y[ce];for(T in V)V.hasOwnProperty(T)&&(u||(u={}),u[T]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(a.hasOwnProperty(ce)?b||(b=[]):(b=b||[]).push(ce,null));for(ce in m){var ee=m[ce];if(V=y!=null?y[ce]:void 0,m.hasOwnProperty(ce)&&ee!==V&&(ee!=null||V!=null))if(ce==="style")if(V){for(T in V)!V.hasOwnProperty(T)||ee&&ee.hasOwnProperty(T)||(u||(u={}),u[T]="");for(T in ee)ee.hasOwnProperty(T)&&V[T]!==ee[T]&&(u||(u={}),u[T]=ee[T])}else u||(b||(b=[]),b.push(ce,u)),u=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,V=V?V.__html:void 0,ee!=null&&V!==ee&&(b=b||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(b=b||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(a.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&Ve("scroll",r),b||V===ee||(b=[])):(b=b||[]).push(ce,ee))}u&&(b=b||[]).push("style",u);var ce=b;(o.updateQueue=ce)&&(o.flags|=4)}},Px=function(r,o,u,m){u!==m&&(o.flags|=4)};function Zi(r,o){if(!mt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function ZA(r,o,u){var m=o.pendingProps;switch(eh(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return hn(o.type)&&wc(),Xt(o),null;case 3:return m=o.stateNode,jo(),pt(dn),pt(Yt),fh(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(_c(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Jn!==null&&(Uh(Jn),Jn=null))),Mh(r,o),Xt(o),null;case 5:dh(o);var y=fa(Vi.current);if(u=o.type,r!==null&&o.stateNode!=null)Ox(r,o,u,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=fa(vr.current),_c(o)){m=o.stateNode,u=o.type;var b=o.memoizedProps;switch(m[wr]=o,m[Bi]=b,r=(o.mode&1)!==0,u){case"dialog":Ve("cancel",m),Ve("close",m);break;case"iframe":case"object":case"embed":Ve("load",m);break;case"video":case"audio":for(y=0;y<ms.length;y++)Ve(ms[y],m);break;case"source":Ve("error",m);break;case"img":case"image":case"link":Ve("error",m),Ve("load",m);break;case"details":Ve("toggle",m);break;case"input":je(m,b),Ve("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!b.multiple},Ve("invalid",m);break;case"textarea":Ke(m,b),Ve("invalid",m)}yt(u,b),y=null;for(var T in b)if(b.hasOwnProperty(T)){var V=b[T];T==="children"?typeof V=="string"?m.textContent!==V&&(b.suppressHydrationWarning!==!0&&mc(m.textContent,V,r),y=["children",V]):typeof V=="number"&&m.textContent!==""+V&&(b.suppressHydrationWarning!==!0&&mc(m.textContent,V,r),y=["children",""+V]):a.hasOwnProperty(T)&&V!=null&&T==="onScroll"&&Ve("scroll",m)}switch(u){case"input":ke(m),se(m,b,!0);break;case"textarea":ke(m),ve(m);break;case"select":case"option":break;default:typeof b.onClick=="function"&&(m.onclick=gc)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Pe(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(u,{is:m.is}):(r=T.createElement(u),u==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,u),r[wr]=o,r[Bi]=m,$x(r,o,!1,!1),o.stateNode=r;e:{switch(T=Ne(u,m),u){case"dialog":Ve("cancel",r),Ve("close",r),y=m;break;case"iframe":case"object":case"embed":Ve("load",r),y=m;break;case"video":case"audio":for(y=0;y<ms.length;y++)Ve(ms[y],r);y=m;break;case"source":Ve("error",r),y=m;break;case"img":case"image":case"link":Ve("error",r),Ve("load",r),y=m;break;case"details":Ve("toggle",r),y=m;break;case"input":je(r,m),y=qe(r,m),Ve("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=Y({},m,{value:void 0}),Ve("invalid",r);break;case"textarea":Ke(r,m),y=at(r,m),Ve("invalid",r);break;default:y=m}yt(u,y),V=y;for(b in V)if(V.hasOwnProperty(b)){var ee=V[b];b==="style"?Be(r,ee):b==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&$e(r,ee)):b==="children"?typeof ee=="string"?(u!=="textarea"||ee!=="")&&re(r,ee):typeof ee=="number"&&re(r,""+ee):b!=="suppressContentEditableWarning"&&b!=="suppressHydrationWarning"&&b!=="autoFocus"&&(a.hasOwnProperty(b)?ee!=null&&b==="onScroll"&&Ve("scroll",r):ee!=null&&E(r,b,ee,T))}switch(u){case"input":ke(r),se(r,m,!1);break;case"textarea":ke(r),ve(r);break;case"option":m.value!=null&&r.setAttribute("value",""+oe(m.value));break;case"select":r.multiple=!!m.multiple,b=m.value,b!=null?ct(r,!!m.multiple,b,!1):m.defaultValue!=null&&ct(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=gc)}switch(u){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Xt(o),null;case 6:if(r&&o.stateNode!=null)Px(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=fa(Vi.current),fa(vr.current),_c(o)){if(m=o.stateNode,u=o.memoizedProps,m[wr]=o,(b=m.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:mc(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&mc(m.nodeValue,u,(r.mode&1)!==0)}b&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[wr]=o,o.stateNode=m}return Xt(o),null;case 13:if(pt(xt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(mt&&En!==null&&(o.mode&1)!==0&&(o.flags&128)===0)D0(),ko(),o.flags|=98560,b=!1;else if(b=_c(o),m!==null&&m.dehydrated!==null){if(r===null){if(!b)throw Error(n(318));if(b=o.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[wr]=o}else ko(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),b=!1}else Jn!==null&&(Uh(Jn),Jn=null),b=!0;if(!b)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(xt.current&1)!==0?Ot===0&&(Ot=3):Gh())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return jo(),Mh(r,o),r===null&&Fi(o.stateNode.containerInfo),Xt(o),null;case 10:return oh(o.type._context),Xt(o),null;case 17:return hn(o.type)&&wc(),Xt(o),null;case 19:if(pt(xt),b=o.memoizedState,b===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=b.rendering,T===null)if(m)Zi(b,!1);else{if(Ot!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Tc(r),T!==null){for(o.flags|=128,Zi(b,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)b=u,r=m,b.flags&=14680066,T=b.alternate,T===null?(b.childLanes=0,b.lanes=r,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=T.childLanes,b.lanes=T.lanes,b.child=T.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=T.memoizedProps,b.memoizedState=T.memoizedState,b.updateQueue=T.updateQueue,b.type=T.type,r=T.dependencies,b.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return dt(xt,xt.current&1|2),o.child}r=r.sibling}b.tail!==null&&ut()>Ro&&(o.flags|=128,m=!0,Zi(b,!1),o.lanes=4194304)}else{if(!m)if(r=Tc(T),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),Zi(b,!0),b.tail===null&&b.tailMode==="hidden"&&!T.alternate&&!mt)return Xt(o),null}else 2*ut()-b.renderingStartTime>Ro&&u!==1073741824&&(o.flags|=128,m=!0,Zi(b,!1),o.lanes=4194304);b.isBackwards?(T.sibling=o.child,o.child=T):(u=b.last,u!==null?u.sibling=T:o.child=T,b.last=T)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=ut(),o.sibling=null,u=xt.current,dt(xt,m?u&1|2:u&1),o):(Xt(o),null);case 22:case 23:return Hh(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Cn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function JA(r,o){switch(eh(o),o.tag){case 1:return hn(o.type)&&wc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return jo(),pt(dn),pt(Yt),fh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return dh(o),null;case 13:if(pt(xt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ko()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(xt),null;case 4:return jo(),null;case 10:return oh(o.type._context),null;case 22:case 23:return Hh(),null;case 24:return null;default:return null}}var qc=!1,Qt=!1,eM=typeof WeakSet=="function"?WeakSet:Set,Te=null;function Co(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(m){Nt(r,o,m)}else u.current=null}function Ih(r,o,u){try{u()}catch(m){Nt(r,o,m)}}var Lx=!1;function tM(r,o){if(Hd=as,r=dc(),lo(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var y=m.anchorOffset,b=m.focusNode;m=m.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var T=0,V=-1,ee=-1,ce=0,ye=0,we=r,ge=null;t:for(;;){for(var Ce;we!==u||y!==0&&we.nodeType!==3||(V=T+y),we!==b||m!==0&&we.nodeType!==3||(ee=T+m),we.nodeType===3&&(T+=we.nodeValue.length),(Ce=we.firstChild)!==null;)ge=we,we=Ce;for(;;){if(we===r)break t;if(ge===u&&++ce===y&&(V=T),ge===b&&++ye===m&&(ee=T),(Ce=we.nextSibling)!==null)break;we=ge,ge=we.parentNode}we=Ce}u=V===-1||ee===-1?null:{start:V,end:ee}}else u=null}u=u||{start:0,end:0}}else u=null;for(Gd={focusedElem:r,selectionRange:u},as=!1,Te=o;Te!==null;)if(o=Te,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Te=r;else for(;Te!==null;){o=Te;try{var Re=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Re!==null){var Me=Re.memoizedProps,Et=Re.memoizedState,ae=o.stateNode,ne=ae.getSnapshotBeforeUpdate(o.elementType===o.type?Me:er(o.type,Me),Et);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var le=o.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){Nt(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Te=r;break}Te=o.return}return Re=Lx,Lx=!1,Re}function Ji(r,o,u){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var b=y.destroy;y.destroy=void 0,b!==void 0&&Ih(o,u,b)}y=y.next}while(y!==m)}}function Dc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var m=u.create;u.destroy=m()}u=u.next}while(u!==o)}}function $h(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function qx(r){var o=r.alternate;o!==null&&(r.alternate=null,qx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[wr],delete o[Bi],delete o[Xd],delete o[LA],delete o[qA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Dx(r){return r.tag===5||r.tag===3||r.tag===4}function Fx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Dx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Oh(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=gc));else if(m!==4&&(r=r.child,r!==null))for(Oh(r,o,u),r=r.sibling;r!==null;)Oh(r,o,u),r=r.sibling}function Ph(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(Ph(r,o,u),r=r.sibling;r!==null;)Ph(r,o,u),r=r.sibling}var Ut=null,tr=!1;function Ss(r,o,u){for(u=u.child;u!==null;)zx(r,o,u),u=u.sibling}function zx(r,o,u){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(Ir,u)}catch{}switch(u.tag){case 5:Qt||Co(u,o);case 6:var m=Ut,y=tr;Ut=null,Ss(r,o,u),Ut=m,tr=y,Ut!==null&&(tr?(r=Ut,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Ut.removeChild(u.stateNode));break;case 18:Ut!==null&&(tr?(r=Ut,u=u.stateNode,r.nodeType===8?Kd(r.parentNode,u):r.nodeType===1&&Kd(r,u),Xn(r)):Kd(Ut,u.stateNode));break;case 4:m=Ut,y=tr,Ut=u.stateNode.containerInfo,tr=!0,Ss(r,o,u),Ut=m,tr=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var b=y,T=b.destroy;b=b.tag,T!==void 0&&((b&2)!==0||(b&4)!==0)&&Ih(u,o,T),y=y.next}while(y!==m)}Ss(r,o,u);break;case 1:if(!Qt&&(Co(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(V){Nt(u,o,V)}Ss(r,o,u);break;case 21:Ss(r,o,u);break;case 22:u.mode&1?(Qt=(m=Qt)||u.memoizedState!==null,Ss(r,o,u),Qt=m):Ss(r,o,u);break;default:Ss(r,o,u)}}function Bx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new eM),o.forEach(function(m){var y=uM.bind(null,r,m);u.has(m)||(u.add(m),m.then(y,y))})}}function nr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var y=u[m];try{var b=r,T=o,V=T;e:for(;V!==null;){switch(V.tag){case 5:Ut=V.stateNode,tr=!1;break e;case 3:Ut=V.stateNode.containerInfo,tr=!0;break e;case 4:Ut=V.stateNode.containerInfo,tr=!0;break e}V=V.return}if(Ut===null)throw Error(n(160));zx(b,T,y),Ut=null,tr=!1;var ee=y.alternate;ee!==null&&(ee.return=null),y.return=null}catch(ce){Nt(y,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Ux(o,r),o=o.sibling}function Ux(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(nr(o,r),br(r),m&4){try{Ji(3,r,r.return),Dc(3,r)}catch(Me){Nt(r,r.return,Me)}try{Ji(5,r,r.return)}catch(Me){Nt(r,r.return,Me)}}break;case 1:nr(o,r),br(r),m&512&&u!==null&&Co(u,u.return);break;case 5:if(nr(o,r),br(r),m&512&&u!==null&&Co(u,u.return),r.flags&32){var y=r.stateNode;try{re(y,"")}catch(Me){Nt(r,r.return,Me)}}if(m&4&&(y=r.stateNode,y!=null)){var b=r.memoizedProps,T=u!==null?u.memoizedProps:b,V=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{V==="input"&&b.type==="radio"&&b.name!=null&&Ge(y,b),Ne(V,T);var ce=Ne(V,b);for(T=0;T<ee.length;T+=2){var ye=ee[T],we=ee[T+1];ye==="style"?Be(y,we):ye==="dangerouslySetInnerHTML"?$e(y,we):ye==="children"?re(y,we):E(y,ye,we,ce)}switch(V){case"input":be(y,b);break;case"textarea":pe(y,b);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!b.multiple;var Ce=b.value;Ce!=null?ct(y,!!b.multiple,Ce,!1):ge!==!!b.multiple&&(b.defaultValue!=null?ct(y,!!b.multiple,b.defaultValue,!0):ct(y,!!b.multiple,b.multiple?[]:"",!1))}y[Bi]=b}catch(Me){Nt(r,r.return,Me)}}break;case 6:if(nr(o,r),br(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,b=r.memoizedProps;try{y.nodeValue=b}catch(Me){Nt(r,r.return,Me)}}break;case 3:if(nr(o,r),br(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{Xn(o.containerInfo)}catch(Me){Nt(r,r.return,Me)}break;case 4:nr(o,r),br(r);break;case 13:nr(o,r),br(r),y=r.child,y.flags&8192&&(b=y.memoizedState!==null,y.stateNode.isHidden=b,!b||y.alternate!==null&&y.alternate.memoizedState!==null||(Dh=ut())),m&4&&Bx(r);break;case 22:if(ye=u!==null&&u.memoizedState!==null,r.mode&1?(Qt=(ce=Qt)||ye,nr(o,r),Qt=ce):nr(o,r),br(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ye&&(r.mode&1)!==0)for(Te=r,ye=r.child;ye!==null;){for(we=Te=ye;Te!==null;){switch(ge=Te,Ce=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ji(4,ge,ge.return);break;case 1:Co(ge,ge.return);var Re=ge.stateNode;if(typeof Re.componentWillUnmount=="function"){m=ge,u=ge.return;try{o=m,Re.props=o.memoizedProps,Re.state=o.memoizedState,Re.componentWillUnmount()}catch(Me){Nt(m,u,Me)}}break;case 5:Co(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Gx(we);continue}}Ce!==null?(Ce.return=ge,Te=Ce):Gx(we)}ye=ye.sibling}e:for(ye=null,we=r;;){if(we.tag===5){if(ye===null){ye=we;try{y=we.stateNode,ce?(b=y.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none"):(V=we.stateNode,ee=we.memoizedProps.style,T=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,V.style.display=_e("display",T))}catch(Me){Nt(r,r.return,Me)}}}else if(we.tag===6){if(ye===null)try{we.stateNode.nodeValue=ce?"":we.memoizedProps}catch(Me){Nt(r,r.return,Me)}}else if((we.tag!==22&&we.tag!==23||we.memoizedState===null||we===r)&&we.child!==null){we.child.return=we,we=we.child;continue}if(we===r)break e;for(;we.sibling===null;){if(we.return===null||we.return===r)break e;ye===we&&(ye=null),we=we.return}ye===we&&(ye=null),we.sibling.return=we.return,we=we.sibling}}break;case 19:nr(o,r),br(r),m&4&&Bx(r);break;case 21:break;default:nr(o,r),br(r)}}function br(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(Dx(u)){var m=u;break e}u=u.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(re(y,""),m.flags&=-33);var b=Fx(r);Ph(r,b,y);break;case 3:case 4:var T=m.stateNode.containerInfo,V=Fx(r);Oh(r,V,T);break;default:throw Error(n(161))}}catch(ee){Nt(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function nM(r,o,u){Te=r,Wx(r)}function Wx(r,o,u){for(var m=(r.mode&1)!==0;Te!==null;){var y=Te,b=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||qc;if(!T){var V=y.alternate,ee=V!==null&&V.memoizedState!==null||Qt;V=qc;var ce=Qt;if(qc=T,(Qt=ee)&&!ce)for(Te=y;Te!==null;)T=Te,ee=T.child,T.tag===22&&T.memoizedState!==null?Vx(y):ee!==null?(ee.return=T,Te=ee):Vx(y);for(;b!==null;)Te=b,Wx(b),b=b.sibling;Te=y,qc=V,Qt=ce}Hx(r)}else(y.subtreeFlags&8772)!==0&&b!==null?(b.return=y,Te=b):Hx(r)}}function Hx(r){for(;Te!==null;){var o=Te;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Qt||Dc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(u===null)m.componentDidMount();else{var y=o.elementType===o.type?u.memoizedProps:er(o.type,u.memoizedProps);m.componentDidUpdate(y,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var b=o.updateQueue;b!==null&&G0(o,b,m);break;case 3:var T=o.updateQueue;if(T!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}G0(o,T,u)}break;case 5:var V=o.stateNode;if(u===null&&o.flags&4){u=V;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&u.focus();break;case"img":ee.src&&(u.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ce=o.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var we=ye.dehydrated;we!==null&&Xn(we)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&$h(o)}catch(ge){Nt(o,o.return,ge)}}if(o===r){Te=null;break}if(u=o.sibling,u!==null){u.return=o.return,Te=u;break}Te=o.return}}function Gx(r){for(;Te!==null;){var o=Te;if(o===r){Te=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Te=u;break}Te=o.return}}function Vx(r){for(;Te!==null;){var o=Te;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Dc(4,o)}catch(ee){Nt(o,u,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(ee){Nt(o,y,ee)}}var b=o.return;try{$h(o)}catch(ee){Nt(o,b,ee)}break;case 5:var T=o.return;try{$h(o)}catch(ee){Nt(o,T,ee)}}}catch(ee){Nt(o,o.return,ee)}if(o===r){Te=null;break}var V=o.sibling;if(V!==null){V.return=o.return,Te=V;break}Te=o.return}}var rM=Math.ceil,Fc=C.ReactCurrentDispatcher,Lh=C.ReactCurrentOwner,zn=C.ReactCurrentBatchConfig,nt=0,Dt=null,Tt=null,Wt=0,Cn=0,To=vs(0),Ot=0,el=null,ma=0,zc=0,qh=0,tl=null,pn=null,Dh=0,Ro=1/0,Vr=null,Bc=!1,Fh=null,Ns=null,Uc=!1,js=null,Wc=0,nl=0,zh=null,Hc=-1,Gc=0;function sn(){return(nt&6)!==0?ut():Hc!==-1?Hc:Hc=ut()}function Es(r){return(r.mode&1)===0?1:(nt&2)!==0&&Wt!==0?Wt&-Wt:FA.transition!==null?(Gc===0&&(Gc=Ks()),Gc):(r=Je,r!==0||(r=window.event,r=r===void 0?16:yi(r.type)),r)}function rr(r,o,u,m){if(50<nl)throw nl=0,zh=null,Error(n(185));Xs(r,u,m),((nt&2)===0||r!==Dt)&&(r===Dt&&((nt&2)===0&&(zc|=u),Ot===4&&Cs(r,Wt)),mn(r,m),u===1&&nt===0&&(o.mode&1)===0&&(Ro=ut()+500,xc&&bs()))}function mn(r,o){var u=r.callbackNode;Rd(r,o);var m=On(r,r===Dt?Wt:0);if(m===0)u!==null&&Ar(u),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(u!=null&&Ar(u),o===1)r.tag===0?DA(Kx.bind(null,r)):$0(Kx.bind(null,r)),OA(function(){(nt&6)===0&&bs()}),u=null;else{switch(hi(m)){case 1:u=$n;break;case 4:u=Ua;break;case 16:u=Mr;break;case 536870912:u=Wa;break;default:u=Mr}u=rb(u,Yx.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function Yx(r,o){if(Hc=-1,Gc=0,(nt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(Ao()&&r.callbackNode!==u)return null;var m=On(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Vc(r,m);else{o=m;var y=nt;nt|=2;var b=Qx();(Dt!==r||Wt!==o)&&(Vr=null,Ro=ut()+500,ya(r,o));do try{oM();break}catch(V){Xx(r,V)}while(!0);ah(),Fc.current=b,nt=y,Tt!==null?o=0:(Dt=null,Wt=0,o=Ot)}if(o!==0){if(o===2&&(y=Pn(r),y!==0&&(m=y,o=Bh(r,y))),o===1)throw u=el,ya(r,0),Cs(r,m),mn(r,ut()),u;if(o===6)Cs(r,m);else{if(y=r.current.alternate,(m&30)===0&&!sM(y)&&(o=Vc(r,m),o===2&&(b=Pn(r),b!==0&&(m=b,o=Bh(r,b))),o===1))throw u=el,ya(r,0),Cs(r,m),mn(r,ut()),u;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:wa(r,pn,Vr);break;case 3:if(Cs(r,m),(m&130023424)===m&&(o=Dh+500-ut(),10<o)){if(On(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){sn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Yd(wa.bind(null,r,pn,Vr),o);break}wa(r,pn,Vr);break;case 4:if(Cs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-on(m);b=1<<T,T=o[T],T>y&&(y=T),m&=~b}if(m=y,m=ut()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*rM(m/1960))-m,10<m){r.timeoutHandle=Yd(wa.bind(null,r,pn,Vr),m);break}wa(r,pn,Vr);break;case 5:wa(r,pn,Vr);break;default:throw Error(n(329))}}}return mn(r,ut()),r.callbackNode===u?Yx.bind(null,r):null}function Bh(r,o){var u=tl;return r.current.memoizedState.isDehydrated&&(ya(r,o).flags|=256),r=Vc(r,o),r!==2&&(o=pn,pn=u,o!==null&&Uh(o)),r}function Uh(r){pn===null?pn=r:pn.push.apply(pn,r)}function sM(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var m=0;m<u.length;m++){var y=u[m],b=y.getSnapshot;y=y.value;try{if(!tn(b(),y))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Cs(r,o){for(o&=~qh,o&=~zc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-on(o),m=1<<u;r[u]=-1,o&=~m}}function Kx(r){if((nt&6)!==0)throw Error(n(327));Ao();var o=On(r,0);if((o&1)===0)return mn(r,ut()),null;var u=Vc(r,o);if(r.tag!==0&&u===2){var m=Pn(r);m!==0&&(o=m,u=Bh(r,m))}if(u===1)throw u=el,ya(r,0),Cs(r,o),mn(r,ut()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,wa(r,pn,Vr),mn(r,ut()),null}function Wh(r,o){var u=nt;nt|=1;try{return r(o)}finally{nt=u,nt===0&&(Ro=ut()+500,xc&&bs())}}function ga(r){js!==null&&js.tag===0&&(nt&6)===0&&Ao();var o=nt;nt|=1;var u=zn.transition,m=Je;try{if(zn.transition=null,Je=1,r)return r()}finally{Je=m,zn.transition=u,nt=o,(nt&6)===0&&bs()}}function Hh(){Cn=To.current,pt(To)}function ya(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,$A(u)),Tt!==null)for(u=Tt.return;u!==null;){var m=u;switch(eh(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&wc();break;case 3:jo(),pt(dn),pt(Yt),fh();break;case 5:dh(m);break;case 4:jo();break;case 13:pt(xt);break;case 19:pt(xt);break;case 10:oh(m.type._context);break;case 22:case 23:Hh()}u=u.return}if(Dt=r,Tt=r=Ts(r.current,null),Wt=Cn=o,Ot=0,el=null,qh=zc=ma=0,pn=tl=null,ha!==null){for(o=0;o<ha.length;o++)if(u=ha[o],m=u.interleaved,m!==null){u.interleaved=null;var y=m.next,b=u.pending;if(b!==null){var T=b.next;b.next=y,m.next=T}u.pending=m}ha=null}return r}function Xx(r,o){do{var u=Tt;try{if(ah(),Rc.current=$c,Ac){for(var m=bt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Ac=!1}if(pa=0,qt=$t=bt=null,Yi=!1,Ki=0,Lh.current=null,u===null||u.return===null){Ot=1,el=o,Tt=null;break}e:{var b=r,T=u.return,V=u,ee=o;if(o=Wt,V.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,ye=V,we=ye.tag;if((ye.mode&1)===0&&(we===0||we===11||we===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Ce=bx(T);if(Ce!==null){Ce.flags&=-257,kx(Ce,T,V,b,o),Ce.mode&1&&xx(b,ce,o),o=Ce,ee=ce;var Re=o.updateQueue;if(Re===null){var Me=new Set;Me.add(ee),o.updateQueue=Me}else Re.add(ee);break e}else{if((o&1)===0){xx(b,ce,o),Gh();break e}ee=Error(n(426))}}else if(mt&&V.mode&1){var Et=bx(T);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),kx(Et,T,V,b,o),rh(Eo(ee,V));break e}}b=ee=Eo(ee,V),Ot!==4&&(Ot=2),tl===null?tl=[b]:tl.push(b),b=T;do{switch(b.tag){case 3:b.flags|=65536,o&=-o,b.lanes|=o;var ae=wx(b,ee,o);H0(b,ae);break e;case 1:V=ee;var ne=b.type,le=b.stateNode;if((b.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||le!==null&&typeof le.componentDidCatch=="function"&&(Ns===null||!Ns.has(le)))){b.flags|=65536,o&=-o,b.lanes|=o;var xe=vx(b,V,o);H0(b,xe);break e}}b=b.return}while(b!==null)}Jx(u)}catch(Ie){o=Ie,Tt===u&&u!==null&&(Tt=u=u.return);continue}break}while(!0)}function Qx(){var r=Fc.current;return Fc.current=$c,r===null?$c:r}function Gh(){(Ot===0||Ot===3||Ot===2)&&(Ot=4),Dt===null||(ma&268435455)===0&&(zc&268435455)===0||Cs(Dt,Wt)}function Vc(r,o){var u=nt;nt|=2;var m=Qx();(Dt!==r||Wt!==o)&&(Vr=null,ya(r,o));do try{aM();break}catch(y){Xx(r,y)}while(!0);if(ah(),nt=u,Fc.current=m,Tt!==null)throw Error(n(261));return Dt=null,Wt=0,Ot}function aM(){for(;Tt!==null;)Zx(Tt)}function oM(){for(;Tt!==null&&!Hs();)Zx(Tt)}function Zx(r){var o=nb(r.alternate,r,Cn);r.memoizedProps=r.pendingProps,o===null?Jx(r):Tt=o,Lh.current=null}function Jx(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=ZA(u,o,Cn),u!==null){Tt=u;return}}else{if(u=JA(u,o),u!==null){u.flags&=32767,Tt=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Ot=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);Ot===0&&(Ot=5)}function wa(r,o,u){var m=Je,y=zn.transition;try{zn.transition=null,Je=1,iM(r,o,u,m)}finally{zn.transition=y,Je=m}return null}function iM(r,o,u,m){do Ao();while(js!==null);if((nt&6)!==0)throw Error(n(327));u=r.finishedWork;var y=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var b=u.lanes|u.childLanes;if(Xl(r,b),r===Dt&&(Tt=Dt=null,Wt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Uc||(Uc=!0,rb(Mr,function(){return Ao(),null})),b=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||b){b=zn.transition,zn.transition=null;var T=Je;Je=1;var V=nt;nt|=4,Lh.current=null,tM(r,u),Ux(u,r),co(Gd),as=!!Hd,Gd=Hd=null,r.current=u,nM(u),ns(),nt=V,Je=T,zn.transition=b}else r.current=u;if(Uc&&(Uc=!1,js=r,Wc=y),b=r.pendingLanes,b===0&&(Ns=null),Vs(u.stateNode),mn(r,ut()),o!==null)for(m=r.onRecoverableError,u=0;u<o.length;u++)y=o[u],m(y.value,{componentStack:y.stack,digest:y.digest});if(Bc)throw Bc=!1,r=Fh,Fh=null,r;return(Wc&1)!==0&&r.tag!==0&&Ao(),b=r.pendingLanes,(b&1)!==0?r===zh?nl++:(nl=0,zh=r):nl=0,bs(),null}function Ao(){if(js!==null){var r=hi(Wc),o=zn.transition,u=Je;try{if(zn.transition=null,Je=16>r?16:r,js===null)var m=!1;else{if(r=js,js=null,Wc=0,(nt&6)!==0)throw Error(n(331));var y=nt;for(nt|=4,Te=r.current;Te!==null;){var b=Te,T=b.child;if((Te.flags&16)!==0){var V=b.deletions;if(V!==null){for(var ee=0;ee<V.length;ee++){var ce=V[ee];for(Te=ce;Te!==null;){var ye=Te;switch(ye.tag){case 0:case 11:case 15:Ji(8,ye,b)}var we=ye.child;if(we!==null)we.return=ye,Te=we;else for(;Te!==null;){ye=Te;var ge=ye.sibling,Ce=ye.return;if(qx(ye),ye===ce){Te=null;break}if(ge!==null){ge.return=Ce,Te=ge;break}Te=Ce}}}var Re=b.alternate;if(Re!==null){var Me=Re.child;if(Me!==null){Re.child=null;do{var Et=Me.sibling;Me.sibling=null,Me=Et}while(Me!==null)}}Te=b}}if((b.subtreeFlags&2064)!==0&&T!==null)T.return=b,Te=T;else e:for(;Te!==null;){if(b=Te,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:Ji(9,b,b.return)}var ae=b.sibling;if(ae!==null){ae.return=b.return,Te=ae;break e}Te=b.return}}var ne=r.current;for(Te=ne;Te!==null;){T=Te;var le=T.child;if((T.subtreeFlags&2064)!==0&&le!==null)le.return=T,Te=le;else e:for(T=ne;Te!==null;){if(V=Te,(V.flags&2048)!==0)try{switch(V.tag){case 0:case 11:case 15:Dc(9,V)}}catch(Ie){Nt(V,V.return,Ie)}if(V===T){Te=null;break e}var xe=V.sibling;if(xe!==null){xe.return=V.return,Te=xe;break e}Te=V.return}}if(nt=y,bs(),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(Ir,r)}catch{}m=!0}return m}finally{Je=u,zn.transition=o}}return!1}function eb(r,o,u){o=Eo(u,o),o=wx(r,o,1),r=_s(r,o,1),o=sn(),r!==null&&(Xs(r,1,o),mn(r,o))}function Nt(r,o,u){if(r.tag===3)eb(r,r,u);else for(;o!==null;){if(o.tag===3){eb(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Ns===null||!Ns.has(m))){r=Eo(u,r),r=vx(o,r,1),o=_s(o,r,1),r=sn(),o!==null&&(Xs(o,1,r),mn(o,r));break}}o=o.return}}function lM(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=sn(),r.pingedLanes|=r.suspendedLanes&u,Dt===r&&(Wt&u)===u&&(Ot===4||Ot===3&&(Wt&130023424)===Wt&&500>ut()-Dh?ya(r,0):qh|=u),mn(r,o)}function tb(r,o){o===0&&((r.mode&1)===0?o=1:(o=_t,_t<<=1,(_t&130023424)===0&&(_t=4194304)));var u=sn();r=Wr(r,o),r!==null&&(Xs(r,o,u),mn(r,u))}function cM(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),tb(r,u)}function uM(r,o){var u=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(u=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),tb(r,u)}var nb;nb=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||dn.current)fn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return fn=!1,QA(r,o,u);fn=(r.flags&131072)!==0}else fn=!1,mt&&(o.flags&1048576)!==0&&O0(o,kc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Lc(r,o),r=o.pendingProps;var y=vo(o,Yt.current);No(o,u),y=gh(null,o,m,r,y,u);var b=yh();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,hn(m)?(b=!0,vc(o)):b=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,ch(o),y.updater=Oc,o.stateNode=y,y._reactInternals=o,_h(o,m,r,u),o=Eh(null,o,m,!0,b,u)):(o.tag=0,mt&&b&&Jd(o),rn(null,o,y,u),o=o.child),o;case 16:m=o.elementType;e:{switch(Lc(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=hM(m),r=er(m,r),y){case 0:o=jh(null,o,m,r,u);break e;case 1:o=Cx(null,o,m,r,u);break e;case 11:o=_x(null,o,m,r,u);break e;case 14:o=Sx(null,o,m,er(m.type,r),u);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),jh(r,o,m,y,u);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),Cx(r,o,m,y,u);case 3:e:{if(Tx(o),r===null)throw Error(n(387));m=o.pendingProps,b=o.memoizedState,y=b.element,W0(r,o),Cc(o,m,null,u);var T=o.memoizedState;if(m=T.element,b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=b,o.memoizedState=b,o.flags&256){y=Eo(Error(n(423)),o),o=Rx(r,o,m,u,y);break e}else if(m!==y){y=Eo(Error(n(424)),o),o=Rx(r,o,m,u,y);break e}else for(En=ws(o.stateNode.containerInfo.firstChild),jn=o,mt=!0,Jn=null,u=B0(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ko(),m===y){o=Gr(r,o,u);break e}rn(r,o,m,u)}o=o.child}return o;case 5:return V0(o),r===null&&nh(o),m=o.type,y=o.pendingProps,b=r!==null?r.memoizedProps:null,T=y.children,Vd(m,y)?T=null:b!==null&&Vd(m,b)&&(o.flags|=32),Ex(r,o),rn(r,o,T,u),o.child;case 6:return r===null&&nh(o),null;case 13:return Ax(r,o,u);case 4:return uh(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=_o(o,null,m,u):rn(r,o,m,u),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),_x(r,o,m,y,u);case 7:return rn(r,o,o.pendingProps,u),o.child;case 8:return rn(r,o,o.pendingProps.children,u),o.child;case 12:return rn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,b=o.memoizedProps,T=y.value,dt(Nc,m._currentValue),m._currentValue=T,b!==null)if(tn(b.value,T)){if(b.children===y.children&&!dn.current){o=Gr(r,o,u);break e}}else for(b=o.child,b!==null&&(b.return=o);b!==null;){var V=b.dependencies;if(V!==null){T=b.child;for(var ee=V.firstContext;ee!==null;){if(ee.context===m){if(b.tag===1){ee=Hr(-1,u&-u),ee.tag=2;var ce=b.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?ee.next=ee:(ee.next=ye.next,ye.next=ee),ce.pending=ee}}b.lanes|=u,ee=b.alternate,ee!==null&&(ee.lanes|=u),ih(b.return,u,o),V.lanes|=u;break}ee=ee.next}}else if(b.tag===10)T=b.type===o.type?null:b.child;else if(b.tag===18){if(T=b.return,T===null)throw Error(n(341));T.lanes|=u,V=T.alternate,V!==null&&(V.lanes|=u),ih(T,u,o),T=b.sibling}else T=b.child;if(T!==null)T.return=b;else for(T=b;T!==null;){if(T===o){T=null;break}if(b=T.sibling,b!==null){b.return=T.return,T=b;break}T=T.return}b=T}rn(r,o,y.children,u),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,No(o,u),y=Dn(y),m=m(y),o.flags|=1,rn(r,o,m,u),o.child;case 14:return m=o.type,y=er(m,o.pendingProps),y=er(m.type,y),Sx(r,o,m,y,u);case 15:return Nx(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),Lc(r,o),o.tag=1,hn(m)?(r=!0,vc(o)):r=!1,No(o,u),gx(o,m,y),_h(o,m,y,u),Eh(null,o,m,!0,r,u);case 19:return Ix(r,o,u);case 22:return jx(r,o,u)}throw Error(n(156,o.tag))};function rb(r,o){return za(r,o)}function dM(r,o,u,m){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(r,o,u,m){return new dM(r,o,u,m)}function Vh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function hM(r){if(typeof r=="function")return Vh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===Q)return 14}return 2}function Ts(r,o){var u=r.alternate;return u===null?(u=Bn(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function Yc(r,o,u,m,y,b){var T=2;if(m=r,typeof r=="function")Vh(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case $:return va(u.children,y,b,o);case z:T=8,y|=8;break;case P:return r=Bn(12,u,o,y|2),r.elementType=P,r.lanes=b,r;case Z:return r=Bn(13,u,o,y),r.elementType=Z,r.lanes=b,r;case R:return r=Bn(19,u,o,y),r.elementType=R,r.lanes=b,r;case te:return Kc(u,y,b,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case M:T=10;break e;case F:T=9;break e;case H:T=11;break e;case Q:T=14;break e;case B:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Bn(T,u,o,y),o.elementType=r,o.type=m,o.lanes=b,o}function va(r,o,u,m){return r=Bn(7,r,m,o),r.lanes=u,r}function Kc(r,o,u,m){return r=Bn(22,r,m,o),r.elementType=te,r.lanes=u,r.stateNode={isHidden:!1},r}function Yh(r,o,u){return r=Bn(6,r,null,o),r.lanes=u,r}function Kh(r,o,u){return o=Bn(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function fM(r,o,u,m,y){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=di(0),this.expirationTimes=di(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=di(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Xh(r,o,u,m,y,b,T,V,ee){return r=new fM(r,o,u,V,ee),o===1?(o=1,b===!0&&(o|=8)):o=0,b=Bn(3,null,null,o),r.current=b,b.stateNode=r,b.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},ch(b),r}function pM(r,o,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:m==null?null:""+m,children:r,containerInfo:o,implementation:u}}function sb(r){if(!r)return xs;r=r._reactInternals;e:{if(In(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(hn(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(hn(u))return M0(r,u,o)}return o}function ab(r,o,u,m,y,b,T,V,ee){return r=Xh(u,m,!0,r,y,b,T,V,ee),r.context=sb(null),u=r.current,m=sn(),y=Es(u),b=Hr(m,y),b.callback=o??null,_s(u,b,y),r.current.lanes=y,Xs(r,y,m),mn(r,m),r}function Xc(r,o,u,m){var y=o.current,b=sn(),T=Es(y);return u=sb(u),o.context===null?o.context=u:o.pendingContext=u,o=Hr(b,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=_s(y,o,T),r!==null&&(rr(r,y,T,b),Ec(r,y,T)),T}function Qc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function ob(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function Qh(r,o){ob(r,o),(r=r.alternate)&&ob(r,o)}function mM(){return null}var ib=typeof reportError=="function"?reportError:function(r){console.error(r)};function Zh(r){this._internalRoot=r}Zc.prototype.render=Zh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Xc(r,o,null,null)},Zc.prototype.unmount=Zh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;ga(function(){Xc(null,r,null,null)}),o[Fr]=null}};function Zc(r){this._internalRoot=r}Zc.prototype.unstable_scheduleHydration=function(r){if(r){var o=pi();r={blockedOn:null,target:r,priority:o};for(var u=0;u<ln.length&&o!==0&&o<ln[u].priority;u++);ln.splice(u,0,r),u===0&&Jl(r)}};function Jh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Jc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function lb(){}function gM(r,o,u,m,y){if(y){if(typeof m=="function"){var b=m;m=function(){var ce=Qc(T);b.call(ce)}}var T=ab(o,m,r,0,null,!1,!1,"",lb);return r._reactRootContainer=T,r[Fr]=T.current,Fi(r.nodeType===8?r.parentNode:r),ga(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var V=m;m=function(){var ce=Qc(ee);V.call(ce)}}var ee=Xh(r,0,!1,null,null,!1,!1,"",lb);return r._reactRootContainer=ee,r[Fr]=ee.current,Fi(r.nodeType===8?r.parentNode:r),ga(function(){Xc(o,ee,u,m)}),ee}function eu(r,o,u,m,y){var b=u._reactRootContainer;if(b){var T=b;if(typeof y=="function"){var V=y;y=function(){var ee=Qc(T);V.call(ee)}}Xc(o,T,r,y)}else T=gM(u,o,r,y,m);return Qc(T)}fi=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Ys(o.pendingLanes);u!==0&&(Ga(o,u|1),mn(o,ut()),(nt&6)===0&&(Ro=ut()+500,bs()))}break;case 13:ga(function(){var m=Wr(r,1);if(m!==null){var y=sn();rr(m,r,1,y)}}),Qh(r,1)}},ss=function(r){if(r.tag===13){var o=Wr(r,134217728);if(o!==null){var u=sn();rr(o,r,134217728,u)}Qh(r,134217728)}},Va=function(r){if(r.tag===13){var o=Es(r),u=Wr(r,o);if(u!==null){var m=sn();rr(u,r,o,m)}Qh(r,o)}},pi=function(){return Je},mi=function(r,o){var u=Je;try{return Je=r,o()}finally{Je=u}},vt=function(r,o,u){switch(o){case"input":if(be(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var m=u[o];if(m!==r&&m.form===r.form){var y=yc(m);if(!y)throw Error(n(90));Ye(m),be(m,y)}}}break;case"textarea":pe(r,u);break;case"select":o=u.value,o!=null&&ct(r,!!u.multiple,o,!1)}},La=Wh,vn=ga;var yM={usingClientEntryPoint:!1,Events:[Ui,yo,yc,Oa,Pa,Wh]},rl={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wM={bundleType:rl.bundleType,version:rl.version,rendererPackageName:rl.rendererPackageName,rendererConfig:rl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Rr(r),r===null?null:r.stateNode},findFiberByHostInstance:rl.findFiberByHostInstance||mM,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 tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tu.isDisabled&&tu.supportsFiber)try{Ir=tu.inject(wM),Lt=tu}catch{}}return gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yM,gn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Jh(o))throw Error(n(200));return pM(r,o,null,u)},gn.createRoot=function(r,o){if(!Jh(r))throw Error(n(299));var u=!1,m="",y=ib;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Xh(r,1,!1,null,null,u,!1,m,y),r[Fr]=o.current,Fi(r.nodeType===8?r.parentNode:r),new Zh(o)},gn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Rr(o),r=r===null?null:r.stateNode,r},gn.flushSync=function(r){return ga(r)},gn.hydrate=function(r,o,u){if(!Jc(o))throw Error(n(200));return eu(null,r,o,!0,u)},gn.hydrateRoot=function(r,o,u){if(!Jh(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,y=!1,b="",T=ib;if(u!=null&&(u.unstable_strictMode===!0&&(y=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(T=u.onRecoverableError)),o=ab(o,null,r,1,u??null,y,!1,b,T),r[Fr]=o.current,Fi(r),m)for(r=0;r<m.length;r++)u=m[r],y=u._getVersion,y=y(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,y]:o.mutableSourceEagerHydrationData.push(u,y);return new Zc(o)},gn.render=function(r,o,u){if(!Jc(o))throw Error(n(200));return eu(null,r,o,!1,u)},gn.unmountComponentAtNode=function(r){if(!Jc(r))throw Error(n(40));return r._reactRootContainer?(ga(function(){eu(null,null,r,!1,function(){r._reactRootContainer=null,r[Fr]=null})}),!0):!1},gn.unstable_batchedUpdates=Wh,gn.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!Jc(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return eu(r,o,u,!1,m)},gn.version="18.3.1-next-f1338f8080-20240426",gn}var gb;function nC(){if(gb)return nf.exports;gb=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(),nf.exports=NM(),nf.exports}var yb;function jM(){if(yb)return ru;yb=1;var e=nC();return ru.createRoot=e.createRoot,ru.hydrateRoot=e.hydrateRoot,ru}var EM=jM(),k=$l();const he=jv(k);function Gt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Gt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var af={exports:{}},of={},lf={exports:{}},cf={};/**
|
|
41
|
-
* @license React
|
|
42
|
-
* use-sync-external-store-shim.production.js
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the MIT license found in the
|
|
47
|
-
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/var wb;function CM(){if(wb)return cf;wb=1;var e=$l();function t(g,w){return g===w&&(g!==0||1/g===1/w)||g!==g&&w!==w}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function d(g,w){var v=w(),N=s({inst:{value:v,getSnapshot:w}}),x=N[0].inst,S=N[1];return i(function(){x.value=v,x.getSnapshot=w,f(x)&&S({inst:x})},[g,v,w]),a(function(){return f(x)&&S({inst:x}),g(function(){f(x)&&S({inst:x})})},[g]),l(v),v}function f(g){var w=g.getSnapshot;g=g.value;try{var v=w();return!n(g,v)}catch{return!0}}function p(g,w){return w()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return cf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,cf}var vb;function TM(){return vb||(vb=1,lf.exports=CM()),lf.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 xb;function RM(){if(xb)return of;xb=1;var e=$l(),t=TM();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,d=e.useMemo,f=e.useDebugValue;return of.useSyncExternalStoreWithSelector=function(p,h,g,w,v){var N=i(null);if(N.current===null){var x={hasValue:!1,value:null};N.current=x}else x=N.current;N=d(function(){function _(O){if(!j){if(j=!0,E=O,O=w(O),v!==void 0&&x.hasValue){var $=x.value;if(v($,O))return C=$}return C=O}if($=C,s(E,O))return $;var z=w(O);return v!==void 0&&v($,z)?(E=O,$):(E=O,C=z)}var j=!1,E,C,A=g===void 0?null:g;return[function(){return _(h())},A===null?void 0:function(){return _(A())}]},[h,g,w,v]);var S=a(p,N[0],N[1]);return l(function(){x.hasValue=!0,x.value=S},[S]),f(S),S},of}var bb;function AM(){return bb||(bb=1,af.exports=RM()),af.exports}var MM=AM();const IM=jv(MM),$M={},kb=e=>{let t;const n=new Set,s=(h,g)=>{const w=typeof h=="function"?h(t):h;if(!Object.is(w,t)){const v=t;t=g??(typeof w!="object"||w===null)?w:Object.assign({},t,w),n.forEach(N=>N(t,v))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{($M?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,a,f);return f},OM=e=>e?kb(e):kb,{useDebugValue:PM}=he,{useSyncExternalStoreWithSelector:LM}=IM,qM=e=>e;function rC(e,t=qM,n){const s=LM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return PM(s),s}const _b=(e,t)=>{const n=OM(e),s=(a,i=t)=>rC(n,a,i);return Object.assign(s,n),s},DM=(e,t)=>e?_b(e,t):_b;function Pt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,a]of e)if(!Object.is(a,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var FM={value:()=>{}};function Zu(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new Nu(n)}function Nu(e){this._=e}function zM(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",a=n.indexOf(".");if(a>=0&&(s=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Nu.prototype=Zu.prototype={constructor:Nu,on:function(e,t){var n=this._,s=zM(e+"",n),a,i=-1,l=s.length;if(arguments.length<2){for(;++i<l;)if((a=(e=s[i]).type)&&(a=BM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(a=(e=s[i]).type)n[a]=Sb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Sb(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 Nu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function BM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function Sb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=FM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gw="http://www.w3.org/1999/xhtml";const Nb={svg:"http://www.w3.org/2000/svg",xhtml:Gw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ju(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Nb.hasOwnProperty(t)?{space:Nb[t],local:e}:e}function UM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Gw&&t.documentElement.namespaceURI===Gw?t.createElement(e):t.createElementNS(n,e)}}function WM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sC(e){var t=Ju(e);return(t.local?WM:UM)(t)}function HM(){}function Ev(e){return e==null?HM:function(){return this.querySelector(e)}}function GM(e){typeof e!="function"&&(e=Ev(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=new Array(l),f,p,h=0;h<l;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),d[h]=p);return new An(s,this._parents)}function VM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function YM(){return[]}function aC(e){return e==null?YM:function(){return this.querySelectorAll(e)}}function KM(e){return function(){return VM(e.apply(this,arguments))}}function XM(e){typeof e=="function"?e=KM(e):e=aC(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var l=t[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&(s.push(e.call(f,f.__data__,p,l)),a.push(f));return new An(s,a)}function oC(e){return function(){return this.matches(e)}}function iC(e){return function(t){return t.matches(e)}}var QM=Array.prototype.find;function ZM(e){return function(){return QM.call(this.children,e)}}function JM(){return this.firstElementChild}function e2(e){return this.select(e==null?JM:ZM(typeof e=="function"?e:iC(e)))}var t2=Array.prototype.filter;function n2(){return Array.from(this.children)}function r2(e){return function(){return t2.call(this.children,e)}}function s2(e){return this.selectAll(e==null?n2:r2(typeof e=="function"?e:iC(e)))}function a2(e){typeof e!="function"&&(e=oC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new An(s,this._parents)}function lC(e){return new Array(e.length)}function o2(){return new An(this._enter||this._groups.map(lC),this._parents)}function Iu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Iu.prototype={constructor:Iu,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 i2(e){return function(){return e}}function l2(e,t,n,s,a,i){for(var l=0,d,f=t.length,p=i.length;l<p;++l)(d=t[l])?(d.__data__=i[l],s[l]=d):n[l]=new Iu(e,i[l]);for(;l<f;++l)(d=t[l])&&(a[l]=d)}function c2(e,t,n,s,a,i,l){var d,f,p=new Map,h=t.length,g=i.length,w=new Array(h),v;for(d=0;d<h;++d)(f=t[d])&&(w[d]=v=l.call(f,f.__data__,d,t)+"",p.has(v)?a[d]=f:p.set(v,f));for(d=0;d<g;++d)v=l.call(e,i[d],d,i)+"",(f=p.get(v))?(s[d]=f,f.__data__=i[d],p.delete(v)):n[d]=new Iu(e,i[d]);for(d=0;d<h;++d)(f=t[d])&&p.get(w[d])===f&&(a[d]=f)}function u2(e){return e.__data__}function d2(e,t){if(!arguments.length)return Array.from(this,u2);var n=t?c2:l2,s=this._parents,a=this._groups;typeof e!="function"&&(e=i2(e));for(var i=a.length,l=new Array(i),d=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],g=a[p],w=g.length,v=h2(e.call(h,h&&h.__data__,p,s)),N=v.length,x=d[p]=new Array(N),S=l[p]=new Array(N),_=f[p]=new Array(w);n(h,g,x,S,_,v,t);for(var j=0,E=0,C,A;j<N;++j)if(C=x[j]){for(j>=E&&(E=j+1);!(A=S[E])&&++E<N;);C._next=A||null}}return l=new An(l,s),l._enter=d,l._exit=f,l}function h2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function f2(){return new An(this._exit||this._groups.map(lC),this._parents)}function p2(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function m2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,l=Math.min(a,i),d=new Array(a),f=0;f<l;++f)for(var p=n[f],h=s[f],g=p.length,w=d[f]=new Array(g),v,N=0;N<g;++N)(v=p[N]||h[N])&&(w[N]=v);for(;f<a;++f)d[f]=n[f];return new An(d,this._parents)}function g2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],l;--a>=0;)(l=s[a])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function y2(e){e||(e=w2);function t(g,w){return g&&w?e(g.__data__,w.__data__):!g-!w}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var l=n[i],d=l.length,f=a[i]=new Array(d),p,h=0;h<d;++h)(p=l[h])&&(f[h]=p);f.sort(t)}return new An(a,this._parents).order()}function w2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function v2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function x2(){return Array.from(this)}function b2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var l=s[a];if(l)return l}return null}function k2(){let e=0;for(const t of this)++e;return e}function _2(){return!this.node()}function S2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,l=a.length,d;i<l;++i)(d=a[i])&&e.call(d,d.__data__,i,a);return this}function N2(e){return function(){this.removeAttribute(e)}}function j2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function E2(e,t){return function(){this.setAttribute(e,t)}}function C2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function T2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function R2(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 A2(e,t){var n=Ju(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?j2:N2:typeof t=="function"?n.local?R2:T2:n.local?C2:E2)(n,t))}function cC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function M2(e){return function(){this.style.removeProperty(e)}}function I2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function $2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function O2(e,t,n){return arguments.length>1?this.each((t==null?M2:typeof t=="function"?$2:I2)(e,t,n??"")):Vo(this.node(),e)}function Vo(e,t){return e.style.getPropertyValue(t)||cC(e).getComputedStyle(e,null).getPropertyValue(t)}function P2(e){return function(){delete this[e]}}function L2(e,t){return function(){this[e]=t}}function q2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function D2(e,t){return arguments.length>1?this.each((t==null?P2:typeof t=="function"?q2:L2)(e,t)):this.node()[e]}function uC(e){return e.trim().split(/^|\s+/)}function Cv(e){return e.classList||new dC(e)}function dC(e){this._node=e,this._names=uC(e.getAttribute("class")||"")}dC.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 hC(e,t){for(var n=Cv(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function fC(e,t){for(var n=Cv(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function F2(e){return function(){hC(this,e)}}function z2(e){return function(){fC(this,e)}}function B2(e,t){return function(){(t.apply(this,arguments)?hC:fC)(this,e)}}function U2(e,t){var n=uC(e+"");if(arguments.length<2){for(var s=Cv(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?B2:t?F2:z2)(n,t))}function W2(){this.textContent=""}function H2(e){return function(){this.textContent=e}}function G2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function V2(e){return arguments.length?this.each(e==null?W2:(typeof e=="function"?G2:H2)(e)):this.node().textContent}function Y2(){this.innerHTML=""}function K2(e){return function(){this.innerHTML=e}}function X2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Q2(e){return arguments.length?this.each(e==null?Y2:(typeof e=="function"?X2:K2)(e)):this.node().innerHTML}function Z2(){this.nextSibling&&this.parentNode.appendChild(this)}function J2(){return this.each(Z2)}function eI(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tI(){return this.each(eI)}function nI(e){var t=typeof e=="function"?e:sC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rI(){return null}function sI(e,t){var n=typeof e=="function"?e:sC(e),s=t==null?rI:typeof t=="function"?t:Ev(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function aI(){var e=this.parentNode;e&&e.removeChild(this)}function oI(){return this.each(aI)}function iI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cI(e){return this.select(e?lI:iI)}function uI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function dI(e){return function(t){e.call(this,t,this.__data__)}}function hI(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function fI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function pI(e,t,n){return function(){var s=this.__on,a,i=dI(t);if(s){for(var l=0,d=s.length;l<d;++l)if((a=s[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function mI(e,t,n){var s=hI(e+""),a,i=s.length,l;if(arguments.length<2){var d=this.node().__on;if(d){for(var f=0,p=d.length,h;f<p;++f)for(a=0,h=d[f];a<i;++a)if((l=s[a]).type===h.type&&l.name===h.name)return h.value}return}for(d=t?pI:fI,a=0;a<i;++a)this.each(d(s[a],t,n));return this}function pC(e,t,n){var s=cC(e),a=s.CustomEvent;typeof a=="function"?a=new a(t,n):(a=s.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function gI(e,t){return function(){return pC(this,e,t)}}function yI(e,t){return function(){return pC(this,e,t.apply(this,arguments))}}function wI(e,t){return this.each((typeof t=="function"?yI:gI)(e,t))}function*vI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,l;a<i;++a)(l=s[a])&&(yield l)}var mC=[null];function An(e,t){this._groups=e,this._parents=t}function Ol(){return new An([[document.documentElement]],mC)}function xI(){return this}An.prototype=Ol.prototype={constructor:An,select:GM,selectAll:XM,selectChild:e2,selectChildren:s2,filter:a2,data:d2,enter:o2,exit:f2,join:p2,merge:m2,selection:xI,order:g2,sort:y2,call:v2,nodes:x2,node:b2,size:k2,empty:_2,each:S2,attr:A2,style:O2,property:D2,classed:U2,text:V2,html:Q2,raise:J2,lower:tI,append:nI,insert:sI,remove:oI,clone:cI,datum:uI,on:mI,dispatch:wI,[Symbol.iterator]:vI};function Wn(e){return typeof e=="string"?new An([[document.querySelector(e)]],[document.documentElement]):new An([[e]],mC)}function bI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ar(e,t){if(e=bI(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const kI={passive:!1},bl={capture:!0,passive:!1};function uf(e){e.stopImmediatePropagation()}function Uo(e){e.preventDefault(),e.stopImmediatePropagation()}function gC(e){var t=e.document.documentElement,n=Wn(e).on("dragstart.drag",Uo,bl);"onselectstart"in t?n.on("selectstart.drag",Uo,bl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function yC(e,t){var n=e.document.documentElement,s=Wn(e).on("dragstart.drag",null);t&&(s.on("click.drag",Uo,bl),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const su=e=>()=>e;function Vw(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:l,y:d,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}Vw.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _I(e){return!e.ctrlKey&&!e.button}function SI(){return this.parentNode}function NI(e,t){return t??{x:e.x,y:e.y}}function jI(){return navigator.maxTouchPoints||"ontouchstart"in this}function EI(){var e=_I,t=SI,n=NI,s=jI,a={},i=Zu("start","drag","end"),l=0,d,f,p,h,g=0;function w(C){C.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",_,kI).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(C,A){if(!(h||!e.call(this,C,A))){var O=E(this,t.call(this,C,A),C,A,"mouse");O&&(Wn(C.view).on("mousemove.drag",N,bl).on("mouseup.drag",x,bl),gC(C.view),uf(C),p=!1,d=C.clientX,f=C.clientY,O("start",C))}}function N(C){if(Uo(C),!p){var A=C.clientX-d,O=C.clientY-f;p=A*A+O*O>g}a.mouse("drag",C)}function x(C){Wn(C.view).on("mousemove.drag mouseup.drag",null),yC(C.view,p),Uo(C),a.mouse("end",C)}function S(C,A){if(e.call(this,C,A)){var O=C.changedTouches,$=t.call(this,C,A),z=O.length,P,M;for(P=0;P<z;++P)(M=E(this,$,C,A,O[P].identifier,O[P]))&&(uf(C),M("start",C,O[P]))}}function _(C){var A=C.changedTouches,O=A.length,$,z;for($=0;$<O;++$)(z=a[A[$].identifier])&&(Uo(C),z("drag",C,A[$]))}function j(C){var A=C.changedTouches,O=A.length,$,z;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),$=0;$<O;++$)(z=a[A[$].identifier])&&(uf(C),z("end",C,A[$]))}function E(C,A,O,$,z,P){var M=i.copy(),F=ar(P||O,A),H,Z,R;if((R=n.call(C,new Vw("beforestart",{sourceEvent:O,target:w,identifier:z,active:l,x:F[0],y:F[1],dx:0,dy:0,dispatch:M}),$))!=null)return H=R.x-F[0]||0,Z=R.y-F[1]||0,function Q(B,te,J){var q=F,Y;switch(B){case"start":a[z]=Q,Y=l++;break;case"end":delete a[z],--l;case"drag":F=ar(J||te,A),Y=l;break}M.call(B,C,new Vw(B,{sourceEvent:te,subject:R,target:w,identifier:z,active:Y,x:F[0]+H,y:F[1]+Z,dx:F[0]-q[0],dy:F[1]-q[1],dispatch:M}),$)}}return w.filter=function(C){return arguments.length?(e=typeof C=="function"?C:su(!!C),w):e},w.container=function(C){return arguments.length?(t=typeof C=="function"?C:su(C),w):t},w.subject=function(C){return arguments.length?(n=typeof C=="function"?C:su(C),w):n},w.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:su(!!C),w):s},w.on=function(){var C=i.on.apply(i,arguments);return C===i?w:C},w.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,w):Math.sqrt(g)},w}function Tv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Pl(){}var kl=.7,$u=1/kl,Wo="\\s*([+-]?\\d+)\\s*",_l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CI=/^#([0-9a-f]{3,8})$/,TI=new RegExp(`^rgb\\(${Wo},${Wo},${Wo}\\)$`),RI=new RegExp(`^rgb\\(${Sr},${Sr},${Sr}\\)$`),AI=new RegExp(`^rgba\\(${Wo},${Wo},${Wo},${_l}\\)$`),MI=new RegExp(`^rgba\\(${Sr},${Sr},${Sr},${_l}\\)$`),II=new RegExp(`^hsl\\(${_l},${Sr},${Sr}\\)$`),$I=new RegExp(`^hsla\\(${_l},${Sr},${Sr},${_l}\\)$`),jb={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};Tv(Pl,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Eb,formatHex:Eb,formatHex8:OI,formatHsl:PI,formatRgb:Cb,toString:Cb});function Eb(){return this.rgb().formatHex()}function OI(){return this.rgb().formatHex8()}function PI(){return vC(this).formatHsl()}function Cb(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=CI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Tb(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?au(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?au(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=TI.exec(e))?new yn(t[1],t[2],t[3],1):(t=RI.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AI.exec(e))?au(t[1],t[2],t[3],t[4]):(t=MI.exec(e))?au(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=II.exec(e))?Mb(t[1],t[2]/100,t[3]/100,1):(t=$I.exec(e))?Mb(t[1],t[2]/100,t[3]/100,t[4]):jb.hasOwnProperty(e)?Tb(jb[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function Tb(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function au(e,t,n,s){return s<=0&&(e=t=n=NaN),new yn(e,t,n,s)}function LI(e){return e instanceof Pl||(e=Sl(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Yw(e,t,n,s){return arguments.length===1?LI(e):new yn(e,t,n,s??1)}function yn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Tv(yn,Yw,wC(Pl,{brighter(e){return e=e==null?$u:Math.pow($u,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Na(this.r),Na(this.g),Na(this.b),Ou(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:Rb,formatHex:Rb,formatHex8:qI,formatRgb:Ab,toString:Ab}));function Rb(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}`}function qI(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}${_a((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ab(){const e=Ou(this.opacity);return`${e===1?"rgb(":"rgba("}${Na(this.r)}, ${Na(this.g)}, ${Na(this.b)}${e===1?")":`, ${e})`}`}function Ou(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Na(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _a(e){return e=Na(e),(e<16?"0":"")+e.toString(16)}function Mb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new or(e,t,n,s)}function vC(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof Pl||(e=Sl(e)),!e)return new or;if(e instanceof or)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),l=NaN,d=i-a,f=(i+a)/2;return d?(t===i?l=(n-s)/d+(n<s)*6:n===i?l=(s-t)/d+2:l=(t-n)/d+4,d/=f<.5?i+a:2-i-a,l*=60):d=f>0&&f<1?0:l,new or(l,d,f,e.opacity)}function DI(e,t,n,s){return arguments.length===1?vC(e):new or(e,t,n,s??1)}function or(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Tv(or,DI,wC(Pl,{brighter(e){return e=e==null?$u:Math.pow($u,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new or(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new yn(df(e>=240?e-240:e+120,a,s),df(e,a,s),df(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new or(Ib(this.h),ou(this.s),ou(this.l),Ou(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=Ou(this.opacity);return`${e===1?"hsl(":"hsla("}${Ib(this.h)}, ${ou(this.s)*100}%, ${ou(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ib(e){return e=(e||0)%360,e<0?e+360:e}function ou(e){return Math.max(0,Math.min(1,e||0))}function df(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 xC=e=>()=>e;function FI(e,t){return function(n){return e+n*t}}function zI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function BI(e){return(e=+e)==1?bC:function(t,n){return n-t?zI(t,n,e):xC(isNaN(t)?n:t)}}function bC(e,t){var n=t-e;return n?FI(e,n):xC(isNaN(e)?t:e)}const $b=(function e(t){var n=BI(t);function s(a,i){var l=n((a=Yw(a)).r,(i=Yw(i)).r),d=n(a.g,i.g),f=n(a.b,i.b),p=bC(a.opacity,i.opacity);return function(h){return a.r=l(h),a.g=d(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function Is(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Kw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hf=new RegExp(Kw.source,"g");function UI(e){return function(){return e}}function WI(e){return function(t){return e(t)+""}}function HI(e,t){var n=Kw.lastIndex=hf.lastIndex=0,s,a,i,l=-1,d=[],f=[];for(e=e+"",t=t+"";(s=Kw.exec(e))&&(a=hf.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),d[l]?d[l]+=i:d[++l]=i),(s=s[0])===(a=a[0])?d[l]?d[l]+=a:d[++l]=a:(d[++l]=null,f.push({i:l,x:Is(s,a)})),n=hf.lastIndex;return n<t.length&&(i=t.slice(n),d[l]?d[l]+=i:d[++l]=i),d.length<2?f[0]?WI(f[0].x):UI(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)d[(g=f[h]).i]=g.x(p);return d.join("")})}var Ob=180/Math.PI,Xw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kC(e,t,n,s,a,i){var l,d,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,f/=d),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Ob,skewX:Math.atan(f)*Ob,scaleX:l,scaleY:d}}var iu;function GI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Xw:kC(t.a,t.b,t.c,t.d,t.e,t.f)}function VI(e){return e==null||(iu||(iu=document.createElementNS("http://www.w3.org/2000/svg","g")),iu.setAttribute("transform",e),!(e=iu.transform.baseVal.consolidate()))?Xw:(e=e.matrix,kC(e.a,e.b,e.c,e.d,e.e,e.f))}function _C(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,g,w,v,N){if(p!==g||h!==w){var x=v.push("translate(",null,t,null,n);N.push({i:x-4,x:Is(p,g)},{i:x-2,x:Is(h,w)})}else(g||w)&&v.push("translate("+g+t+w+n)}function l(p,h,g,w){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),w.push({i:g.push(a(g)+"rotate(",null,s)-2,x:Is(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function d(p,h,g,w){p!==h?w.push({i:g.push(a(g)+"skewX(",null,s)-2,x:Is(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,w,v,N){if(p!==g||h!==w){var x=v.push(a(v)+"scale(",null,",",null,")");N.push({i:x-4,x:Is(p,g)},{i:x-2,x:Is(h,w)})}else(g!==1||w!==1)&&v.push(a(v)+"scale("+g+","+w+")")}return function(p,h){var g=[],w=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,g,w),l(p.rotate,h.rotate,g,w),d(p.skewX,h.skewX,g,w),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,w),p=h=null,function(v){for(var N=-1,x=w.length,S;++N<x;)g[(S=w[N]).i]=S.x(v);return g.join("")}}}var YI=_C(GI,"px, ","px)","deg)"),KI=_C(VI,", ",")",")"),XI=1e-12;function Pb(e){return((e=Math.exp(e))+1/e)/2}function QI(e){return((e=Math.exp(e))-1/e)/2}function ZI(e){return((e=Math.exp(2*e))-1)/(e+1)}const JI=(function e(t,n,s){function a(i,l){var d=i[0],f=i[1],p=i[2],h=l[0],g=l[1],w=l[2],v=h-d,N=g-f,x=v*v+N*N,S,_;if(x<XI)_=Math.log(w/p)/t,S=function($){return[d+$*v,f+$*N,p*Math.exp(t*$*_)]};else{var j=Math.sqrt(x),E=(w*w-p*p+s*x)/(2*p*n*j),C=(w*w-p*p-s*x)/(2*w*n*j),A=Math.log(Math.sqrt(E*E+1)-E),O=Math.log(Math.sqrt(C*C+1)-C);_=(O-A)/t,S=function($){var z=$*_,P=Pb(A),M=p/(n*j)*(P*ZI(t*z+A)-QI(A));return[d+M*v,f+M*N,p*P/Pb(t*z+A)]}}return S.duration=_*1e3*t/Math.SQRT2,S}return a.rho=function(i){var l=Math.max(.001,+i),d=l*l,f=d*d;return e(l,d,f)},a})(Math.SQRT2,2,4);var Yo=0,pl=0,al=0,SC=1e3,Pu,ml,Lu=0,Ca=0,ed=0,Nl=typeof performance=="object"&&performance.now?performance:Date,NC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rv(){return Ca||(NC(e$),Ca=Nl.now()+ed)}function e$(){Ca=0}function qu(){this._call=this._time=this._next=null}qu.prototype=jC.prototype={constructor:qu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Rv():+n)+(t==null?0:+t),!this._next&&ml!==this&&(ml?ml._next=this:Pu=this,ml=this),this._call=e,this._time=n,Qw()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qw())}};function jC(e,t,n){var s=new qu;return s.restart(e,t,n),s}function t$(){Rv(),++Yo;for(var e=Pu,t;e;)(t=Ca-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Yo}function Lb(){Ca=(Lu=Nl.now())+ed,Yo=pl=0;try{t$()}finally{Yo=0,r$(),Ca=0}}function n$(){var e=Nl.now(),t=e-Lu;t>SC&&(ed-=t,Lu=e)}function r$(){for(var e,t=Pu,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Pu=n);ml=e,Qw(s)}function Qw(e){if(!Yo){pl&&(pl=clearTimeout(pl));var t=e-Ca;t>24?(e<1/0&&(pl=setTimeout(Lb,e-Nl.now()-ed)),al&&(al=clearInterval(al))):(al||(Lu=Nl.now(),al=setInterval(n$,SC)),Yo=1,NC(Lb))}}function qb(e,t,n){var s=new qu;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var s$=Zu("start","end","cancel","interrupt"),a$=[],EC=0,Db=1,Zw=2,ju=3,Fb=4,Jw=5,Eu=6;function td(e,t,n,s,a,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;o$(e,n,{name:t,index:s,group:a,on:s$,tween:a$,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:EC})}function Av(e,t){var n=hr(e,t);if(n.state>EC)throw new Error("too late; already scheduled");return n}function Nr(e,t){var n=hr(e,t);if(n.state>ju)throw new Error("too late; already running");return n}function hr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function o$(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=jC(i,0,n.time);function i(p){n.state=Db,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var h,g,w,v;if(n.state!==Db)return f();for(h in s)if(v=s[h],v.name===n.name){if(v.state===ju)return qb(l);v.state===Fb?(v.state=Eu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[h]):+h<t&&(v.state=Eu,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[h])}if(qb(function(){n.state===ju&&(n.state=Fb,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=Zw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Zw){for(n.state=ju,a=new Array(w=n.tween.length),h=0,g=-1;h<w;++h)(v=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=v);a.length=g+1}}function d(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Jw,1),g=-1,w=a.length;++g<w;)a[g].call(e,h);n.state===Jw&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Eu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Cu(e,t){var n=e.__transition,s,a,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){i=!1;continue}a=s.state>Zw&&s.state<Jw,s.state=Eu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}i&&delete e.__transition}}function i$(e){return this.each(function(){Cu(this,e)})}function l$(e,t){var n,s;return function(){var a=Nr(this,e),i=a.tween;if(i!==n){s=n=i;for(var l=0,d=s.length;l<d;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}a.tween=s}}function c$(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Nr(this,e),l=i.tween;if(l!==s){a=(s=l).slice();for(var d={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=d;break}f===p&&a.push(d)}i.tween=a}}function u$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=hr(this.node(),n).tween,a=0,i=s.length,l;a<i;++a)if((l=s[a]).name===e)return l.value;return null}return this.each((t==null?l$:c$)(n,e,t))}function Mv(e,t,n){var s=e._id;return e.each(function(){var a=Nr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return hr(a,s).value[t]}}function CC(e,t){var n;return(typeof t=="number"?Is:t instanceof Sl?$b:(n=Sl(t))?(t=n,$b):HI)(e,t)}function d$(e){return function(){this.removeAttribute(e)}}function h$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function f$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttribute(e);return l===a?null:l===s?i:i=t(s=l,n)}}function p$(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===s?i:i=t(s=l,n)}}function m$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function g$(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function y$(e,t){var n=Ju(e),s=n==="transform"?KI:CC;return this.attrTween(e,typeof t=="function"?(n.local?g$:m$)(n,s,Mv(this,"attr."+e,t)):t==null?(n.local?h$:d$)(n):(n.local?p$:f$)(n,s,t))}function w$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function v$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function x$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&v$(e,i)),n}return a._value=t,a}function b$(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&w$(e,i)),n}return a._value=t,a}function k$(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Ju(e);return this.tween(n,(s.local?x$:b$)(s,t))}function _$(e,t){return function(){Av(this,e).delay=+t.apply(this,arguments)}}function S$(e,t){return t=+t,function(){Av(this,e).delay=t}}function N$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_$:S$)(t,e)):hr(this.node(),t).delay}function j$(e,t){return function(){Nr(this,e).duration=+t.apply(this,arguments)}}function E$(e,t){return t=+t,function(){Nr(this,e).duration=t}}function C$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?j$:E$)(t,e)):hr(this.node(),t).duration}function T$(e,t){if(typeof t!="function")throw new Error;return function(){Nr(this,e).ease=t}}function R$(e){var t=this._id;return arguments.length?this.each(T$(t,e)):hr(this.node(),t).ease}function A$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nr(this,e).ease=n}}function M$(e){if(typeof e!="function")throw new Error;return this.each(A$(this._id,e))}function I$(e){typeof e!="function"&&(e=oC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new Qr(s,this._parents,this._name,this._id)}function $$(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),l=new Array(s),d=0;d<i;++d)for(var f=t[d],p=n[d],h=f.length,g=l[d]=new Array(h),w,v=0;v<h;++v)(w=f[v]||p[v])&&(g[v]=w);for(;d<s;++d)l[d]=t[d];return new Qr(l,this._parents,this._name,this._id)}function O$(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 P$(e,t,n){var s,a,i=O$(t)?Av:Nr;return function(){var l=i(this,e),d=l.on;d!==s&&(a=(s=d).copy()).on(t,n),l.on=a}}function L$(e,t){var n=this._id;return arguments.length<2?hr(this.node(),n).on.on(e):this.each(P$(n,e,t))}function q$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function D$(){return this.on("end.remove",q$(this._id))}function F$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ev(e));for(var s=this._groups,a=s.length,i=new Array(a),l=0;l<a;++l)for(var d=s[l],f=d.length,p=i[l]=new Array(f),h,g,w=0;w<f;++w)(h=d[w])&&(g=e.call(h,h.__data__,w,d))&&("__data__"in h&&(g.__data__=h.__data__),p[w]=g,td(p[w],t,n,w,p,hr(h,n)));return new Qr(i,this._parents,t,n)}function z$(e){var t=this._name,n=this._id;typeof e!="function"&&(e=aC(e));for(var s=this._groups,a=s.length,i=[],l=[],d=0;d<a;++d)for(var f=s[d],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var w=e.call(h,h.__data__,g,f),v,N=hr(h,n),x=0,S=w.length;x<S;++x)(v=w[x])&&td(v,t,n,x,w,N);i.push(w),l.push(h)}return new Qr(i,l,t,n)}var B$=Ol.prototype.constructor;function U$(){return new B$(this._groups,this._parents)}function W$(e,t){var n,s,a;return function(){var i=Vo(this,e),l=(this.style.removeProperty(e),Vo(this,e));return i===l?null:i===n&&l===s?a:a=t(n=i,s=l)}}function TC(e){return function(){this.style.removeProperty(e)}}function H$(e,t,n){var s,a=n+"",i;return function(){var l=Vo(this,e);return l===a?null:l===s?i:i=t(s=l,n)}}function G$(e,t,n){var s,a,i;return function(){var l=Vo(this,e),d=n(this),f=d+"";return d==null&&(f=d=(this.style.removeProperty(e),Vo(this,e))),l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d))}}function V$(e,t){var n,s,a,i="style."+t,l="end."+i,d;return function(){var f=Nr(this,e),p=f.on,h=f.value[i]==null?d||(d=TC(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(l,a=h),f.on=s}}function Y$(e,t,n){var s=(e+="")=="transform"?YI:CC;return t==null?this.styleTween(e,W$(e,s)).on("end.style."+e,TC(e)):typeof t=="function"?this.styleTween(e,G$(e,s,Mv(this,"style."+e,t))).each(V$(this._id,e)):this.styleTween(e,H$(e,s,t),n).on("end.style."+e,null)}function K$(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function X$(e,t,n){var s,a;function i(){var l=t.apply(this,arguments);return l!==a&&(s=(a=l)&&K$(e,l,n)),s}return i._value=t,i}function Q$(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,X$(e,t,n??""))}function Z$(e){return function(){this.textContent=e}}function J$(e){return function(){var t=e(this);this.textContent=t??""}}function eO(e){return this.tween("text",typeof e=="function"?J$(Mv(this,"text",e)):Z$(e==null?"":e+""))}function tO(e){return function(t){this.textContent=e.call(this,t)}}function nO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&tO(a)),t}return s._value=e,s}function rO(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,nO(e))}function sO(){for(var e=this._name,t=this._id,n=RC(),s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)if(f=l[p]){var h=hr(f,t);td(f,e,n,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Qr(s,this._parents,e,n)}function aO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,l){var d={value:l},f={value:function(){--a===0&&i()}};n.each(function(){var p=Nr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(f)),p.on=t}),a===0&&i()})}var oO=0;function Qr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function RC(){return++oO}var Yr=Ol.prototype;Qr.prototype={constructor:Qr,select:F$,selectAll:z$,selectChild:Yr.selectChild,selectChildren:Yr.selectChildren,filter:I$,merge:$$,selection:U$,transition:sO,call:Yr.call,nodes:Yr.nodes,node:Yr.node,size:Yr.size,empty:Yr.empty,each:Yr.each,on:L$,attr:y$,attrTween:k$,style:Y$,styleTween:Q$,text:eO,textTween:rO,remove:D$,tween:u$,delay:N$,duration:C$,ease:R$,easeVarying:M$,end:aO,[Symbol.iterator]:Yr[Symbol.iterator]};function iO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var lO={time:null,delay:0,duration:250,ease:iO};function cO(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 uO(e){var t,n;e instanceof Qr?(t=e._id,e=e._name):(t=RC(),(n=lO).time=Rv(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&td(f,e,t,p,l,n||cO(f,t));return new Qr(s,this._parents,e,t)}Ol.prototype.interrupt=i$;Ol.prototype.transition=uO;const lu=e=>()=>e;function dO(e,{sourceEvent:t,target:n,transform:s,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:a}})}function Kr(e,t,n){this.k=e,this.x=t,this.y=n}Kr.prototype={constructor:Kr,scale:function(e){return e===1?this:new Kr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Kr(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 Xr=new Kr(1,0,0);Kr.prototype;function ff(e){e.stopImmediatePropagation()}function ol(e){e.preventDefault(),e.stopImmediatePropagation()}function hO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fO(){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 zb(){return this.__zoom||Xr}function pO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mO(){return navigator.maxTouchPoints||"ontouchstart"in this}function gO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function AC(){var e=hO,t=fO,n=gO,s=pO,a=mO,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],d=250,f=JI,p=Zu("start","zoom","end"),h,g,w,v=500,N=150,x=0,S=10;function _(R){R.property("__zoom",zb).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",M).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,Q,B,te){var J=R.selection?R.selection():R;J.property("__zoom",zb),R!==J?A(R,Q,B,te):J.interrupt().each(function(){O(this,arguments).event(te).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},_.scaleBy=function(R,Q,B,te){_.scaleTo(R,function(){var J=this.__zoom.k,q=typeof Q=="function"?Q.apply(this,arguments):Q;return J*q},B,te)},_.scaleTo=function(R,Q,B,te){_.transform(R,function(){var J=t.apply(this,arguments),q=this.__zoom,Y=B==null?C(J):typeof B=="function"?B.apply(this,arguments):B,L=q.invert(Y),K=typeof Q=="function"?Q.apply(this,arguments):Q;return n(E(j(q,K),Y,L),J,l)},B,te)},_.translateBy=function(R,Q,B,te){_.transform(R,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,te)},_.translateTo=function(R,Q,B,te,J){_.transform(R,function(){var q=t.apply(this,arguments),Y=this.__zoom,L=te==null?C(q):typeof te=="function"?te.apply(this,arguments):te;return n(Xr.translate(L[0],L[1]).scale(Y.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof B=="function"?-B.apply(this,arguments):-B),q,l)},te,J)};function j(R,Q){return Q=Math.max(i[0],Math.min(i[1],Q)),Q===R.k?R:new Kr(Q,R.x,R.y)}function E(R,Q,B){var te=Q[0]-B[0]*R.k,J=Q[1]-B[1]*R.k;return te===R.x&&J===R.y?R:new Kr(R.k,te,J)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function A(R,Q,B,te){R.on("start.zoom",function(){O(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(te).end()}).tween("zoom",function(){var J=this,q=arguments,Y=O(J,q).event(te),L=t.apply(J,q),K=B==null?C(L):typeof B=="function"?B.apply(J,q):B,de=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),G=J.__zoom,I=typeof Q=="function"?Q.apply(J,q):Q,X=f(G.invert(K).concat(de/G.k),I.invert(K).concat(de/I.k));return function(U){if(U===1)U=I;else{var oe=X(U),fe=de/oe[2];U=new Kr(fe,K[0]-oe[0]*fe,K[1]-oe[1]*fe)}Y.zoom(null,U)}})}function O(R,Q,B){return!B&&R.__zooming||new $(R,Q)}function $(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Q),this.taps=0}$.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Q=Wn(this.that).datum();p.call(R,this.that,new dO(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),Q)}};function z(R,...Q){if(!e.apply(this,arguments))return;var B=O(this,Q).event(R),te=this.__zoom,J=Math.max(i[0],Math.min(i[1],te.k*Math.pow(2,s.apply(this,arguments)))),q=ar(R);if(B.wheel)(B.mouse[0][0]!==q[0]||B.mouse[0][1]!==q[1])&&(B.mouse[1]=te.invert(B.mouse[0]=q)),clearTimeout(B.wheel);else{if(te.k===J)return;B.mouse=[q,te.invert(q)],Cu(this),B.start()}ol(R),B.wheel=setTimeout(Y,N),B.zoom("mouse",n(E(j(te,J),B.mouse[0],B.mouse[1]),B.extent,l));function Y(){B.wheel=null,B.end()}}function P(R,...Q){if(w||!e.apply(this,arguments))return;var B=R.currentTarget,te=O(this,Q,!0).event(R),J=Wn(R.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",de,!0),q=ar(R,B),Y=R.clientX,L=R.clientY;gC(R.view),ff(R),te.mouse=[q,this.__zoom.invert(q)],Cu(this),te.start();function K(G){if(ol(G),!te.moved){var I=G.clientX-Y,X=G.clientY-L;te.moved=I*I+X*X>x}te.event(G).zoom("mouse",n(E(te.that.__zoom,te.mouse[0]=ar(G,B),te.mouse[1]),te.extent,l))}function de(G){J.on("mousemove.zoom mouseup.zoom",null),yC(G.view,te.moved),ol(G),te.event(G).end()}}function M(R,...Q){if(e.apply(this,arguments)){var B=this.__zoom,te=ar(R.changedTouches?R.changedTouches[0]:R,this),J=B.invert(te),q=B.k*(R.shiftKey?.5:2),Y=n(E(j(B,q),te,J),t.apply(this,Q),l);ol(R),d>0?Wn(this).transition().duration(d).call(A,Y,te,R):Wn(this).call(_.transform,Y,te,R)}}function F(R,...Q){if(e.apply(this,arguments)){var B=R.touches,te=B.length,J=O(this,Q,R.changedTouches.length===te).event(R),q,Y,L,K;for(ff(R),Y=0;Y<te;++Y)L=B[Y],K=ar(L,this),K=[K,this.__zoom.invert(K),L.identifier],J.touch0?!J.touch1&&J.touch0[2]!==K[2]&&(J.touch1=K,J.taps=0):(J.touch0=K,q=!0,J.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(J.taps<2&&(g=K[0],h=setTimeout(function(){h=null},v)),Cu(this),J.start())}}function H(R,...Q){if(this.__zooming){var B=O(this,Q).event(R),te=R.changedTouches,J=te.length,q,Y,L,K;for(ol(R),q=0;q<J;++q)Y=te[q],L=ar(Y,this),B.touch0&&B.touch0[2]===Y.identifier?B.touch0[0]=L:B.touch1&&B.touch1[2]===Y.identifier&&(B.touch1[0]=L);if(Y=B.that.__zoom,B.touch1){var de=B.touch0[0],G=B.touch0[1],I=B.touch1[0],X=B.touch1[1],U=(U=I[0]-de[0])*U+(U=I[1]-de[1])*U,oe=(oe=X[0]-G[0])*oe+(oe=X[1]-G[1])*oe;Y=j(Y,Math.sqrt(U/oe)),L=[(de[0]+I[0])/2,(de[1]+I[1])/2],K=[(G[0]+X[0])/2,(G[1]+X[1])/2]}else if(B.touch0)L=B.touch0[0],K=B.touch0[1];else return;B.zoom("touch",n(E(Y,L,K),B.extent,l))}}function Z(R,...Q){if(this.__zooming){var B=O(this,Q).event(R),te=R.changedTouches,J=te.length,q,Y;for(ff(R),w&&clearTimeout(w),w=setTimeout(function(){w=null},v),q=0;q<J;++q)Y=te[q],B.touch0&&B.touch0[2]===Y.identifier?delete B.touch0:B.touch1&&B.touch1[2]===Y.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(Y=ar(Y,this),Math.hypot(g[0]-Y[0],g[1]-Y[1])<S)){var L=Wn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:lu(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:lu(!!R),_):e},_.touchable=function(R){return arguments.length?(a=typeof R=="function"?R:lu(!!R),_):a},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:lu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],_):[i[0],i[1]]},_.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(d=+R,_):d},_.interpolate=function(R){return arguments.length?(f=R,_):f},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(x=(R=+R)*R,_):Math.sqrt(x)},_.tapDistance=function(R){return arguments.length?(S=+R,_):S},_}var Iv=nC();const nd=k.createContext(null),yO=nd.Provider,Zr={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.`},MC=Zr.error001();function lt(e,t){const n=k.useContext(nd);if(n===null)throw new Error(MC);return rC(n,e,t)}const At=()=>{const e=k.useContext(nd);if(e===null)throw new Error(MC);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},wO=e=>e.userSelectionActive?"none":"all";function $v({position:e,children:t,className:n,style:s,...a}){const i=lt(wO),l=`${e}`.split("-");return he.createElement("div",{className:Gt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:i},...a},t)}function vO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:he.createElement($v,{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"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const xO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:d=2,children:f,className:p,...h})=>{const g=k.useRef(null),[w,v]=k.useState({x:0,y:0,width:0,height:0}),N=Gt(["react-flow__edge-textwrapper",p]);return k.useEffect(()=>{if(g.current){const x=g.current.getBBox();v({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${e-w.width/2} ${t-w.height/2})`,className:N,visibility:w.width?"visible":"hidden",...h},a&&he.createElement("rect",{width:w.width+2*l[0],x:-l[0],y:-l[1],height:w.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:d,ry:d}),he.createElement("text",{className:"react-flow__edge-text",y:w.height/2,dy:"0.3em",ref:g,style:s},n),f)};var bO=k.memo(xO);const Ov=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ko=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pv=(e={x:0,y:0},t)=>({x:Ko(e.x,t[0][0],t[1][0]),y:Ko(e.y,t[0][1],t[1][1])}),Bb=(e,t,n)=>e<t?Ko(Math.abs(e-t),1,50)/50:e>n?-Ko(Math.abs(e-n),1,50)/50:0,IC=(e,t)=>{const n=Bb(e.x,35,t.width-35)*20,s=Bb(e.y,35,t.height-35)*20;return[n,s]},$C=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},OC=(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)}),jl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),PC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Ub=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),kO=(e,t)=>PC(OC(jl(e),jl(t))),ev=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},_O=e=>Hn(e.width)&&Hn(e.height)&&Hn(e.x)&&Hn(e.y),Hn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),LC=["Enter"," ","Escape"],SO=(e,t)=>{},NO=e=>"nativeEvent"in e;function tv(e){var a,i;const t=NO(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const qC=e=>"clientX"in e,Ps=(e,t)=>{var i,l;const n=qC(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Du=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ll=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:w,interactionWidth:v=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:w}),v&&he.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),a&&Hn(n)&&Hn(s)?he.createElement(bO,{x:n,y:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p}):null);Ll.displayName="BaseEdge";function il(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function DC({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,l=Math.abs(s-t)/2,d=s<t?s+l:s-l;return[i,d,a,l]}function FC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d}){const f=e*.125+a*.375+l*.375+n*.125,p=t*.125+i*.375+d*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}var Ta;(function(e){e.Strict="strict",e.Loose="loose"})(Ta||(Ta={}));var Sa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Sa||(Sa={}));var El;(function(e){e.Partial="partial",e.Full="full"})(El||(El={}));var Os;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Os||(Os={}));var Fu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Fu||(Fu={}));var Oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Oe||(Oe={}));function Wb({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===Oe.Left||e===Oe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function zC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top}){const[l,d]=Wb({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Wb({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,g,w,v]=FC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${s},${a}`,h,g,w,v]}const Lv=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:w,markerEnd:v,markerStart:N,interactionWidth:x})=>{const[S,_,j]=zC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return he.createElement(Ll,{path:S,labelX:_,labelY:j,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:w,markerEnd:v,markerStart:N,interactionWidth:x})});Lv.displayName="SimpleBezierEdge";const Hb={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},jO=({source:e,sourcePosition:t=Oe.Bottom,target:n})=>t===Oe.Left||t===Oe.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},Gb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function EO({source:e,sourcePosition:t=Oe.Bottom,target:n,targetPosition:s=Oe.Top,center:a,offset:i}){const l=Hb[t],d=Hb[s],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=jO({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",w=h[g];let v=[],N,x;const S={x:0,y:0},_={x:0,y:0},[j,E,C,A]=DC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){N=a.x??j,x=a.y??E;const $=[{x:N,y:f.y},{x:N,y:p.y}],z=[{x:f.x,y:x},{x:p.x,y:x}];l[g]===w?v=g==="x"?$:z:v=g==="x"?z:$}else{const $=[{x:f.x,y:p.y}],z=[{x:p.x,y:f.y}];if(g==="x"?v=l.x===w?z:$:v=l.y===w?$:z,t===s){const Z=Math.abs(e[g]-n[g]);if(Z<=i){const R=Math.min(i-1,i-Z);l[g]===w?S[g]=(f[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const Z=g==="x"?"y":"x",R=l[g]===d[Z],Q=f[Z]>p[Z],B=f[Z]<p[Z];(l[g]===1&&(!R&&Q||R&&B)||l[g]!==1&&(!R&&B||R&&Q))&&(v=g==="x"?$:z)}const P={x:f.x+S.x,y:f.y+S.y},M={x:p.x+_.x,y:p.y+_.y},F=Math.max(Math.abs(P.x-v[0].x),Math.abs(M.x-v[0].x)),H=Math.max(Math.abs(P.y-v[0].y),Math.abs(M.y-v[0].y));F>=H?(N=(P.x+M.x)/2,x=v[0].y):(N=v[0].x,x=(P.y+M.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...v,{x:p.x+_.x,y:p.y+_.y},n],N,x,C,A]}function CO(e,t,n,s){const a=Math.min(Gb(e,t)/2,Gb(t,n)/2,s),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${l}Q ${i},${l} ${i},${l+a*h}`}const d=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+a*f}Q ${i},${l} ${i+a*d},${l}`}function nv({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,borderRadius:l=5,centerX:d,centerY:f,offset:p=20}){const[h,g,w,v,N]=EO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:d,y:f},offset:p});return[h.reduce((S,_,j)=>{let E="";return j>0&&j<h.length-1?E=CO(h[j-1],_,h[j+1],l):E=`${j===0?"M":"L"}${_.x} ${_.y}`,S+=E,S},""),g,w,v,N]}const rd=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=Oe.Bottom,targetPosition:w=Oe.Top,markerEnd:v,markerStart:N,pathOptions:x,interactionWidth:S})=>{const[_,j,E]=nv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:w,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return he.createElement(Ll,{path:_,labelX:j,labelY:E,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:v,markerStart:N,interactionWidth:S})});rd.displayName="SmoothStepEdge";const qv=k.memo(e=>{var t;return he.createElement(rd,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});qv.displayName="StepEdge";function TO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,l,d]=DC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,l,d]}const Dv=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:w,interactionWidth:v})=>{const[N,x,S]=TO({sourceX:e,sourceY:t,targetX:n,targetY:s});return he.createElement(Ll,{path:N,labelX:x,labelY:S,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:w,interactionWidth:v})});Dv.displayName="StraightEdge";function cu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vb({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case Oe.Left:return[t-cu(t-s,i),n];case Oe.Right:return[t+cu(s-t,i),n];case Oe.Top:return[t,n-cu(n-a,i)];case Oe.Bottom:return[t,n+cu(a-n,i)]}}function BC({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:s,targetY:a,targetPosition:i=Oe.Top,curvature:l=.25}){const[d,f]=Vb({pos:n,x1:e,y1:t,x2:s,y2:a,c:l}),[p,h]=Vb({pos:i,x1:s,y1:a,x2:e,y2:t,c:l}),[g,w,v,N]=FC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${d},${f} ${p},${h} ${s},${a}`,g,w,v,N]}const zu=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=Oe.Bottom,targetPosition:i=Oe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:w,markerEnd:v,markerStart:N,pathOptions:x,interactionWidth:S})=>{const[_,j,E]=BC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:x==null?void 0:x.curvature});return he.createElement(Ll,{path:_,labelX:j,labelY:E,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:w,markerEnd:v,markerStart:N,interactionWidth:S})});zu.displayName="BezierEdge";const Fv=k.createContext(null),RO=Fv.Provider;Fv.Consumer;const AO=()=>k.useContext(Fv),MO=e=>"id"in e&&"source"in e&&"target"in e,IO=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,rv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,$O=(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)),OO=(e,t)=>{if(!e.source||!e.target)return t;let n;return MO(e)?n={...e}:n={...e,id:IO(e)},$O(n,t)?t:t.concat(n)},sv=({x:e,y:t},[n,s,a],i,[l,d])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:l*Math.round(f.x/l),y:d*Math.round(f.y/d)}:f},UC=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),ja=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-s};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:a}},sd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:l}=ja(a,t).positionAbsolute;return OC(s,jl({x:i,y:l,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return PC(n)},WC=(e,t,[n,s,a]=[0,0,1],i=!1,l=!1,d=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:g,height:w,selectable:v=!0,hidden:N=!1}=h;if(l&&!v||N)return!1;const{positionAbsolute:x}=ja(h,d),S={x:x.x,y:x.y,width:g||0,height:w||0},_=ev(f,S),j=typeof g>"u"||typeof w>"u"||g===null||w===null,E=i&&_>0,C=(g||0)*(w||0);(j||E||_>=C||h.dragging)&&p.push(h)}),p},HC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},GC=(e,t,n,s,a,i=.1)=>{const l=t/(e.width*(1+i)),d=n/(e.height*(1+i)),f=Math.min(l,d),p=Ko(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,w=t/2-h*p,v=n/2-g*p;return{x:w,y:v,zoom:p}},ka=(e,t=0)=>e.transition().duration(t);function Yb(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var l,d;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+i.y+i.height/2}),a},[])}function PO(e,t,n,s,a,i){const{x:l,y:d}=Ps(e),p=t.elementsFromPoint(l,d).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const x=zv(void 0,p),S=p.getAttribute("data-handleid"),_=i({nodeId:N,id:S,type:x});if(_){const j=a.find(E=>E.nodeId===N&&E.type===x&&E.id===S);return{handle:{id:S,type:x,nodeId:N,x:(j==null?void 0:j.x)||n.x,y:(j==null?void 0:j.y)||n.y},validHandleResult:_}}}}let h=[],g=1/0;if(a.forEach(N=>{const x=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(x<=s){const S=i(N);x<=g&&(x<g?h=[{handle:N,validHandleResult:S}]:x===g&&h.push({handle:N,validHandleResult:S}),g=x)}}),!h.length)return{handle:null,validHandleResult:VC()};if(h.length===1)return h[0];const w=h.some(({validHandleResult:N})=>N.isValid),v=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:x})=>v?N.type==="target":w?x.isValid:!0)||h[0]}const LO={source:null,target:null,sourceHandle:null,targetHandle:null},VC=()=>({handleDomNode:null,isValid:!1,connection:LO,endHandle:null});function YC(e,t,n,s,a,i,l){const d=a==="target",f=l.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={...VC(),handleDomNode:f};if(f){const h=zv(void 0,f),g=f.getAttribute("data-nodeid"),w=f.getAttribute("data-handleid"),v=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),x={source:d?g:n,sourceHandle:d?w:s,target:d?n:g,targetHandle:d?s:w};p.connection=x,v&&N&&(t===Ta.Strict?d&&h==="source"||!d&&h==="target":g!==n||w!==s)&&(p.endHandle={nodeId:g,handleId:w,type:h},p.isValid=i(x))}return p}function qO({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[jt]){const{handleBounds:l}=i[jt];let d=[],f=[];l&&(d=Yb(i,l,"source",`${t}-${n}-${s}`),f=Yb(i,l,"target",`${t}-${n}-${s}`)),a.push(...d,...f)}return a},[])}function zv(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function pf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function DO(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function KC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:l,isValidConnection:d,edgeUpdaterType:f,onReconnectEnd:p}){const h=$C(e.target),{connectionMode:g,domNode:w,autoPanOnConnect:v,connectionRadius:N,onConnectStart:x,panBy:S,getNodes:_,cancelConnection:j}=i();let E=0,C;const{x:A,y:O}=Ps(e),$=h==null?void 0:h.elementFromPoint(A,O),z=zv(f,$),P=w==null?void 0:w.getBoundingClientRect();if(!P||!z)return;let M,F=Ps(e,P),H=!1,Z=null,R=!1,Q=null;const B=qO({nodes:_(),nodeId:n,handleId:t,handleType:z}),te=()=>{if(!v)return;const[Y,L]=IC(F,P);S({x:Y,y:L}),E=requestAnimationFrame(te)};l({connectionPosition:F,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),x==null||x(e,{nodeId:n,handleId:t,handleType:z});function J(Y){const{transform:L}=i();F=Ps(Y,P);const{handle:K,validHandleResult:de}=PO(Y,h,sv(F,L,!1,[1,1]),N,B,G=>YC(G,g,n,t,a?"target":"source",d,h));if(C=K,H||(te(),H=!0),Q=de.handleDomNode,Z=de.connection,R=de.isValid,l({connectionPosition:C&&R?UC({x:C.x,y:C.y},L):F,connectionStatus:DO(!!C,R),connectionEndHandle:de.endHandle}),!C&&!R&&!Q)return pf(M);Z.source!==Z.target&&Q&&(pf(M),M=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function q(Y){var L,K;(C||Q)&&Z&&R&&(s==null||s(Z)),(K=(L=i()).onConnectEnd)==null||K.call(L,Y),f&&(p==null||p(Y)),pf(M),j(),cancelAnimationFrame(E),H=!1,R=!1,Z=null,Q=null,h.removeEventListener("mousemove",J),h.removeEventListener("mouseup",q),h.removeEventListener("touchmove",J),h.removeEventListener("touchend",q)}h.addEventListener("mousemove",J),h.addEventListener("mouseup",q),h.addEventListener("touchmove",J),h.addEventListener("touchend",q)}const Kb=()=>!0,FO=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),zO=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:l}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},XC=k.forwardRef(({type:e="source",position:t=Oe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:d,children:f,className:p,onMouseDown:h,onTouchStart:g,...w},v)=>{var P,M;const N=l||null,x=e==="target",S=At(),_=AO(),{connectOnClick:j,noPanClassName:E}=lt(FO,Pt),{connecting:C,clickConnecting:A}=lt(zO(_,N,e),Pt);_||(M=(P=S.getState()).onError)==null||M.call(P,"010",Zr.error010());const O=F=>{const{defaultEdgeOptions:H,onConnect:Z,hasDefaultEdges:R}=S.getState(),Q={...H,...F};if(R){const{edges:B,setEdges:te}=S.getState();te(OO(Q,B))}Z==null||Z(Q),d==null||d(Q)},$=F=>{if(!_)return;const H=qC(F);a&&(H&&F.button===0||!H)&&KC({event:F,handleId:N,nodeId:_,onConnect:O,isTarget:x,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Kb}),H?h==null||h(F):g==null||g(F)},z=F=>{const{onClickConnectStart:H,onClickConnectEnd:Z,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:B}=S.getState();if(!_||!R&&!a)return;if(!R){H==null||H(F,{nodeId:_,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:N}});return}const te=$C(F.target),J=n||B||Kb,{connection:q,isValid:Y}=YC({nodeId:_,id:N,type:e},Q,R.nodeId,R.handleId||null,R.type,J,te);Y&&O(q),Z==null||Z(F),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":N,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${N}-${e}`,className:Gt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!x,target:x,connectable:s,connectablestart:a,connectableend:i,connecting:A,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:$,onTouchStart:$,onClick:j?z:void 0,ref:v,...w},f)});XC.displayName="Handle";var Xo=k.memo(XC);const QC=({data:e,isConnectable:t,targetPosition:n=Oe.Top,sourcePosition:s=Oe.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Xo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,he.createElement(Xo,{type:"source",position:s,isConnectable:t}));QC.displayName="DefaultNode";var av=k.memo(QC);const ZC=({data:e,isConnectable:t,sourcePosition:n=Oe.Bottom})=>he.createElement(he.Fragment,null,e==null?void 0:e.label,he.createElement(Xo,{type:"source",position:n,isConnectable:t}));ZC.displayName="InputNode";var JC=k.memo(ZC);const eT=({data:e,isConnectable:t,targetPosition:n=Oe.Top})=>he.createElement(he.Fragment,null,he.createElement(Xo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);eT.displayName="OutputNode";var tT=k.memo(eT);const Bv=()=>null;Bv.displayName="GroupNode";const BO=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),uu=e=>e.id;function UO(e,t){return Pt(e.selectedNodes.map(uu),t.selectedNodes.map(uu))&&Pt(e.selectedEdges.map(uu),t.selectedEdges.map(uu))}const nT=k.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=lt(BO,UO);return k.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});nT.displayName="SelectionListener";const WO=e=>!!e.onSelectionChange;function HO({onSelectionChange:e}){const t=lt(WO);return e||t?he.createElement(nT,{onSelectionChange:e}):null}const GO=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 Mo(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Qe(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const VO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:l,onClickConnectStart:d,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:w,edgesUpdatable:v,elevateNodesOnSelect:N,minZoom:x,maxZoom:S,nodeExtent:_,onNodesChange:j,onEdgesChange:E,elementsSelectable:C,connectionMode:A,snapGrid:O,snapToGrid:$,translateExtent:z,connectOnClick:P,defaultEdgeOptions:M,fitView:F,fitViewOptions:H,onNodesDelete:Z,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:B,onNodeDragStop:te,onSelectionDrag:J,onSelectionDragStart:q,onSelectionDragStop:Y,noPanClassName:L,nodeOrigin:K,rfId:de,autoPanOnConnect:G,autoPanOnNodeDrag:I,onError:X,connectionRadius:U,isValidConnection:oe,nodeDragThreshold:fe})=>{const{setNodes:me,setEdges:ke,setDefaultNodesAndEdges:Ye,setMinZoom:Le,setMaxZoom:qe,setTranslateExtent:je,setNodeExtent:Ge,reset:be}=lt(GO,Pt),se=At();return k.useEffect(()=>{const Ze=s==null?void 0:s.map(ht=>({...ht,...M}));return Ye(n,Ze),()=>{be()}},[]),Qe("defaultEdgeOptions",M,se.setState),Qe("connectionMode",A,se.setState),Qe("onConnect",a,se.setState),Qe("onConnectStart",i,se.setState),Qe("onConnectEnd",l,se.setState),Qe("onClickConnectStart",d,se.setState),Qe("onClickConnectEnd",f,se.setState),Qe("nodesDraggable",p,se.setState),Qe("nodesConnectable",h,se.setState),Qe("nodesFocusable",g,se.setState),Qe("edgesFocusable",w,se.setState),Qe("edgesUpdatable",v,se.setState),Qe("elementsSelectable",C,se.setState),Qe("elevateNodesOnSelect",N,se.setState),Qe("snapToGrid",$,se.setState),Qe("snapGrid",O,se.setState),Qe("onNodesChange",j,se.setState),Qe("onEdgesChange",E,se.setState),Qe("connectOnClick",P,se.setState),Qe("fitViewOnInit",F,se.setState),Qe("fitViewOnInitOptions",H,se.setState),Qe("onNodesDelete",Z,se.setState),Qe("onEdgesDelete",R,se.setState),Qe("onNodeDrag",Q,se.setState),Qe("onNodeDragStart",B,se.setState),Qe("onNodeDragStop",te,se.setState),Qe("onSelectionDrag",J,se.setState),Qe("onSelectionDragStart",q,se.setState),Qe("onSelectionDragStop",Y,se.setState),Qe("noPanClassName",L,se.setState),Qe("nodeOrigin",K,se.setState),Qe("rfId",de,se.setState),Qe("autoPanOnConnect",G,se.setState),Qe("autoPanOnNodeDrag",I,se.setState),Qe("onError",X,se.setState),Qe("connectionRadius",U,se.setState),Qe("isValidConnection",oe,se.setState),Qe("nodeDragThreshold",fe,se.setState),Mo(e,me),Mo(t,ke),Mo(x,Le),Mo(S,qe),Mo(z,je),Mo(_,Ge),null},Xb={display:"none"},YO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rT="react-flow__node-desc",sT="react-flow__edge-desc",KO="react-flow__aria-live",XO=e=>e.ariaLiveMessage;function QO({rfId:e}){const t=lt(XO);return he.createElement("div",{id:`${KO}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:YO},t)}function ZO({rfId:e,disableKeyboardA11y:t}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${rT}-${e}`,style:Xb},"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."," "),he.createElement("div",{id:`${sT}-${e}`,style:Xb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&he.createElement(QO,{rfId:e}))}var Cl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=k.useState(!1),a=k.useRef(!1),i=k.useRef(new Set([])),[l,d]=k.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),h=p.reduce((g,w)=>g.concat(...w),[]);return[p,h]}return[[],[]]},[e]);return k.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=v=>{if(a.current=v.ctrlKey||v.metaKey||v.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&tv(v))return!1;const x=Zb(v.code,d);i.current.add(v[x]),Qb(l,i.current,!1)&&(v.preventDefault(),s(!0))},g=v=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&tv(v))return!1;const x=Zb(v.code,d);Qb(l,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(v[x]),v.key==="Meta"&&i.current.clear(),a.current=!1},w=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",w),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",w)}}},[e,s]),n};function Qb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Zb(e,t){return t.includes(e)?"code":"key"}function aT(e,t,n,s){var d,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),l=ja(i,s);return aT(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((d=i[jt])==null?void 0:d.z)??0)>(n.z??0)?((f=i[jt])==null?void 0:f.z)??0:n.z??0},s)}function oT(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:l,y:d,z:f}=aT(s,e,{...s.position,z:((i=s[jt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:d},s[jt].z=f,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function mf(e,t,n,s){const a=new Map,i={},l=s?1e3:0;return e.forEach(d=>{var v;const f=(Hn(d.zIndex)?d.zIndex:0)+(d.selected?l:0),p=t.get(d.id),h={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},g=d.parentNode||d.parentId;g&&(i[g]=!0);const w=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(h,jt,{enumerable:!1,value:{handleBounds:w||(v=p==null?void 0:p[jt])==null?void 0:v.handleBounds,z:f}}),a.set(d.id,h)}),oT(a,n,i),a}function iT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:l,d3Zoom:d,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),w=t.initial&&!p&&h;if(d&&f&&(w||!t.initial)){const N=n().filter(S=>{var j;const _=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(j=t.nodes)!=null&&j.length?_&&t.nodes.some(E=>E.id===S.id):_}),x=N.every(S=>S.width&&S.height);if(N.length>0&&x){const S=sd(N,g),{x:_,y:j,zoom:E}=GC(S,s,a,t.minZoom??i,t.maxZoom??l,t.padding??.1),C=Xr.translate(_,j).scale(E);return typeof t.duration=="number"&&t.duration>0?d.transform(ka(f,t.duration),C):d.transform(f,C),!0}}return!1}function JO(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[jt]:s[jt],selected:n.selected})}),new Map(t)}function eP(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function du({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:l,onEdgesChange:d,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:JO(e,a)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:eP(t,i)}),d==null||d(t))}const Io=()=>{},tP={zoomIn:Io,zoomOut:Io,zoomTo:Io,getZoom:()=>1,setViewport:Io,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Io,fitBounds:Io,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},nP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),rP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=lt(nP,Pt);return k.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ka(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ka(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ka(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[l,d,f]=e.getState().transform,p=Xr.translate(a.x??l,a.y??d).scale(a.zoom??f);t.transform(ka(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,l]=e.getState().transform;return{x:a,y:i,zoom:l}},fitView:a=>iT(e.getState,a),setCenter:(a,i,l)=>{const{width:d,height:f,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=d/2-a*h,w=f/2-i*h,v=Xr.translate(g,w).scale(h);t.transform(ka(n,l==null?void 0:l.duration),v)},fitBounds:(a,i)=>{const{width:l,height:d,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:w}=GC(a,l,d,f,p,(i==null?void 0:i.padding)??.1),v=Xr.translate(h,g).scale(w);t.transform(ka(n,i==null?void 0:i.duration),v)},project:a=>{const{transform:i,snapToGrid:l,snapGrid:d}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),sv(a,i,l,d)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:l,snapGrid:d,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),g={x:a.x-p,y:a.y-h};return sv(g,i,l,d)},flowToScreenPosition:a=>{const{transform:i,domNode:l}=e.getState();if(!l)return a;const{x:d,y:f}=l.getBoundingClientRect(),p=UC(a,i);return{x:p.x+d,y:p.y+f}},viewportInitialized:!0}:tP,[t,n])};function ql(){const e=rP(),t=At(),n=k.useCallback(()=>t.getState().getNodes().map(x=>({...x})),[]),s=k.useCallback(x=>t.getState().nodeInternals.get(x),[]),a=k.useCallback(()=>{const{edges:x=[]}=t.getState();return x.map(S=>({...S}))},[]),i=k.useCallback(x=>{const{edges:S=[]}=t.getState();return S.find(_=>_.id===x)},[]),l=k.useCallback(x=>{const{getNodes:S,setNodes:_,hasDefaultNodes:j,onNodesChange:E}=t.getState(),C=S(),A=typeof x=="function"?x(C):x;if(j)_(A);else if(E){const O=A.length===0?C.map($=>({type:"remove",id:$.id})):A.map($=>({item:$,type:"reset"}));E(O)}},[]),d=k.useCallback(x=>{const{edges:S=[],setEdges:_,hasDefaultEdges:j,onEdgesChange:E}=t.getState(),C=typeof x=="function"?x(S):x;if(j)_(C);else if(E){const A=C.length===0?S.map(O=>({type:"remove",id:O.id})):C.map(O=>({item:O,type:"reset"}));E(A)}},[]),f=k.useCallback(x=>{const S=Array.isArray(x)?x:[x],{getNodes:_,setNodes:j,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const O=[..._(),...S];j(O)}else if(C){const A=S.map(O=>({item:O,type:"add"}));C(A)}},[]),p=k.useCallback(x=>{const S=Array.isArray(x)?x:[x],{edges:_=[],setEdges:j,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)j([..._,...S]);else if(C){const A=S.map(O=>({item:O,type:"add"}));C(A)}},[]),h=k.useCallback(()=>{const{getNodes:x,edges:S=[],transform:_}=t.getState(),[j,E,C]=_;return{nodes:x().map(A=>({...A})),edges:S.map(A=>({...A})),viewport:{x:j,y:E,zoom:C}}},[]),g=k.useCallback(({nodes:x,edges:S})=>{const{nodeInternals:_,getNodes:j,edges:E,hasDefaultNodes:C,hasDefaultEdges:A,onNodesDelete:O,onEdgesDelete:$,onNodesChange:z,onEdgesChange:P}=t.getState(),M=(x||[]).map(Q=>Q.id),F=(S||[]).map(Q=>Q.id),H=j().reduce((Q,B)=>{const te=B.parentNode||B.parentId,J=!M.includes(B.id)&&te&&Q.find(Y=>Y.id===te);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(M.includes(B.id)||J)&&Q.push(B),Q},[]),Z=E.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=Z.filter(Q=>F.includes(Q.id));if(H||R){const Q=HC(H,Z),B=[...R,...Q],te=B.reduce((J,q)=>(J.includes(q.id)||J.push(q.id),J),[]);if((A||C)&&(A&&t.setState({edges:E.filter(J=>!te.includes(J.id))}),C&&(H.forEach(J=>{_.delete(J.id)}),t.setState({nodeInternals:new Map(_)}))),te.length>0&&($==null||$(B),P&&P(te.map(J=>({id:J,type:"remove"})))),H.length>0&&(O==null||O(H),z)){const J=H.map(q=>({id:q.id,type:"remove"}));z(J)}}},[]),w=k.useCallback(x=>{const S=_O(x),_=S?null:t.getState().nodeInternals.get(x.id);return!S&&!_?[null,null,S]:[S?x:Ub(_),_,S]},[]),v=k.useCallback((x,S=!0,_)=>{const[j,E,C]=w(x);return j?(_||t.getState().getNodes()).filter(A=>{if(!C&&(A.id===E.id||!A.positionAbsolute))return!1;const O=Ub(A),$=ev(O,j);return S&&$>0||$>=j.width*j.height}):[]},[]),N=k.useCallback((x,S,_=!0)=>{const[j]=w(x);if(!j)return!1;const E=ev(j,S);return _&&E>0||E>=j.width*j.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:l,setEdges:d,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:v,isNodeIntersecting:N}),[e,n,s,a,i,l,d,f,p,h,g,v,N])}const sP={actInsideInputWithModifier:!1};var aP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=ql(),a=Cl(e,sP),i=Cl(t);k.useEffect(()=>{if(a){const{edges:l,getNodes:d}=n.getState(),f=d().filter(h=>h.selected),p=l.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),k.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function oP(e){const t=At();k.useEffect(()=>{let n;const s=()=>{var i,l;if(!e.current)return;const a=Ov(e.current);(a.height===0||a.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",Zr.error004())),t.setState({width:a.width||500,height:a.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Uv={position:"absolute",width:"100%",height:"100%",top:0,left:0},iP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,hu=e=>({x:e.x,y:e.y,zoom:e.k}),$o=(e,t)=>e.target.closest(`.${t}`),Jb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ek=e=>{const t=e.ctrlKey&&Du()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},lP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),cP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:d=.5,panOnScrollMode:f=Sa.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:w,translateExtent:v,minZoom:N,maxZoom:x,zoomActivationKeyCode:S,preventScrolling:_=!0,children:j,noWheelClassName:E,noPanClassName:C})=>{const A=k.useRef(),O=At(),$=k.useRef(!1),z=k.useRef(!1),P=k.useRef(null),M=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:F,d3Selection:H,d3ZoomHandler:Z,userSelectionActive:R}=lt(lP,Pt),Q=Cl(S),B=k.useRef(0),te=k.useRef(!1),J=k.useRef();return oP(P),k.useEffect(()=>{if(P.current){const q=P.current.getBoundingClientRect(),Y=AC().scaleExtent([N,x]).translateExtent(v),L=Wn(P.current).call(Y),K=Xr.translate(w.x,w.y).scale(Ko(w.zoom,N,x)),de=[[0,0],[q.width,q.height]],G=Y.constrain()(K,de,v);Y.transform(L,G),Y.wheelDelta(ek),O.setState({d3Zoom:Y,d3Selection:L,d3ZoomHandler:L.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:P.current.closest(".react-flow")})}},[]),k.useEffect(()=>{H&&F&&(l&&!Q&&!R?H.on("wheel.zoom",q=>{if($o(q,E))return!1;q.preventDefault(),q.stopImmediatePropagation();const Y=H.property("__zoom").k||1;if(q.ctrlKey&&i){const oe=ar(q),fe=ek(q),me=Y*Math.pow(2,fe);F.scaleTo(H,me,oe,q);return}const L=q.deltaMode===1?20:1;let K=f===Sa.Vertical?0:q.deltaX*L,de=f===Sa.Horizontal?0:q.deltaY*L;!Du()&&q.shiftKey&&f!==Sa.Vertical&&(K=q.deltaY*L,de=0),F.translateBy(H,-(K/Y)*d,-(de/Y)*d,{internal:!0});const G=hu(H.property("__zoom")),{onViewportChangeStart:I,onViewportChange:X,onViewportChangeEnd:U}=O.getState();clearTimeout(J.current),te.current||(te.current=!0,t==null||t(q,G),I==null||I(G)),te.current&&(e==null||e(q,G),X==null||X(G),J.current=setTimeout(()=>{n==null||n(q,G),U==null||U(G),te.current=!1},150))},{passive:!1}):typeof Z<"u"&&H.on("wheel.zoom",function(q,Y){if(!_&&q.type==="wheel"&&!q.ctrlKey||$o(q,E))return null;q.preventDefault(),Z.call(this,q,Y)},{passive:!1}))},[R,l,f,H,F,Z,Q,i,_,E,t,e,n]),k.useEffect(()=>{F&&F.on("start",q=>{var K,de;if(!q.sourceEvent||q.sourceEvent.internal)return null;B.current=(K=q.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:Y}=O.getState(),L=hu(q.transform);$.current=!0,M.current=L,((de=q.sourceEvent)==null?void 0:de.type)==="mousedown"&&O.setState({paneDragging:!0}),Y==null||Y(L),t==null||t(q.sourceEvent,L)})},[F,t]),k.useEffect(()=>{F&&(R&&!$.current?F.on("zoom",null):R||F.on("zoom",q=>{var L;const{onViewportChange:Y}=O.getState();if(O.setState({transform:[q.transform.x,q.transform.y,q.transform.k]}),z.current=!!(s&&Jb(g,B.current??0)),(e||Y)&&!((L=q.sourceEvent)!=null&&L.internal)){const K=hu(q.transform);Y==null||Y(K),e==null||e(q.sourceEvent,K)}}))},[R,F,e,g,s]),k.useEffect(()=>{F&&F.on("end",q=>{if(!q.sourceEvent||q.sourceEvent.internal)return null;const{onViewportChangeEnd:Y}=O.getState();if($.current=!1,O.setState({paneDragging:!1}),s&&Jb(g,B.current??0)&&!z.current&&s(q.sourceEvent),z.current=!1,(n||Y)&&iP(M.current,q.transform)){const L=hu(q.transform);M.current=L,clearTimeout(A.current),A.current=setTimeout(()=>{Y==null||Y(L),n==null||n(q.sourceEvent,L)},l?150:0)}})},[F,l,g,n,s]),k.useEffect(()=>{F&&F.filter(q=>{const Y=Q||a,L=i&&q.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&q.button===1&&q.type==="mousedown"&&($o(q,"react-flow__node")||$o(q,"react-flow__edge")))return!0;if(!g&&!Y&&!l&&!p&&!i||R||!p&&q.type==="dblclick"||$o(q,E)&&q.type==="wheel"||$o(q,C)&&(q.type!=="wheel"||l&&q.type==="wheel"&&!Q)||!i&&q.ctrlKey&&q.type==="wheel"||!Y&&!l&&!L&&q.type==="wheel"||!g&&(q.type==="mousedown"||q.type==="touchstart")||Array.isArray(g)&&!g.includes(q.button)&&q.type==="mousedown")return!1;const K=Array.isArray(g)&&g.includes(q.button)||!q.button||q.button<=1;return(!q.ctrlKey||q.type==="wheel")&&K})},[R,F,a,i,l,p,g,h,Q]),he.createElement("div",{className:"react-flow__renderer",ref:P,style:Uv},j)},uP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function dP(){const{userSelectionActive:e,userSelectionRect:t}=lt(uP,Pt);return e&&t?he.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 tk(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function hP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(d=>d.id===a.id);if(i.length===0)return s.push(a),s;const l={...a};for(const d of i)if(d)switch(d.type){case"select":{l.selected=d.selected;break}case"position":{typeof d.position<"u"&&(l.position=d.position),typeof d.positionAbsolute<"u"&&(l.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(l.dragging=d.dragging),l.expandParent&&tk(s,l);break}case"dimensions":{typeof d.dimensions<"u"&&(l.width=d.dimensions.width,l.height=d.dimensions.height),typeof d.updateStyle<"u"&&(l.style={...l.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(l.resizing=d.resizing),l.expandParent&&tk(s,l);break}case"remove":return s}return s.push(l),s},n)}function fP(e,t){return hP(e,t)}const $s=(e,t)=>({id:e,type:"select",selected:t});function Fo(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push($s(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push($s(s.id,!1))),n},[])}const gf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},pP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),lT=k.memo(({isSelecting:e,selectionMode:t=El.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const w=k.useRef(null),v=At(),N=k.useRef(0),x=k.useRef(0),S=k.useRef(),{userSelectionActive:_,elementsSelectable:j,dragging:E}=lt(pP,Pt),C=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,x.current=0},A=Z=>{i==null||i(Z),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},O=Z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Z.preventDefault();return}l==null||l(Z)},$=d?Z=>d(Z):void 0,z=Z=>{const{resetSelectedElements:R,domNode:Q}=v.getState();if(S.current=Q==null?void 0:Q.getBoundingClientRect(),!j||!e||Z.button!==0||Z.target!==w.current||!S.current)return;const{x:B,y:te}=Ps(Z,S.current);R(),v.setState({userSelectionRect:{width:0,height:0,startX:B,startY:te,x:B,y:te}}),s==null||s(Z)},P=Z=>{const{userSelectionRect:R,nodeInternals:Q,edges:B,transform:te,onNodesChange:J,onEdgesChange:q,nodeOrigin:Y,getNodes:L}=v.getState();if(!e||!S.current||!R)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Ps(Z,S.current),de=R.startX??0,G=R.startY??0,I={...R,x:K.x<de?K.x:de,y:K.y<G?K.y:G,width:Math.abs(K.x-de),height:Math.abs(K.y-G)},X=L(),U=WC(Q,I,te,t===El.Partial,!0,Y),oe=HC(U,B).map(me=>me.id),fe=U.map(me=>me.id);if(N.current!==fe.length){N.current=fe.length;const me=Fo(X,fe);me.length&&(J==null||J(me))}if(x.current!==oe.length){x.current=oe.length;const me=Fo(B,oe);me.length&&(q==null||q(me))}v.setState({userSelectionRect:I})},M=Z=>{if(Z.button!==0)return;const{userSelectionRect:R}=v.getState();!_&&R&&Z.target===w.current&&(A==null||A(Z)),v.setState({nodesSelectionActive:N.current>0}),C(),a==null||a(Z)},F=Z=>{_&&(v.setState({nodesSelectionActive:N.current>0}),a==null||a(Z)),C()},H=j&&(e||_);return he.createElement("div",{className:Gt(["react-flow__pane",{dragging:E,selection:e}]),onClick:H?void 0:gf(A,w),onContextMenu:gf(O,w),onWheel:gf($,w),onMouseEnter:H?void 0:f,onMouseDown:H?z:void 0,onMouseMove:H?P:p,onMouseUp:H?M:void 0,onMouseLeave:H?F:h,ref:w,style:Uv},g,he.createElement(dP,null))});lT.displayName="Pane";function cT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:cT(s,t):!1}function nk(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function mP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!cT(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,l;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=a.positionAbsolute)==null?void 0:l.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 gP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function uT(e,t,n,s,a=[0,0],i){const l=gP(e,e.extent||s);let d=l;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=n.get(f),{x:w,y:v}=ja(g,a).positionAbsolute;d=g&&Hn(w)&&Hn(v)&&Hn(g.width)&&Hn(g.height)?[[w+e.width*a[0],v+e.height*a[1]],[w+g.width-e.width+e.width*a[0],v+g.height-e.height+e.height*a[1]]]:d}else i==null||i("005",Zr.error005()),d=l;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:w,y:v}=ja(g,a).positionAbsolute;d=[[e.extent[0][0]+w,e.extent[0][1]+v],[e.extent[1][0]+w,e.extent[1][1]+v]]}let p={x:0,y:0};if(f){const g=n.get(f);p=ja(g,a).positionAbsolute}const h=d&&d!=="parent"?Pv(t,d):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function yf({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?s.find(a=>a.id===e):s[0],s]}const rk=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),l=t.getBoundingClientRect(),d={x:l.width*s[0],y:l.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-l.left-d.x)/n,y:(p.top-l.top-d.y)/n,...Ov(f)}})};function ll(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function ov({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:d,onError:f}=t.getState(),p=d.get(e);if(!p){f==null||f("012",Zr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function yP(){const e=At();return k.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,d=n.touches?n.touches[0].clientY:n.clientY,f={x:(l-s[0])/s[2],y:(d-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function wf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function dT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:l}){const d=At(),[f,p]=k.useState(!1),h=k.useRef([]),g=k.useRef({x:null,y:null}),w=k.useRef(0),v=k.useRef(null),N=k.useRef({x:0,y:0}),x=k.useRef(null),S=k.useRef(!1),_=k.useRef(!1),j=k.useRef(!1),E=yP();return k.useEffect(()=>{if(e!=null&&e.current){const C=Wn(e.current),A=({x:z,y:P})=>{const{nodeInternals:M,onNodeDrag:F,onSelectionDrag:H,updateNodePositions:Z,nodeExtent:R,snapGrid:Q,snapToGrid:B,nodeOrigin:te,onError:J}=d.getState();g.current={x:z,y:P};let q=!1,Y={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&R){const K=sd(h.current,te);Y=jl(K)}if(h.current=h.current.map(K=>{const de={x:z-K.distance.x,y:P-K.distance.y};B&&(de.x=Q[0]*Math.round(de.x/Q[0]),de.y=Q[1]*Math.round(de.y/Q[1]));const G=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];h.current.length>1&&R&&!K.extent&&(G[0][0]=K.positionAbsolute.x-Y.x+R[0][0],G[1][0]=K.positionAbsolute.x+(K.width??0)-Y.x2+R[1][0],G[0][1]=K.positionAbsolute.y-Y.y+R[0][1],G[1][1]=K.positionAbsolute.y+(K.height??0)-Y.y2+R[1][1]);const I=uT(K,de,M,G,te,J);return q=q||K.position.x!==I.position.x||K.position.y!==I.position.y,K.position=I.position,K.positionAbsolute=I.positionAbsolute,K}),!q)return;Z(h.current,!0,!0),p(!0);const L=a?F:wf(H);if(L&&x.current){const[K,de]=yf({nodeId:a,dragItems:h.current,nodeInternals:M});L(x.current,K,de)}},O=()=>{if(!v.current)return;const[z,P]=IC(N.current,v.current);if(z!==0||P!==0){const{transform:M,panBy:F}=d.getState();g.current.x=(g.current.x??0)-z/M[2],g.current.y=(g.current.y??0)-P/M[2],F({x:z,y:P})&&A(g.current)}w.current=requestAnimationFrame(O)},$=z=>{var te;const{nodeInternals:P,multiSelectionActive:M,nodesDraggable:F,unselectNodesAndEdges:H,onNodeDragStart:Z,onSelectionDragStart:R}=d.getState();_.current=!0;const Q=a?Z:wf(R);(!l||!i)&&!M&&a&&((te=P.get(a))!=null&&te.selected||H()),a&&i&&l&&ov({id:a,store:d,nodeRef:e});const B=E(z);if(g.current=B,h.current=mP(P,F,B,a),Q&&h.current){const[J,q]=yf({nodeId:a,dragItems:h.current,nodeInternals:P});Q(z.sourceEvent,J,q)}};if(t)C.on(".drag",null);else{const z=EI().on("start",P=>{const{domNode:M,nodeDragThreshold:F}=d.getState();F===0&&$(P),j.current=!1;const H=E(P);g.current=H,v.current=(M==null?void 0:M.getBoundingClientRect())||null,N.current=Ps(P.sourceEvent,v.current)}).on("drag",P=>{var Z,R;const M=E(P),{autoPanOnNodeDrag:F,nodeDragThreshold:H}=d.getState();if(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&_.current&&F&&(S.current=!0,O()),!_.current){const Q=M.xSnapped-(((Z=g==null?void 0:g.current)==null?void 0:Z.x)??0),B=M.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+B*B)>H&&$(P)}(g.current.x!==M.xSnapped||g.current.y!==M.ySnapped)&&h.current&&_.current&&(x.current=P.sourceEvent,N.current=Ps(P.sourceEvent,v.current),A(M))}}).on("end",P=>{if(!(!_.current||j.current)&&(p(!1),S.current=!1,_.current=!1,cancelAnimationFrame(w.current),h.current)){const{updateNodePositions:M,nodeInternals:F,onNodeDragStop:H,onSelectionDragStop:Z}=d.getState(),R=a?H:wf(Z);if(M(h.current,!1,!1),R){const[Q,B]=yf({nodeId:a,dragItems:h.current,nodeInternals:F});R(P.sourceEvent,Q,B)}}}).filter(P=>{const M=P.target;return!P.button&&(!n||!nk(M,`.${n}`,e))&&(!s||nk(M,s,e))});return C.call(z),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,d,a,l,E]),f}function hT(){const e=At();return k.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:l,snapToGrid:d,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=l().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),w=d?f[0]:5,v=d?f[1]:5,N=n.isShiftPressed?4:1,x=n.x*w*N,S=n.y*v*N,_=g.map(j=>{if(j.positionAbsolute){const E={x:j.positionAbsolute.x+x,y:j.positionAbsolute.y+S};d&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:A}=uT(j,E,s,a,void 0,p);j.position=A,j.positionAbsolute=C}return j});i(_,!0,!1)},[])}const Ho={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var cl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:l,xPosOrigin:d,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:w,onMouseLeave:v,onContextMenu:N,onDoubleClick:x,style:S,className:_,isDraggable:j,isSelectable:E,isConnectable:C,isFocusable:A,selectNodesOnDrag:O,sourcePosition:$,targetPosition:z,hidden:P,resizeObserver:M,dragHandle:F,zIndex:H,isParent:Z,noDragClassName:R,noPanClassName:Q,initialized:B,disableKeyboardA11y:te,ariaLabel:J,rfId:q,hasHandleBounds:Y})=>{const L=At(),K=k.useRef(null),de=k.useRef(null),G=k.useRef($),I=k.useRef(z),X=k.useRef(s),U=E||j||h||g||w||v,oe=hT(),fe=ll(n,L.getState,g),me=ll(n,L.getState,w),ke=ll(n,L.getState,v),Ye=ll(n,L.getState,N),Le=ll(n,L.getState,x),qe=be=>{const{nodeDragThreshold:se}=L.getState();if(E&&(!O||!j||se>0)&&ov({id:n,store:L,nodeRef:K}),h){const Ze=L.getState().nodeInternals.get(n);Ze&&h(be,{...Ze})}},je=be=>{if(!tv(be)&&!te)if(LC.includes(be.key)&&E){const se=be.key==="Escape";ov({id:n,store:L,unselect:se,nodeRef:K})}else j&&p&&Object.prototype.hasOwnProperty.call(Ho,be.key)&&(L.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),oe({x:Ho[be.key].x,y:Ho[be.key].y,isShiftPressed:be.shiftKey}))};k.useEffect(()=>()=>{de.current&&(M==null||M.unobserve(de.current),de.current=null)},[]),k.useEffect(()=>{if(K.current&&!P){const be=K.current;(!B||!Y||de.current!==be)&&(de.current&&(M==null||M.unobserve(de.current)),M==null||M.observe(be),de.current=be)}},[P,B,Y]),k.useEffect(()=>{const be=X.current!==s,se=G.current!==$,Ze=I.current!==z;K.current&&(be||se||Ze)&&(be&&(X.current=s),se&&(G.current=$),Ze&&(I.current=z),L.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,s,$,z]);const Ge=dT({nodeRef:K,disabled:P||!j,noDragClassName:R,handleSelector:F,nodeId:n,isSelectable:E,selectNodesOnDrag:O});return P?null:he.createElement("div",{className:Gt(["react-flow__node",`react-flow__node-${s}`,{[Q]:j},_,{selected:p,selectable:E,parent:Z,dragging:Ge}]),ref:K,style:{zIndex:H,transform:`translate(${d}px,${f}px)`,pointerEvents:U?"all":"none",visibility:B?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:fe,onMouseMove:me,onMouseLeave:ke,onContextMenu:Ye,onClick:qe,onDoubleClick:Le,onKeyDown:A?je:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":te?void 0:`${rT}-${q}`,"aria-label":J},he.createElement(RO,{value:n},he.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:l,selected:p,isConnectable:C,sourcePosition:$,targetPosition:z,dragging:Ge,dragHandle:F,zIndex:H})))};return t.displayName="NodeWrapper",k.memo(t)};const wP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...sd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function vP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:a,height:i,x:l,y:d,transformString:f,userSelectionActive:p}=lt(wP,Pt),h=hT(),g=k.useRef(null);if(k.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),dT({nodeRef:g}),p||!a||!i)return null;const w=e?N=>{const x=s.getState().getNodes().filter(S=>S.selected);e(N,x)}:void 0,v=N=>{Object.prototype.hasOwnProperty.call(Ho,N.key)&&h({x:Ho[N.key].x,y:Ho[N.key].y,isShiftPressed:N.shiftKey})};return he.createElement("div",{className:Gt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},he.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:w,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:i,top:d,left:l}}))}var xP=k.memo(vP);const bP=e=>e.nodesSelectionActive,fT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:d,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:w,selectionMode:v,onSelectionStart:N,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:j,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:O,panOnScrollSpeed:$,panOnScrollMode:z,zoomOnDoubleClick:P,panOnDrag:M,defaultViewport:F,translateExtent:H,minZoom:Z,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:B,noWheelClassName:te,noPanClassName:J,disableKeyboardA11y:q})=>{const Y=lt(bP),L=Cl(g),K=Cl(_),de=K||M,G=K||O,I=L||w&&de!==!0;return aP({deleteKeyCode:d,multiSelectionKeyCode:S}),he.createElement(cP,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:G,panOnScrollSpeed:$,panOnScrollMode:z,zoomOnDoubleClick:P,panOnDrag:!L&&de,defaultViewport:F,translateExtent:H,minZoom:Z,maxZoom:R,zoomActivationKeyCode:j,preventScrolling:Q,noWheelClassName:te,noPanClassName:J},he.createElement(lT,{onSelectionStart:N,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:de,isSelecting:!!I,selectionMode:v},e,Y&&he.createElement(xP,{onSelectionContextMenu:B,noPanClassName:J,disableKeyboardA11y:q})))};fT.displayName="FlowRenderer";var kP=k.memo(fT);function _P(e){return lt(k.useCallback(n=>e?WC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function SP(e){const t={input:cl(e.input||JC),default:cl(e.default||av),output:cl(e.output||tT),group:cl(e.group||Bv)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=cl(e[i]||av),a),n);return{...t,...s}}const NP=({x:e,y:t,width:n,height:s,origin:a})=>!n||!s?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-s*a[1]},jP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),pT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:l}=lt(jP,Pt),d=_P(e.onlyRenderVisibleElements),f=k.useRef(),p=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const w=g.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));i(w)});return f.current=h,h},[]);return k.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:Uv},d.map(h=>{var A,O,$;let g=h.type||"default";e.nodeTypes[g]||(l==null||l("003",Zr.error003(g)),g="default");const w=e.nodeTypes[g]||e.nodeTypes.default,v=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),x=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||s&&typeof h.focusable>"u"),_=e.nodeExtent?Pv(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,j=(_==null?void 0:_.x)??0,E=(_==null?void 0:_.y)??0,C=NP({x:j,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return he.createElement(w,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||Oe.Bottom,targetPosition:h.targetPosition||Oe.Top,hidden:h.hidden,xPos:j,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:v,isSelectable:N,isConnectable:x,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((A=h[jt])==null?void 0:A.z)??0,isParent:!!((O=h[jt])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!(($=h[jt])!=null&&$.handleBounds)})}))};pT.displayName="NodeRenderer";var EP=k.memo(pT);const CP=(e,t,n)=>n===Oe.Left?e-t:n===Oe.Right?e+t:e,TP=(e,t,n)=>n===Oe.Top?e-t:n===Oe.Bottom?e+t:e,sk="react-flow__edgeupdater",ak=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:d})=>he.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:Gt([sk,`${sk}-${d}`]),cx:CP(t,s,e),cy:TP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),RP=()=>!0;var Oo=e=>{const t=({id:n,className:s,type:a,data:i,onClick:l,onEdgeDoubleClick:d,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:w,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:x,style:S,source:_,target:j,sourceX:E,sourceY:C,targetX:A,targetY:O,sourcePosition:$,targetPosition:z,elementsSelectable:P,hidden:M,sourceHandleId:F,targetHandleId:H,onContextMenu:Z,onMouseEnter:R,onMouseMove:Q,onMouseLeave:B,reconnectRadius:te,onReconnect:J,onReconnectStart:q,onReconnectEnd:Y,markerEnd:L,markerStart:K,rfId:de,ariaLabel:G,isFocusable:I,isReconnectable:X,pathOptions:U,interactionWidth:oe,disableKeyboardA11y:fe})=>{const me=k.useRef(null),[ke,Ye]=k.useState(!1),[Le,qe]=k.useState(!1),je=At(),Ge=k.useMemo(()=>`url('#${rv(K,de)}')`,[K,de]),be=k.useMemo(()=>`url('#${rv(L,de)}')`,[L,de]);if(M)return null;const se=Se=>{var Ne;const{edges:De,addSelectedEdges:_e,unselectNodesAndEdges:Be,multiSelectionActive:kt}=je.getState(),yt=De.find(rt=>rt.id===n);yt&&(P&&(je.setState({nodesSelectionActive:!1}),yt.selected&&kt?(Be({nodes:[],edges:[yt]}),(Ne=me.current)==null||Ne.blur()):_e([n])),l&&l(Se,yt))},Ze=il(n,je.getState,d),ht=il(n,je.getState,Z),ct=il(n,je.getState,R),at=il(n,je.getState,Q),Ke=il(n,je.getState,B),pe=(Se,De)=>{if(Se.button!==0)return;const{edges:_e,isValidConnection:Be}=je.getState(),kt=De?j:_,yt=(De?H:F)||null,Ne=De?"target":"source",rt=Be||RP,wt=De,vt=_e.find(Mn=>Mn.id===n);qe(!0),q==null||q(Se,vt,Ne);const Jt=Mn=>{qe(!1),Y==null||Y(Mn,vt,Ne)};KC({event:Se,handleId:yt,nodeId:kt,onConnect:Mn=>J==null?void 0:J(vt,Mn),isTarget:wt,getState:je.getState,setState:je.setState,isValidConnection:rt,edgeUpdaterType:Ne,onReconnectEnd:Jt})},ve=Se=>pe(Se,!0),Pe=Se=>pe(Se,!1),Ue=()=>Ye(!0),ot=()=>Ye(!1),$e=!P&&!l,re=Se=>{var De;if(!fe&&LC.includes(Se.key)&&P){const{unselectNodesAndEdges:_e,addSelectedEdges:Be,edges:kt}=je.getState();Se.key==="Escape"?((De=me.current)==null||De.blur(),_e({edges:[kt.find(Ne=>Ne.id===n)]})):Be([n])}};return he.createElement("g",{className:Gt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:$e,updating:ke}]),onClick:se,onDoubleClick:Ze,onContextMenu:ht,onMouseEnter:ct,onMouseMove:at,onMouseLeave:Ke,onKeyDown:I?re:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${_} to ${j}`,"aria-describedby":I?`${sT}-${de}`:void 0,ref:me},!Le&&he.createElement(e,{id:n,source:_,target:j,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:w,labelBgStyle:v,labelBgPadding:N,labelBgBorderRadius:x,data:i,style:S,sourceX:E,sourceY:C,targetX:A,targetY:O,sourcePosition:$,targetPosition:z,sourceHandleId:F,targetHandleId:H,markerStart:Ge,markerEnd:be,pathOptions:U,interactionWidth:oe}),X&&he.createElement(he.Fragment,null,(X==="source"||X===!0)&&he.createElement(ak,{position:$,centerX:E,centerY:C,radius:te,onMouseDown:ve,onMouseEnter:Ue,onMouseOut:ot,type:"source"}),(X==="target"||X===!0)&&he.createElement(ak,{position:z,centerX:A,centerY:O,radius:te,onMouseDown:Pe,onMouseEnter:Ue,onMouseOut:ot,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function AP(e){const t={default:Oo(e.default||zu),straight:Oo(e.bezier||Dv),step:Oo(e.step||qv),smoothstep:Oo(e.step||rd),simplebezier:Oo(e.simplebezier||Lv)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=Oo(e[i]||zu),a),n);return{...t,...s}}function ok(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Oe.Top:return{x:s+i/2,y:a};case Oe.Right:return{x:s+i,y:a+l/2};case Oe.Bottom:return{x:s+i/2,y:a+l};case Oe.Left:return{x:s,y:a+l/2}}}function ik(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const MP=(e,t,n,s,a,i)=>{const l=ok(n,e,t),d=ok(i,s,a);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y}};function IP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:l,height:d,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=jl({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:l/f[2],height:d/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),w=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*w)>0}function lk(e){var s,a,i,l,d;const t=((s=e==null?void 0:e[jt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((d=e==null?void 0:e.positionAbsolute)==null?void 0:d.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const $P=[{level:0,isMaxLevel:!0,edges:[]}];function OP(e,t,n=!1){let s=-1;const a=e.reduce((l,d)=>{var h,g;const f=Hn(d.zIndex);let p=f?d.zIndex:0;if(n){const w=t.get(d.target),v=t.get(d.source),N=d.selected||(w==null?void 0:w.selected)||(v==null?void 0:v.selected),x=Math.max(((h=v==null?void 0:v[jt])==null?void 0:h.z)||0,((g=w==null?void 0:w[jt])==null?void 0:g.z)||0,1e3);p=(f?d.zIndex:0)+(N?x:0)}return l[p]?l[p].push(d):l[p]=[d],s=p>s?p:s,l},{}),i=Object.entries(a).map(([l,d])=>{const f=+l;return{edges:d,level:f,isMaxLevel:f===s}});return i.length===0?$P:i}function PP(e,t,n){const s=lt(k.useCallback(a=>e?a.edges.filter(i=>{const l=t.get(i.source),d=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&IP({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return OP(s,t,n)}const LP=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),qP=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ck={[Fu.Arrow]:LP,[Fu.ArrowClosed]:qP};function DP(e){const t=At();return k.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(ck,e)?ck[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",Zr.error009(e)),null)},[e])}const FP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:d="auto-start-reverse"})=>{const f=DP(t);return f?he.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:d,refX:"0",refY:"0"},he.createElement(f,{color:n,strokeWidth:l})):null},zP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const d=rv(l,t);s.includes(d)||(a.push({id:d,color:l.color||e,...l}),s.push(d))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},mT=({defaultColor:e,rfId:t})=>{const n=lt(k.useCallback(zP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,l)=>i.id!==a[l].id)));return he.createElement("defs",null,n.map(s=>he.createElement(FP,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};mT.displayName="MarkerDefinitions";var BP=k.memo(mT);const UP=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}),gT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:d,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:w,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:x,children:S,disableKeyboardA11y:_})=>{const{edgesFocusable:j,edgesUpdatable:E,elementsSelectable:C,width:A,height:O,connectionMode:$,nodeInternals:z,onError:P}=lt(UP,Pt),M=PP(t,z,n);return A?he.createElement(he.Fragment,null,M.map(({level:F,edges:H,isMaxLevel:Z})=>he.createElement("svg",{key:F,style:{zIndex:F},width:A,height:O,className:"react-flow__edges react-flow__container"},Z&&he.createElement(BP,{defaultColor:e,rfId:s}),he.createElement("g",null,H.map(R=>{const[Q,B,te]=lk(z.get(R.source)),[J,q,Y]=lk(z.get(R.target));if(!te||!Y)return null;let L=R.type||"default";a[L]||(P==null||P("011",Zr.error011(L)),L="default");const K=a[L]||a.default,de=$===Ta.Strict?q.target:(q.target??[]).concat(q.source??[]),G=ik(B.source,R.sourceHandle),I=ik(de,R.targetHandle),X=(G==null?void 0:G.position)||Oe.Bottom,U=(I==null?void 0:I.position)||Oe.Top,oe=!!(R.focusable||j&&typeof R.focusable>"u"),fe=R.reconnectable||R.updatable,me=typeof w<"u"&&(fe||E&&typeof fe>"u");if(!G||!I)return P==null||P("008",Zr.error008(G,R)),null;const{sourceX:ke,sourceY:Ye,targetX:Le,targetY:qe}=MP(Q,G,X,J,I,U);return he.createElement(K,{key:R.id,id:R.id,className:Gt([R.className,i]),type:L,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:ke,sourceY:Ye,targetX:Le,targetY:qe,sourcePosition:X,targetPosition:U,elementsSelectable:C,onContextMenu:l,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:w,onReconnectStart:v,onReconnectEnd:N,reconnectRadius:x,rfId:s,ariaLabel:R.ariaLabel,isFocusable:oe,isReconnectable:me,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),S):null};gT.displayName="EdgeRenderer";var WP=k.memo(gT);const HP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function GP({children:e}){const t=lt(HP);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function VP(e){const t=ql(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const YP={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},yT=({nodeId:e,handleType:t,style:n,type:s=Os.Bezier,CustomComponent:a,connectionStatus:i})=>{var O,$,z;const{fromNode:l,handleId:d,toX:f,toY:p,connectionMode:h}=lt(k.useCallback(P=>({fromNode:P.nodeInternals.get(e),handleId:P.connectionHandleId,toX:(P.connectionPosition.x-P.transform[0])/P.transform[2],toY:(P.connectionPosition.y-P.transform[1])/P.transform[2],connectionMode:P.connectionMode}),[e]),Pt),g=(O=l==null?void 0:l[jt])==null?void 0:O.handleBounds;let w=g==null?void 0:g[t];if(h===Ta.Loose&&(w=w||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!w)return null;const v=d?w.find(P=>P.id===d):w[0],N=v?v.x+v.width/2:(l.width??0)/2,x=v?v.y+v.height/2:l.height??0,S=((($=l.positionAbsolute)==null?void 0:$.x)??0)+N,_=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+x,j=v==null?void 0:v.position,E=j?YP[j]:null;if(!j||!E)return null;if(a)return he.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:v,fromX:S,fromY:_,toX:f,toY:p,fromPosition:j,toPosition:E,connectionStatus:i});let C="";const A={sourceX:S,sourceY:_,sourcePosition:j,targetX:f,targetY:p,targetPosition:E};return s===Os.Bezier?[C]=BC(A):s===Os.Step?[C]=nv({...A,borderRadius:0}):s===Os.SmoothStep?[C]=nv(A):s===Os.SimpleBezier?[C]=zC(A):C=`M${S},${_} ${f},${p}`,he.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};yT.displayName="ConnectionLine";const KP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function XP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:l,width:d,height:f,connectionStatus:p}=lt(KP,Pt);return!(a&&i&&d&&l)?null:he.createElement("svg",{style:e,width:d,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:Gt(["react-flow__connection",p])},he.createElement(yT,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function uk(e,t){return k.useRef(null),At(),k.useMemo(()=>t(e),[e])}const wT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:l,onEdgeClick:d,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:w,onNodeContextMenu:v,onSelectionContextMenu:N,onSelectionStart:x,onSelectionEnd:S,connectionLineType:_,connectionLineStyle:j,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:A,selectionOnDrag:O,selectionMode:$,multiSelectionKeyCode:z,panActivationKeyCode:P,zoomActivationKeyCode:M,deleteKeyCode:F,onlyRenderVisibleElements:H,elementsSelectable:Z,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:B,minZoom:te,maxZoom:J,preventScrolling:q,defaultMarkerColor:Y,zoomOnScroll:L,zoomOnPinch:K,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:I,zoomOnDoubleClick:X,panOnDrag:U,onPaneClick:oe,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneScroll:Ye,onPaneContextMenu:Le,onEdgeContextMenu:qe,onEdgeMouseEnter:je,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:se,onReconnectStart:Ze,onReconnectEnd:ht,reconnectRadius:ct,noDragClassName:at,noWheelClassName:Ke,noPanClassName:pe,elevateEdgesOnSelect:ve,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})=>{const re=uk(e,SP),Se=uk(t,AP);return VP(i),he.createElement(kP,{onPaneClick:oe,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneContextMenu:Le,onPaneScroll:Ye,deleteKeyCode:F,selectionKeyCode:A,selectionOnDrag:O,selectionMode:$,onSelectionStart:x,onSelectionEnd:S,multiSelectionKeyCode:z,panActivationKeyCode:P,zoomActivationKeyCode:M,elementsSelectable:Z,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:L,zoomOnPinch:K,zoomOnDoubleClick:X,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:I,panOnDrag:U,defaultViewport:Q,translateExtent:B,minZoom:te,maxZoom:J,onSelectionContextMenu:N,preventScrolling:q,noDragClassName:at,noWheelClassName:Ke,noPanClassName:pe,disableKeyboardA11y:Pe},he.createElement(GP,null,he.createElement(WP,{edgeTypes:Se,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:qe,onEdgeMouseEnter:je,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:se,onReconnectStart:Ze,onReconnectEnd:ht,reconnectRadius:ct,defaultMarkerColor:Y,noPanClassName:pe,elevateEdgesOnSelect:!!ve,disableKeyboardA11y:Pe,rfId:$e},he.createElement(XP,{style:j,type:_,component:E,containerStyle:C})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(EP,{nodeTypes:re,onNodeClick:l,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:w,onNodeContextMenu:v,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:pe,noDragClassName:at,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:ot,rfId:$e})))};wT.displayName="GraphView";var QP=k.memo(wT);const iv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],As={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:iv,nodeExtent:iv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ta.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:SO,isValidConnection:void 0},ZP=()=>DM((e,t)=>({...As,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:mf(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",l=a?mf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:d,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:w}=new window.DOMMatrixReadOnly(g.transform),v=n.reduce((x,S)=>{const _=a.get(S.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:void 0}});else if(_){const j=Ov(S.nodeElement);!!(j.width&&j.height&&(_.width!==j.width||_.height!==j.height||S.forceUpdate))&&(a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:{source:rk(".source",S.nodeElement,w,p),target:rk(".target",S.nodeElement,w,p)}},...j}),x.push({id:_.id,type:"dimensions",dimensions:j}))}return x},[]);oT(a,p);const N=l||i&&!l&&iT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(v==null?void 0:v.length)>0&&(s==null||s(v))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(d=>{const f={id:d.id,type:"position",dragging:a};return s&&(f.positionAbsolute=d.positionAbsolute,f.position=d.position),f});i(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:l,getNodes:d,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=fP(n,d()),h=mf(p,a,l,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>$s(f,!0)):(l=Fo(i(),n),d=Fo(a,[])),du({changedNodes:l,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>$s(f,!0)):(l=Fo(a,n),d=Fo(i(),[])),du({changedNodes:d,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),l=n||i(),d=s||a,f=l.map(h=>(h.selected=!1,$s(h.id,!1))),p=d.map(h=>$s(h.id,!1));du({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),i=s().filter(d=>d.selected).map(d=>$s(d.id,!1)),l=n.filter(d=>d.selected).map(d=>$s(d.id,!1));du({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Pv(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:l,d3Selection:d,translateExtent:f}=t();if(!l||!d||!n.x&&!n.y)return!1;const p=Xr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],g=l==null?void 0:l.constrain()(p,h,f);return l.transform(d,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:As.connectionNodeId,connectionHandleId:As.connectionHandleId,connectionHandleType:As.connectionHandleType,connectionStatus:As.connectionStatus,connectionStartHandle:As.connectionStartHandle,connectionEndHandle:As.connectionEndHandle}),reset:()=>e({...As})}),Object.is),Wv=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=ZP()),he.createElement(yO,{value:t.current},e)};Wv.displayName="ReactFlowProvider";const vT=({children:e})=>k.useContext(nd)?he.createElement(he.Fragment,null,e):he.createElement(Wv,null,e);vT.displayName="ReactFlowWrapper";const JP={input:JC,default:av,output:tT,group:Bv},eL={default:zu,straight:Dv,step:qv,smoothstep:rd,simplebezier:Lv},tL=[0,0],nL=[15,15],rL={x:0,y:0,zoom:1},sL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},xT=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=JP,edgeTypes:l=eL,onNodeClick:d,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:w,onConnect:v,onConnectStart:N,onConnectEnd:x,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:O,onNodeDragStart:$,onNodeDrag:z,onNodeDragStop:P,onNodesDelete:M,onEdgesDelete:F,onSelectionChange:H,onSelectionDragStart:Z,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:B,onSelectionStart:te,onSelectionEnd:J,connectionMode:q=Ta.Strict,connectionLineType:Y=Os.Bezier,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:de,deleteKeyCode:G="Backspace",selectionKeyCode:I="Shift",selectionOnDrag:X=!1,selectionMode:U=El.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:fe=Du()?"Meta":"Control",zoomActivationKeyCode:me=Du()?"Meta":"Control",snapToGrid:ke=!1,snapGrid:Ye=nL,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:qe=!0,nodesDraggable:je,nodesConnectable:Ge,nodesFocusable:be,nodeOrigin:se=tL,edgesFocusable:Ze,edgesUpdatable:ht,elementsSelectable:ct,defaultViewport:at=rL,minZoom:Ke=.5,maxZoom:pe=2,translateExtent:ve=iv,preventScrolling:Pe=!0,nodeExtent:Ue,defaultMarkerColor:ot="#b1b1b7",zoomOnScroll:$e=!0,zoomOnPinch:re=!0,panOnScroll:Se=!1,panOnScrollSpeed:De=.5,panOnScrollMode:_e=Sa.Free,zoomOnDoubleClick:Be=!0,panOnDrag:kt=!0,onPaneClick:yt,onPaneMouseEnter:Ne,onPaneMouseMove:rt,onPaneMouseLeave:wt,onPaneScroll:vt,onPaneContextMenu:Jt,children:en,onEdgeContextMenu:Mn,onEdgeDoubleClick:Oa,onEdgeMouseEnter:Pa,onEdgeMouseMove:La,onEdgeMouseLeave:vn,onEdgeUpdate:Fs,onEdgeUpdateStart:qa,onEdgeUpdateEnd:It,onReconnect:pr,onReconnectStart:Yn,onReconnectEnd:ci,reconnectRadius:Er=10,edgeUpdaterRadius:Cr=10,onNodesChange:Tr,onEdgesChange:ts,noDragClassName:zs="nodrag",noWheelClassName:Da="nowheel",noPanClassName:Bs="nopan",fitView:In=!1,fitViewOptions:Fa,connectOnClick:Us=!0,attributionPosition:ui,proOptions:Rr,defaultEdgeOptions:Ws,elevateNodesOnSelect:za=!0,elevateEdgesOnSelect:Ar=!1,disableKeyboardA11y:Hs=!1,autoPanOnConnect:ns=!0,autoPanOnNodeDrag:ut=!0,connectionRadius:Ba=20,isValidConnection:$n,onError:Ua,style:Mr,id:Gs,nodeDragThreshold:Wa,...Ir},Lt)=>{const Vs=Gs||"1";return he.createElement("div",{...Ir,style:{...Mr,...sL},ref:Lt,className:Gt(["react-flow",a]),"data-testid":"rf__wrapper",id:Gs},he.createElement(vT,null,he.createElement(QP,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:w,onNodeClick:d,onEdgeClick:f,onNodeMouseEnter:j,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:O,nodeTypes:i,edgeTypes:l,connectionLineType:Y,connectionLineStyle:L,connectionLineComponent:K,connectionLineContainerStyle:de,selectionKeyCode:I,selectionOnDrag:X,selectionMode:U,deleteKeyCode:G,multiSelectionKeyCode:fe,panActivationKeyCode:oe,zoomActivationKeyCode:me,onlyRenderVisibleElements:Le,selectNodesOnDrag:qe,defaultViewport:at,translateExtent:ve,minZoom:Ke,maxZoom:pe,preventScrolling:Pe,zoomOnScroll:$e,zoomOnPinch:re,zoomOnDoubleClick:Be,panOnScroll:Se,panOnScrollSpeed:De,panOnScrollMode:_e,panOnDrag:kt,onPaneClick:yt,onPaneMouseEnter:Ne,onPaneMouseMove:rt,onPaneMouseLeave:wt,onPaneScroll:vt,onPaneContextMenu:Jt,onSelectionContextMenu:B,onSelectionStart:te,onSelectionEnd:J,onEdgeContextMenu:Mn,onEdgeDoubleClick:Oa,onEdgeMouseEnter:Pa,onEdgeMouseMove:La,onEdgeMouseLeave:vn,onReconnect:pr??Fs,onReconnectStart:Yn??qa,onReconnectEnd:ci??It,reconnectRadius:Er??Cr,defaultMarkerColor:ot,noDragClassName:zs,noWheelClassName:Da,noPanClassName:Bs,elevateEdgesOnSelect:Ar,rfId:Vs,disableKeyboardA11y:Hs,nodeOrigin:se,nodeExtent:Ue}),he.createElement(VO,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:v,onConnectStart:N,onConnectEnd:x,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:je,nodesConnectable:Ge,nodesFocusable:be,edgesFocusable:Ze,edgesUpdatable:ht,elementsSelectable:ct,elevateNodesOnSelect:za,minZoom:Ke,maxZoom:pe,nodeExtent:Ue,onNodesChange:Tr,onEdgesChange:ts,snapToGrid:ke,snapGrid:Ye,connectionMode:q,translateExtent:ve,connectOnClick:Us,defaultEdgeOptions:Ws,fitView:In,fitViewOptions:Fa,onNodesDelete:M,onEdgesDelete:F,onNodeDragStart:$,onNodeDrag:z,onNodeDragStop:P,onSelectionDrag:R,onSelectionDragStart:Z,onSelectionDragStop:Q,noPanClassName:Bs,nodeOrigin:se,rfId:Vs,autoPanOnConnect:ns,autoPanOnNodeDrag:ut,onError:Ua,connectionRadius:Ba,isValidConnection:$n,nodeDragThreshold:Wa}),he.createElement(HO,{onSelectionChange:H}),en,he.createElement(vO,{proOptions:Rr,position:ui}),he.createElement(ZO,{rfId:Vs,disableKeyboardA11y:Hs})))});xT.displayName="ReactFlow";const aL=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function bT(){return lt(aL,Pt)}const kT=({id:e,x:t,y:n,width:s,height:a,style:i,color:l,strokeColor:d,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:w,selected:v})=>{const{background:N,backgroundColor:x}=i||{},S=l||N||x;return he.createElement("rect",{className:Gt(["react-flow__minimap-node",{selected:v},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:S,stroke:d,strokeWidth:f,shapeRendering:g,onClick:w?_=>w(_,e):void 0})};kT.displayName="MiniMapNode";var oL=k.memo(kT);const iL=e=>e.nodeOrigin,lL=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),vf=e=>e instanceof Function?e:()=>e;function cL({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=oL,onClick:l}){const d=lt(lL,Pt),f=lt(iL),p=vf(t),h=vf(e),g=vf(n),w=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,d.map(v=>{const{x:N,y:x}=ja(v,f).positionAbsolute;return he.createElement(i,{key:v.id,x:N,y:x,width:v.width,height:v.height,style:v.style,selected:v.selected,className:g(v),color:p(v),borderRadius:s,strokeColor:h(v),strokeWidth:a,shapeRendering:w,onClick:l,id:v.id})}))}var uL=k.memo(cL);const dL=200,hL=150,fL=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?kO(sd(t,e.nodeOrigin),n):n,rfId:e.rfId}},pL="react-flow__minimap-desc";function _T({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:d,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:w,onNodeClick:v,pannable:N=!1,zoomable:x=!1,ariaLabel:S="React Flow mini map",inversePan:_=!1,zoomStep:j=10,offsetScale:E=5}){const C=At(),A=k.useRef(null),{boundingRect:O,viewBB:$,rfId:z}=lt(fL,Pt),P=(e==null?void 0:e.width)??dL,M=(e==null?void 0:e.height)??hL,F=O.width/P,H=O.height/M,Z=Math.max(F,H),R=Z*P,Q=Z*M,B=E*Z,te=O.x-(R-O.width)/2-B,J=O.y-(Q-O.height)/2-B,q=R+B*2,Y=Q+B*2,L=`${pL}-${z}`,K=k.useRef(0);K.current=Z,k.useEffect(()=>{if(A.current){const I=Wn(A.current),X=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ye}=C.getState();if(fe.sourceEvent.type!=="wheel"||!ke||!Ye)return;const Le=-fe.sourceEvent.deltaY*(fe.sourceEvent.deltaMode===1?.05:fe.sourceEvent.deltaMode?1:.002)*j,qe=me[2]*Math.pow(2,Le);Ye.scaleTo(ke,qe)},U=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ye,translateExtent:Le,width:qe,height:je}=C.getState();if(fe.sourceEvent.type!=="mousemove"||!ke||!Ye)return;const Ge=K.current*Math.max(1,me[2])*(_?-1:1),be={x:me[0]-fe.sourceEvent.movementX*Ge,y:me[1]-fe.sourceEvent.movementY*Ge},se=[[0,0],[qe,je]],Ze=Xr.translate(be.x,be.y).scale(me[2]),ht=Ye.constrain()(Ze,se,Le);Ye.transform(ke,ht)},oe=AC().on("zoom",N?U:null).on("zoom.wheel",x?X:null);return I.call(oe),()=>{I.on("zoom",null)}}},[N,x,_,j]);const de=w?I=>{const X=ar(I);w(I,{x:X[0],y:X[1]})}:void 0,G=v?(I,X)=>{const U=C.getState().nodeInternals.get(X);v(I,U)}:void 0;return he.createElement($v,{position:g,style:e,className:Gt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},he.createElement("svg",{width:P,height:M,viewBox:`${te} ${J} ${q} ${Y}`,role:"img","aria-labelledby":L,ref:A,onClick:de},S&&he.createElement("title",{id:L},S),he.createElement(uL,{onClick:G,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:d}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${te-B},${J-B}h${q+B*2}v${Y+B*2}h${-q-B*2}z
|
|
57
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}_T.displayName="MiniMap";var mL=k.memo(_T);function gL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function yL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function wL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.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 vL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 xL(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 _r=({children:e,className:t,...n})=>he.createElement("button",{type:"button",className:Gt(["react-flow__controls-button",t]),...n},e);_r.displayName="ControlButton";const bL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ST=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:l,onFitView:d,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const w=At(),[v,N]=k.useState(!1),{isInteractive:x,minZoomReached:S,maxZoomReached:_}=lt(bL,Pt),{zoomIn:j,zoomOut:E,fitView:C}=ql();if(k.useEffect(()=>{N(!0)},[]),!v)return null;const A=()=>{j(),i==null||i()},O=()=>{E(),l==null||l()},$=()=>{C(a),d==null||d()},z=()=>{w.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),f==null||f(!x)};return he.createElement($v,{className:Gt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&he.createElement(he.Fragment,null,he.createElement(_r,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},he.createElement(gL,null)),he.createElement(_r,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(yL,null))),n&&he.createElement(_r,{className:"react-flow__controls-fitview",onClick:$,title:"fit view","aria-label":"fit view"},he.createElement(wL,null)),s&&he.createElement(_r,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},x?he.createElement(xL,null):he.createElement(vL,null)),h)};ST.displayName="Controls";var kL=k.memo(ST),ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ur||(ur={}));function _L({color:e,dimensions:t,lineWidth:n}){return he.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function SL({color:e,radius:t}){return he.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const NL={[ur.Dots]:"#91919a",[ur.Lines]:"#eee",[ur.Cross]:"#e2e2e2"},jL={[ur.Dots]:1,[ur.Lines]:1,[ur.Cross]:6},EL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function NT({id:e,variant:t=ur.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:l,style:d,className:f}){const p=k.useRef(null),{transform:h,patternId:g}=lt(EL,Pt),w=l||NL[t],v=s||jL[t],N=t===ur.Dots,x=t===ur.Cross,S=Array.isArray(n)?n:[n,n],_=[S[0]*h[2]||1,S[1]*h[2]||1],j=v*h[2],E=x?[j,j]:_,C=N?[j/i,j/i]:[E[0]/i,E[1]/i];return he.createElement("svg",{className:Gt(["react-flow__background",f]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},he.createElement("pattern",{id:g+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?he.createElement(SL,{color:w,radius:j/i}):he.createElement(_L,{dimensions:E,color:w,lineWidth:a})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}NT.displayName="Background";var CL=k.memo(NT);const TL=["us-gov","global","apac","us","eu","jp","au"],RL=new RegExp(`^(?:(?:${TL.join("|")})\\.)?anthropic\\.`,"i");function Dl(e){return e.replace(RL,"")}const AL=["command","cmd","file_path","path","url","pattern","notebook_path"],dk=120,xf=e=>e.length>dk?`${e.slice(0,dk-1)}…`:e;function ML(e){if(typeof e=="string")return e.trim()?xf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of AL){const s=t[n];if(typeof s=="string"&&s.trim())return xf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return xf(a)}}return null}function jT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Hv(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(a??0)}}function IL(e){const t=Hv(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 $L(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=IL(s));return Object.keys(t).length?t:void 0}function ET(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),...Hv(n)};for(const s of Object.values(n)){const a=ET(s,t+1);if(a)return a}return null}const OL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function CT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&OL.test(Dl(n.model)))return n.model;for(const s of Object.values(n)){const a=CT(s,t+1);if(a)return a}return null}function lv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ls(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function hk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Fl(e,t){return`${e}::${t}`}function Bu(e){return e.agent_type??e.subagent_type??"subagent"}function vl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function zo(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:jT()},e.agents.set(a,i),i)}function TT(e,t,n,s){const a=Fl(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=Ls(s.cwd));const l=Bu(s);return l&&(i.label==="subagent"||!i.label)&&(i.label=l),i}function PL(e,t,n){const s=t.session_id??"unknown",a=vl(t);if(a){const f=TT(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),l=i&&i.length>0?i[i.length-1]:null;if(l){const f=e.agents.get(Fl(s,l));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Ls(t.cwd)),f}const d=zo(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=Ls(t.cwd)),d.label==="session"&&t.cwd&&(d.label=Ls(t.cwd)??"session"),d}function LL(e,t,n,s,a){const i=Fl(t,n),l=zo(e,t,a,!0);let d=e.agents.get(i);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=Ls(s.cwd));const f=Bu(s);return f&&(d.label==="subagent"||!d.label)&&(d.label=f),d}return d={id:i,sessionId:t,label:Bu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ls(s.cwd),toolCount:0,childCount:0,usage:jT()},e.agents.set(i,d),l.childCount+=1,d}function qL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function DL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let a=s.length-1;a>=0;a--)if(s[a]===n){s.splice(a,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function fu(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 fk=200,FL=25;function zL(e,t){const n=t.tools;if(n.length>fk){const s=n.splice(0,n.length-fk);for(const a of s)e.toolIndex.get(a.id)===a&&(e.toolIndex.delete(a.id),e.toolOwner.delete(a.id))}for(let s=n.length-FL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function BL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const pk=2e3;function UL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-pk)return!1;if(a.text===n&&a.at<=t+pk)return!0}return!1}function RT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function zl(e,t){return t&&(e.revision+=1),t}function WL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,i=[],l=new Map;for(const[p,h]of e.agents){if(h.parentId!=null){const g=l.get(h.parentId);g?g.push(p):l.set(h.parentId,[p])}a(h)&&i.push({id:p,endedAt:h.endedAt})}if(i.length===0)return!1;i.sort((p,h)=>p.endedAt-h.endedAt);let d=0;const f=p=>{const h=e.agents.get(p);h&&(RT(e,h),e.agents.delete(p),d++)};for(const p of i){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const h=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!h.some(g=>!a(g))){for(const g of h)f(g.id);f(p.id)}}return zl(e,d>0)}function HL(e,t,n,s){const a=new Map;for(const[p,h]of e.agents){let g=a.get(h.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},a.set(h.sessionId,g)),g.ids.push(p),h.kind==="root"&&h.closedAt!=null&&(g.closed=!0),h.state==="done"&&h.endedAt!=null?g.endedAt=Math.max(g.endedAt,h.endedAt):g.live=!0}const i=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,h)=>p.closed===h.closed?p.endedAt-h.endedAt:p.closed?-1:1);let d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let f=!1;for(const p of i){if(d<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&RT(e,g),e.agents.delete(h)}d--,f=!0}return zl(e,f)}function GL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a=="string"&&a.length>0&&e.toolIndex.has(a)}function VL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return zl(e,t)}function YL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const d of a.tools){const f=Math.max(d.startedAt,l??d.startedAt);d.endedAt==null&&t-f>n&&(d.endedAt=f,d.ok=!1,d.errorPreview=d.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(d.id),e.toolOwner.delete(d.id),s=!0)}}return zl(e,s)}const mk=90*6e4;function KL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==a.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return zl(e,s)}function XL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const QL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function ZL(e,t){let n=null;for(const s of e.toolIndex.values()){const a=s.agentId?e.agents.get(s.agentId):void 0;!a||a.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const JL=3e4;function e3(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>JL)&&!(e.startedAt>t))return{name:e.name,preview:ML(e.input)??""}}function t3(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=ZL(e,t),l={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const d=e3(i,a);return d&&(l.tool=d),l}function n3(e,t,n){if(e.kind==="idle")return!0;const s=vl(t);return s==null?!0:e.subagentId!=null&&Fl(n,s)===e.subagentId}function gk(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...lv(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!QL.has(i)){const h=e.agents.get(l);h!=null&&h.waiting&&n3(h.waiting,s,l)&&(h.waiting=null)}const d=e.agents.get(l);if(d&&a>(d.lastEventAt??0)&&(d.lastEventAt=a,d.reaped&&(d.reaped=!1,d.state="active",d.endedAt=void 0,d.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const h=e.agents.get(l);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(l);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(l);h&&(h.context={...h.context??hk(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const w=e.agents.get(l);w&&(w.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[w,v]of Object.entries(g)){if(typeof v!="string")continue;const N=`${l}::${w}`,x=e.agents.get(N);x&&(x.model=v)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const g=e.agents.get(l);if(g){const w=g.context??hk(),v=(x,S)=>typeof h[x]=="number"?h[x]:S,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.context={msgsUser:v("msgsUser",w.msgsUser),msgsAssistant:v("msgsAssistant",w.msgsAssistant),toolUses:v("toolUses",w.toolUses),toolResults:v("toolResults",w.toolResults),systemReminders:v("systemReminders",w.systemReminders),currentContextTokens:v("currentContextTokens",w.currentContextTokens),memoryFiles:N??w.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(l);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",w=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),w&&(h.sessionTitle=w);const v=h.sessionName??"";h.sessionTitle&&v&&h.sessionTitle.toLowerCase()===v.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(h.input_tokens??0),g.usage.outputTokens=Number(h.output_tokens??0),g.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const w=Hv(h);g.usage.cacheCreate1hTokens=w.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=w.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=$L(s.usageByModel)}}return e}const f=PL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=CT(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=zo(e,l,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.startedAt=h.startedAt||a,!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=Ls(s.cwd)),h.label==="session"&&s.cwd&&(h.label=Ls(s.cwd)??"session");break}case"UserPromptSubmit":{for(const w of e.agents.values())w.sessionId===l&&w.kind==="subagent"&&w.state==="done"&&w.exitAt==null&&w.endedAt!=null&&w.endedAt<a&&(w.exitAt=a);const h=zo(e,l,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!UL(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=fu(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?BL(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=fu(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,w=vl(s),v={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:fu(s.tool_input),agentId:f.id,explicitSubagentId:w?Fl(l,w):void 0,startedAt:a};f.tools.push(v),f.toolCount+=1,f.state="active",e.toolIndex.set(g,v),e.toolOwner.set(g,f.id),zL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),w=!1;if(!g)for(const N of e.agents.values()){const x=N.tools.find(S=>S.id===h);if(x){g=x,w=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=a,g.ok=i==="PostToolUse",g.trimmed||(g.response=s.tool_response),i==="PostToolUseFailure"?g.errorPreview=fu(s.tool_response):w&&(g.errorPreview=void 0);const v=ET(s.tool_response);v&&(g.usage=v),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=vl(s);if(!h)break;const g=LL(e,l,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const w=Bu(s);w&&(g.label=w),qL(e,l,h);break}case"SubagentStop":{const h=vl(s);if(!h)break;const g=TT(e,l,h,s);if(!g)break;g.state="done",g.endedAt=a,DL(e,l,h);break}case"Stop":case"SessionEnd":{const h=zo(e,l,a,!1);h.state="done",h.endedAt=a,i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(l);break}case"Notification":{const h=XL(s.notification_type);if(!h)break;const g=zo(e,l,a,!1),w=typeof s.message=="string"?s.message:"",v=g.waiting;g.waiting=v&&v.kind===h&&v.message===w?{...v,since:Math.min(v.since,a)}:t3(e,l,h,w,a);break}}return e}function Gv(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 r3={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},s3=[{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:r3},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function a3(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ni(e,t=Date.now()){if(!e)return null;const n=Dl(e);for(const s of s3)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function AT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*l/1e6}}function MT(e,t,n=Date.now()){if(!a3(t))return e.inputTokens;const s=ni(t,n),a=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Vv(e,t,n=Date.now()){const s=ni(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=MT(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,d=AT(e,s),f=d.usd5m+d.usd1h;return{input:a,output:i,cacheRead:l,cacheWrite:f,total:a+i+l+f}}const yk=2e5,o3=1e6,i3=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],l3=[{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 c3(e){if(!e)return yk;const t=Dl(e);for(const n of i3)if(n.test(t))return o3;for(const n of l3)if(n.match.test(t))return n.window;return yk}function IT(e,t){return typeof e=="number"&&e>0?e:c3(t)}const Do="not priced";function et(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function Yv(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${et(s)}/min`:`${et(n*3600)}/hr`}function u3(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 d3(e,t){let n=0,s=0,a=0,i=0,l=0,d=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,i+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,d+=g.cacheCreate5mTokens??0;const f=(g,w)=>Math.max(0,g-w),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Bl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=d3(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(l=>l.model===e.model);i>=0?s[i]={model:s[i].model,usage:u3(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function Rn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Bl(e)){const a=Vv(s.usage,s.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function cv(e,t=Date.now()){let n=0;for(const s of Bl(e))ni(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function $T(e){const t=[];for(const n of Bl(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function OT(e){return $T(e).filter(t=>t!==e.model)}const h3=new Set(["untrusted","on-request","on-failure"]);function f3(e){return typeof e!="string"||!e?null:h3.has(e)?!0:e==="never"?!1:null}function p3(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=f3(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 wk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function qs(e){const t=Dl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=wk(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),i=s[2].split(/[-_]/).filter(Boolean).map(wk);return[`GPT-${a}`,...i].join(" ")}return e}function ad(e){const t=Dl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ul(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function m3(e){const t=[];for(const n of e)n.kind==="root"&&Ul(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function g3(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function od(e,t){return`${e}@${t.since}`}function PT(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?a?s:`${n} · ${s}`:a?null:n}function y3(e){const t=e.message||"Needs your permission",n=PT(e,t);return n?`${t}
|
|
60
|
-
Likely on: ${n}`:t}function w3(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!Ul(i.waiting))continue;const l=od(i.id,i.waiting);t.has(l)||a.push({key:l,title:i.label,body:y3(i.waiting),sessionId:i.id})}return a}function v3(e,t,n){const s=new Set;for(const i of e)s.add(od(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function vk(e){return new Set(e.map(t=>od(t.id,t.waiting)))}function x3(e,t){return e!==t}function Rt(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Uu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),l=a%60;return`${i}m ${String(l).padStart(2,"0")}s`}function LT(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 qT(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const b3=1;function k3(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const l=e.indexOf(i);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const a=n();return a!=null&&a.dismiss===s},depth(){return e.length}}}const Wu=k3();function _3(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function xk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function S3(e,t){return!e||!e.isConnected||xk(e)?!1:t==null||xk(t)}const bk="a[href], button, input, select, textarea, [tabindex]";function N3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function j3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function E3({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 Kv(e){return e.ctrlKey||e.metaKey||e.altKey}const C3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),T3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),R3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function DT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Xv(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=DT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!C3.has(String(e.type??"text").toLowerCase())}function A3(e){if(!e)return!1;if(Xv(e)||T3.has(DT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>R3.has(n))}function M3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function FT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(bk))return N3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&j3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(bk)!=null})}):[]}function I3(e,t){const n=FT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Zt(e,t={}){const{focusRef:n,layer:s}=t,a=k.useRef(null),i=k.useRef(e);i.current=e;const l=k.useRef(null);l.current===null&&(l.current=()=>i.current());const d=l.current;return k.useEffect(()=>Wu.push(d,s),[d,s]),k.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??FT(a.current)[0])==null||p.focus(),()=>{S3(f,document.activeElement)&&f.focus()}},[]),k.useEffect(()=>{const f=p=>{var x;if(p.key!=="Tab"||Kv(p))return;const h=a.current;if(!h)return;const g=document.activeElement;if(!(g!=null&&h.contains(g))&&!Wu.isTop(d))return;const v=I3(h,g),N=E3({count:v.length,index:g?v.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((x=v[N.index])==null||x.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[d]),a}function $3(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 Un(e){return e.toLocaleString()}function O3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const P3=60;function L3(e,t=P3){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function q3({agent:e,onClose:t}){var w;const n=k.useRef(null),s=Zt(t,{focusRef:n}),a=e.context,i=e.usage,l=(a==null?void 0:a.currentContextTokens)??0,d=IT(e.contextWindow,e.model),f=Math.min(100,l/d*100),p=Rn(e),h=i.inputTokens+i.cacheReadTokens+i.cacheCreateTokens,g=$3(e.provider);return c.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:s,className:"ctx-modal",onClick:v=>v.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[c.jsxs("header",{className:"ctx-modal-head",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),c.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),c.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("section",{className:"ctx-window-row",children:[c.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:c.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),c.jsxs("div",{className:"ctx-window-meta",children:[c.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),c.jsxs("span",{children:[Un(l)," / ",Un(d)," tok (",g.windowScope,")"]})]})]}),c.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),c.jsxs("div",{className:"ctx-grid",children:[c.jsx(sr,{label:"input tokens",val:Un(i.inputTokens)}),c.jsx(sr,{label:"output tokens",val:Un(i.outputTokens)}),c.jsx(sr,{label:"cache reads",val:Un(i.cacheReadTokens)}),c.jsx(sr,{label:"cache writes",val:Un(i.cacheCreateTokens)}),c.jsx(sr,{label:"cumulative total",val:Un(h)}),c.jsx(sr,{label:"estimated cost",val:et(p.total),accent:!0})]}),c.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?c.jsxs("div",{className:"ctx-grid",children:[c.jsx(sr,{label:"user messages",val:Un((a==null?void 0:a.msgsUser)??0)}),c.jsx(sr,{label:"assistant messages",val:Un((a==null?void 0:a.msgsAssistant)??0)}),c.jsx(sr,{label:"tool uses",val:Un((a==null?void 0:a.toolUses)??0)}),c.jsx(sr,{label:"tool results",val:Un((a==null?void 0:a.toolResults)??0)}),c.jsx(sr,{label:"system-reminders",val:Un((a==null?void 0:a.systemReminders)??0)})]}):c.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),c.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((w=a==null?void 0:a.memoryFiles)==null?void 0:w.length)??0)===0?c.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):c.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(v=>c.jsxs("li",{children:[c.jsx("span",{className:"ctx-md-path",title:v.path,children:L3(v.path)}),c.jsx("span",{className:"ctx-md-size",children:O3(v.bytes)})]},v.path))})]})})}function sr({label:e,val:t,accent:n}){return c.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[c.jsx("span",{className:"ctx-row-label",children:e}),c.jsx("span",{className:"ctx-row-val",children:t})]})}function D3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=IT(n,t),l=Math.min(1,e/i),d=s/2-3,f=s/2,p=2*Math.PI*d,h=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return c.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:c.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[c.jsx("circle",{cx:f,cy:f,r:d,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),c.jsx("circle",{cx:f,cy:f,r:d,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),c.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function kk(e,t){const n=ni(t);if(!n)return`model: ${t}
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Vv(e,t),l=AT(e,n),d=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${et(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${et(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${et(l.usd5m)}`],f=MT(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${et(i.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${et(i.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${et(i.cacheRead)}`,...d,"─────────────────────────────────────────",`total = ${et(i.total)}`].join(`
|
|
62
|
-
`)}function _k(e){const t=Bl(e);return t.length<=1?kk(e.usage,e.model):[...t.map(n=>kk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${et(Rn(e).total)}`].join(`
|
|
63
|
-
`)}function F3({data:e,selected:t}){var w;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(v=>!v.endedAt).length,i=Gv(e.sessionId),l=((w=e.context)==null?void 0:w.currentContextTokens)??0,d=e.kind==="root"&&l>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=OT(e),h=p.length>0?`${e.model}
|
|
65
|
-
spend on this card also covers:
|
|
66
|
-
${p.join(`
|
|
67
|
-
`)}`:e.model,g=qT(e.sessionName,e.sessionTitle);return c.jsxs("div",{className:s,style:{"--session-hue":i},children:[c.jsx("span",{className:"accent-stripe"}),c.jsx(Xo,{type:"target",position:Oe.Left,style:{background:"transparent",border:"none"}}),c.jsxs("div",{className:"head",children:[c.jsxs("div",{className:"title",children:[c.jsx(z3,{state:e.state}),c.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&c.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),c.jsxs("div",{className:"head-right",children:[d&&e.onOpenContext&&c.jsx(D3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),c.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Uu(e.startedAt,e.endedAt,n)})]})]}),c.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&c.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?c.jsxs("span",{className:"model-chip","data-family":ad(e.model),title:h,children:[qs(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?c.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&c.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&c.jsx(W3,{waiting:e.waiting,now:n}),(()=>{const v=p3(e);return v?c.jsxs("div",{className:"approval-blind-row",title:v.detail,children:[c.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),c.jsx("span",{className:"approval-blind-said",children:v.label})]}):null})(),e.tools.length>0&&c.jsx(H3,{tools:e.tools,now:n}),c.jsxs("div",{className:"meta",children:[c.jsxs("span",{children:[c.jsx("b",{children:e.toolCount})," tools"]}),a>0&&c.jsxs("span",{className:"inflight-meta",children:[c.jsx("b",{children:a})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&c.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:[c.jsx("b",{children:Rt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const v=ni(e.model),N=Rn(e),x=cv(e);if(!v&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:c.jsx("span",{className:"cost-unpriced",title:_k(e),children:Do});if(N.total<=0)return null;const S=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),_=e.state==="active"?Yv(N.total,S):null,j=_k(e)+(_?`
|
|
68
|
-
burn: ${_}`:"");return c.jsxs("span",{className:"cost-meta",title:j,children:[c.jsxs("b",{children:[et(N.total),x>0?"+":""]}),_&&c.jsx("span",{className:"cost-rate",children:_})]})})()]}),c.jsx(Xo,{type:"source",position:Oe.Right,style:{background:"transparent",border:"none"}})]})}function Hu(e){return e==="active"?"live":e==="done"?"done":"err"}function z3({state:e}){return c.jsx("span",{className:`state-pill state-${e}`,children:Hu(e)})}function Tl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function B3(e,t){const n=PT(e,t);return n?`Likely on: ${n}`:null}function U3(e){return e.kind==="idle"?"Your turn":Tl(e)}function W3({waiting:e,now:t}){const n=Ul(e),s=Tl(e);return c.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
-
Blocked for ${Uu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?c.jsx("span",{className:"ap-pulse","aria-hidden":!0}):c.jsx("span",{className:"waiting-dot","aria-hidden":!0}),c.jsx("span",{className:"waiting-said",children:U3(e)}),c.jsx("b",{children:Uu(e.since,void 0,t)})]})}function H3({tools:e,now:t}){const i=new Array(24).fill(0);let l=0;for(const N of e){const x=t-N.startedAt;if(x<0||x>=6e4)continue;const S=23-Math.floor(x/2500);S>=0&&S<24&&(i[S]+=1,l+=1)}const d=Math.max(1,...i),f=Math.max(0,...i),p=132,h=14,g=p/24,w=f/(2500/1e3),v=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${w.toFixed(1)}/s`;return c.jsxs("div",{className:"tool-spark-row",title:v,children:[c.jsx("svg",{className:"tool-spark",width:p,height:h,viewBox:`0 0 ${p} ${h}`,"aria-hidden":!0,children:i.map((N,x)=>{const S=N===0?1.5:Math.max(1.5,N/d*h),_=x===23&&N>0,E=`tool-spark-bar${N>0?" active":""}${_?" latest":""}`;return c.jsx("rect",{x:x*g+.4,y:h-S,width:Math.max(.5,g-1),height:S,rx:.8,className:E},x)})}),c.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Sk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function G3({tool:e,onClose:t}){const n=Zt(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),c.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),c.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",children:LT(e,"in-flight…")}),c.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("section",{className:"modal-body",children:[e.trimmed&&c.jsx("div",{className:"modal-section",children:c.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h4",{children:"Input"}),c.jsx("pre",{children:Sk(e.input??e.inputPreview)})]}),c.jsxs("div",{className:"modal-section",children:[c.jsxs("h4",{children:["Response ",s==="err"&&c.jsx("span",{className:"err-tag",children:"error"})]}),c.jsx("pre",{children:e.endedAt==null?"(waiting…)":Sk(e.response??e.errorPreview)})]})]})]})})}const pu=18,Nk=26,V3=12;function Y3(e){return K3(e.nodeInternals.values())}function K3(e){const t=new Map;for(const a of e){if(a.type!=="agent")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const l=a.position.x,d=a.position.y,f=l+a.width,p=d+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,d),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=Ek(i)??h.label),i.kind==="root"&&(h.name=Ck(i))):t.set(i.sessionId,{minX:l,minY:d,maxX:f,maxY:p,label:Ek(i)??i.sessionId,name:Ck(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const l=(n.get(i.label)??0)>1;s.push({sessionId:a,...J3(i.label,i.name,a,l),x:i.minX-pu,y:i.minY-pu-Nk,w:i.maxX-i.minX+pu*2,h:i.maxY-i.minY+pu*2+Nk})}return s}const uv=" · ",X3=32,Q3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function jk(e){return Q3.test(e)?2:1}function Z3(e,t=X3){const n=[...e];let s=0;for(const l of n)s+=jk(l);if(s<=t)return e;const a=[];let i=0;for(const l of n){const d=jk(l);if(i+d>t-1)break;a.push(l),i+=d}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function J3(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?e4(n):void 0,l=[e,a||void 0,i].filter(Boolean);return{label:e,name:a?Z3(a):void 0,shortId:i,fullLabel:l.join(uv)}}function e4(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function Ek(e){if(e.kind==="root")return e.label}function Ck(e){if(e.kind==="root")return qT(e.sessionName,e.sessionTitle).face}function t4({onFit:e}){const{x:t,y:n,zoom:s}=bT(),a=ql(),i=lt(Y3,n4);if(i.length<=1)return null;const l=f=>{try{const p=a.getNodes().filter(h=>{const g=h.data;return(g==null?void 0:g.sessionId)===f});if(p.length===0)return;a.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},d={transform:`translate(${t}px, ${n}px) scale(${s})`};return c.jsx("div",{className:"session-clusters",style:d,children:i.map(f=>{const p=Gv(f.sessionId),h={position:"absolute",left:f.x,top:f.y,width:f.w,height:f.h,"--session-hue":p},g={position:"absolute",left:f.x+16,top:f.y-V3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return c.jsxs(he.Fragment,{children:[c.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),c.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${f.fullLabel}
|
|
70
|
-
drag the wrapper to move the whole session`,onClick:()=>l(f.sessionId),children:[f.label,f.name?c.jsxs(c.Fragment,{children:[uv,c.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?uv+f.shortId:null]})]},f.sessionId)})})}function n4(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.fullLabel!==a.fullLabel||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}function r4({data:e}){return c.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Wl={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},s4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.category])),a4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.emoji])),o4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.label])),i4=new Set(Object.keys(Wl)),l4=new Set(Object.entries(Wl).filter(([,e])=>e.shell).map(([e])=>e)),Tk={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",...s4};function zT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(Tk,e)?Tk[e]:"other"}const c4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,u4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function d4(e){if(typeof e!="string"||!e)return null;const t=c4.exec(e);if(t){const s=h4(t[2]);if(s.trim())return s}const n=u4.exec(e);return n?n[1]:null}function h4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const BT=600,f4=4,p4=36,dv=16,m4=60,g4=6,Rk=220,Ak=96,y4=28,Mk={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:"📡",...a4};function Ik(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Mk,e)?Mk[e]:"✨"}const $k={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 UT(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 UT(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let a=s[1];return a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null}function w4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=d4(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const v4=new Set(["Bash","PowerShell",...l4]),x4=i4;function b4(e,t){return x4.has(e)||e.startsWith("mcp__")?Math.max(Ak,34+t.length*7.5):Ak}function k4(e,t){if(!v4.has(e))return null;const n=w4(t);if(!n)return null;const s=UT(n);return s?{emoji:Object.hasOwn($k,s)?$k[s]:"⚙️",label:s,category:"shell",detail:n}:null}const _4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Ok={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:"🗄️"},Pk={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 S4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function N4(e){const t=e.toLowerCase();if(Object.hasOwn(Pk,t))return Pk[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(Ok,s))return Ok[s]}return"📄"}function j4(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function E4(e,t){if(!_4.has(e))return null;const n=j4(e,t);if(!n)return null;const s=S4(n);return s?{emoji:e==="LS"?"📂":N4(s),label:s,category:"file",detail:n}:null}const Lk={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 Qv(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 C4(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 WT(e){const t=e.toLowerCase();return Object.hasOwn(Lk,t)?Lk[t]:void 0}function T4(e,t){const n=Qv(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=WT(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function R4(e,t){return k4(e,t)??E4(e,t)??T4(e)}const qk=o4;function HT(e){const t=Qv(e);if(t){const s=WT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:C4(t.server)}}const n=Object.hasOwn(qk,e)?qk[e]:"";return n?{emoji:Ik(e),label:n}:{emoji:Ik(e),label:e}}function A4(e){let t=null,n="";for(const s of e){const a=Qv(s);if(a){if(!a.server)return null;if(t===null)t=a.server,n=s;else if(a.server!==t)return null}}return t===null?null:HT(n)}function M4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function I4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/BT)}function $4(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function O4(e,t,n,s,a,i){const l=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&i-d.exitAt>BT)continue;const f=s.get(d.id)??n.get(d.id);if(!f)continue;const p=$4(d.tools,f4);if(p.length===0)continue;const h=d.exitAt??null,g=a.get(d.id),w=Math.max((g==null?void 0:g.width)??Rk,Rk),v=(g==null?void 0:g.height)??130,N=f.x,x=f.y,S=N+w,_=x+v/2;p.forEach((j,E)=>{const C=E*p4,A=N+w+m4,O=x+g4+C,$=I4(i,h),z=j.inputPreview??"",P=M4(j),M=$<.999,F=HT(j.name);l.push({id:`${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:F.label,emoji:F.emoji,status:P,category:zT(j.name),mcpHue:F.hue,inputPreview:z,fade:$,fading:M,worldX:A,worldY:O,anchorX:S,anchorY:_,spawnDx:S-A,spawnDy:_-(O+dv)});const H=R4(j.name,j.input);if(H){const Z=b4(j.name,F.label),R=A+Z+y4,Q=O,B=A+Z,te=O+dv;l.push({id:`sub:${d.id}::${j.id}`,toolId:j.id,agentId:d.id,toolName:j.name,name:H.label,emoji:H.emoji,isSub:!0,status:P,category:H.category,inputPreview:H.detail??z,fade:$,fading:M,worldX:R,worldY:Q,anchorX:B,anchorY:te,spawnDx:B-R,spawnDy:0})}})}return l}function P4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:l,now:d,onOpenTool:f}){const p=O4(e,t,n,s,a,d),h=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return c.jsx(L4,{bursts:h,spotlight:i,onOpenTool:f})}function L4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=bT();return c.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[c.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const d=l.anchorX*i+s,f=l.anchorY*i+a,p=(l.worldX+6)*i+s,h=(l.worldY+dv)*i+a,g=d+(p-d)*.55,w=t!=null&&!t.has(l.agentId),v=l.fade*(w?.14:1);return c.jsx("path",{d:`M ${d} ${f} Q ${g} ${f}, ${p} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:v},`l:${l.id}`)})}),e.map(l=>{const d=l.worldX*i+s,f=l.worldY*i+a,p={left:`${d}px`,top:`${f}px`,transform:`scale(${i})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},h=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${h} · ${l.inputPreview}`:h,w=n!=null,v=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},x=t!=null&&!t.has(l.agentId)?" dim":"";return c.jsx("div",{className:"tool-burst-wrap",style:p,children:c.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${w?" clickable":""}${l.isSub?" sub":""}${x}`,style:v,title:g,onClick:w?()=>n(l.toolId):void 0,children:[c.jsx("span",{className:"tb-emoji",children:l.emoji}),c.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&c.jsx("span",{className:"tb-spin"}),l.status==="done"&&c.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&c.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function q4(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const l of e){const d=Rn(l);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,a+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const D4="spend on this board",F4="on this board",Dk=`Everything on the board right now, and only that.
|
|
72
|
-
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
73
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,GT="session spend";function Zv({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,l,d)=>{if(i<=0)return null;const f=i/n*100;return c.jsx("span",{className:`cb-seg ${l}`,style:{width:`${f}%`},title:`${d}: ${et(i)} (${f.toFixed(0)}%)`},l)},a=t==="lg";return c.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function z4({state:e,sessionId:t,onClose:n}){const s=k.useMemo(()=>B4(e,t),[e,t]),a=k.useRef(null),i=Zt(n,{focusRef:a});return s?c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),c.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),c.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),c.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body",children:[c.jsxs("section",{className:"ss-hero",children:[c.jsxs("div",{className:"ss-hero-left",children:[c.jsx("div",{className:"ss-cost-label",children:GT}),c.jsx("div",{className:"ss-cost",children:et(s.cost.total)}),s.modelChips.length>0&&c.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>c.jsx("span",{className:"model-chip","data-family":ad(l),title:l,children:qs(l)},l))})]}),c.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&c.jsxs(c.Fragment,{children:[c.jsx(Zv,{cost:s.cost,size:"lg"}),c.jsxs("div",{className:"ss-cost-legend",children:[c.jsxs("span",{className:"ssl ssl-in",children:["input ",c.jsx("b",{children:et(s.cost.input)})]}),c.jsxs("span",{className:"ssl ssl-out",children:["output ",c.jsx("b",{children:et(s.cost.output)})]}),c.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",c.jsx("b",{children:et(s.cost.cacheRead)})]}),c.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",c.jsx("b",{children:et(s.cost.cacheWrite)})]})]})]})})]}),c.jsxs("section",{className:"ss-stats",children:[c.jsx(Po,{label:"agents",value:s.agentCount}),c.jsx(Po,{label:"subagents",value:s.subagentCount}),c.jsx(Po,{label:"tool calls",value:s.toolCount}),c.jsx(Po,{label:"prompts",value:s.promptCount}),c.jsx(Po,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&c.jsx(Po,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Most-used tools"}),c.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,d])=>c.jsxs("div",{className:"ss-tt",children:[c.jsx("span",{className:"ss-tt-name",children:l}),c.jsx("span",{className:"ss-tt-bar",children:c.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${d/s.topTools[0][1]*100}%`}})}),c.jsx("span",{className:"ss-tt-count",children:d})]},l))})]}),s.firstPrompt&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Opening prompt"}),c.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function Po({label:e,value:t,tone:n}){return c.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[c.jsx("div",{className:"ss-stat-value",children:t}),c.jsx("div",{className:"ss-stat-label",children:e})]})}function B4(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const E of e.agents.values())E.sessionId===t&&s.push(E);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let d=0,f=0,p=0,h=0,g=0,w,v=1/0,N=0;for(const E of s){const C=Rn(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 $T(E))i.add(A);E.model&&i.add(E.model),E.kind==="subagent"&&g++,f+=E.prompts.length,!w&&E.prompts.length>0&&(w=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,d+=E.toolCount,v=Math.min(v,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const A of E.tools)l.set(A.name,(l.get(A.name)??0)+1),A.ok===!1&&h++}const x=Math.max(0,N-v),S=Math.floor(x/1e3),_=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,j=Array.from(l.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:_,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:g,toolCount:d,promptCount:f,tokensSum:p,errCount:h,topTools:j,firstPrompt:w}}function Fk(e){return e.waiting?Ul(e.waiting)?0:1:e.state==="active"?2:3}function U4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=Rn(s).total,l=s.endedAt??s.startedAt;for(const d of e.agents.values()){if(d.sessionId!==s.sessionId||d.kind==="root")continue;a+=d.toolCount,i+=Rn(d).total;const f=d.endedAt??d.startedAt;f>l&&(l=f)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:a,cost:i,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,a)=>{const i=Fk(s),l=Fk(a);return i!==l?i-l:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function zk(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function W4({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=k.useMemo(()=>U4(e),[e,e.revision,t]),l=i.filter(f=>f.state==="active").length,d=i.filter(f=>Ul(f.waiting)).length;return c.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[c.jsxs("div",{className:"sl-header",children:[c.jsxs("h2",{children:["Sessions ",c.jsx("span",{className:"sl-count",children:i.length})]}),d>0&&c.jsxs("span",{className:"sl-waiting-count",children:[d," waiting"]}),l>0&&c.jsxs("span",{className:"sl-live-count",children:[l," live"]}),c.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),c.jsxs("div",{className:"sl-rows",children:[i.length===0&&c.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return c.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[c.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Hu(f.state)}),c.jsxs("div",{className:"sl-row-body",children:[c.jsxs("div",{className:"sl-row-head",children:[c.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&c.jsx("span",{className:"model-chip","data-family":ad(f.modelId),title:f.modelId,children:qs(f.modelId)})]}),c.jsxs("div",{className:"sl-row-meta",children:[c.jsxs("span",{title:"tool calls",children:[c.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&c.jsx("span",{className:"sl-cost",title:GT,children:c.jsx("b",{children:et(f.cost)})}),f.waiting?c.jsxs("span",{className:"sl-waiting",title:[Tl(f.waiting),B3(f.waiting,Tl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
-
`),children:["waiting ",zk(f.waiting.since,void 0,t),f.waiting.tool&&c.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):c.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:zk(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const H4=e=>1-Math.pow(1-e,5),VT=420;function G4(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function V4(e,t,n,s=VT){return n>=s?t:n<=0?e:e+(t-e)*H4(n/s)}function Y4(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(v=>requestAnimationFrame(v)),l=s.cancel??(v=>cancelAnimationFrame(v)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||f()||!G4(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const w=()=>{if(!g)return;const v=a()-p;n(V4(e,t,v)),v<VT&&(h=i(w))};return h=i(w),()=>{g=!1,h&&l(h)}}const hv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function Bk(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=Rn(s,t);n.set(s.sessionId,{cost:a.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function K4(e,t){if(!e)return hv;const n={...hv};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const l={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function fv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const id=[{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 X4(e,t,n=id.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 Q4(e,t=new Date){return e==="today"?fv(1,t):e==="month"?fv(t.getDate(),t):"20200101"}const Tn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Tu=e=>typeof e=="string"?e:"";function YT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const l=Tu(i==null?void 0:i.modelName);if(!l)continue;let d=n.get(l);d||(d={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,d)),d.cost+=Tn(i==null?void 0:i.cost),d.inputTokens+=Tn(i==null?void 0:i.inputTokens),d.outputTokens+=Tn(i==null?void 0:i.outputTokens),d.cacheReadTokens+=Tn(i==null?void 0:i.cacheReadTokens),d.cacheCreateTokens+=Tn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function Z4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=Tu(a==null?void 0:a.period);if(!i)continue;const l=a==null?void 0:a.metadata,d=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:i,label:t.get(i)??null,agent:Tu(a==null?void 0:a.agent)||"claude",cost:Tn(a==null?void 0:a.totalCost),tokens:Tn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Tu).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function KT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Tn(t.cacheReadTokens),p=Tn(t.cacheCreationTokens),h=Tn(t.inputTokens),g=Tn(t.outputTokens);return{cost:Tn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Tn(t.totalTokens)||h+g+f+p}}const n=YT(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),l=s(f=>f.cacheReadTokens),d=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:d,tokens:a+i+l+d}}function J4(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 Uk(e,t){var n;return((n=id.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function eq(e,t,n){const s=e!=null,a=KT(e);return{fromRange:s,cost:s?a.cost+n.cost:t.cost.total,inputTokens:s?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?a.cost>0:t.cost.total>0,tokenSum:s?a.tokens:t.sum,showCostBar:!s}}const tq="1",Wk="agent-dag.schema",nq=["agent-dag.layout","agent-dag.viewport"];function ri(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function rq(e,t=tq){let n=null;try{n=e.getItem(Wk)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of nq)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(Wk,t)}catch{}return s}const zt="ccdeck";function XT(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function pv(e){return XT(Math.floor(e/1e3))}function QT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function sq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function aq(e,t,n){const s=new Date(e),a=pv(t-e);return{label:sq(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ra(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function ld(e){return e==null}const mv="self";function lr(e,t=!1){const n=Ra(e?mv:null,mv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function cr(e){return ld(e?mv:null)}function oq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function iq(e){return e==null||e==="BODY"||e==="HTML"}const ZT="agent-dag.usagePeriod";function lq(){const e=ri(ZT);return id.some(t=>t.key===e)?e:"today"}function cq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ZT,e)}catch{}}const JT="agent-dag.usageSessionsOpen";function uq(){return ri(JT)==="1"}function dq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(JT,e?"1":"0")}catch{}}function Hk(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 hq(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const bf="__unknown__";function fq(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const l=Math.min(100,i/n*100),d=e-l;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(d>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,g={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<a&&h<86400){const w=Math.floor(h/3600),v=Math.floor(h%3600/60);g.runsOutIn=w>0?`${w}h ${v}m`:`${v}m`}return g}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function xa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:l}){const d=Math.min(100,Math.max(0,e)),p=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",h=d===0?"< 1%":`${d}%`,g=d===0?2:d,w=s?QT(s,l):null,v=s&&a?fq(d,s,a,l):null;return c.jsxs("div",{className:"qb-row",children:[c.jsxs("div",{className:"qb-meta",children:[c.jsxs("span",{className:"qb-label",children:[t,i&&c.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),c.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),c.jsxs("div",{className:"qb-track",children:[c.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:d===0?.4:1}}),v&&c.jsx("div",{className:"qb-pace-marker",style:{left:`${v.expectedPct}%`,background:v.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(v.expectedPct)}% by now`})]}),c.jsxs("div",{className:"qb-reset-row",children:[w?c.jsxs("span",{className:"qb-reset",children:["resets in ",w]}):n?c.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,v&&c.jsx("span",{className:"qb-pace",style:{color:v.color},children:v.runsOutIn?`runs out in ${v.runsOutIn}`:v.label})]})]})}const pq=6e4;function mq(e){const[t,n]=k.useState(null),[s,a]=k.useState(!1),i=k.useRef(null),l=k.useRef(!1),d=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return k.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),pq),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function gq(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 yq(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 eR=6e4,Gk=6e4;function wq(e){const[t,n]=k.useState(null),[s,a]=k.useState(!1),i=k.useRef(null),l=k.useRef(!1),d=async(p=!1)=>{if(!(p&&!cr(l.current))){p&&(l.current=!0,a(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,a(!1))}}};return k.useEffect(()=>{if(e)return d(!0),i.current=window.setInterval(()=>d(!1),eR),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function vq(e){const[t,n]=k.useState(null),s=k.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return k.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,eR),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function xq(e,t,n){const[s,a]=k.useState(null),[i,l]=k.useState(!1),[d,f]=k.useState(0),p=k.useRef(0);k.useEffect(()=>{const g=()=>document.visibilityState==="visible",w=()=>{g()&&f(x=>x+1)},v=window.setInterval(w,Gk),N=()=>{g()&&Date.now()-p.current>=Gk&&f(x=>x+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",N)}},[]);const h=k.useRef(t);return k.useEffect(()=>{let g=!0;const w=t!==h.current;h.current=t;const v=e,N=Q4(v);return l(!0),fetch(`/api/ccusage?since=${N}${w?"&refresh=1":""}`).then(x=>x.ok?x.json():null).then(x=>{!g||!(x!=null&&x.ok)||(p.current=Date.now(),a({period:v,data:x,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,d]),{...J4(s,e),loading:i}}function ul(e){const[t,n]=k.useState(e),s=k.useRef(e),a=k.useRef(!0);return k.useEffect(()=>{s.current=t},[t]),k.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return Y4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function bq({state:e,now:t,providers:n,onClose:s}){var at,Ke;const{quota:a,loading:i,refresh:l}=mq(n.claude),{data:d,loading:f,refresh:p}=wq(n.codex),{data:h}=vq(n.codex),[g,w]=k.useState(()=>Math.floor(Date.now()/1e3));k.useEffect(()=>{const pe=window.setInterval(()=>w(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:v,totalCost:N,totalTokens:x,burnRate:S}=k.useMemo(()=>{const pe=new Map;for(const re of e.agents.values())for(const Se of Bl(re)){const De=Se.model??bf,_e=Vv(Se.usage,Se.model),Be=pe.get(De);Be?(Be.inputTokens+=Se.usage.inputTokens,Be.outputTokens+=Se.usage.outputTokens,Be.cacheReadTokens+=Se.usage.cacheReadTokens,Be.cacheCreateTokens+=Se.usage.cacheCreateTokens,Be.cost.total+=_e.total,Be.cost.input+=_e.input,Be.cost.output+=_e.output,Be.cost.cacheRead+=_e.cacheRead,Be.cost.cacheWrite+=_e.cacheWrite,Be.agentCount++):pe.set(De,{model:De,inputTokens:Se.usage.inputTokens,outputTokens:Se.usage.outputTokens,cacheReadTokens:Se.usage.cacheReadTokens,cacheCreateTokens:Se.usage.cacheCreateTokens,cost:{..._e},agentCount:1,priced:ni(Se.model)!=null})}const ve=Array.from(pe.values()).sort((re,Se)=>Se.cost.total-re.cost.total||Se.inputTokens+Se.outputTokens-(re.inputTokens+re.outputTokens));let Pe=0,Ue=0;for(const re of e.agents.values()){if(re.state!=="active")continue;const Se=Rn(re);Pe+=Se.total,Ue=Math.max(Ue,((re.endedAt??t)-re.startedAt)/1e3)}const ot=Ue>0?Yv(Pe,Ue):null,$e=q4(e.agents.values());return{byModel:ve,totalCost:$e.cost,totalTokens:$e,burnRate:ot}},[e,e.revision,t]),_=k.useMemo(()=>{const pe=[];for(const ve of e.agents.values()){if(ve.kind!=="root")continue;let Pe=Rn(ve).total,Ue=ve.usage.inputTokens,ot=ve.usage.outputTokens,$e=cv(ve);for(const re of e.agents.values())re.sessionId!==ve.sessionId||re.kind==="root"||(Pe+=Rn(re).total,Ue+=re.usage.inputTokens,ot+=re.usage.outputTokens,$e+=cv(re));pe.push({sessionId:ve.sessionId,label:ve.label||ve.cwdBasename||"session",state:ve.state,cost:Pe,inputTokens:Ue,outputTokens:ot,unpricedTokens:$e})}return pe.sort((ve,Pe)=>Pe.cost-ve.cost||Pe.inputTokens+Pe.outputTokens-(ve.inputTokens+ve.outputTokens)).slice(0,12)},[e,e.revision]),[j,E]=k.useState(lq);k.useEffect(()=>{cq(j)},[j]);const[C,A]=k.useState(uq);k.useEffect(()=>{dq(C)},[C]);const O=k.useRef([]),[$,z]=k.useState(0),P=k.useRef(()=>new Map);P.current=()=>Bk(e.agents.values(),t);const M=k.useCallback(()=>P.current(),[]),{data:F,shown:H,stale:Z,loading:R,baseline:Q}=xq(j,$,M),B=F!=null,te=R&&Z,J=k.useMemo(()=>{const pe=new Map;for(const ve of e.agents.values()){if(ve.kind!=="root"||!ve.sessionId)continue;const Pe=ve.label||ve.cwdBasename;Pe&&pe.set(ve.sessionId,Pe)}return pe},[e,e.revision]),q=k.useMemo(()=>{const pe=new Map;for(const ve of e.agents.values())ve.kind!=="root"||!ve.sessionId||pe.set(ve.sessionId,ve.state);return pe},[e,e.revision]),Y=k.useMemo(()=>B?YT(F):[],[F,B]),L=k.useMemo(()=>{if(!B)return[];const pe=Z4(F,J).slice(0,12),ve=new Map;for(const Pe of pe)Pe.label&&ve.set(Pe.label,(ve.get(Pe.label)??0)+1);return pe.map(Pe=>Pe.label&&(ve.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[F,B,J]),K=k.useMemo(()=>KT(F),[F]),de=Uk(H,j),G=Z?" up-stale":"",I=k.useMemo(()=>B?K4(Q,Bk(e.agents.values(),t)):hv,[e,e.revision,Q,B,t]),X=eq(F,{...x,cost:N},I),U=X.hasCost,oe=X.tokenSum,fe=ul(X.cost),me=ul(X.inputTokens),ke=ul(X.outputTokens),Ye=ul(X.cacheReadTokens),Le=ul(X.cacheCreateTokens),qe=v.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),je=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),Ge=B?Y.some(pe=>pe.cost<=0&&pe.tokens>0):qe.some(pe=>!pe.priced),be=i||f,se=Hk(a==null?void 0:a.fetchedAt,g),Ze=Hk(d==null?void 0:d.fetchedAt,g),ht=()=>{l(),p(),z(pe=>pe+1)},ct=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return c.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[c.jsxs("div",{className:"up-header",children:[c.jsx("h2",{children:"Usage"}),S&&c.jsx("span",{className:"up-rate",children:S}),c.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&c.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ht,...lr(be),"aria-label":ct,title:ct,children:be?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Claude quota",se&&!i&&c.jsx("span",{className:"up-section-age",title:hq(a==null?void 0:a.source),children:se})]}),a!=null&&a.ok?c.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&c.jsx(xa,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&c.jsx(xa,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&c.jsx(xa,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&c.jsx(xa,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:gq(a.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Codex quota",(d==null?void 0:d.ok)&&d.planLabel&&c.jsx("span",{className:"up-plan-badge",children:d.planLabel}),Ze&&!f&&c.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Ze})]}),d!=null&&d.ok?c.jsxs("div",{className:"up-quota-bars",children:[(at=d.windows)==null?void 0:at.map(pe=>c.jsx(xa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:d.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(Ke=d.extraWindows)==null?void 0:Ke.map(pe=>c.jsx(xa,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),d.creditLimit&&c.jsx(xa,{label:`spend cap · $${Math.round(d.creditLimit.used)} of $${Math.round(d.creditLimit.limit)}`,pct:d.creditLimit.usedPct,reset:d.creditLimit.reset??void 0,resetAt:d.creditLimit.resetAt??void 0,limitReached:d.spendControlReached,nowSec:g}),d.creditsBalance&&!d.creditsUnlimited&&c.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",d.creditsBalance,d.overageReached&&" · overage limit reached"]}),d.creditsUnlimited&&c.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),d.resetCredits&&d.resetCredits.availableCount>0&&c.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[d.resetCredits.availableCount," rate-limit reset",d.resetCredits.availableCount!==1?"s":""," available",d.resetCredits.nextExpiryAt&&` · expires ${new Date(d.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),d.promo&&c.jsx("div",{className:"up-quota-sub",children:d.promo}),d.partial&&c.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(d==null?void 0:d.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:yq(d.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&c.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${h.window5h?`
|
|
75
|
-
last 5h: ${Rt(h.window5h.totalTokens)} tokens · ${h.window5h.sessionCount} session${h.window5h.sessionCount!==1?"s":""}`:""}`,children:[Rt(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]})]}),B&&c.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":te||void 0,onKeyDown:pe=>{var Ue;const ve=O.current.indexOf(pe.target);if(ve<0)return;const Pe=X4(pe.key,ve);Pe!==null&&(pe.preventDefault(),(Ue=O.current[Pe])==null||Ue.focus())},children:id.map((pe,ve)=>c.jsx("button",{type:"button",ref:Pe=>{O.current[ve]=Pe},tabIndex:j===pe.key?0:-1,"aria-pressed":j===pe.key,"data-pending":j===pe.key&&te?"":void 0,title:j===pe.key&&te?`Reading ${pe.noun} from the transcripts on this machine…`:pe.hint,className:"uh-range-btn",onClick:()=>E(pe.key),children:pe.label},pe.key))}),B&&c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:te?`Reading ${Uk(j,j)}…`:""}),oe>0?c.jsxs(c.Fragment,{children:[U&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`up-total${G}`,title:B?void 0:Dk,children:[c.jsx("span",{className:"up-total-value",children:et(fe)}),c.jsx("span",{className:"up-total-label",children:B?de:D4})]}),X.showCostBar&&c.jsx(Zv,{cost:N})]}),c.jsxs("div",{className:`up-tokens-row${G}`,title:B?void 0:Dk,children:[c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"in"}),Rt(me)]}),c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"out"}),Rt(ke)]}),X.cacheReadTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache r"}),Rt(Ye)]}),X.cacheCreateTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache c"}),Rt(Le)]}),!U&&c.jsx("span",{className:"up-tok up-scope",children:F4})]}),(B?Y.length:qe.length)>0&&c.jsxs("section",{className:`up-section${G}`,children:[c.jsx("h3",{className:"up-section-title",children:"By model"}),c.jsxs("table",{className:"up-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Model"}),c.jsx("th",{children:"Tokens"}),c.jsx("th",{children:"Cost"})]})}),c.jsx("tbody",{children:B?Y.map(pe=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:pe.model,children:qs(pe.model)}),c.jsx("td",{className:"up-num",children:Rt(pe.tokens)}),pe.cost>0?c.jsx("td",{className:"up-num up-cost-val",children:et(pe.cost)}):c.jsx("td",{className:"up-num up-unpriced",children:Do})]},pe.model)):qe.map(pe=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:pe.model===bf?"no model reported yet":pe.model,children:pe.model===bf?"unknown":qs(pe.model)}),c.jsx("td",{className:"up-num",children:Rt(pe.inputTokens+pe.outputTokens)}),pe.priced?c.jsx("td",{className:"up-num up-cost-val",children:et(pe.cost.total)}):c.jsx("td",{className:"up-num up-unpriced",children:Do})]},pe.model))})]})]}),B&&L.length===0&&K.tokens>0&&c.jsxs("section",{className:"up-section",children:[c.jsx("h3",{className:"up-section-title",children:"By session"}),c.jsxs("div",{className:"up-hint",children:["No session is dated ",de," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(B?L.length:je.length)>0&&(()=>{const pe=B?L.length:je.length;return c.jsxs("section",{className:`up-section${G}`,children:[c.jsx("h3",{className:"up-section-title",children:c.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":C,"aria-controls":"up-sessions",title:C?"Hide the per-session breakdown":`Show the per-session breakdown — ${pe} session${pe===1?"":"s"}`,onClick:()=>A(ve=>!ve),children:["By session",B&&c.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${de}, each showing what that session has cost since it started.
|
|
76
|
-
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",de]}),c.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:c.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),c.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!C,children:[B&&L.map(ve=>{const Pe=q.get(ve.sessionId);return c.jsxs("div",{className:"up-session-row",children:[Pe?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:`sl-dot state-${Pe}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Hu(Pe)})]}):c.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),c.jsx("span",{className:`up-session-label${ve.label?"":" up-session-id"}`,title:ve.label?`${ve.label}
|
|
77
|
-
${ve.sessionId}`:ve.sessionId,children:ve.label??ve.sessionId.slice(0,8)}),c.jsx("span",{className:"up-session-tokens",children:Rt(ve.tokens)}),ve.cost>0?c.jsx("span",{className:"up-session-cost",title:ve.models.join(", ")||void 0,children:et(ve.cost)}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Do})]},ve.sessionId)}),!B&&je.map(ve=>c.jsxs("div",{className:"up-session-row",children:[c.jsx("span",{className:`sl-dot state-${ve.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Hu(ve.state)}),c.jsx("span",{className:"up-session-label",children:ve.label}),c.jsx("span",{className:"up-session-tokens",children:Rt(ve.inputTokens+ve.outputTokens)}),ve.cost>0?c.jsxs("span",{className:"up-session-cost",title:ve.unpricedTokens>0?`${Rt(ve.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[et(ve.cost),ve.unpricedTokens>0?"+":""]}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Do})]},ve.sessionId))]})]})})(),Ge&&c.jsxs("div",{className:"up-hint",children:["“",Do,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):c.jsx("div",{className:"up-empty",children:B?c.jsxs(c.Fragment,{children:["No usage ",de,".",c.jsx("br",{}),"Try a longer period."]}):c.jsxs(c.Fragment,{children:["No usage data yet.",c.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Ht={l:30,r:6,t:6,b:2},Ms={l:0,r:0,t:2,b:1},cd=104,kq=64;function ir(e,t=100,n=cd,s=Ht){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function tR(e,t,n,s=100,a=cd,i=Ht){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,d=h=>{const g=t-i.l-i.r;return i.l+(l>0?g*(h-e[0].t)/l:g/2)};let f="",p=null;for(const h of e){const g=p&&h.t-p.t<=n*2?"L":"M";f+=`${g}${d(h.t).toFixed(1)} ${ir(h.v,s,a,i).toFixed(1)}`,p=h}return f}function nR(e,t,n,s=100,a=cd,i=Ht){if(e.length<2)return"";const l=a-i.b,d=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=v=>i.l+(d>0?f*(v-e[0].t)/d:f/2);let h="",g=[];const w=()=>{if(g.length>=2){let v=`M${p(g[0].t).toFixed(1)} ${l}`;for(const N of g)v+=`L${p(N.t).toFixed(1)} ${ir(N.v,s,a,i).toFixed(1)}`;h+=`${v}L${p(g[g.length-1].t).toFixed(1)} ${l}Z`}g=[]};for(const v of e)g.length&&v.t-g[g.length-1].t>n*2&&w(),g.push(v);return w(),h}function _q(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 rR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Sq(e,t,n=s=>xl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function xl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Jv(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),a=n%60;return a?`${s}h ${a}m`:`${s}h`}function Nq({group:e,title:t,onClose:n}){const s=Zt(n),[a,i]=k.useState(null);k.useEffect(()=>{let p=!0;const h=async()=>{try{const w=await fetch(`/api/system/history?group=${e}`);if(!w.ok)return;const v=await w.json();p&&(v!=null&&v.ok)&&i(v)}catch{}};h();const g=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(a==null?void 0:a.series)??[],[d,f]=k.useMemo(()=>{let p=1/0,h=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),h=Math.max(h,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[l,a==null?void 0:a.sinceMs]);return Iv.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&c.jsxs("span",{className:"hist-since",children:["since ",xl(d)," · ",Jv(d,f||Date.now())]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsx("div",{className:"hist-body",children:a==null?c.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?c.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>c.jsx(jq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function jq({series:e,stepMs:t}){const n=k.useRef(null),[s,a]=k.useState(560),[i,l]=k.useState(null);k.useEffect(()=>{const $=n.current;if(!$||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([P])=>a(Math.max(160,P.contentRect.width)));return z.observe($),()=>z.disconnect()},[]);const{points:d,unit:f,warnAt:p,critAt:h,label:g,top:w,restsAtZero:v}=e,N=v?kq:cd,{now:x,peak:S}=_q(d),_=f==="C"?"°C":f,j=g==="Throttling"?Sq(d,t):null,E=i!=null?d[i]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,A=$=>{const z=s-Ht.l-Ht.r;return Ht.l+(C>0?z*($-d[0].t)/C:z/2)},O=$=>{if(d.length<2)return;const z=$.currentTarget.getBoundingClientRect(),P=($.clientX-z.left-Ht.l)/Math.max(1,z.width-Ht.l-Ht.r),M=d[0].t+C*Math.max(0,Math.min(1,P));let F=0;for(let H=1;H<d.length;H++)Math.abs(d[H].t-M)<Math.abs(d[F].t-M)&&(F=H);l(F)};return c.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[c.jsxs("div",{className:"hist-head",children:[c.jsx("span",{className:"hist-label",children:g}),c.jsxs("span",{className:"hist-stats",children:[x!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{children:x}),c.jsxs("span",{children:[_," now"]})]}),S!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{className:rR(S,p,h),children:S}),c.jsxs("span",{children:[_," peak"]})]})]})]}),c.jsx("div",{className:"hist-plot",ref:n,children:c.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":x==null?`${g}: nothing measured yet`:`${g}: ${x}${_} now, peak ${S}${_}, over ${Jv(d[0].t,d[d.length-1].t)}`,onPointerMove:O,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",h]].map(([$,z])=>z==null||z>w?null:c.jsxs("g",{children:[c.jsx("line",{className:`hist-rule ${$}`,x1:Ht.l,x2:s-Ht.r,y1:ir(z,w,N),y2:ir(z,w,N)}),c.jsx("text",{className:`hist-rule-tag ${$}`,x:2,y:ir(z,w,N)+3,children:z})]},$)),c.jsx("line",{className:"hist-floor",x1:Ht.l,x2:s-Ht.r,y1:N-Ht.b,y2:N-Ht.b}),c.jsx("path",{className:"hist-area",d:nR(d,s,t,w,N)}),c.jsx("path",{className:"hist-line",d:tR(d,s,t,w,N)}),d.length===1&&c.jsx("circle",{className:"hist-dot",cx:A(d[0].t),cy:ir(d[0].v,w,N),r:3}),E&&c.jsxs("g",{children:[c.jsx("line",{className:"hist-cross",x1:A(E.t),x2:A(E.t),y1:Ht.t,y2:N-Ht.b}),c.jsx("circle",{className:"hist-dot",cx:A(E.t),cy:ir(E.v,w,N),r:3})]})]})}),c.jsx("div",{className:"hist-axis",children:E?c.jsxs("span",{className:"hist-at",children:[xl(E.t)," — ",c.jsx("b",{children:E.v}),_]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:d.length?xl(d[0].t):""}),c.jsx("span",{children:d.length?xl(d[d.length-1].t):""})]})}),j&&c.jsx("div",{className:"hist-note",children:j})]})}const Eq="thermal:Throttling";function Cq(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const l of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[Eq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ru(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function mu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Ru(e,t)}const Vk=["cores","memory","load","thermal"],ba=116,kr=24,Tq=60,Rq=6e4;function Aq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Mq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function Iq(e,t=Tq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function $q({sys:e}){const[t,n]=k.useState({});k.useEffect(()=>{let l=!0;const d=async()=>{const p=await Promise.all(Vk.map(async h=>{try{const g=await fetch(`/api/system/history?group=${h}`);return g.ok?[h,await g.json()]:[h,null]}catch{return[h,null]}}));l&&n(h=>{const g={...h};for(const[w,v]of p)v!=null&&v.ok&&(g[w]=v);return g})};d();const f=setInterval(()=>void d(),Rq);return()=>{l=!1,clearInterval(f)}},[]);const s=k.useMemo(()=>Cq(e),[e]),a=k.useMemo(()=>Vk.flatMap(l=>{const d=t[l];return d?d.series.filter(Aq).map(f=>({series:Iq(f),stepMs:d.stepMs})):[]}),[t]),i=k.useMemo(()=>{let l=1/0,d=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(l=Math.min(l,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(l)?Jv(l,d):"less than a minute"},[a]);return Object.keys(s).length?c.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:l,stepMs:d})=>c.jsx(Oq,{series:l,stepMs:d,now:s[l.key],span:i},l.key))}):null}function Oq({series:e,stepMs:t,now:n,span:s}){var v;const{points:a,top:i,unit:l,warnAt:d,critAt:f}=e,p=Mq(e),h=n??((v=a[a.length-1])==null?void 0:v.v),g=h==null?"":rR(h,d,f),w=Math.max(...a.map(N=>N.v));return c.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${Ru(w,l)} over the last ${s}`,d!=null?`over ${mu(d,l)} is uncomfortable`:"",f!=null?`over ${mu(f,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[c.jsxs("div",{className:"pl-cell-head",children:[c.jsx("span",{className:"pl-cell-label",children:p}),c.jsx("span",{className:"pl-cell-now",children:h==null?"—":Ru(h,l)})]}),c.jsxs("svg",{className:"pl-spark",width:ba,height:kr,viewBox:`0 0 ${ba} ${kr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[c.jsx("line",{className:"pl-spark-floor",x1:0,x2:ba,y1:kr-Ms.b,y2:kr-Ms.b}),c.jsx("path",{className:"pl-spark-area",d:nR(a,ba,t,i,kr,Ms)}),d!=null&&c.jsx("line",{className:"pl-rule warn",x1:0,x2:ba,y1:ir(d,i,kr,Ms),y2:ir(d,i,kr,Ms)}),f!=null&&c.jsx("line",{className:"pl-rule hot",x1:0,x2:ba,y1:ir(f,i,kr,Ms),y2:ir(f,i,kr,Ms)}),c.jsx("path",{className:"pl-spark-line",d:tR(a,ba,t,i,kr,Ms)})]}),c.jsxs("span",{className:"vis-hidden",children:["peak ",Ru(w,l)," over the last ",s,d!=null&&`, uncomfortable over ${mu(d,l)}`,f!=null&&`, the machine acts over ${mu(f,l)}`]})]})}const Pq={key:"cpu",dir:"desc"};function Lq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function qq(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=l.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const d=s(i),f=s(l);return d==null||f==null?d==null?f==null?0:1:-1:n*(d-f)};return[...e].sort((i,l)=>a(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function Dq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Fq=4e3;function zq(){const[e,t]=k.useState(null);return k.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&(l!=null&&l.ok)&&t({procs:l.procs??[],total:l.total??0})}catch{}};s();const a=window.setInterval(s,Fq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Bq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function Uq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Wq({sys:e,onClose:t}){const n=Zt(t),[s,a]=k.useState(Pq),i=zq(),l=i?qq(i.procs,s):null;return Iv.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&c.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("div",{className:"pl-split",children:[c.jsx("div",{className:"pl-body",children:l==null?c.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):l.length===0?c.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):c.jsxs("table",{className:"sd-procs pl-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(Lo,{col:"cpu",label:"cpu",sort:s,onSort:a}),c.jsx(Lo,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:s,onSort:a}),c.jsx(Lo,{col:"threads",label:"threads",sort:s,onSort:a}),c.jsx(Lo,{col:"uptime",label:"up",sort:s,onSort:a}),c.jsx(Lo,{col:"user",label:"user",sort:s,onSort:a}),c.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),c.jsx(Lo,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),c.jsx("tbody",{children:l.map(d=>c.jsxs("tr",{children:[c.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),c.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:Bq(d.rssBytes)}),c.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),c.jsx("td",{className:"sd-num sd-dim",children:Uq(d.uptimeSec)}),c.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),c.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),c.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&c.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),c.jsx($q,{sys:e})]})]})}),document.body)}function Lo({col:e,label:t,note:n,sort:s,onSort:a}){const i=Dq(s,e);return c.jsx("th",{scope:"col","aria-sort":i,children:c.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
|
-
|
|
79
|
-
${n}`:`Sort by ${t}`,onClick:()=>a(Lq(s,e)),children:[t,c.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const Hq=3e3;function Gq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Vq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${Yq(t.lastMs,n)}`:"running at full speed, and never held back"}}function Yq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function dl(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 Kq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function Xq(){const[e,t]=k.useState(null),n=k.useRef(null);return k.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,Hq))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){l();return}i(),a()};return i(),document.addEventListener("visibilitychange",d),()=>{s=!1,l(),document.removeEventListener("visibilitychange",d)}},[]),e}function Yk({usageOpen:e,sub:t,onClose:n,children:s}){return c.jsxs("aside",{className:`sysdetail${e?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[c.jsxs("div",{className:"sd-head",children:[c.jsx("span",{className:"sd-title",children:"This machine"}),t&&c.jsx("span",{className:"sd-sub",children:t}),c.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function Qq({usageOpen:e,onClose:t}){const n=Xq();if(!n||n.cpu==null||!n.memory)return c.jsx(Yk,{usageOpen:e,onClose:t,children:c.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:i,loadavg:l,cores:d,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,w=p==="win32"?"Commit":"Swap",v=a&&a.total>0?a.used/a.total*100:0;return c.jsxs(Yk,{usageOpen:e,sub:`up ${Kq(f)} · ${d} cores`,onClose:t,children:[i&&i.length>0&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:c.jsx(Au,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:c.jsx("div",{className:"sd-cores",style:{"--n":i.length},children:i.map((N,x)=>c.jsx("span",{className:"sd-core",title:`core ${x+1}: ${N}%`,children:c.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,N)/100})`}})},x))})})}),c.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:c.jsxs(Au,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&c.jsx(Gu,{label:"Physical",value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(g)})," of ",dl(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${dl(s.available)} available`}),a&&a.total>0&&c.jsx(Gu,{label:w,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(a.used)})," of ",dl(a.total)]}),pct:v,tone:v>=90?"warn":"calm",note:v>=50?"paging to disk":void 0})]})}),l&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:c.jsxs(Au,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[c.jsx("div",{className:"sd-load",children:l.map((N,x)=>c.jsxs("span",{className:`sd-load-item${N>d?" over":""}`,children:[c.jsx("b",{children:N.toFixed(2)}),c.jsx("span",{children:["1m","5m","15m"][x]})]},x))}),c.jsx("div",{className:"sd-note",children:l[0]>d?`${(l[0]/d).toFixed(1)}× more work queued than cores to run it`:`within ${d} cores`})]})}),c.jsx(Zq,{thermal:h}),c.jsx(Jq,{sys:n})]})}function Au({group:e,title:t,action:n,label:s,children:a}){const[i,l]=k.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[c.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",c.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&c.jsx(Nq,{group:e,title:t,onClose:()=>l(!1)})]})}function Zq({thermal:e}){if(!e)return null;const t=e.throttle?Vq(e.throttle.speedLimit,e.heldBack):null;return c.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:c.jsxs(Au,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>c.jsx(Gu,{label:n.label,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Gq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&c.jsx(Gu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Jq({sys:e}){const[t,n]=k.useState(!1);return c.jsxs("div",{className:"sd-section",children:[c.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:c.jsxs("span",{className:"sd-door-plate",children:[c.jsxs("span",{className:"sd-door-name",children:["Busiest processes",c.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),c.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&c.jsx(Wq,{sys:e,onClose:()=>n(!1)})]})}function Gu({label:e,value:t,pct:n,tone:s="calm",note:a}){return c.jsxs("div",{className:"sd-row",children:[c.jsxs("div",{className:"sd-row-head",children:[c.jsx("span",{className:"sd-row-label",children:e}),c.jsx("span",{className:"sd-row-val",children:t})]}),c.jsx("span",{className:"sd-track",children:c.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&c.jsx("div",{className:"sd-note",children:a})]})}const Kk=18,eD=1100,qo=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},tD=Array.from({length:Kk},(e,t)=>{const n=-72+144*t/(Kk-1)+(qo(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+qo(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+qo(t,3)*260),delay:Math.round(qo(t,4)*90),dur:760+Math.round(qo(t,5)*260),scale:.8+qo(t,6)*.45,hue:t%4,round:t%3===0}});function Xk({anchor:e}){var a;const[t,n]=k.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return k.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const d=window.setTimeout(()=>n(null),eD);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:Iv.createPortal(c.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:tD.map((i,l)=>c.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const sR=new Set(["awaiting_url","awaiting_code","registering"]);function nD(e){return e!=null&&sR.has(e)}function aR(e){return e!=null&&e!=="done"&&!sR.has(e)}const rD="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",sD="the sign-in did not complete";function aD({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?rD:sD)}}const oD="done";function iD(){let e=!1;return{shouldAnnounce(t){return t!==oD?(e=!1,!1):e?!1:(e=!0,!0)}}}function e0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const lD={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},cD={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"},uD=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function gv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Qo(e)))return uD;const n=e0(cD,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Qo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const dD={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"},hD="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 fD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const pD="ccusage could not be started — the deck launched npx and Node could not load the npm script it points at. An older deck asked cmd.exe for a bare npx.cmd, which made the shim look for that script under the deck's working directory instead of beside itself; update the deck and reopen this modal",mD="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",gD=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),yD=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,wD=/[\\/]_npx[\\/]/i,vD=`the copy of ccusage ${zt} installed for itself`;function xD(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function bD(e,t){const n=kD(e,t),s=xD(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${hl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${hl(n)}`;case"managed":return`${vD} failed to run: ${hl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${hl(n)}`:`the ccusage this deck found on your PATH failed to run: ${hl(n)}`;default:return n}}const hl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function kD(e,t){const n=Qo(e);if(gD(n)){if(wD.test(n))return mD;if(yD.test(n))return pD}if(fD(n))return hD;const s=e0(dD,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Bo(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&aR(e.state))return e.error;const n=e0(lD,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function _D(e,t,n){if(n<=0||Kv(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function oR(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 SD(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function ND(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 jD(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 ED(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const d=n("present");d&&s.push(`${d} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const CD=1500,gu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Qk="aa-panel",Zk=e=>`aa-tab-${e}`;async function fl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const yv=he.forwardRef((e,t)=>c.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[c.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),c.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));yv.displayName="SuccessMark";function TD({onClose:e,onChanged:t}){const[n,s]=k.useState("login"),[a,i]=k.useState(null),[l,d]=k.useState(""),[f,p]=k.useState(""),[h,g]=k.useState(!1),[w,v]=k.useState(null),[N,x]=k.useState(null),[S,_]=k.useState(null),[j,E]=k.useState(null),C=k.useRef(""),A=k.useRef(!1),O=k.useRef(!1),$=k.useRef(null),z=k.useRef(null),P=k.useRef(null),M=k.useRef(null),F=k.useRef([]),H=k.useRef(!1),Z=k.useCallback(()=>{A.current&&fl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=Zt(Z,{focusRef:P}),Q=k.useCallback(async()=>{if(!cr(O.current))return;O.current=!0,g(!0),v(null),A.current=!0;const I=await fl({action:"login"}).catch(()=>null);if(O.current=!1,g(!1),!(I!=null&&I.ok)){v(Bo(I,"could not start the sign-in"));return}i(I)},[]);k.useEffect(()=>{if(!nD(a==null?void 0:a.state))return;const I=window.setInterval(async()=>{try{const X=await fetch("/api/claude-accounts/login");X.ok&&i(await X.json())}catch{}},CD);return()=>window.clearInterval(I)},[a]);const B=k.useRef(t);B.current=t;const te=k.useState(iD)[0];k.useEffect(()=>{var I;(a==null?void 0:a.state)==="awaiting_code"&&((I=$.current)==null||I.focus()),te.shouldAnnounce(a==null?void 0:a.state)&&B.current()},[a==null?void 0:a.state,te]),k.useEffect(()=>{var I;n==="paste"&&!H.current&&((I=z.current)==null||I.focus()),H.current=!1},[n]);const J=k.useCallback(I=>{var U;const X=_D(I,gu.findIndex(oe=>oe.id===n),gu.length);X.kind!=="pass"&&(I.preventDefault(),H.current=!0,s(gu[X.index].id),(U=F.current[X.index])==null||U.focus())},[n]),q=k.useCallback(async()=>{var X;if(!cr(O.current))return;O.current=!0,g(!0),v(null);const I=await fl({action:"login-code",code:l}).catch(()=>null);if(O.current=!1,g(!1),!(I!=null&&I.ok)){v(Bo(I,"the code was not accepted")),I!=null&&I.state&&i(I),(X=$.current)==null||X.select();return}d(""),i(I)},[l,a]),Y=k.useCallback(async()=>{if(!cr(O.current))return;O.current=!0,g(!0),v(null);const I=await fl({action:"import",blob:f}).catch(()=>null);if(O.current=!1,g(!1),!(I!=null&&I.ok)){v(Bo(I,"the import failed"));return}C.current=f,p(""),E(null),x(I.results??[]),t()},[f,t]),L=k.useCallback(async I=>{const X=`${I.email}|${I.org??""}`;if(!cr(O.current)||!C.current)return;O.current=!0,g(!0),_(X),E(null);const U=await fl({action:"import",blob:C.current,force:!0,only:{email:I.email,org:I.org??""}}).catch(()=>null);if(O.current=!1,g(!1),_(null),!(U!=null&&U.ok)){E({key:X,text:Bo(U,"that account could not be updated")});return}const oe=(U.results??[])[0];oe&&x(fe=>fe&&fe.map(me=>`${me.email}|${me.org??""}`===X?oe:me)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,de=aR(a==null?void 0:a.state)||!!(w&&A.current&&!h),G=aD({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:w});return c.jsx("div",{className:"modal-backdrop",onClick:Z,role:"presentation",children:c.jsxs("div",{ref:R,className:"modal aa-modal",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:J,children:gu.map((I,X)=>c.jsx("button",{type:"button",role:"tab",id:Zk(I.id),ref:U=>{F.current[X]=U},"aria-selected":n===I.id,"aria-controls":Qk,tabIndex:n===I.id?0:-1,className:`aa-tab${n===I.id?" on":""}`,onClick:()=>{H.current=!1,s(I.id)},children:I.label},I.id))})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:Z,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body aa-body",id:Qk,role:"tabpanel","aria-labelledby":Zk(n),children:n==="login"?K?c.jsxs("div",{className:"aa-done",children:[c.jsx(yv,{ref:M}),c.jsx(Xk,{anchor:M}),c.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),c.jsxs("p",{className:"aa-note",children:[c.jsx("strong",{children:K.email}),K.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),c.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"1 · Approve in the browser"}),c.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),c.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),c.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."}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:$,type:"text",value:l,onChange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&l.trim()&&!h&&q()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),c.jsx("button",{type:"button",className:"btn primary",...lr(h,!l.trim()||a.state==="registering"),onClick:q,children:a.state==="registering"?"registering…":"Continue"})]}),(w||a.error)&&c.jsx("p",{className:"aa-err",children:w??a.error}),c.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."})]})]}):de?c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:G.title}),c.jsx("p",{className:"aa-err",children:G.message}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{A.current=!1,i(null),v(null),Q()},children:"Try again"})]}):h||A.current?c.jsx("div",{className:"aa-step",children:c.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):c.jsxs("div",{className:"aa-step aa-primer",children:[c.jsx("h4",{children:"Sign in to Anthropic"}),c.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."}),c.jsx("div",{className:"aa-actions",children:c.jsx("button",{type:"button",ref:P,className:"btn primary",onClick:Q,children:"Open the sign-in page"})})]}):N?(()=>{const I=N.filter(X=>X.state==="imported").length;return c.jsxs("div",{className:"aa-done",children:[c.jsx(yv,{ref:M}),I>0&&c.jsx(Xk,{anchor:M}),c.jsx("h4",{children:ED(N)}),N.length>0&&c.jsx("ul",{className:"aa-results",children:N.map(X=>{const U=`${X.email}|${X.org??""}`;return c.jsxs("li",{className:`aa-result ${X.state}`,children:[c.jsx("span",{className:"aa-result-who",children:X.email||(X.num?`slot ${X.num}`:"an account")}),c.jsx("span",{className:"aa-result-what",children:jD(X.state)}),X.state==="present"&&c.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===U,title:`Overwrite the stored login for ${X.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>L(X),children:S===U?"updating…":"update anyway"}),(j==null?void 0:j.key)===U&&c.jsx("span",{className:"aa-result-err",children:j.text})]},U)})}),c.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",c.jsx("strong",{children:" update anyway"}),"."]}),c.jsxs("div",{className:"aa-actions",children:[c.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),x(null)},children:"Import another"})]})]})})():c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"Paste an account shared from another deck"}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:z,type:"text",value:f,onChange:I=>p(I.target.value),onKeyDown:I=>{I.key==="Enter"&&f.trim()&&!h&&Y()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),c.jsx("button",{type:"button",className:"btn primary",...lr(h,!f.trim()),onClick:Y,children:h?"importing…":"Import"})]}),w&&c.jsx("p",{className:"aa-err",children:w}),c.jsxs("p",{className:"aa-note",children:["Use ",c.jsx("strong",{children:"share"})," on one account in the other deck, or ",c.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function RD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const AD=1800;function MD({accounts:e,onClose:t,copyText:n}){const[s,a]=k.useState([]),[i,l]=k.useState(null),[d,f]=k.useState(!1),[p,h]=k.useState(null),[g,w]=k.useState(!1),[v,N]=k.useState(()=>Math.floor(Date.now()/1e3)),x=k.useRef(null),S=k.useRef(!1),_=Zt(t,{focusRef:x});k.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const M=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(M)},[i]);const j=SD(e),E=e.filter(M=>!s.includes(M.num)).map(M=>M.num),C=E.length===e.length,A=M=>a(F=>F.includes(M)?F.filter(H=>H!==M):[...F,M]),O=k.useCallback(async()=>{if(!cr(S.current)||!E.length)return;S.current=!0,f(!0),h(null),w(!1);const M=await RD({action:"share",accounts:E}).catch(()=>null);if(S.current=!1,f(!1),!(M!=null&&M.ok)){h(Bo(M,"the share could not be made"));return}l({blob:M.blob,expiresAt:M.expiresAt,shared:M.shared??[],failed:M.failed??[]})},[e,E]),$=i?oR(i.expiresAt,v):null,z=($==null?void 0:$.tone)==="gone",P=(i==null?void 0:i.shared.length)??0;return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:_,className:"modal sa-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("h3",{children:"Share accounts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body sa-body",children:i?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:z?"This share has expired":P===1?"1 account, ready to paste":`${P} accounts, ready to paste`}),c.jsx("code",{className:`ap-share-blob${z?" sa-dead":""}`,children:i.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",ref:x,onClick:async()=>{if(z){l(null),O();return}await n(i.blob)&&(w(!0),window.setTimeout(()=>w(!1),AD))},children:z?"make a new share":g?"copied":`copy ${P===1?"the share":"all "+P}`}),c.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:[c.jsx("span",{className:"ap-share-warn",children:P===1?"this is the password":`this is ${P} passwords`})," · ",c.jsx("span",{className:`ap-share-expiry ${$==null?void 0:$.tone}`,children:$==null?void 0:$.text})]})]}),i.failed.length>0&&c.jsxs("div",{className:"sa-failed",role:"alert",children:[c.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),c.jsx("ul",{className:"sa-list",children:i.failed.map(M=>{var H;const F=!!(M.email&&((H=M.detail)!=null&&H.includes(M.email)));return c.jsxs("li",{children:[!F&&c.jsx("span",{className:"sa-who",children:M.email||`account ${M.num}`}),c.jsx("span",{className:"sa-why",children:M.detail||"could not be exported"})]},`${M.num}-${M.email}`)})})]}),c.jsx("p",{className:"sa-note",children:z?c.jsx(c.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):c.jsxs(c.Fragment,{children:["Paste it into the other deck with ",c.jsx("strong",{children:"+"})," → ",c.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),w(!1)},children:"Pick again"}),c.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:"Nothing to share"}),c.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",c.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),c.jsx("div",{className:"sa-actions",children:c.jsx("button",{type:"button",className:"btn primary",ref:x,onClick:t,children:"Close"})})]}):c.jsxs("div",{className:"sa-step",children:[c.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),c.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:ND(E.length)}),c.jsx("ul",{className:"sa-list sa-pick",children:j.map(M=>c.jsx("li",{children:c.jsxs("label",{className:"sa-row",children:[c.jsx("input",{type:"checkbox",checked:E.includes(M.num),onChange:()=>A(M.num)}),c.jsx("span",{className:"sa-who",children:M.label}),M.sub&&c.jsx("span",{className:"sa-sub",children:M.sub})]})},M.num))}),p&&c.jsx("p",{className:"aa-err",children:p}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(M=>M.num):[]),children:C?"Clear all":"Select all"}),c.jsx("button",{type:"button",className:"btn primary",ref:x,...lr(d,!E.length),onClick:O,children:d?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})})}function ID(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function $D(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:a&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:s,displaced:t}:null}}function OD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function PD(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function LD(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 Jk(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function e1(e){const t=e.filter(d=>!Jk(d)),n=e.filter(d=>Jk(d)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((d,f)=>d&&d.pct>=f.pct?d:f,null);let l=null;for(const d of a)i&&d.pct<=i.pct||(!l||d.pct>l.pct)&&(l=d);return{shown:s,rest:a,fuller:l,peak:l??i}}function qD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function DD(e,t,n,s){const a=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,i=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${i}.`}const FD="\0";function t0(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}${FD}${n}`}function zD(e,t){const n=t0(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function BD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(t0)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const UD=64;function WD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const HD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function t1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function GD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Qo(t.body);return{text:gv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function n1(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}async function kf(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const VD={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."},YD={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function r1(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||an(n,t)}function KD({status:e,manual:t,onClose:n,onChanged:s}){var te,J;const a=k.useRef(null),i=Zt(n,{focusRef:a}),[l,d]=k.useState(""),[f,p]=k.useState(""),[h,g]=k.useState(null),[w,v]=k.useState(null),[N,x]=k.useState(null),[S,_]=k.useState(null),[j,E]=k.useState(()=>Date.now());k.useEffect(()=>{const q=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval(q)},[]);const C=k.useRef(!0);k.useEffect(()=>()=>{C.current=!1},[]);const A=k.useRef(null),O=k.useCallback(q=>ld(A.current)?(A.current=q,x(q),!0):!1,[]),$=k.useCallback(()=>{A.current=null,C.current&&x(null)},[]),z=q=>{const Y=Ra(N,q);return{disabled:Y.disabled,"aria-busy":Y.busy}},P=q=>(h==null?void 0:h.field)===q?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},M=q=>g(Y=>Y&&Y.field===q?null:Y),F=k.useCallback(async()=>{const q=n5(l);if(!q){g({text:XD(l),field:"addr"});return}const Y=`${q.addr}:${q.port}`,L=e.peers.find(K=>K.addr===q.addr&&K.port===q.port&&K.paired);if(L){g({text:`Already paired with ${L.name} at that address.`,field:"addr"});return}if(t.includes(Y)){g({text:"This deck already calls that address.",field:"addr"});return}if(O("add"))try{const K=await kf("/api/prefs",{lan:{manual:[...t,Y]}});if(!C.current)return;K!=null&&K.ok?(g(null),d(""),s(),n()):g({text:an("add that address",K),field:"addr"})}catch{C.current&&g({text:an("add that address",null),field:"addr"})}finally{$()}},[l,t,e.peers,s,n,O,$]),H=k.useCallback(async q=>{if(!O(`invite:${q}`))return;const Y=q==="make"?"make an invite":"cancel that invite";try{const L=await kf("/api/lan/invite",{action:q});if(!C.current)return;L!=null&&L.ok?(g(null),v(null),s()):g({text:r1(YD,L,Y)})}catch{C.current&&g({text:an(Y,null)})}finally{$()}},[s,O,$]),Z=k.useCallback(async()=>{const q=f.trim();if(!(!q||!O("join"))){_(null);try{const Y=await kf("/api/lan/invite",{action:"join",token:q});if(!C.current)return;Y!=null&&Y.ok?(p(""),g(null),s(),n()):(Y==null?void 0:Y.reason)==="unreachable"&&Array.isArray(Y.tried)&&Y.tried.length?(_(Y.tried),g(null)):(_(null),g({text:r1(VD,Y,"use that invite"),field:"join"}))}catch{C.current&&g({text:an("use that invite",null),field:"join"})}finally{$()}}},[f,s,n,O,$]),R=k.useCallback(async(q,Y)=>{try{await navigator.clipboard.writeText(q),v(Y),window.setTimeout(()=>{C.current&&v(L=>L===Y?null:L)},1600)}catch{g({text:"Could not copy it — select the text and copy it by hand."})}},[]),Q=e.invite&&e.invite.expiresAt>j?e.invite:null,B=((te=e.reach)==null?void 0:te.steps)??[];return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal lan-add",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[h&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>g(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),((J=e.reach)==null?void 0:J.blocked)&&c.jsxs("div",{className:"ap-lan-reach",children:[c.jsx("p",{className:"lan-warn",children:e.reach.text}),c.jsx("p",{className:"lan-note",children:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."}),B.length>0&&c.jsxs("details",{className:"ap-lan-reach-fix",children:[c.jsx("summary",{children:"or let them find this deck on their own"}),c.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",c.jsx("strong",{children:"as Administrator"}),", then restart the deck.",e.reach.category==="Public"&&c.jsx(c.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),c.jsx("pre",{className:"ap-lan-cmd",children:c.jsx("code",{children:B.join(`
|
|
80
|
-
`)})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...z("copy:fix"),onClick:()=>void R(B.join(`
|
|
81
|
-
`),"fix"),title:"Copy these lines, then paste them into an elevated PowerShell",children:w==="fix"?"copied":"copy command"})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"By address"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:l,placeholder:"192.168.1.5:54340",spellCheck:!1,...P("addr"),onChange:q=>{d(q.target.value),M("addr")},onKeyDown:q=>{q.key==="Enter"&&F()}}),l.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("add"),onClick:()=>void F(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),c.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."})]}),c.jsxs("div",{className:"modal-section",children:[c.jsxs("h3",{className:"lan-h",children:["With an invite",!Q&&c.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...z("invite:make"),onClick:()=>void H("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:N==="invite:make"?"making…":"make one to send"})]}),c.jsxs("div",{className:"ap-lan-row",children:[c.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,...P("join"),onChange:q=>{p(q.target.value),_(null),M("join")},onKeyDown:q=>{q.key==="Enter"&&Z()}}),f.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...z("join"),onClick:()=>void Z(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:N==="join"?"joining…":"join"})]}),c.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),S&&c.jsxs("div",{className:"ap-lan-tried",children:[c.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(q=>c.jsxs("span",{className:"ap-lan-tried-row",children:[c.jsx("code",{className:"ap-lan-code",children:q.addr}),c.jsx("span",{className:"ap-lan-bad",children:q.why})]},q.addr))]}),Q&&c.jsxs("div",{className:"ap-lan-invite",children:[c.jsxs("div",{className:"ap-lan-invite-head",children:[c.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),c.jsxs("span",{className:"ap-lan-invite-left",children:[s5(Q.expiresAt,j)," left"]})]}),c.jsx("code",{className:"ap-lan-token",children:Q.token}),c.jsxs("div",{className:"ap-lan-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...z("copy:invite"),onClick:()=>void R(Q.token,"invite"),title:"Copy it, and send it however you already talk to them",children:w==="invite"?"copied":"copy"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...z("invite:withdraw"),onClick:()=>void H("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),c.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})})}function XD(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}".`}function QD({status:e,accounts:t,onClose:n,onChanged:s}){const a=Zt(n),[i,l]=k.useState(null),[d,f]=k.useState(null),[p,h]=k.useState(null),g=k.useRef(null),w=E=>{const C=Ra(p,E);return{disabled:C.disabled,"aria-busy":C.busy}},v=k.useRef(null),N=k.useRef(!0);k.useEffect(()=>()=>{N.current=!1},[]),k.useEffect(()=>{v.current&&r5(v.current,e.shared??[])&&(v.current=null)},[e.shared]);const x=k.useCallback(async(E,C,A="write")=>{g.current=A,h(A);try{const $=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:E})})).json().catch(()=>null);return N.current?($!=null&&$.ok?f(null):f(an(C,$)),s(),($==null?void 0:$.ok)===!0):!1}catch{return N.current&&f(an(C,null)),!1}finally{g.current=null,N.current&&h(null)}},[s]),S=new Set(v.current??e.shared??[]),_=e.autoAsk!==!1,j=e.autoAccept!==!1;return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal lan-modal",onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[d&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:d}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Name"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"appear as"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:E=>l(E.target.value),onKeyDown:E=>{E.key!=="Enter"||i==null||(x({name:i},"save the name","name"),l(null))}}),i!=null&&i!==(e.name??"")&&c.jsx("button",{type:"button",className:"ap-manage-btn",...w("name"),onClick:()=>{x({name:i},"save the name","name"),l(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Share these accounts"}),c.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&c.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(E=>c.jsxs("label",{className:"ap-lan-pick",title:E.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:[c.jsx("input",{type:"checkbox",checked:S.has(E.key),onChange:C=>{const A=new Set(v.current??e.shared??[]);C.target.checked?A.add(E.key):A.delete(E.key),v.current=[...A],x({shared:[...A]},C.target.checked?"share that account":"stop sharing that account")}}),c.jsx("span",{className:"ap-lan-pick-name",children:E.email}),!E.alive&&c.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},E.key))]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Pairing"}),c.jsxs("div",{className:"lan-switches",children:[c.jsxs("div",{className:"lan-switch",children:[c.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),c.jsx("button",{type:"button",className:`ap-auto-state${_?" live":""}`,role:"switch","aria-checked":_,"aria-label":"Ask every deck this one finds",...w("ask"),onClick:()=>void x({autoAsk:!_},_?"stop asking automatically":"ask every deck this one finds","ask"),title:_?"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."})]}),c.jsxs("div",{className:"lan-switch",children:[c.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),c.jsx("button",{type:"button",className:`ap-auto-state${j?" live":""}`,role:"switch","aria-checked":j,"aria-label":"Say yes to every deck that asks",...w("accept"),onClick:()=>void x({autoAccept:!j},j?"stop accepting automatically":"accept every deck that asks","accept"),title:j?"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."})]})]}),j?null:_?c.jsx("p",{className:"lan-note",children:"This deck asks; somebody on the other machine still has to say yes. A request coming the other way waits in the panel for you."}):c.jsxs("p",{className:"lan-note",children:["Nothing pairs on its own. You press ",c.jsx("strong",{children:"ask"})," on a deck you find, and ",c.jsx("strong",{children:"accept"})," on one that asks. A deck you said no to is never asked about again either way."]})]})]})]})})}function Ea(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const s=Math.round(n/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const n0={"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"}},ZD={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 JD(e){var s;const t=e5[e];if(t)return t;const n=(s=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:s[1];return n&&ZD[n]||e}const e5={"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 t5(e,t){if(!e)return null;if(e.error)return n0[e.error]??{text:JD(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Ea(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Ea(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Ea(e.at,t)}`,tone:"bad"}}const wv=5e3,iR=6e4;function n5(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const s=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!s||!Number.isInteger(a)||a<1||a>65535||s.includes(":")&&!(s.startsWith("[")&&s.endsWith("]"))?null:{addr:s,port:a}}function an(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 r5(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function s5(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function lR(e,t){var n,s;return(n=e.last)!=null&&n.error&&!n0[e.last.error]?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Vu||e.lastSeen!=null&&t-e.lastSeen<Vu)}const Vu=95e3;function a5(e,t){const n=[],s=[];for(const a of e??[])(lR(a,t)?n:s).push(a);return{online:n,offline:s}}function o5(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const s=(e.peers??[]).filter(v=>v.paired!==!1||v.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(v=>v.waiting),i=s.filter(v=>!v.waiting),l=a.filter(v=>{var N;return!((N=v.last)!=null&&N.error)&&v.lastSeen!=null&&t-v.lastSeen<Vu}),{online:d,offline:f}=a5(i,t),p=[...f,...a.filter(v=>!l.includes(v))],h=d.length+l.length,g=d.filter(v=>{var N;return((N=v.last)==null?void 0:N.error)==="waiting for the other deck to accept this one"});if(h&&g.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const w=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${w} · ${p.length} away`:w,tone:"ok"}}function i5(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const s=Ea(e,t);return s==="now"?"checked just now":`checked ${s}`}function cR(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const s=Math.round(n/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}function l5(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<Vu;return{text:n?"online · one-way, it calls in":`one-way · last online ${Ea(e,t)}`,here:n}}function s1(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Ea(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function c5(e,t){var h,g,w,v,N;if(!e)return[];const n=[],s=new Set,a=(x,S)=>x.name.localeCompare(S.name,void 0,{numeric:!0});for(const x of e.pending??[])!(x!=null&&x.fp)||s.has(x.fp)||(s.add(x.fp),n.push({fp:x.fp,name:x.name||x.fp,addr:x.addr??"",kind:"asks",state:`wants to pair · ${cR(x.at,t)}`,tone:"wait",here:!0,hint:`${x.name||x.fp} at ${x.addr} is waiting for an answer.`}));const i=[],l=[];for(const x of e.peers??[]){const S=x.peerFp??x.fp;if(!S||s.has(S))continue;s.add(S);const _=t5(x.last,t),j=lR(x,t),E=x.addr?`${x.addr}:${x.port}`:"";if(!x.paired&&x.manual&&!x.met){l.push({fp:E,name:E||x.name||S,addr:x.addr??"",kind:"dialling",state:_?_.text.replace(/ · .*$/,""):"trying…",tone:_?_.tone:"idle",here:!1,hint:(h=x.last)!=null&&h.error?`Nothing has answered at ${E} yet — ${x.last.error}.`:`Dialling ${E} until something answers.`});continue}const C=x.waiting?l5(x.lastSeen,t):null,A=C?C.here:j,O=!C&&_?A?`online · ${_.text.replace(/ · .*$/,"")}`:`${_.text.replace(/ · .*$/,"")} · ${s1(x,A,t)}`:C?C.text:s1(x,A,t),$=(g=x.last)!=null&&g.error?n0[x.last.error]:null,z=!C&&A&&!((w=x.last)!=null&&w.error)&&!(((v=x.last)==null?void 0:v.done)??[]).length;i.push({fp:S,name:x.manual&&!x.met?E:x.name||S,addr:x.addr??"",kind:"paired",state:O,quiet:z,tone:$?$.tone==="bad"?"bad":"wait":_?_.tone:A?"ok":"idle",here:C?C.here:j,hint:C?`${x.name||S} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. ${x.lastSeen==null?"It has not called since this deck started.":`It last called ${Ea(x.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${x.name||S}${E?` at ${E}`:""}${(N=x.last)!=null&&N.error?` — ${x.last.error}`:""}`})}n.push(...i.sort(a),...l.sort(a));const d=[];for(const x of e.strangers??[])!(x!=null&&x.fp)||s.has(x.fp)||(s.add(x.fp),d.push({fp:x.fp,name:x.name||x.fp,addr:x.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${x.name||x.fp} at ${x.addr} is on this network and nothing is shared with it.`}));n.push(...d.sort(a));const f=[];for(const x of e.declined??[])!(x!=null&&x.fp)||s.has(x.fp)||(s.add(x.fp),f.push({fp:x.fp,name:x.name||x.fp,addr:x.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${x.name||x.fp} asked and was turned away. It is not asking any more.`}));n.push(...f.sort(a));const p=new Map;for(const x of n)p.set(x.name,(p.get(x.name)??0)+1);for(const x of n)(p.get(x.name)??0)<2||!x.addr||(x.state=x.quiet||!x.state?x.addr:`${x.addr} · ${x.state}`,x.quiet=!1);return n}async function yu(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function u5({accounts:e,onChanged:t}){const[n,s]=k.useState(null),[a,i]=k.useState([]),[l,d]=k.useState(null),[f,p]=k.useState(!1),[h,g]=k.useState(null),[w,v]=k.useState(!1),[N,x]=k.useState(!1),[S,_]=k.useState(null),j=k.useRef(null),E=k.useCallback(I=>ld(j.current)?(j.current=I,d(I),!0):!1,[]),C=k.useCallback(()=>{j.current=null,z.current&&d(null)},[]),A=I=>{const X=Ra(l,I);return{disabled:X.disabled,"aria-busy":X.busy}},[O,$]=k.useState(()=>Date.now()),z=k.useRef(!0),P=k.useRef(wv),M=k.useCallback(async()=>{var I,X;try{const[U,oe]=await Promise.all([fetch("/api/lan").then(fe=>fe.json()),fetch("/api/prefs").then(fe=>fe.json())]);if(!z.current)return;U!=null&&U.ok&&s(U),oe!=null&&oe.ok&&i(Array.isArray((X=(I=oe.prefs)==null?void 0:I.lan)==null?void 0:X.manual)?oe.prefs.lan.manual:[]),P.current=(U==null?void 0:U.enabled)===!0?wv:iR}catch{}},[]);k.useEffect(()=>{z.current=!0;let I=0;const X=async()=>{$(Date.now()),await M(),z.current&&(I=window.setTimeout(X,P.current))};return X(),()=>{z.current=!1,window.clearTimeout(I)}},[M]);const F=k.useCallback(async()=>{const I=(n==null?void 0:n.enabled)===!0;if(E("switch"))try{const X=await yu("/api/prefs",{lan:{enabled:!I}});if(!z.current)return;X!=null&&X.ok?(_(null),I||p(!0)):_(an(I?"turn this off":"turn this on",X)),await M()}catch{z.current&&_(an(I?"turn this off":"turn this on",null))}finally{C()}},[n==null?void 0:n.enabled,M,E,C]),H=k.useCallback(async(I,X,U)=>{if(E(`${I}:${X}`))try{const oe=await yu("/api/lan/peer",{action:I,fp:X});if(!z.current)return;oe!=null&&oe.ok?(s(oe),_(null)):_(an(U,oe)),await M()}catch{z.current&&_(an(U,null))}finally{C()}},[M,E,C]),Z=k.useCallback(async I=>{if(E(`drop:${I}`))try{const X=await yu("/api/prefs",{lan:{manual:a.filter(U=>U!==I)}});if(!z.current)return;X!=null&&X.ok?(_(null),t()):_(an("stop dialling that address",X)),await M()}catch{z.current&&_(an("stop dialling that address",null))}finally{C()}},[a,M,t,E,C]),R=k.useCallback(async()=>{if(E("check"))try{const I=await yu("/api/lan/sync",{});if(!z.current)return;I!=null&&I.ok?(s(I),_(null)):_(an("check the other decks",I)),t()}catch{z.current&&_(an("check the other decks",null))}finally{C()}},[E,C,t]),Q=(n==null?void 0:n.enabled)===!0,B=c5(n,O),te=B.filter(I=>I.kind==="asks"),J=B.filter(I=>I.kind!=="asks"),q=J.filter(I=>I.here),Y=J.filter(I=>!I.here),L=Y.filter(I=>I.tone==="bad").length,K=N||q.length===0,de=o5(n,O),G=J.filter(I=>I.kind==="paired").length;return c.jsxs("div",{className:"ap-auto ap-lan",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Local network"}),Q&&c.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>v(!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:c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:c.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),Q&&G>0&&c.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...A("check"),onClick:()=>void R(),"aria-label":l==="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:c.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:[c.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),c.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),Q&&c.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...A("setup"),onClick:()=>p(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),c.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),c.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),c.jsx("button",{type:"button",className:`ap-auto-state${Q?" live":""}`,role:"switch","aria-checked":Q,"aria-label":"Local network sync",...A("switch"),onClick:()=>void F(),title:Q?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins"})]}),!Q&&c.jsx("p",{className:"ap-auto-note",children:"Paired decks repair each other's expired logins."}),c.jsx("p",{className:`ap-lan-status ${de.tone}`,role:"status",children:de.tone==="ok"?"":de.text}),S&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:S}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>_(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),Q&&c.jsxs(c.Fragment,{children:[te.length>0&&c.jsx("div",{className:"ap-lan-asks",role:"alert",children:te.map(I=>c.jsxs("div",{className:"ap-lan-ask",children:[c.jsxs("span",{className:"ap-lan-ask-what",children:[c.jsx("strong",{className:"ap-lan-peer-name",children:I.name})," at ",c.jsx("code",{className:"ap-lan-code",children:I.addr})," wants to pair"]}),c.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",c.jsx("code",{className:"ap-lan-code",children:I.fp})]}),c.jsxs("span",{className:"ap-lan-ask-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...A(`accept:${I.fp}`),onClick:()=>void H("accept",I.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${I.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...A(`dismiss:${I.fp}`),onClick:()=>void H("dismiss",I.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},I.fp))}),(K?[...q,...Y]:q).length>0&&c.jsx("ul",{className:"ap-lan-here",children:(K?[...q,...Y]:q).map(I=>c.jsxs("li",{className:"ap-lan-who","data-tone":I.tone,title:I.hint,children:[c.jsx("i",{className:I.here?"ap-pulse":"ap-dot","aria-hidden":!0}),c.jsx("span",{className:"ap-lan-who-name",children:I.name}),c.jsx("span",{className:I.quiet?"vis-hidden":"ap-lan-who-when",children:I.state}),I.kind==="nearby"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...A(`accept:${I.fp}`),onClick:()=>void H("accept",I.fp,"reach that deck"),"aria-label":`Ask ${I.name} to pair`,title:`Send ${I.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${I.fp}.`,children:"ask"}),I.kind==="paired"&&c.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${h===I.fp?" armed":""}`,...A(`unpair:${I.fp}`),onClick:()=>{if(h!==I.fp){g(I.fp),window.setTimeout(()=>g(X=>X===I.fp?null:X),4e3);return}g(null),H("unpair",I.fp,"unpair that deck")},"aria-label":h===I.fp?`Confirm unpairing ${I.name}`:`Unpair ${I.name}`,title:h===I.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:h===I.fp?"sure?":"unpair"}),I.kind==="dialling"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...A(`drop:${I.fp}`),onClick:()=>void Z(I.fp),"aria-label":`Stop dialling ${I.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),I.kind==="declined"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...A(`allow:${I.fp}`),onClick:()=>void H("allow",I.fp,"let that deck ask again"),"aria-label":`Let ${I.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${I.kind}:${I.fp}`))}),(q.length>0&&Y.length>0||Q&&G>0)&&c.jsxs("div",{className:"ap-lan-tail",children:[q.length>0&&Y.length>0&&c.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":N,onClick:()=>x(I=>!I),title:N?"Show only the decks that are on":`Show the ${Y.length} deck${Y.length===1?"":"s"} that are not answering right now`,children:[c.jsx("span",{className:`ap-lan-chev${N?" open":""}`,"aria-hidden":!0,children:"›"}),N?"fewer":`${Y.length} more`,!N&&L>0&&c.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",L," not answering"]})]}),Q&&G>0&&c.jsx("span",{className:"ap-lan-checked",children:i5(n==null?void 0:n.checkedAt,O,l==="check")})]}),J.length===0&&te.length===0&&c.jsxs("p",{className:"ap-lan-fine",children:["No other deck yet. Decks on one network usually find each other on their own; when that has not happened, ",c.jsx("strong",{children:"+"})," at the top of this section reaches one by address or by invite."]})]}),w&&n&&c.jsx(KD,{status:n,manual:a,onClose:()=>v(!1),onChanged:()=>{M(),t()}}),f&&n&&c.jsx(QD,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{M(),t()}})]})}const a1=15e3,d5=8e3,_f=1800,h5=3e4,f5=[70,80,85,90,95];function o1(e,t){return XT(t-Math.floor(e/1e3))}function p5(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 m5(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 i1(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 l1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",a=e.resetAt?QT(e.resetAt,t):null;return c.jsxs("div",{className:"ap-lane",children:[c.jsx("span",{className:"ap-lane-label",children:e.label}),c.jsx("div",{className:"ap-lane-track",children:c.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),c.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),c.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function c1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function g5({onClose:e}){var ve,Pe,Ue,ot,$e;const[t,n]=k.useState(null),[s,a]=k.useState(null),[i,l]=k.useState(null),[d,f]=k.useState(!1),[p,h]=k.useState(null),[g,w]=k.useState(()=>Math.floor(Date.now()/1e3)),v=k.useRef(null),[N,x]=k.useState(null),[S,_]=k.useState(!1),[j,E]=k.useState(""),[C,A]=k.useState(null),[O,$]=k.useState(null),[z,P]=k.useState(null),[M,F]=k.useState(!1),[H,Z]=k.useState(!1),[R,Q]=k.useState(null),[B,te]=k.useState(null),[J,q]=k.useState(null),[Y,L]=k.useState(null),[K,de]=k.useState(!1),[G,I]=k.useState([]),X=k.useRef(null),U=k.useCallback(re=>ld(X.current)?(X.current=re,l(re),!0):!1,[]),oe=k.useCallback(()=>{X.current=null,l(null)},[]),fe=(re,Se=!1)=>{const De=Ra(i,re);return{disabled:De.disabled,"aria-busy":De.busy||Se}},me=k.useCallback(re=>{window.requestAnimationFrame(()=>{var Se;if(iq(((Se=document.activeElement)==null?void 0:Se.tagName)??null))for(const De of oq(re)){const _e=document.querySelector(De);if(_e){_e.focus();return}}})},[]),ke=k.useCallback(async(re=!1)=>{re&&f(!0);const Se=new AbortController,De=window.setTimeout(()=>Se.abort(),h5);try{const[_e,Be]=await Promise.all([fetch(`/api/claude-accounts${re?"?refresh=1":""}`,{signal:Se.signal}),fetch("/api/cswap-auto",{signal:Se.signal})]);if(_e.ok){const yt=await _e.json();n(yt),I(Ne=>BD(Ne,yt.accounts))}Be.ok&&a(await Be.json());const kt=GD([await t1(_e),await t1(Be)]);h(yt=>n1(yt,kt))}catch{h(_e=>n1(_e,HD))}finally{window.clearTimeout(De),re&&f(!1)}},[]),Ye=k.useCallback(async(re,Se)=>{if(!U(Se))return null;h(null);try{const _e=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:gv(_e,"command failed"),raw:Qo(_e)}),_e}catch{return h({text:"server unreachable"}),null}finally{oe()}},[U,oe]),Le=k.useCallback(async(re,Se)=>{if(!U(Se))return null;h(null);try{const _e=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:Bo(_e,"command failed")}),_e}catch{return h({text:"server unreachable"}),null}finally{oe()}},[U,oe]);k.useEffect(()=>(ke(!0),v.current=window.setInterval(()=>ke(!1),a1),()=>{v.current!=null&&window.clearInterval(v.current)}),[ke]),k.useEffect(()=>{const re=window.setInterval(()=>w(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const qe=((ve=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:ve.value)??"90",je=Y??qe,Ge=LD(je,qe),be=(Pe=t==null?void 0:t.accounts)==null?void 0:Pe.find(re=>re.active),se=((Ue=e1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:Ue.pct)??null,Ze=se!=null&&se>=Number(qe)-15,ht=async re=>{if(U(`switch-${re}`)){h(null);try{const De=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:re})})).json().catch(()=>null);De!=null&&De.ok||h({text:gv(De,"the switch failed"),raw:Qo(De)}),await ke(!0)}catch{h({text:"server unreachable"})}finally{oe(),me(re)}}},ct=async(re,Se)=>{const{commit:De,alias:_e}=WD(j,Se);if(De){const Be=await Le({action:"alias",account:re,alias:_e},`alias-${re}`);if(await ke(!0),!(Be!=null&&Be.ok))return;E(_e)}A(re),window.setTimeout(()=>A(Be=>Be===re?null:Be),_f)},at=async(re,Se)=>{const De=await Le({action:"move",account:re,slot:Se},`move-${re}`),_e=$D({menuFor:N,shareFor:(z==null?void 0:z.num)??null},re,De);if(await ke(!0),_e){x(_e.menuFor),$(_e.confirmRemove),_e.shareFor==null&&(P(null),Z(!1)),Q(_e.swapNote);const Be=_e.swapNote;Be&&window.setTimeout(()=>Q(kt=>kt===Be?null:kt),d5),te(null),me(_e.menuFor)}return De},Ke=async(re,Se,De)=>{if(De.sends){const _e=await at(re,Se);if(!(_e!=null&&_e.ok))return}q(re),window.setTimeout(()=>q(_e=>_e===re?null:_e),_f)},pe=async(re,Se)=>{if(Se.sends){const De=await Ye({action:"setting",key:"autoswitch.threshold",value:re},"threshold");if(await ke(!0),!(De!=null&&De.ok))return;L(null)}de(!0),window.setTimeout(()=>de(!1),_f)};return c.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[c.jsxs("div",{className:"ap-header",children:[c.jsx("h2",{children:"Accounts"}),c.jsxs("div",{className:"ap-header-right",children:[c.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:c.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((ot=t==null?void 0:t.accounts)==null?void 0:ot.length)??0)>0&&c.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>F(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:c.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:[c.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),c.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),c.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ke(!0),...fe("reload",d),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c.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:[c.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),c.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:c.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})})]})]}),t==null?p?c.jsxs("div",{className:"ap-empty",role:"alert",children:[c.jsx("span",{title:p.raw||void 0,children:p.text}),c.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",a1/1e3," seconds."]}),c.jsx("button",{type:"button",className:"ap-fix",disabled:d,onClick:()=>ke(!0),children:d?"trying…":"try again"})]}):c.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?c.jsxs(c.Fragment,{children:[c.jsx("ul",{className:"ap-list",children:($e=t.accounts)==null?void 0:$e.map(re=>{const{shown:Se,rest:De,fuller:_e,peak:Be}=e1(re.lanes),kt=G.includes(t0(re)),yt=qD(De.length,kt,_e);return c.jsxs("li",{className:`ap-account${re.active?" active":""}`,children:[c.jsxs("div",{className:"ap-account-head",children:[c.jsx("span",{className:"ap-num",children:re.num}),re.alias&&c.jsx("span",{className:"ap-alias",title:re.alias,children:re.alias}),c.jsx("span",{className:"ap-email",title:re.email??void 0,children:re.email}),c.jsx("button",{type:"button",id:`ap-more-${re.num}`,className:`ap-more${N===re.num?" on":""}`,"aria-label":`Manage account ${re.num}`,"aria-expanded":N===re.num,"aria-controls":N===re.num?`ap-manage-${re.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{x(N===re.num?null:re.num),E(re.alias??""),$(null),P(null),Z(!1),Q(null),A(null),te(null),q(null)},children:"⋯"}),re.active&&c.jsx("span",{className:"ap-badge-active",children:"active"}),re.disabled&&c.jsx("span",{className:"ap-badge-held",children:"held out"}),!re.active&&!re.disabled&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...fe(`switch-${re.num}`),onClick:()=>ht(re.num),title:`Switch to ${re.alias??re.email}`,children:i===`switch-${re.num}`?"…":"switch"})]}),c.jsx("div",{className:"ap-lanes",id:`ap-lanes-${re.num}`,children:Se.length?c.jsxs(c.Fragment,{children:[Se.map(Ne=>c.jsx(l1,{lane:Ne,nowSec:g},Ne.id)),kt&&De.map(Ne=>c.jsx(l1,{lane:Ne,nowSec:g},Ne.id))]}):c.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),c.jsxs("div",{className:"ap-meta",children:[re.staleCopy&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-stale-copy",title:"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. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),c.jsx("button",{type:"button",className:"ap-fix",...fe("recapture"),onClick:async()=>{const Ne=await Le({action:"recapture"},"recapture");Ne!=null&&Ne.ok&&ke(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:i==="recapture"?"resuming…":"resume"})]}),re.stopped&&(()=>{const Ne=i1(re.collector??null);return c.jsx("span",{className:"ap-stopped",title:(Ne==null?void 0:Ne.hint)??"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",children:(Ne==null?void 0:Ne.text)??"not collecting"})})(),re.stopped&&(()=>{var rt;const Ne=(rt=i1(re.collector??null))==null?void 0:rt.fix;return Ne?c.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account puts its login in this slot.",children:Ne}):null})(),re.error&&(()=>{const Ne=m5(re.error);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-err",title:Ne.hint,children:Ne.text}),Ne.fixable&&c.jsx("button",{type:"button",className:"ap-fix",onClick:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),yt&&c.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":kt,"aria-controls":`ap-lanes-${re.num}`,title:DD(re.headroom,(Be==null?void 0:Be.label)??null,De.length,kt),onClick:()=>I(Ne=>zD(Ne,re)),children:yt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!re.active||re.disabled)&&c.jsx("button",{type:"button",className:"ap-rotate",...fe(`rot-${re.num}`),onClick:()=>Ye({action:"account",account:re.num,enabled:re.disabled},`rot-${re.num}`).then(()=>ke(!0)),title:re.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:re.disabled?"put back":"hold out"}),re.fetchedAt?c.jsxs("span",{className:`ap-age${re.stale&&!re.stopped&&!re.error?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",o1(re.fetchedAt,g),p5(re.nextAt,g)]}):c.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===re.num&&c.jsxs("div",{className:"ap-manage",id:`ap-manage-${re.num}`,role:"group","aria-label":`Manage account ${re.num}`,children:[c.jsxs("div",{className:"ap-manage-name",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${re.num}`,children:"Alias"}),c.jsx("input",{id:`ap-alias-${re.num}`,className:"ap-manage-input",type:"text",value:j,onChange:Ne=>E(Ne.target.value),onKeyDown:Ne=>{Ne.key==="Enter"&&ct(re.num,re.alias)},maxLength:UD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`alias-${re.num}`),onClick:()=>ct(re.num,re.alias),title:"A short name to show instead of the email",children:C===re.num?"saved":"save"})]}),(()=>{const Ne=ID((t.accounts??[]).map(vt=>vt.num),re.num),rt=OD(Ne,B,re.num),wt=PD(Ne,rt,re.num);return c.jsxs("div",{className:"ap-manage-slot",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${re.num}`,children:"Slot"}),c.jsx("span",{className:"ap-field",children:c.jsx("select",{id:`ap-slot-${re.num}`,value:String(rt),...fe(`move-${re.num}`),onChange:vt=>te(Number(vt.target.value)),children:Ne.map(vt=>c.jsx("option",{value:vt.slot,children:vt.label},vt.slot))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`move-${re.num}`),title:wt.title,onClick:()=>Ke(re.num,rt,wt),children:J===re.num?wt.done:wt.label})]})})(),c.jsxs("div",{className:"ap-manage-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${re.num}`),title:`Copy this account to another ${zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{Z(!1);const Ne=await Le({action:"share",account:re.num},`share-${re.num}`);Ne!=null&&Ne.ok&&P({num:re.num,blob:Ne.blob,expiresAt:Ne.expiresAt})},children:"share"}),c.jsx("button",{type:"button",className:`ap-manage-btn danger${O===re.num?" armed":""}`,...fe(`rm-${re.num}`),title:O===re.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(O!==re.num){$(re.num),window.setTimeout(()=>$(Ne=>Ne===re.num?null:Ne),4e3);return}$(null),Le({action:"remove",account:re.num},`rm-${re.num}`).then(()=>{x(null),ke(!0),me(null)})},children:O===re.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===re.num&&(()=>{var wt;const Ne=(wt=t.accounts)==null?void 0:wt.find(vt=>vt.num===R.displaced),rt=(Ne==null?void 0:Ne.alias)??(Ne==null?void 0:Ne.email)??"the account that was there";return c.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${rt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===re.num&&(()=>{const Ne=oR(z.expiresAt,g),rt=Ne.tone==="gone";return c.jsxs("div",{className:`ap-share${rt?" expired":""}`,children:[c.jsx("code",{className:"ap-share-blob",children:z.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${re.num}`),onClick:async()=>{if(rt){Z(!1);const wt=await Le({action:"share",account:re.num},`share-${re.num}`);wt!=null&&wt.ok&&P({num:re.num,blob:wt.blob,expiresAt:wt.expiresAt});return}await c1(z.blob)&&(Z(!0),window.setTimeout(()=>Z(!1),1800))},children:rt?"make a new share":H?"copied":"copy"}),c.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[c.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",c.jsx("span",{className:`ap-share-expiry ${Ne.tone}`,children:Ne.text})]})]})]})})()]})]},re.num)})}),(s==null?void 0:s.ok)&&c.jsxs("div",{className:"ap-auto",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),c.jsxs("span",{className:"ap-auto-ctl",children:[se!=null&&c.jsxs("span",{className:`ap-auto-now${Ze?" near":""}`,title:`The active account has used ${Math.round(se)}% of its limit. Auto-switch trips at ${qe}%.`,children:[Math.round(se),"%"]}),c.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:c.jsx("select",{"aria-label":"Switch threshold",value:je,...fe("threshold"),onChange:re=>L(re.target.value),children:f5.map(re=>c.jsxs("option",{value:re,children:[re,"%"]},re))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...fe("threshold"),title:Ge.title,onClick:()=>pe(je,Ge),children:K?Ge.done:Ge.label}),c.jsx("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...fe("enable"),onClick:()=>Ye({action:"enable",enabled:!s.enabled},"enable").then(()=>ke(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit"})]})]}),s.external&&c.jsxs("p",{className:"ap-auto-note",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",c.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&c.jsx("div",{className:"ap-auto-foot",children:c.jsxs("span",{className:"ap-auto-result",children:["checked ",o1(s.lastTick.at,g)]})})]}),p&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."}),c.jsx(u5,{accounts:((t==null?void 0:t.accounts)??[]).map(re=>({key:`${String(re.email??"").trim().toLowerCase()}@@${re.orgUuid??""}`,email:re.email??"",alive:re.alive===!0})),onChanged:()=>ke(!0)})]}):c.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"claude-swap isn't installed."}),c.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&c.jsx("code",{className:"ap-cmd",children:t.hint}),c.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",c.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"No accounts added yet."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",c.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"Couldn't read the account store."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),S&&c.jsx(TD,{onClose:()=>_(!1),onChanged:()=>ke(!0)}),M&&c.jsx(MD,{accounts:((t==null?void 0:t.accounts)??[]).map(re=>({num:re.num,email:re.email,alias:re.alias,org:re.org})),onClose:()=>F(!1),copyText:c1})]})}const y5=3e4;function w5({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function v5({bundle:e,running:t,pending:n,lastTried:s}){return t?w5({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function x5(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function b5({asked:e,reported:t}){return t?t!==e:!1}function uR(e){const t=e.thresholdMs??y5;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 k5(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 _5(e,t){return e?t==null?"auto when idle":`auto in ${k5(t)}`:"auto-restart off"}function u1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function S5(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 N5(e){const t=uR(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}async function dR(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}function j5(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function E5(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 C5(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function T5(e,t){const n=C5(e),s=n?`removes ${n} on the canvas`:null,a=d=>`This ${s?`${s} and ${d}`:d}`;if(!t)return{note:`${a("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${a("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const d=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${d}${f}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${a("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const i=t.decks-1,l=i===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${a(`deletes the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function R5({agentCount:e,onConfirm:t,onCancel:n}){const s=k.useRef(null),a=Zt(n,{focusRef:s,layer:b3}),[i,l]=k.useState(null);k.useEffect(()=>{let p=!1;return fetch("/api/clear").then(h=>h.ok?h.json():null).then(h=>{p||l(E5(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:f}=T5(e,i);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"status-dot err","aria-hidden":!0}),c.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:d}),c.jsxs("div",{className:"cc-actions",children:[c.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),c.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const A5="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",M5=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function I5({onClose:e}){const t=Zt(e);return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:A5}),c.jsx("div",{className:"shortcuts",children:M5.map(n=>c.jsxs(k.Fragment,{children:[c.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>c.jsxs("div",{className:"sc",children:[c.jsx("kbd",{children:s.cap}),c.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const $5=["done","needs-input"],O5=[{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}]}],P5=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],r0={done:O5,"needs-input":P5},Zo="two";function vv(e,t){const n=r0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Zo)??n[0]}function hR(e,t){return r0[e].some(s=>s.id===t)?t:Zo}vv("done",Zo).notes,vv("needs-input",Zo).notes;const d1=.04,L5=.24,Mu=0,Yu=100,xv=5,Rl=50;function Al(e){if(!Number.isFinite(e))return Rl;const t=Math.round(e/xv)*xv;return Math.min(Yu,Math.max(Mu,t))}function q5(e){if(e==null)return Rl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Al(Number(t)):Rl}function D5(e){const t=Al(e),n=d1+(L5-d1)*(t/Yu);return Math.round(n*1e4)/1e4}function F5(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(D5(e)*s*1e4)/1e4}const z5=160,B5="agent-dag.soundLevel.done",U5="agent-dag.soundLevel.needs-input",W5="agent-dag.soundFigure.done",H5="agent-dag.soundFigure.needs-input",fR={done:B5,"needs-input":U5},pR={done:W5,"needs-input":H5},bv={done:{level:Rl,figure:Zo},"needs-input":{level:Rl,figure:Zo}};function G5(e){const t=n=>({level:q5(e(fR[n])),figure:hR(n,e(pR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const V5={Stop:"done",Notification:"needs-input"};function Y5(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:V5[n]??null}function K5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function l(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function d(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??bv)[f]??bv[f],g=vv(f,h.figure),w=F5(h.level,g),v=n.currentTime;for(const x of g.notes){const S=n.createOscillator(),_=n.createGain();S.type=g.type??"sine",S.frequency.value=x.hz;const j=v+x.at,E=j+x.ms/1e3;_.gain.setValueAtTime(1e-4,j),_.gain.exponentialRampToValueAtTime(w,j+.012),_.gain.exponentialRampToValueAtTime(1e-4,E),S.connect(_).connect(n.destination),S.start(j),S.stop(E+.02)}return!0}return{unlock:l,play:d,state:a,get context(){return n}}}const X5="Notify me when a session needs my attention.",Q5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",h1="Get notified when you're away from this tab.";function Z5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:h1};case"default":return{status:null,ask:!0,ok:!1,note:h1};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const f1={done:"Turn finished","needs-input":"Claude is asking"},J5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function eF({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:l,openerRef:d,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:w}){const v=Z5(g),N=f&&!h,x=Zt(e),S=k.useRef(e);return S.current=e,k.useEffect(()=>{const _=j=>{var C,A;const E=j.target;E&&((C=x.current)!=null&&C.contains(E)||(A=d.current)!=null&&A.contains(E)||S.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[x,d]),c.jsxs("div",{ref:x,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[c.jsxs("div",{className:"sm-switches",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsxs("div",{className:"sm-setting",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),c.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsx("p",{className:"sm-note",children:h?Q5:X5})]})]}),N&&c.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[c.jsxs("div",{className:"sm-channel-head",children:[c.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),v.ask?c.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:w,children:"Enable"}):c.jsxs("span",{className:"sm-channel-state","data-ok":v.ok||void 0,children:[v.ok&&c.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:c.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),v.status]})]}),c.jsx("p",{className:"sm-note",children:v.note})]}),!t&&c.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."}),c.jsx("div",{className:"sm-tones",children:$5.map(_=>{const j=s[_],E=`sm-level-${_}`,C=`sm-figure-${_}`;return c.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[c.jsxs("div",{className:"sm-tone-head",children:[c.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:f1[_]}),c.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${f1[_].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:[c.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:E,children:"Volume"}),c.jsx("input",{id:E,type:"range",min:Mu,max:Yu,step:xv,value:j.level,onChange:A=>a(_,Number(A.target.value)),style:{"--sm-level":`${(j.level-Mu)/(Yu-Mu)*100}%`}}),c.jsxs("span",{className:"sm-read",children:[j.level,"%"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:C,children:"Tone"}),c.jsx("select",{id:C,className:"sm-select",value:j.figure,onChange:A=>i(_,A.target.value),children:r0[_].map(A=>c.jsx("option",{value:A.id,children:A.label},A.id))})]}),c.jsx("p",{className:"sm-note",children:J5[_]})]},_)})}),c.jsxs("p",{className:"sm-foot",children:[c.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const tF={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all."],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
|
|
82
|
-
|
|
83
|
-
\`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
|
|
84
|
-
|
|
85
|
-
**Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
|
|
86
|
-
|
|
87
|
-
Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"3.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
88
|
-
|
|
89
|
-
The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
|
|
90
|
-
|
|
91
|
-
The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"3.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
|
|
92
|
-
|
|
93
|
-
A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
|
|
94
|
-
|
|
95
|
-
Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
|
|
96
|
-
|
|
97
|
-
Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
|
|
98
|
-
|
|
99
|
-
What you are reading is the first version that does not.
|
|
100
|
-
|
|
101
|
-
No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
|
|
102
|
-
|
|
103
|
-
The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
|
|
104
|
-
|
|
105
|
-
What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
|
|
106
|
-
|
|
107
|
-
Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
|
|
108
|
-
|
|
109
|
-
With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
110
|
-
|
|
111
|
-
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
112
|
-
|
|
113
|
-
**Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
|
|
114
|
-
|
|
115
|
-
There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
|
|
116
|
-
|
|
117
|
-
\`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
|
|
118
|
-
|
|
119
|
-
The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"3.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
|
|
120
|
-
|
|
121
|
-
**A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
|
|
122
|
-
|
|
123
|
-
**Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
|
|
124
|
-
|
|
125
|
-
**Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
|
|
126
|
-
|
|
127
|
-
**Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
|
|
128
|
-
|
|
129
|
-
**A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
|
|
130
|
-
|
|
131
|
-
**Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
|
|
132
|
-
|
|
133
|
-
The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
|
|
134
|
-
|
|
135
|
-
A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
|
|
136
|
-
|
|
137
|
-
When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
|
|
138
|
-
|
|
139
|
-
Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
|
|
140
|
-
|
|
141
|
-
The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
|
|
142
|
-
|
|
143
|
-
There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
|
|
144
|
-
|
|
145
|
-
It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
|
|
146
|
-
|
|
147
|
-
What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
|
|
148
|
-
|
|
149
|
-
Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
|
|
150
|
-
|
|
151
|
-
An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
|
|
152
|
-
|
|
153
|
-
Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
|
|
154
|
-
|
|
155
|
-
One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
|
|
156
|
-
|
|
157
|
-
Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
|
|
158
|
-
|
|
159
|
-
The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"3.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
|
|
160
|
-
|
|
161
|
-
The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
|
|
162
|
-
|
|
163
|
-
What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
|
|
164
|
-
|
|
165
|
-
So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
|
|
166
|
-
|
|
167
|
-
It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
|
|
168
|
-
|
|
169
|
-
Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
|
|
170
|
-
|
|
171
|
-
And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
|
|
172
|
-
|
|
173
|
-
What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
|
|
174
|
-
|
|
175
|
-
It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
|
|
176
|
-
|
|
177
|
-
It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
|
|
178
|
-
|
|
179
|
-
The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
|
|
180
|
-
|
|
181
|
-
One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
|
|
182
|
-
|
|
183
|
-
With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
|
|
184
|
-
|
|
185
|
-
The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
|
|
186
|
-
|
|
187
|
-
It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
|
|
188
|
-
|
|
189
|
-
Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
|
|
190
|
-
|
|
191
|
-
The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
|
|
192
|
-
|
|
193
|
-
It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
|
|
194
|
-
|
|
195
|
-
Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
|
|
196
|
-
|
|
197
|
-
One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
|
|
198
|
-
|
|
199
|
-
It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
|
|
200
|
-
|
|
201
|
-
The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
|
|
202
|
-
|
|
203
|
-
It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
|
|
204
|
-
|
|
205
|
-
The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
|
|
206
|
-
|
|
207
|
-
On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
|
|
208
|
-
|
|
209
|
-
A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
|
|
210
|
-
|
|
211
|
-
It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
|
|
212
|
-
|
|
213
|
-
And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
|
|
214
|
-
|
|
215
|
-
The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
|
|
216
|
-
|
|
217
|
-
Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
|
|
218
|
-
|
|
219
|
-
This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
|
|
220
|
-
|
|
221
|
-
It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
|
|
222
|
-
|
|
223
|
-
The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
|
|
224
|
-
|
|
225
|
-
Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
|
|
226
|
-
|
|
227
|
-
A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
|
|
228
|
-
|
|
229
|
-
Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
|
|
230
|
-
|
|
231
|
-
It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
|
|
232
|
-
|
|
233
|
-
When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
|
|
234
|
-
|
|
235
|
-
Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
|
|
236
|
-
|
|
237
|
-
The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
|
|
238
|
-
|
|
239
|
-
You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
|
|
240
|
-
|
|
241
|
-
It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
|
|
242
|
-
|
|
243
|
-
The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
|
|
244
|
-
|
|
245
|
-
M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
|
|
246
|
-
|
|
247
|
-
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
|
|
248
|
-
|
|
249
|
-
Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
|
|
250
|
-
|
|
251
|
-
The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
|
|
252
|
-
|
|
253
|
-
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}]},s0="agent-dag.releaseNotesSeen";function p1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Jo(e,t){const n=p1(e),s=p1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function ei(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function nF(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 rF(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!ei(n)||!Array.isArray(s))continue;const a=s.filter(nF);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Jo(s.version,n.version))}const m1=rF(tF);function mR(e,t,n){return e.filter(s=>Jo(s.version,n)<=0&&(t===null||Jo(s.version,t)>0))}function sF(e,t){return e.filter(n=>Jo(n.version,t)===0)}function aF(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function oF({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&ei(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(!ei(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=Jo(a,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const iF=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function lF(e){const t=iF.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function cF(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function uF(e){if(!e)return null;let t=null;try{t=e.getItem(s0)}catch{return null}return ei(t)?t:null}function dF(e){if(!e)return!1;try{return e.getItem(s0),!0}catch{return!1}}function hF(e,t){if(!e)return!1;try{return e.setItem(s0,t),!0}catch{return!1}}function fF({stored:e,running:t,notes:n,remembers:s=!0}){if(!ei(t))return{show:[],record:null,reason:"no-version"};if(!ei(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=sF(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Jo(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=mR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function pF(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function gR(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){a(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=pF(e,i);if(l>0){a(),n.push({kind:"bold",kids:gR(e.slice(i+2,l),!1)}),i=l+2;continue}}s+=e[i],i+=1}return a(),n}function mF({entries:e,since:t,running:n,firstRun:s,onClose:a}){const i=Zt(a),l=aF(e);return c.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal release-notes",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&c.jsx("span",{className:"modal-tool-id",children:l})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:oF({since:t,running:n,firstRun:s,entries:e})}),e.map(d=>c.jsxs("section",{className:"modal-section",children:[c.jsxs("h3",{className:"rn-version",children:["v",d.version]}),c.jsx("ul",{className:"rn-notes",children:d.notes.map((f,p)=>{const{icon:h,rest:g}=lF(f.title);return c.jsxs("li",{className:"rn-note",children:[c.jsxs("p",{className:"rn-note-title",children:[h&&c.jsx("span",{className:"rn-note-icon",children:h}),g]}),c.jsx("p",{className:"rn-note-body",children:yR(gR(f.body))})]},p)})})]},d.version))]})]})})}function yR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?c.jsx("code",{className:"rn-code",children:t.text},n):c.jsx("strong",{className:"rn-strong",children:yR(t.kids)},n))}function gF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function yF(e,t,n){var l;if(e.length===0)return null;const s=gF(e),a=t?s.findIndex(d=>d.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((l=s[i])==null?void 0:l.id)??null}const wF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function vF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:wF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const xF=new Set(["","BODY","HTML","#DOCUMENT"]);function bF(e){return!e||Xv(e)?!1:!xF.has(String(e.tagName??"").toUpperCase())}function wu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function kF(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const s=new Set;for(const a of e)t.has(a)&&s.add(a);return s}function _F(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function SF(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const l=e.agents.get(a);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),a=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),i=!0)}return s}function NF(e,t){const n=new Set;for(const s of t){const a=SF(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function wR(e,t,n){return!t.has(e)||n.has(e)}function jF(e,t,n,s){return!t.has(e)&&wR(e,n,s)}function EF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function CF(e,t,n,s){n.set(e,t),s.delete(e)}const TF=40,RF=120;function AF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},d=(f,p,h)=>{if(n!=null){if(s<=f)return;l()}const g=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,g)};return{live(f=TF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){l(),i();return}d(h,p,f)},replay(f=RF){l(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){l(),i()},cancel(){l()}}}const MF=1e3;function IF(e={}){const t=Math.max(1,Math.floor(e.limit??MF)),n=e.protect;let s=!1,a=[],i=new Set,l=0,d=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return l},get overflowed(){return l>0},get through(){return d},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,w=g!==null&&g!==f;w&&(f=g,d=0);const v=h!==null&&!w&&h<=d;if(h!==null&&h>d&&(d=h),!s)return!0;if(v)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[x]=a.splice(N,1);i.delete(x),l++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,l=0,h}}}const vR="agent-dag.theme";function $F(e){return e==="light"?"light":"dark"}function OF(){return $F(ri(vR))}function PF({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const vu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function xu(e,t){const a=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;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 LF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(xu(vu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(xu(vu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(xu(vu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(xu(vu.idle,"idle"))}`}),qF="No sessions are waiting for you.";function DF(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function FF(e,t){return t!==""?t:e===""?"":qF}function zF(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function BF(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function UF(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const g1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function a0(e){const t=e.toLowerCase();return Object.hasOwn(g1,t)?g1[t]:t?t[0].toUpperCase()+t.slice(1):""}function WF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function HF(e,t=[]){const n=t.length?WF(t.map(a0)):UF(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function GF(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 VF(e,t){const n=t.prefs??bv,s=Al(n.done.level),a=Al(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,l=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",d=e.codex?`
|
|
254
|
-
|
|
255
|
-
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",f=t.on&&t.locked?`
|
|
256
|
-
|
|
257
|
-
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+d+f+`
|
|
258
|
-
|
|
259
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function xR(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const a=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};a.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,a.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,a)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function YF(e){const t=xR([{agents:e}]);return t.length<2?null:t.map(n=>`${a0(n.id)} ${et(n.cost)}`).join(" · ")}function y1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function KF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function bu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const XF=[7,14,30,90];function QF(e){const[t,n]=k.useState(null),[s,a]=k.useState(!1),i=k.useState(zF)[0],l=k.useRef(!1),d=(f=!1)=>{if(f&&!cr(l.current))return;const p=i.begin();l.current=f;const h=e;a(!0);const w=`/api/ccusage?since=${fv(h)}${f?"&refresh=1":""}`;fetch(w).then(v=>v.json()).then(v=>{p()&&n({range:h,resp:v})}).catch(()=>{p()&&n({range:h,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,a(!1))})};return k.useEffect(()=>(d(!1),()=>i.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function ZF({onClose:e,providers:t}){var z;const[n,s]=k.useState(30),[a,i]=k.useState(null),{landed:l,loading:d,reload:f}=QF(n),p=k.useRef(null),h=Zt(e,{focusRef:p}),g=BF({loading:d,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),w=g.phase==="chart"?l.resp.days??[]:[],v=k.useMemo(()=>w.reduce((P,M)=>Math.max(P,M.totalCost),0),[w]),N=k.useRef(null);k.useLayoutEffect(()=>{const P=N.current;P&&(P.scrollLeft=P.scrollWidth)},[w]);const{totalCost:x,totalTok:S,inOut:_,cacheRead:j,modelCosts:E}=k.useMemo(()=>{let P=0,M=0,F=0,H=0;const Z=new Map;for(const R of w){P+=R.totalCost,M+=R.totalTokens,F+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const Q of R.modelBreakdowns)Z.set(Q.modelName,(Z.get(Q.modelName)??0)+Q.cost)}return{totalCost:P,totalTok:M,inOut:F,cacheRead:H,modelCosts:Z}},[w]),C=k.useMemo(()=>Array.from(E.entries()).sort((P,M)=>M[1]-P[1]),[E]),A=k.useMemo(()=>xR(w),[w]),O=A.length>1,$=a?w.find(P=>P.period===a)??null:null;return c.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:h,className:"uh-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[c.jsxs("header",{className:"uh-head",children:[c.jsxs("div",{className:"uh-titlewrap",children:[c.jsx("div",{className:"uh-title",children:"Usage history"}),c.jsx("div",{className:"uh-sub",children:HF(t,A.map(P=>P.id))})]}),c.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:XF.map(P=>c.jsxs("button",{type:"button","aria-pressed":n===P,className:"uh-range-btn",onClick:()=>{s(P),i(null)},children:[P,"d"]},P))}),c.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...lr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),c.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?c.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[c.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),c.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):g.phase==="error"?c.jsxs("div",{className:"uh-status uh-err",title:Qo(l.resp)||void 0,children:[bD(l.resp,"ccusage did not report usage"),c.jsx("div",{children:c.jsx("button",{className:"btn uh-retry",onClick:f,...lr(d),children:d?"trying…":"Try again"})})]}):g.phase==="empty"?c.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):c.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[c.jsxs("div",{className:"uh-totals",children:[c.jsx(ku,{label:"total cost",val:et(x),accent:!0}),c.jsx(ku,{label:"tokens",val:Rt(S)}),c.jsx(ku,{label:"input+output",val:Rt(_)}),c.jsx(ku,{label:"cache reads",val:Rt(j)})]}),O&&c.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[c.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:A.map(P=>c.jsx("span",{className:"uh-agent-seg",style:{width:`${x>0?P.cost/x*100:0}%`,background:y1(P.id)}},P.id))}),c.jsx("div",{className:"uh-agent-keys",children:A.map(P=>c.jsxs("span",{className:"uh-agent-key",title:`${P.id} · ${Rt(P.tokens)} tokens`,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:y1(P.id)}}),a0(P.id),c.jsx("span",{className:"uh-agent-cost",children:et(P.cost)}),c.jsx("span",{className:"uh-agent-share",children:KF(P.cost,x)})]},P.id))})]}),c.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:w.map((P,M)=>{const F=v>0?P.totalCost/v*100:0,H=P.period===a,Z=`${P.period}, ${et(P.totalCost)}`;return c.jsxs("button",{className:`uh-bar-col${H?" sel":""}`,onClick:()=>i(H?null:P.period),"aria-pressed":H,"aria-label":Z,title:`${P.period} · ${et(P.totalCost)}`,style:{flexBasis:`${100/w.length}%`,"--uh-i":M,"--uh-step":`${Math.min(10,200/Math.max(w.length,1))}ms`},children:[c.jsx("div",{className:"uh-bar",style:{height:`${Math.max(F,P.totalCost>0?2:0)}%`},children:P.modelBreakdowns.slice().sort((R,Q)=>Q.cost-R.cost).map(R=>{const Q=P.totalCost>0?R.cost/P.totalCost*100:0;return c.jsx("div",{className:"uh-bar-seg",style:{height:`${Q}%`,background:bu(R.modelName)}},R.modelName)})}),c.jsx("span",{className:"uh-bar-label",children:P.period.slice(5)})]},P.period)})}),c.jsx("div",{className:"uh-legend",children:C.map(([P,M])=>c.jsxs("span",{className:"uh-legend-item",title:P,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:bu(P)}}),qs(P)," ",c.jsx("span",{className:"uh-legend-cost",children:et(M)})]},P))}),$&&c.jsxs("div",{className:"uh-detail",children:[c.jsxs("div",{className:"uh-detail-head",children:[c.jsx("span",{className:"uh-detail-date",children:$.period}),c.jsx("span",{className:"uh-detail-cost",children:et($.totalCost)}),(()=>{var F,H;const M=YF($.agents)??((H=(F=$.metadata)==null?void 0:F.agents)!=null&&H.length?$.metadata.agents.join(" · "):null);return M?c.jsx("span",{className:"uh-detail-agents",title:M,children:M}):null})()]}),c.jsxs("div",{className:"uh-detail-mini",children:[c.jsx(_u,{label:"input",val:Rt($.inputTokens)}),c.jsx(_u,{label:"output",val:Rt($.outputTokens)}),c.jsx(_u,{label:"cache write",val:Rt($.cacheCreationTokens)}),c.jsx(_u,{label:"cache read",val:Rt($.cacheReadTokens)})]}),c.jsx("div",{className:"uh-detail-models",children:$.modelBreakdowns.slice().sort((P,M)=>M.cost-P.cost).map(P=>{const M=$.totalCost>0?P.cost/$.totalCost*100:0;return c.jsxs("div",{className:"uh-model-row",title:P.modelName,children:[c.jsxs("span",{className:"uh-model-name",children:[c.jsx("span",{className:"uh-legend-dot",style:{background:bu(P.modelName)}}),c.jsx("span",{className:"uh-model-label",children:qs(P.modelName)})]}),c.jsx("span",{className:"uh-model-bar",children:c.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:bu(P.modelName)}})}),c.jsx("span",{className:"uh-model-cost",children:et(P.cost)})]},P.modelName)})})]})]})]})})}function ku({label:e,val:t,accent:n}){return c.jsxs("div",{className:"uh-stat",children:[c.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),c.jsx("span",{className:"uh-stat-label",children:e})]})}function _u({label:e,val:t}){return c.jsxs("div",{className:"uh-ministat",children:[c.jsx("span",{className:"uh-ministat-val",children:t}),c.jsx("span",{className:"uh-ministat-label",children:e})]})}function JF(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(a=>{const i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const w1=1e4,e6=12e3;function t6({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const i=k.useRef(null),l=k.useRef(null);return l.current={browsers:e,findings:t,watching:n},k.useEffect(()=>{var v;const d=i.current;if(!d)return;const f=d.getContext("2d");if(!f)return;const p=((v=window.matchMedia)==null?void 0:v.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let h=0,g=!1;const w=()=>{var te;if(g)return;const N=l.current;if(!N)return;const{browsers:x,findings:S,watching:_}=N,j=s["--accent"]||"#7dd3fc",E=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",A=JF(s["--bg"]),O=A?42:26,$=A?.85:.65,z=a(),P=Math.min(window.devicePixelRatio||1,2),M=d.clientWidth,F=d.clientHeight;(d.width!==M*P||d.height!==F*P)&&(d.width=M*P,d.height=F*P),f.setTransform(P,0,0,P,0,0),f.clearRect(0,0,M,F);const H=M/2,Z=F/2,R=Math.min(M,F)/2-6;f.strokeStyle=E,f.lineWidth=1,f.globalAlpha=A?1:.9;for(const J of[.4,.7,1])f.beginPath(),f.arc(H,Z,R*J,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(H-R,Z),f.lineTo(H+R,Z),f.moveTo(H,Z-R),f.lineTo(H,Z+R),f.stroke(),f.globalAlpha=1;const B=(_&&!p?z%w1/w1:0)*Math.PI*2-Math.PI/2;if(_){const J=(te=f.createConicGradient)==null?void 0:te.call(f,B-.85,H,Z);J&&(J.addColorStop(0,"transparent"),J.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${j} ${O}%, transparent)`),J.addColorStop(1,"transparent"),f.fillStyle=J,f.beginPath(),f.moveTo(H,Z),f.arc(H,Z,R,B-.85,B),f.closePath(),f.fill()),f.strokeStyle=j,f.globalAlpha=$,f.beginPath(),f.moveTo(H,Z),f.lineTo(H+Math.cos(B)*R,Z+Math.sin(B)*R),f.stroke(),f.globalAlpha=1}x.forEach((J,q)=>{const Y=q/Math.max(x.length,1)*Math.PI*2-Math.PI/2,L=J.lastReadMs===null?1:Math.min(1,(z-J.lastReadMs)/12e4),K=R*(.42+L*.5),de=H+Math.cos(Y)*K,G=Z+Math.sin(Y)*K,I=Math.abs((B-Y+Math.PI*3)%(Math.PI*2)-Math.PI),X=_?Math.max(0,1-I/.55):0;f.beginPath(),f.arc(de,G,3+X*1.6,0,Math.PI*2),f.fillStyle=J.running?j:C,f.globalAlpha=J.running?.55+X*.45:.35,f.fill(),f.globalAlpha=1});for(const J of S){const q=(z-J.atMs)/e6;if(q<0||q>1)continue;const L=Math.max(0,x.findIndex(G=>G.key===J.browser))/Math.max(x.length,1)*Math.PI*2-Math.PI/2,K=H+Math.cos(L)*R*.6,de=Z+Math.sin(L)*R*.6;f.beginPath(),f.arc(K,de,4+q*22,0,Math.PI*2),f.strokeStyle=j,f.globalAlpha=(1-q)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(w)};return w(),()=>{g=!0,cancelAnimationFrame(h)}},[a,s]),c.jsx("canvas",{ref:i,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const v1="agent-dag.browserWatch.seenMs";function n6(e,t){return e.filter(n=>n.startMs>t)}function r6(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function s6(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function bR(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function x1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function a6(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function o6(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function i6(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=bR(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function l6(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function c6(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function b1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function u6({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Zt(e),[i,l]=k.useState(null),[d,f]=k.useState(null),[p,h]=k.useState(null),[g,w]=k.useState(!1),v=k.useRef(!1),[N,x]=k.useState(null),[S,_]=k.useState(null),[j,E]=k.useState(!1),C=k.useRef(!1),[A,O]=k.useState(!1),[$,z]=k.useState(!1),[P,M]=k.useState(!1),[F,H]=k.useState(!1),[Z,R]=k.useState(!1),[Q,B]=k.useState(()=>Date.now());k.useEffect(()=>{const U=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(U)},[]);const te=k.useCallback(async U=>{var oe,fe;if(!(U&&!cr(v.current))){v.current=U,w(!0);try{const me=await fetch(`/api/browser-watch${U?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const ke=await me.json();l(ke),C.current||x(((oe=ke==null?void 0:ke.settings)==null?void 0:oe.quietMinutes)??15),n(((fe=ke==null?void 0:ke.settings)==null?void 0:fe.enabled)===!0),f(null)}catch(me){f(me instanceof Error?me.message:String(me))}finally{v.current=!1,w(!1)}}},[n]);k.useEffect(()=>{te(!1)},[te]),k.useEffect(()=>{const U=setInterval(()=>{te(!1)},1e4);return()=>clearInterval(U)},[te]);const J=k.useCallback(async U=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:U.host,startMs:U.startMs})})}finally{await te(!1)}},[te]),q=k.useCallback(async U=>{C.current=!0,E(!0);try{const oe=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U)});if(!oe.ok)throw new Error(`the deck answered ${oe.status}`);await te(!1),h(null)}catch(oe){h(oe instanceof Error?oe.message:String(oe))}finally{C.current=!1,E(!1)}},[te]),Y=k.useRef(t);Y.current=t,k.useEffect(()=>()=>Y.current(Date.now()),[]);const L=k.useMemo(()=>{const U=[];for(const oe of(i==null?void 0:i.episodes)??[]){const fe=c6(oe.startMs),me=U[U.length-1];me&&me.label===fe?me.episodes.push(oe):U.push({label:fe,episodes:[oe]})}return U},[i]),K=bR(i==null?void 0:i.browsers),de=((i==null?void 0:i.browsers)??[]).filter(U=>!(U.installed&&U.profiles>0)),G=i?i6(i):null,I=K.reduce((U,oe)=>U+oe.profiles,0),X=i?r6(i.coverage.lastHumanMs,i.coverage.quietMs,Q):null;return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal bw-modal",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),c.jsx("span",{className:"modal-tool-id",children:i?`${I} ${I===1?"profile":"profiles"} · local only`:"local only"})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("button",{className:"glyph-btn",onClick:()=>void te(!0),...lr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),c.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body bw-body",children:[!i&&!d&&c.jsxs("div",{className:"bw-loading",children:[c.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),c.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&c.jsx("div",{className:"bw-state",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not read"}),c.jsx("span",{className:"bw-row-detail",children:d})]})}),i&&G&&c.jsx("p",{className:`bw-trouble ${G.kind}`,role:"status",children:G.text}),i&&c.jsxs("div",{className:"bw-work",children:[c.jsxs("aside",{className:"bw-side",children:[c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",c.jsx("button",{className:"bw-help",onClick:()=>M(U=>!U),"aria-expanded":P,"aria-label":"What the sweep and the dots mean",children:"?"})]}),c.jsxs("div",{className:"bw-glance",children:[c.jsx(t6,{browsers:K.map(U=>{var oe;return{key:U.key,name:U.name,running:U.running,lastReadMs:((oe=i.profiles.find(fe=>fe.browser===U.key))==null?void 0:oe.lastWrittenMs)??null}}),findings:i.episodes.slice(0,6).map(U=>({browser:U.browser??null,atMs:U.endMs})),watching:i.settings.enabled,palette:s}),c.jsx("ul",{className:"bw-counts",children:a6(K,i.profiles).map(U=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-count-n",children:U.visits.toLocaleString("en-US")}),c.jsx("span",{className:"bw-count-of",children:U.name})]},U.key))})]}),c.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),i.coverage.checkedMs>0&&c.jsxs("p",{className:"bw-since",children:["Last checked ",o6(i.coverage.checkedMs,Q),i.coverage.checks>0&&c.jsxs(c.Fragment,{children:[" · ",i.coverage.checks.toLocaleString("en-US")," ",i.coverage.checks===1?"check":"checks"]})]}),X!==null&&c.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",s6(X)]}),P&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Sweep"}),c.jsx("dd",{children:"one poll of every watched profile"}),c.jsx("dt",{children:"Dot"}),c.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),c.jsx("dt",{children:"Ring"}),c.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",c.jsx("button",{className:"bw-help",onClick:()=>H(U=>!U),"aria-expanded":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Running"}),c.jsx("dd",{children:"the browser has a process on this machine right now"}),c.jsx("dt",{children:"Connected"}),c.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),c.jsx("ul",{className:"bw-profiles",children:K.map(U=>c.jsxs("li",{children:[c.jsx("span",{className:`bw-prof-dot${U.running?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-prof-name",children:U.name}),c.jsx("span",{className:"bw-prof-state",children:U.running?"running":"idle"}),U.running&&U.relay.state==="live"&&c.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},U.key))}),de.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(U=>!U),"aria-expanded":Z,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:Z?"▾":"▸"})," ",de.length," not watched"]}),Z&&c.jsxs("p",{className:"bw-rest",children:[de.map(U=>U.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),i.relay&&c.jsx(d6,{relay:i.relay})]}),c.jsxs("div",{className:"bw-main",children:[c.jsxs("section",{className:"bw-findings",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",i.episodes.length>0&&c.jsxs("span",{className:"bw-feed-count",children:[i.episodes.length," ",i.episodes.length===1?"episode":"episodes"]})]}),c.jsx("div",{className:"bw-eps",children:L.length===0?c.jsxs("div",{className:"bw-empty",children:[c.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),c.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",i.settings.quietMinutes," ",i.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!i.settings.enabled&&c.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):L.map(U=>c.jsxs("div",{className:"bw-day",children:[c.jsx("h4",{className:"bw-sec-head",children:U.label}),U.episodes.map(oe=>{const fe=`${oe.host}-${oe.startMs}`,me=S===fe;return c.jsxs("div",{className:`bw-ep${me?" open":""}`,children:[c.jsxs("div",{className:"bw-ep-row",children:[c.jsxs("button",{className:"bw-ep-head",onClick:()=>_(me?null:fe),"aria-expanded":me,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),c.jsx("span",{className:"bw-ep-host",children:oe.host}),c.jsxs("span",{className:"bw-ep-meta",children:[l6(oe),b1(oe)&&c.jsxs(c.Fragment,{children:[" · ",b1(oe)]})]}),c.jsxs("span",{className:"bw-ep-count",children:[oe.count," ",oe.count===1?"page":"pages"]})]}),c.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void J(oe),"aria-label":`Dismiss ${oe.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&c.jsx("ul",{className:"bw-urls",children:oe.urls.map((ke,Ye)=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-url-time",children:new Date(ke.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),c.jsx("span",{className:"bw-url",children:ke.url})]},`${ke.url}-${ke.timeMs}-${Ye}`))})]},fe)})]},U.label))})]}),c.jsxs("section",{className:"bw-feed",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",c.jsxs("span",{className:"bw-feed-count",children:[i.log.length," ",i.log.length===1?"event":"events"]})]}),c.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),c.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:i.log.length===0?c.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):i.log.map(U=>c.jsxs("div",{className:`bw-log-line ${U.level}${U.parts?"":" sys"}`,children:[c.jsx("span",{className:"bw-log-time",children:new Date(U.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),U.parts?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"bw-log-browser",children:U.parts.browser}),c.jsx("span",{className:"bw-log-profile",title:U.parts.profile,children:U.parts.profile}),c.jsxs("span",{className:"bw-log-value",children:[U.parts.value,U.parts.flagged>0&&c.jsxs("span",{className:"bw-log-flag",children:[" · ",U.parts.flagged," flagged"]})]})]}):c.jsx("span",{className:"bw-log-sys",children:U.text})]},`${U.atMs}-${U.level}-${U.text}`))})]})]})]}),i&&A&&c.jsxs("div",{className:"bw-settings",children:[c.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[c.jsx("span",{children:"Nobody browsing for"}),c.jsxs("select",{value:N??i.settings.quietMinutes,onChange:U=>{x(Number(U.target.value)),q({quietMinutes:Number(U.target.value)})},children:[c.jsx("option",{value:1,children:"1 min"}),c.jsx("option",{value:5,children:"5 min"}),c.jsx("option",{value:15,children:"15 min"}),c.jsx("option",{value:30,children:"30 min"}),c.jsx("option",{value:60,children:"60 min"})]})]}),c.jsxs("label",{children:[c.jsx("span",{children:"When it finds one"}),c.jsx("select",{value:i.settings.reaction,onChange:U=>void q({reaction:U.target.value}),disabled:!i.settings.enabled,title:i.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(i.reactions??["notify"]).map(U=>c.jsx("option",{value:U,children:U==="notify"?"notify me":U==="close-tab"?"close the tab":"quit the browser"},U))})]}),c.jsxs("div",{className:"bw-settings-note",children:[c.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",c.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),c.jsxs("button",{className:"bw-why",onClick:()=>z(U=>!U),"aria-expanded":$,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:$?"▾":"▸"})," What Browser Watch can access"]}),$&&c.jsxs("dl",{className:"bw-access",children:[c.jsx("dt",{children:"Reads"}),c.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(i.coverage.startedMs).toLocaleString(),"."]}),c.jsx("dt",{children:"Keeps"}),c.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",c.jsx("code",{className:"bw-path",children:i.coverage.logPath}),", with every address written in full so you can check it yourself."]}),c.jsx("dt",{children:"Sends"}),c.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),c.jsx("dt",{children:"Never reads"}),c.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&c.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),c.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),c.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>h(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),i&&c.jsxs("footer",{className:"bw-status",children:[c.jsx("span",{className:`bw-mode-dot${i.settings.enabled?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-mode-word",children:x1(i,j).word},x1(i,j).kind),c.jsx("span",{className:"bw-status-text",children:i.coverage.archived===0?i.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${i.coverage.archived} ${i.coverage.archived===1?"episode":"episodes"} on disk`}),c.jsx("button",{className:`glyph-btn bw-gear${A?" on":""}`,onClick:()=>O(U=>!U),"aria-expanded":A,"aria-label":"Settings",title:"Settings",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[c.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),c.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),c.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[c.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),c.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":i.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void q({enabled:!i.settings.enabled}),title:i.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:c.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function d6({relay:e}){const[t,n]=k.useState(!1),[s,a]=k.useState(!1),i=e.killswitch.blocked?"unblock":"block",l=e.command[i],d=k.useCallback(async()=>{await dR(l.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[l.command]),f=e.profiles.filter(h=>{var g;return(g=h.report)==null?void 0:g.present}),p=e.profiles.filter(h=>h.report===null);return c.jsxs("section",{className:"bw-sec",children:[c.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),c.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&c.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(h=>c.jsx("code",{className:"bw-path",children:h},h))]}),c.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"aria-expanded":t,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&c.jsxs("div",{className:"bw-rc-body",children:[f.length>0&&c.jsx("dl",{className:"bw-key",children:f.map(h=>c.jsxs(k.Fragment,{children:[c.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),c.jsxs("dd",{children:[h.report.enabled?"enabled":"installed but switched off",h.report.allUrls?", can act on every site":", limited to the sites it was granted",h.report.sensitiveApis.length>0&&c.jsxs(c.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&c.jsxs("p",{className:"bw-rc-note",children:[p.map(h=>h.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&c.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),f.some(h=>h.report.allUrls)&&c.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",c.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),c.jsxs("div",{className:"bw-rc-cmd",children:[c.jsx("code",{children:l.command}),c.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),c.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function h6(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function f6({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:l}){const d=k.useRef(null),f=Zt(l,{focusRef:d}),p=Ra(n,"accept"),h=Ra(n,"dismiss");return c.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:c.jsxs("div",{ref:f,className:"modal lan-ask",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0}),c.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsxs("p",{className:"lan-ask-who",children:[c.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",c.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",cR(e.at,s)]}),c.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."}),c.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",c.jsx("code",{className:"ap-lan-code",children:e.fp})," — it should match the one on their screen."]}),t>0&&c.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.`}),c.jsxs("div",{className:"lan-ask-acts",children:[c.jsx("button",{type:"button",ref:d,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),c.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function o0(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 Sf,k1;function p6(){if(k1)return Sf;k1=1;function e(){this.__data__=[],this.size=0}return Sf=e,Sf}var Nf,_1;function si(){if(_1)return Nf;_1=1;function e(t,n){return t===n||t!==t&&n!==n}return Nf=e,Nf}var jf,S1;function ud(){if(S1)return jf;S1=1;var e=si();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return jf=t,jf}var Ef,N1;function m6(){if(N1)return Ef;N1=1;var e=ud(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var d=i.length-1;return l==d?i.pop():n.call(i,l,1),--this.size,!0}return Ef=s,Ef}var Cf,j1;function g6(){if(j1)return Cf;j1=1;var e=ud();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Cf=t,Cf}var Tf,E1;function y6(){if(E1)return Tf;E1=1;var e=ud();function t(n){return e(this.__data__,n)>-1}return Tf=t,Tf}var Rf,C1;function w6(){if(C1)return Rf;C1=1;var e=ud();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Rf=t,Rf}var Af,T1;function dd(){if(T1)return Af;T1=1;var e=p6(),t=m6(),n=g6(),s=y6(),a=w6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Af=i,Af}var Mf,R1;function v6(){if(R1)return Mf;R1=1;var e=dd();function t(){this.__data__=new e,this.size=0}return Mf=t,Mf}var If,A1;function x6(){if(A1)return If;A1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return If=e,If}var $f,M1;function b6(){if(M1)return $f;M1=1;function e(t){return this.__data__.get(t)}return $f=e,$f}var Of,I1;function k6(){if(I1)return Of;I1=1;function e(t){return this.__data__.has(t)}return Of=e,Of}var Pf,$1;function kR(){if($1)return Pf;$1=1;var e=typeof nu=="object"&&nu&&nu.Object===Object&νreturn Pf=e,Pf}var Lf,O1;function fr(){if(O1)return Lf;O1=1;var e=kR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Lf=n,Lf}var qf,P1;function ai(){if(P1)return qf;P1=1;var e=fr(),t=e.Symbol;return qf=t,qf}var Df,L1;function _6(){if(L1)return Df;L1=1;var e=ai(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(l){var d=n.call(l,a),f=l[a];try{l[a]=void 0;var p=!0}catch{}var h=s.call(l);return p&&(d?l[a]=f:delete l[a]),h}return Df=i,Df}var Ff,q1;function S6(){if(q1)return Ff;q1=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Ff=n,Ff}var zf,D1;function Aa(){if(D1)return zf;D1=1;var e=ai(),t=_6(),n=S6(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(d){return d==null?d===void 0?a:s:i&&i in Object(d)?t(d):n(d)}return zf=l,zf}var Bf,F1;function Gn(){if(F1)return Bf;F1=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bf=e,Bf}var Uf,z1;function Hl(){if(z1)return Uf;z1=1;var e=Aa(),t=Gn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(d){if(!t(d))return!1;var f=e(d);return f==s||f==a||f==n||f==i}return Uf=l,Uf}var Wf,B1;function N6(){if(B1)return Wf;B1=1;var e=fr(),t=e["__core-js_shared__"];return Wf=t,Wf}var Hf,U1;function j6(){if(U1)return Hf;U1=1;var e=N6(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return Hf=n,Hf}var Gf,W1;function _R(){if(W1)return Gf;W1=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Gf=n,Gf}var Vf,H1;function E6(){if(H1)return Vf;H1=1;var e=Hl(),t=j6(),n=Gn(),s=_R(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,d=Object.prototype,f=l.toString,p=d.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(w){if(!n(w)||t(w))return!1;var v=e(w)?h:i;return v.test(s(w))}return Vf=g,Vf}var Yf,G1;function C6(){if(G1)return Yf;G1=1;function e(t,n){return t==null?void 0:t[n]}return Yf=e,Yf}var Kf,V1;function Ma(){if(V1)return Kf;V1=1;var e=E6(),t=C6();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Kf=n,Kf}var Xf,Y1;function i0(){if(Y1)return Xf;Y1=1;var e=Ma(),t=fr(),n=e(t,"Map");return Xf=n,Xf}var Qf,K1;function hd(){if(K1)return Qf;K1=1;var e=Ma(),t=e(Object,"create");return Qf=t,Qf}var Zf,X1;function T6(){if(X1)return Zf;X1=1;var e=hd();function t(){this.__data__=e?e(null):{},this.size=0}return Zf=t,Zf}var Jf,Q1;function R6(){if(Q1)return Jf;Q1=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Jf=e,Jf}var ep,Z1;function A6(){if(Z1)return ep;Z1=1;var e=hd(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var d=l[i];return d===t?void 0:d}return s.call(l,i)?l[i]:void 0}return ep=a,ep}var tp,J1;function M6(){if(J1)return tp;J1=1;var e=hd(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return tp=s,tp}var np,e_;function I6(){if(e_)return np;e_=1;var e=hd(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return np=n,np}var rp,t_;function $6(){if(t_)return rp;t_=1;var e=T6(),t=R6(),n=A6(),s=M6(),a=I6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,rp=i,rp}var sp,n_;function O6(){if(n_)return sp;n_=1;var e=$6(),t=dd(),n=i0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return sp=s,sp}var ap,r_;function P6(){if(r_)return ap;r_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return ap=e,ap}var op,s_;function fd(){if(s_)return op;s_=1;var e=P6();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return op=t,op}var ip,a_;function L6(){if(a_)return ip;a_=1;var e=fd();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return ip=t,ip}var lp,o_;function q6(){if(o_)return lp;o_=1;var e=fd();function t(n){return e(this,n).get(n)}return lp=t,lp}var cp,i_;function D6(){if(i_)return cp;i_=1;var e=fd();function t(n){return e(this,n).has(n)}return cp=t,cp}var up,l_;function F6(){if(l_)return up;l_=1;var e=fd();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return up=t,up}var dp,c_;function l0(){if(c_)return dp;c_=1;var e=O6(),t=L6(),n=q6(),s=D6(),a=F6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,dp=i,dp}var hp,u_;function z6(){if(u_)return hp;u_=1;var e=dd(),t=i0(),n=l0(),s=200;function a(i,l){var d=this.__data__;if(d instanceof e){var f=d.__data__;if(!t||f.length<s-1)return f.push([i,l]),this.size=++d.size,this;d=this.__data__=new n(f)}return d.set(i,l),this.size=d.size,this}return hp=a,hp}var fp,d_;function pd(){if(d_)return fp;d_=1;var e=dd(),t=v6(),n=x6(),s=b6(),a=k6(),i=z6();function l(d){var f=this.__data__=new e(d);this.size=f.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=a,l.prototype.set=i,fp=l,fp}var pp,h_;function c0(){if(h_)return pp;h_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a&&n(t[s],s,t)!==!1;);return t}return pp=e,pp}var mp,f_;function SR(){if(f_)return mp;f_=1;var e=Ma(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return mp=t,mp}var gp,p_;function md(){if(p_)return gp;p_=1;var e=SR();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return gp=t,gp}var yp,m_;function gd(){if(m_)return yp;m_=1;var e=md(),t=si(),n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d){var f=i[l];(!(s.call(i,l)&&t(f,d))||d===void 0&&!(l in i))&&e(i,l,d)}return yp=a,yp}var wp,g_;function Gl(){if(g_)return wp;g_=1;var e=gd(),t=md();function n(s,a,i,l){var d=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],g=l?l(i[h],s[h],h,i,s):void 0;g===void 0&&(g=s[h]),d?t(i,h,g):e(i,h,g)}return i}return wp=n,wp}var vp,y_;function B6(){if(y_)return vp;y_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return vp=e,vp}var xp,w_;function jr(){if(w_)return xp;w_=1;function e(t){return t!=null&&typeof t=="object"}return xp=e,xp}var bp,v_;function U6(){if(v_)return bp;v_=1;var e=Aa(),t=jr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return bp=s,bp}var kp,x_;function Vl(){if(x_)return kp;x_=1;var e=U6(),t=jr(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!a.call(l,"callee")};return kp=i,kp}var _p,b_;function Mt(){if(b_)return _p;b_=1;var e=Array.isArray;return _p=e,_p}var gl={exports:{}},Sp,k_;function W6(){if(k_)return Sp;k_=1;function e(){return!1}return Sp=e,Sp}gl.exports;var __;function oi(){return __||(__=1,(function(e,t){var n=fr(),s=W6(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,d=l?n.Buffer:void 0,f=d?d.isBuffer:void 0,p=f||s;e.exports=p})(gl,gl.exports)),gl.exports}var Np,S_;function yd(){if(S_)return Np;S_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return Np=n,Np}var jp,N_;function u0(){if(N_)return jp;N_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return jp=t,jp}var Ep,j_;function H6(){if(j_)return Ep;j_=1;var e=Aa(),t=u0(),n=jr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",d="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",w="[object RegExp]",v="[object Set]",N="[object String]",x="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",j="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",O="[object Int32Array]",$="[object Uint8Array]",z="[object Uint8ClampedArray]",P="[object Uint16Array]",M="[object Uint32Array]",F={};F[j]=F[E]=F[C]=F[A]=F[O]=F[$]=F[z]=F[P]=F[M]=!0,F[s]=F[a]=F[S]=F[i]=F[_]=F[l]=F[d]=F[f]=F[p]=F[h]=F[g]=F[w]=F[v]=F[N]=F[x]=!1;function H(Z){return n(Z)&&t(Z.length)&&!!F[e(Z)]}return Ep=H,Ep}var Cp,E_;function wd(){if(E_)return Cp;E_=1;function e(t){return function(n){return t(n)}}return Cp=e,Cp}var yl={exports:{}};yl.exports;var C_;function d0(){return C_||(C_=1,(function(e,t){var n=kR(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i&&n.process,d=(function(){try{var f=a&&a.require&&a.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=d})(yl,yl.exports)),yl.exports}var Tp,T_;function Yl(){if(T_)return Tp;T_=1;var e=H6(),t=wd(),n=d0(),s=n&&n.isTypedArray,a=s?t(s):e;return Tp=a,Tp}var Rp,R_;function NR(){if(R_)return Rp;R_=1;var e=B6(),t=Vl(),n=Mt(),s=oi(),a=yd(),i=Yl(),l=Object.prototype,d=l.hasOwnProperty;function f(p,h){var g=n(p),w=!g&&t(p),v=!g&&!w&&s(p),N=!g&&!w&&!v&&i(p),x=g||w||v||N,S=x?e(p.length,String):[],_=S.length;for(var j in p)(h||d.call(p,j))&&!(x&&(j=="length"||v&&(j=="offset"||j=="parent")||N&&(j=="buffer"||j=="byteLength"||j=="byteOffset")||a(j,_)))&&S.push(j);return S}return Rp=f,Rp}var Ap,A_;function vd(){if(A_)return Ap;A_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Ap=t,Ap}var Mp,M_;function jR(){if(M_)return Mp;M_=1;function e(t,n){return function(s){return t(n(s))}}return Mp=e,Mp}var Ip,I_;function G6(){if(I_)return Ip;I_=1;var e=jR(),t=e(Object.keys,Object);return Ip=t,Ip}var $p,$_;function h0(){if($_)return $p;$_=1;var e=vd(),t=G6(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var d in Object(i))s.call(i,d)&&d!="constructor"&&l.push(d);return l}return $p=a,$p}var Op,O_;function Jr(){if(O_)return Op;O_=1;var e=Hl(),t=u0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Op=n,Op}var Pp,P_;function Ds(){if(P_)return Pp;P_=1;var e=NR(),t=h0(),n=Jr();function s(a){return n(a)?e(a):t(a)}return Pp=s,Pp}var Lp,L_;function V6(){if(L_)return Lp;L_=1;var e=Gl(),t=Ds();function n(s,a){return s&&e(a,t(a),s)}return Lp=n,Lp}var qp,q_;function Y6(){if(q_)return qp;q_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return qp=e,qp}var Dp,D_;function K6(){if(D_)return Dp;D_=1;var e=Gn(),t=vd(),n=Y6(),s=Object.prototype,a=s.hasOwnProperty;function i(l){if(!e(l))return n(l);var d=t(l),f=[];for(var p in l)p=="constructor"&&(d||!a.call(l,p))||f.push(p);return f}return Dp=i,Dp}var Fp,F_;function Ia(){if(F_)return Fp;F_=1;var e=NR(),t=K6(),n=Jr();function s(a){return n(a)?e(a,!0):t(a)}return Fp=s,Fp}var zp,z_;function X6(){if(z_)return zp;z_=1;var e=Gl(),t=Ia();function n(s,a){return s&&e(a,t(a),s)}return zp=n,zp}var wl={exports:{}};wl.exports;var B_;function ER(){return B_||(B_=1,(function(e,t){var n=fr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,d=l?l.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,w=d?d(g):new p.constructor(g);return p.copy(w),w}e.exports=f})(wl,wl.exports)),wl.exports}var Bp,U_;function CR(){if(U_)return Bp;U_=1;function e(t,n){var s=-1,a=t.length;for(n||(n=Array(a));++s<a;)n[s]=t[s];return n}return Bp=e,Bp}var Up,W_;function TR(){if(W_)return Up;W_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,l=[];++s<a;){var d=t[s];n(d,s,t)&&(l[i++]=d)}return l}return Up=e,Up}var Wp,H_;function RR(){if(H_)return Wp;H_=1;function e(){return[]}return Wp=e,Wp}var Hp,G_;function f0(){if(G_)return Hp;G_=1;var e=TR(),t=RR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(d){return s.call(l,d)}))}:t;return Hp=i,Hp}var Gp,V_;function Q6(){if(V_)return Gp;V_=1;var e=Gl(),t=f0();function n(s,a){return e(s,t(s),a)}return Gp=n,Gp}var Vp,Y_;function p0(){if(Y_)return Vp;Y_=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return Vp=e,Vp}var Yp,K_;function xd(){if(K_)return Yp;K_=1;var e=jR(),t=e(Object.getPrototypeOf,Object);return Yp=t,Yp}var Kp,X_;function AR(){if(X_)return Kp;X_=1;var e=p0(),t=xd(),n=f0(),s=RR(),a=Object.getOwnPropertySymbols,i=a?function(l){for(var d=[];l;)e(d,n(l)),l=t(l);return d}:s;return Kp=i,Kp}var Xp,Q_;function Z6(){if(Q_)return Xp;Q_=1;var e=Gl(),t=AR();function n(s,a){return e(s,t(s),a)}return Xp=n,Xp}var Qp,Z_;function MR(){if(Z_)return Qp;Z_=1;var e=p0(),t=Mt();function n(s,a,i){var l=a(s);return t(s)?l:e(l,i(s))}return Qp=n,Qp}var Zp,J_;function IR(){if(J_)return Zp;J_=1;var e=MR(),t=f0(),n=Ds();function s(a){return e(a,n,t)}return Zp=s,Zp}var Jp,eS;function J6(){if(eS)return Jp;eS=1;var e=MR(),t=AR(),n=Ia();function s(a){return e(a,n,t)}return Jp=s,Jp}var em,tS;function ez(){if(tS)return em;tS=1;var e=Ma(),t=fr(),n=e(t,"DataView");return em=n,em}var tm,nS;function tz(){if(nS)return tm;nS=1;var e=Ma(),t=fr(),n=e(t,"Promise");return tm=n,tm}var nm,rS;function $R(){if(rS)return nm;rS=1;var e=Ma(),t=fr(),n=e(t,"Set");return nm=n,nm}var rm,sS;function nz(){if(sS)return rm;sS=1;var e=Ma(),t=fr(),n=e(t,"WeakMap");return rm=n,rm}var sm,aS;function ii(){if(aS)return sm;aS=1;var e=ez(),t=i0(),n=tz(),s=$R(),a=nz(),i=Aa(),l=_R(),d="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",w="[object DataView]",v=l(e),N=l(t),x=l(n),S=l(s),_=l(a),j=i;return(e&&j(new e(new ArrayBuffer(1)))!=w||t&&j(new t)!=d||n&&j(n.resolve())!=p||s&&j(new s)!=h||a&&j(new a)!=g)&&(j=function(E){var C=i(E),A=C==f?E.constructor:void 0,O=A?l(A):"";if(O)switch(O){case v:return w;case N:return d;case x:return p;case S:return h;case _:return g}return C}),sm=j,sm}var am,oS;function rz(){if(oS)return am;oS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return am=n,am}var om,iS;function OR(){if(iS)return om;iS=1;var e=fr(),t=e.Uint8Array;return om=t,om}var im,lS;function m0(){if(lS)return im;lS=1;var e=OR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return im=t,im}var lm,cS;function sz(){if(cS)return lm;cS=1;var e=m0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return lm=t,lm}var cm,uS;function az(){if(uS)return cm;uS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return cm=t,cm}var um,dS;function oz(){if(dS)return um;dS=1;var e=ai(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return um=s,um}var dm,hS;function PR(){if(hS)return dm;hS=1;var e=m0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return dm=t,dm}var hm,fS;function iz(){if(fS)return hm;fS=1;var e=m0(),t=sz(),n=az(),s=oz(),a=PR(),i="[object Boolean]",l="[object Date]",d="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",w="[object Symbol]",v="[object ArrayBuffer]",N="[object DataView]",x="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",j="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",A="[object Uint8ClampedArray]",O="[object Uint16Array]",$="[object Uint32Array]";function z(P,M,F){var H=P.constructor;switch(M){case v:return e(P);case i:case l:return new H(+P);case N:return t(P,F);case x:case S:case _:case j:case E:case C:case A:case O:case $:return a(P,F);case d:return new H;case f:case g:return new H(P);case p:return n(P);case h:return new H;case w:return s(P)}}return hm=z,hm}var fm,pS;function LR(){if(pS)return fm;pS=1;var e=Gn(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return fm=n,fm}var pm,mS;function qR(){if(mS)return pm;mS=1;var e=LR(),t=xd(),n=vd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return pm=s,pm}var mm,gS;function lz(){if(gS)return mm;gS=1;var e=ii(),t=jr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return mm=s,mm}var gm,yS;function cz(){if(yS)return gm;yS=1;var e=lz(),t=wd(),n=d0(),s=n&&n.isMap,a=s?t(s):e;return gm=a,gm}var ym,wS;function uz(){if(wS)return ym;wS=1;var e=ii(),t=jr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return ym=s,ym}var wm,vS;function dz(){if(vS)return wm;vS=1;var e=uz(),t=wd(),n=d0(),s=n&&n.isSet,a=s?t(s):e;return wm=a,wm}var vm,xS;function DR(){if(xS)return vm;xS=1;var e=pd(),t=c0(),n=gd(),s=V6(),a=X6(),i=ER(),l=CR(),d=Q6(),f=Z6(),p=IR(),h=J6(),g=ii(),w=rz(),v=iz(),N=qR(),x=Mt(),S=oi(),_=cz(),j=Gn(),E=dz(),C=Ds(),A=Ia(),O=1,$=2,z=4,P="[object Arguments]",M="[object Array]",F="[object Boolean]",H="[object Date]",Z="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",B="[object Map]",te="[object Number]",J="[object Object]",q="[object RegExp]",Y="[object Set]",L="[object String]",K="[object Symbol]",de="[object WeakMap]",G="[object ArrayBuffer]",I="[object DataView]",X="[object Float32Array]",U="[object Float64Array]",oe="[object Int8Array]",fe="[object Int16Array]",me="[object Int32Array]",ke="[object Uint8Array]",Ye="[object Uint8ClampedArray]",Le="[object Uint16Array]",qe="[object Uint32Array]",je={};je[P]=je[M]=je[G]=je[I]=je[F]=je[H]=je[X]=je[U]=je[oe]=je[fe]=je[me]=je[B]=je[te]=je[J]=je[q]=je[Y]=je[L]=je[K]=je[ke]=je[Ye]=je[Le]=je[qe]=!0,je[Z]=je[R]=je[de]=!1;function Ge(be,se,Ze,ht,ct,at){var Ke,pe=se&O,ve=se&$,Pe=se&z;if(Ze&&(Ke=ct?Ze(be,ht,ct,at):Ze(be)),Ke!==void 0)return Ke;if(!j(be))return be;var Ue=x(be);if(Ue){if(Ke=w(be),!pe)return l(be,Ke)}else{var ot=g(be),$e=ot==R||ot==Q;if(S(be))return i(be,pe);if(ot==J||ot==P||$e&&!ct){if(Ke=ve||$e?{}:N(be),!pe)return ve?f(be,a(Ke,be)):d(be,s(Ke,be))}else{if(!je[ot])return ct?be:{};Ke=v(be,ot,pe)}}at||(at=new e);var re=at.get(be);if(re)return re;at.set(be,Ke),E(be)?be.forEach(function(_e){Ke.add(Ge(_e,se,Ze,_e,be,at))}):_(be)&&be.forEach(function(_e,Be){Ke.set(Be,Ge(_e,se,Ze,Be,be,at))});var Se=Pe?ve?h:p:ve?A:C,De=Ue?void 0:Se(be);return t(De||be,function(_e,Be){De&&(Be=_e,_e=be[Be]),n(Ke,Be,Ge(_e,se,Ze,Be,be,at))}),Ke}return vm=Ge,vm}var xm,bS;function hz(){if(bS)return xm;bS=1;var e=DR(),t=4;function n(s){return e(s,t)}return xm=n,xm}var bm,kS;function g0(){if(kS)return bm;kS=1;function e(t){return function(){return t}}return bm=e,bm}var km,_S;function fz(){if(_S)return km;_S=1;function e(t){return function(n,s,a){for(var i=-1,l=Object(n),d=a(n),f=d.length;f--;){var p=d[t?f:++i];if(s(l[p],p,l)===!1)break}return n}}return km=e,km}var _m,SS;function y0(){if(SS)return _m;SS=1;var e=fz(),t=e();return _m=t,_m}var Sm,NS;function w0(){if(NS)return Sm;NS=1;var e=y0(),t=Ds();function n(s,a){return s&&e(s,a,t)}return Sm=n,Sm}var Nm,jS;function pz(){if(jS)return Nm;jS=1;var e=Jr();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var l=a.length,d=s?l:-1,f=Object(a);(s?d--:++d<l)&&i(f[d],d,f)!==!1;);return a}}return Nm=t,Nm}var jm,ES;function bd(){if(ES)return jm;ES=1;var e=w0(),t=pz(),n=t(e);return jm=n,jm}var Em,CS;function $a(){if(CS)return Em;CS=1;function e(t){return t}return Em=e,Em}var Cm,TS;function FR(){if(TS)return Cm;TS=1;var e=$a();function t(n){return typeof n=="function"?n:e}return Cm=t,Cm}var Tm,RS;function zR(){if(RS)return Tm;RS=1;var e=c0(),t=bd(),n=FR(),s=Mt();function a(i,l){var d=s(i)?e:t;return d(i,n(l))}return Tm=a,Tm}var Rm,AS;function BR(){return AS||(AS=1,Rm=zR()),Rm}var Am,MS;function mz(){if(MS)return Am;MS=1;var e=bd();function t(n,s){var a=[];return e(n,function(i,l,d){s(i,l,d)&&a.push(i)}),a}return Am=t,Am}var Mm,IS;function gz(){if(IS)return Mm;IS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Mm=t,Mm}var Im,$S;function yz(){if($S)return Im;$S=1;function e(t){return this.__data__.has(t)}return Im=e,Im}var $m,OS;function UR(){if(OS)return $m;OS=1;var e=l0(),t=gz(),n=yz();function s(a){var i=-1,l=a==null?0:a.length;for(this.__data__=new e;++i<l;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,$m=s,$m}var Om,PS;function wz(){if(PS)return Om;PS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return Om=e,Om}var Pm,LS;function WR(){if(LS)return Pm;LS=1;function e(t,n){return t.has(n)}return Pm=e,Pm}var Lm,qS;function HR(){if(qS)return Lm;qS=1;var e=UR(),t=wz(),n=WR(),s=1,a=2;function i(l,d,f,p,h,g){var w=f&s,v=l.length,N=d.length;if(v!=N&&!(w&&N>v))return!1;var x=g.get(l),S=g.get(d);if(x&&S)return x==d&&S==l;var _=-1,j=!0,E=f&a?new e:void 0;for(g.set(l,d),g.set(d,l);++_<v;){var C=l[_],A=d[_];if(p)var O=w?p(A,C,_,d,l,g):p(C,A,_,l,d,g);if(O!==void 0){if(O)continue;j=!1;break}if(E){if(!t(d,function($,z){if(!n(E,z)&&(C===$||h(C,$,f,p,g)))return E.push(z)})){j=!1;break}}else if(!(C===A||h(C,A,f,p,g))){j=!1;break}}return g.delete(l),g.delete(d),j}return Lm=i,Lm}var qm,DS;function vz(){if(DS)return qm;DS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return qm=e,qm}var Dm,FS;function v0(){if(FS)return Dm;FS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Dm=e,Dm}var Fm,zS;function xz(){if(zS)return Fm;zS=1;var e=ai(),t=OR(),n=si(),s=HR(),a=vz(),i=v0(),l=1,d=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",w="[object Number]",v="[object RegExp]",N="[object Set]",x="[object String]",S="[object Symbol]",_="[object ArrayBuffer]",j="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function A(O,$,z,P,M,F,H){switch(z){case j:if(O.byteLength!=$.byteLength||O.byteOffset!=$.byteOffset)return!1;O=O.buffer,$=$.buffer;case _:return!(O.byteLength!=$.byteLength||!F(new t(O),new t($)));case f:case p:case w:return n(+O,+$);case h:return O.name==$.name&&O.message==$.message;case v:case x:return O==$+"";case g:var Z=a;case N:var R=P&l;if(Z||(Z=i),O.size!=$.size&&!R)return!1;var Q=H.get(O);if(Q)return Q==$;P|=d,H.set(O,$);var B=s(Z(O),Z($),P,M,F,H);return H.delete(O),B;case S:if(C)return C.call(O)==C.call($)}return!1}return Fm=A,Fm}var zm,BS;function bz(){if(BS)return zm;BS=1;var e=IR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d,f,p,h){var g=d&t,w=e(i),v=w.length,N=e(l),x=N.length;if(v!=x&&!g)return!1;for(var S=v;S--;){var _=w[S];if(!(g?_ in l:s.call(l,_)))return!1}var j=h.get(i),E=h.get(l);if(j&&E)return j==l&&E==i;var C=!0;h.set(i,l),h.set(l,i);for(var A=g;++S<v;){_=w[S];var O=i[_],$=l[_];if(f)var z=g?f($,O,_,l,i,h):f(O,$,_,i,l,h);if(!(z===void 0?O===$||p(O,$,d,f,h):z)){C=!1;break}A||(A=_=="constructor")}if(C&&!A){var P=i.constructor,M=l.constructor;P!=M&&"constructor"in i&&"constructor"in l&&!(typeof P=="function"&&P instanceof P&&typeof M=="function"&&M instanceof M)&&(C=!1)}return h.delete(i),h.delete(l),C}return zm=a,zm}var Bm,US;function kz(){if(US)return Bm;US=1;var e=pd(),t=HR(),n=xz(),s=bz(),a=ii(),i=Mt(),l=oi(),d=Yl(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",w=Object.prototype,v=w.hasOwnProperty;function N(x,S,_,j,E,C){var A=i(x),O=i(S),$=A?h:a(x),z=O?h:a(S);$=$==p?g:$,z=z==p?g:z;var P=$==g,M=z==g,F=$==z;if(F&&l(x)){if(!l(S))return!1;A=!0,P=!1}if(F&&!P)return C||(C=new e),A||d(x)?t(x,S,_,j,E,C):n(x,S,$,_,j,E,C);if(!(_&f)){var H=P&&v.call(x,"__wrapped__"),Z=M&&v.call(S,"__wrapped__");if(H||Z){var R=H?x.value():x,Q=Z?S.value():S;return C||(C=new e),E(R,Q,_,j,C)}}return F?(C||(C=new e),s(x,S,_,j,E,C)):!1}return Bm=N,Bm}var Um,WS;function GR(){if(WS)return Um;WS=1;var e=kz(),t=jr();function n(s,a,i,l,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,l,n,d)}return Um=n,Um}var Wm,HS;function _z(){if(HS)return Wm;HS=1;var e=pd(),t=GR(),n=1,s=2;function a(i,l,d,f){var p=d.length,h=p,g=!f;if(i==null)return!h;for(i=Object(i);p--;){var w=d[p];if(g&&w[2]?w[1]!==i[w[0]]:!(w[0]in i))return!1}for(;++p<h;){w=d[p];var v=w[0],N=i[v],x=w[1];if(g&&w[2]){if(N===void 0&&!(v in i))return!1}else{var S=new e;if(f)var _=f(N,x,v,i,l,S);if(!(_===void 0?t(x,N,n|s,f,S):_))return!1}}return!0}return Wm=a,Wm}var Hm,GS;function VR(){if(GS)return Hm;GS=1;var e=Gn();function t(n){return n===n&&!e(n)}return Hm=t,Hm}var Gm,VS;function Sz(){if(VS)return Gm;VS=1;var e=VR(),t=Ds();function n(s){for(var a=t(s),i=a.length;i--;){var l=a[i],d=s[l];a[i]=[l,d,e(d)]}return a}return Gm=n,Gm}var Vm,YS;function YR(){if(YS)return Vm;YS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Vm=e,Vm}var Ym,KS;function Nz(){if(KS)return Ym;KS=1;var e=_z(),t=Sz(),n=YR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===a||e(l,a,i)}}return Ym=s,Ym}var Km,XS;function li(){if(XS)return Km;XS=1;var e=Aa(),t=jr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Km=s,Km}var Xm,QS;function x0(){if(QS)return Xm;QS=1;var e=Mt(),t=li(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,l){if(e(i))return!1;var d=typeof i;return d=="number"||d=="symbol"||d=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Xm=a,Xm}var Qm,ZS;function jz(){if(ZS)return Qm;ZS=1;var e=l0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,d=a?a.apply(this,l):l[0],f=i.cache;if(f.has(d))return f.get(d);var p=s.apply(this,l);return i.cache=f.set(d,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Qm=n,Qm}var Zm,JS;function Ez(){if(JS)return Zm;JS=1;var e=jz(),t=500;function n(s){var a=e(s,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return Zm=n,Zm}var Jm,eN;function Cz(){if(eN)return Jm;eN=1;var e=Ez(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,d,f,p){i.push(f?p.replace(n,"$1"):d||l)}),i});return Jm=s,Jm}var eg,tN;function kd(){if(tN)return eg;tN=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return eg=e,eg}var tg,nN;function Tz(){if(nN)return tg;nN=1;var e=ai(),t=kd(),n=Mt(),s=li(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(d){if(typeof d=="string")return d;if(n(d))return t(d,l)+"";if(s(d))return i?i.call(d):"";var f=d+"";return f=="0"&&1/d==-1/0?"-0":f}return tg=l,tg}var ng,rN;function KR(){if(rN)return ng;rN=1;var e=Tz();function t(n){return n==null?"":e(n)}return ng=t,ng}var rg,sN;function _d(){if(sN)return rg;sN=1;var e=Mt(),t=x0(),n=Cz(),s=KR();function a(i,l){return e(i)?i:t(i,l)?[i]:n(s(i))}return rg=a,rg}var sg,aN;function Kl(){if(aN)return sg;aN=1;var e=li();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return sg=t,sg}var ag,oN;function Sd(){if(oN)return ag;oN=1;var e=_d(),t=Kl();function n(s,a){a=e(a,s);for(var i=0,l=a.length;s!=null&&i<l;)s=s[t(a[i++])];return i&&i==l?s:void 0}return ag=n,ag}var og,iN;function Rz(){if(iN)return og;iN=1;var e=Sd();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return og=t,og}var ig,lN;function Az(){if(lN)return ig;lN=1;function e(t,n){return t!=null&&n in Object(t)}return ig=e,ig}var lg,cN;function XR(){if(cN)return lg;cN=1;var e=_d(),t=Vl(),n=Mt(),s=yd(),a=u0(),i=Kl();function l(d,f,p){f=e(f,d);for(var h=-1,g=f.length,w=!1;++h<g;){var v=i(f[h]);if(!(w=d!=null&&p(d,v)))break;d=d[v]}return w||++h!=g?w:(g=d==null?0:d.length,!!g&&a(g)&&s(v,g)&&(n(d)||t(d)))}return lg=l,lg}var cg,uN;function QR(){if(uN)return cg;uN=1;var e=Az(),t=XR();function n(s,a){return s!=null&&t(s,a,e)}return cg=n,cg}var ug,dN;function Mz(){if(dN)return ug;dN=1;var e=GR(),t=Rz(),n=QR(),s=x0(),a=VR(),i=YR(),l=Kl(),d=1,f=2;function p(h,g){return s(h)&&a(g)?i(l(h),g):function(w){var v=t(w,h);return v===void 0&&v===g?n(w,h):e(g,v,d|f)}}return ug=p,ug}var dg,hN;function ZR(){if(hN)return dg;hN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return dg=e,dg}var hg,fN;function Iz(){if(fN)return hg;fN=1;var e=Sd();function t(n){return function(s){return e(s,n)}}return hg=t,hg}var fg,pN;function $z(){if(pN)return fg;pN=1;var e=ZR(),t=Iz(),n=x0(),s=Kl();function a(i){return n(i)?e(s(i)):t(i)}return fg=a,fg}var pg,mN;function es(){if(mN)return pg;mN=1;var e=Nz(),t=Mz(),n=$a(),s=Mt(),a=$z();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):a(l)}return pg=i,pg}var mg,gN;function JR(){if(gN)return mg;gN=1;var e=TR(),t=mz(),n=es(),s=Mt();function a(i,l){var d=s(i)?e:t;return d(i,n(l,3))}return mg=a,mg}var gg,yN;function Oz(){if(yN)return gg;yN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return gg=n,gg}var yg,wN;function eA(){if(wN)return yg;wN=1;var e=Oz(),t=XR();function n(s,a){return s!=null&&t(s,a,e)}return yg=n,yg}var wg,vN;function Pz(){if(vN)return wg;vN=1;var e=h0(),t=ii(),n=Vl(),s=Mt(),a=Jr(),i=oi(),l=vd(),d=Yl(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function w(v){if(v==null)return!0;if(a(v)&&(s(v)||typeof v=="string"||typeof v.splice=="function"||i(v)||d(v)||n(v)))return!v.length;var N=t(v);if(N==f||N==p)return!v.size;if(l(v))return!e(v).length;for(var x in v)if(g.call(v,x))return!1;return!0}return wg=w,wg}var vg,xN;function tA(){if(xN)return vg;xN=1;function e(t){return t===void 0}return vg=e,vg}var xg,bN;function nA(){if(bN)return xg;bN=1;var e=bd(),t=Jr();function n(s,a){var i=-1,l=t(s)?Array(s.length):[];return e(s,function(d,f,p){l[++i]=a(d,f,p)}),l}return xg=n,xg}var bg,kN;function rA(){if(kN)return bg;kN=1;var e=kd(),t=es(),n=nA(),s=Mt();function a(i,l){var d=s(i)?e:n;return d(i,t(l,3))}return bg=a,bg}var kg,_N;function Lz(){if(_N)return kg;_N=1;function e(t,n,s,a){var i=-1,l=t==null?0:t.length;for(a&&l&&(s=t[++i]);++i<l;)s=n(s,t[i],i,t);return s}return kg=e,kg}var _g,SN;function qz(){if(SN)return _g;SN=1;function e(t,n,s,a,i){return i(t,function(l,d,f){s=a?(a=!1,l):n(s,l,d,f)}),s}return _g=e,_g}var Sg,NN;function sA(){if(NN)return Sg;NN=1;var e=Lz(),t=bd(),n=es(),s=qz(),a=Mt();function i(l,d,f){var p=a(l)?e:s,h=arguments.length<3;return p(l,n(d,4),f,h,t)}return Sg=i,Sg}var Ng,jN;function Dz(){if(jN)return Ng;jN=1;var e=Aa(),t=Mt(),n=jr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return Ng=a,Ng}var jg,EN;function Fz(){if(EN)return jg;EN=1;var e=ZR(),t=e("length");return jg=t,jg}var Eg,CN;function zz(){if(CN)return Eg;CN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="\\u200d",d=RegExp("["+l+e+a+i+"]");function f(p){return d.test(p)}return Eg=f,Eg}var Cg,TN;function Bz(){if(TN)return Cg;TN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="["+e+"]",d="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",N=p+"?",x="["+i+"]?",S="(?:"+v+"(?:"+[h,g,w].join("|")+")"+x+N+")*",_=x+N+S,j="(?:"+[h+d+"?",d,g,w,l].join("|")+")",E=RegExp(f+"(?="+f+")|"+j+_,"g");function C(A){for(var O=E.lastIndex=0;E.test(A);)++O;return O}return Cg=C,Cg}var Tg,RN;function Uz(){if(RN)return Tg;RN=1;var e=Fz(),t=zz(),n=Bz();function s(a){return t(a)?n(a):e(a)}return Tg=s,Tg}var Rg,AN;function Wz(){if(AN)return Rg;AN=1;var e=h0(),t=ii(),n=Jr(),s=Dz(),a=Uz(),i="[object Map]",l="[object Set]";function d(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==l?f.size:e(f).length}return Rg=d,Rg}var Ag,MN;function Hz(){if(MN)return Ag;MN=1;var e=c0(),t=LR(),n=w0(),s=es(),a=xd(),i=Mt(),l=oi(),d=Hl(),f=Gn(),p=Yl();function h(g,w,v){var N=i(g),x=N||l(g)||p(g);if(w=s(w,4),v==null){var S=g&&g.constructor;x?v=N?new S:[]:f(g)?v=d(S)?t(a(g)):{}:v={}}return(x?e:n)(g,function(_,j,E){return w(v,_,j,E)}),v}return Ag=h,Ag}var Mg,IN;function Gz(){if(IN)return Mg;IN=1;var e=ai(),t=Vl(),n=Mt(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return Mg=a,Mg}var Ig,$N;function b0(){if($N)return Ig;$N=1;var e=p0(),t=Gz();function n(s,a,i,l,d){var f=-1,p=s.length;for(i||(i=t),d||(d=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,l,d):e(d,h):l||(d[d.length]=h)}return d}return Ig=n,Ig}var $g,ON;function Vz(){if(ON)return $g;ON=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return $g=e,$g}var Og,PN;function aA(){if(PN)return Og;PN=1;var e=Vz(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var l=arguments,d=-1,f=t(l.length-a,0),p=Array(f);++d<f;)p[d]=l[a+d];d=-1;for(var h=Array(a+1);++d<a;)h[d]=l[d];return h[a]=i(p),e(s,this,h)}}return Og=n,Og}var Pg,LN;function Yz(){if(LN)return Pg;LN=1;var e=g0(),t=SR(),n=$a(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Pg=s,Pg}var Lg,qN;function Kz(){if(qN)return Lg;qN=1;var e=800,t=16,n=Date.now;function s(a){var i=0,l=0;return function(){var d=n(),f=t-(d-l);if(l=d,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Lg=s,Lg}var qg,DN;function oA(){if(DN)return qg;DN=1;var e=Yz(),t=Kz(),n=t(e);return qg=n,qg}var Dg,FN;function Nd(){if(FN)return Dg;FN=1;var e=$a(),t=aA(),n=oA();function s(a,i){return n(t(a,i,e),a+"")}return Dg=s,Dg}var Fg,zN;function iA(){if(zN)return Fg;zN=1;function e(t,n,s,a){for(var i=t.length,l=s+(a?1:-1);a?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return Fg=e,Fg}var zg,BN;function Xz(){if(BN)return zg;BN=1;function e(t){return t!==t}return zg=e,zg}var Bg,UN;function Qz(){if(UN)return Bg;UN=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Bg=e,Bg}var Ug,WN;function Zz(){if(WN)return Ug;WN=1;var e=iA(),t=Xz(),n=Qz();function s(a,i,l){return i===i?n(a,i,l):e(a,t,l)}return Ug=s,Ug}var Wg,HN;function Jz(){if(HN)return Wg;HN=1;var e=Zz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Wg=t,Wg}var Hg,GN;function eB(){if(GN)return Hg;GN=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return Hg=e,Hg}var Gg,VN;function tB(){if(VN)return Gg;VN=1;function e(){}return Gg=e,Gg}var Vg,YN;function nB(){if(YN)return Vg;YN=1;var e=$R(),t=tB(),n=v0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return Vg=a,Vg}var Yg,KN;function rB(){if(KN)return Yg;KN=1;var e=UR(),t=Jz(),n=eB(),s=WR(),a=nB(),i=v0(),l=200;function d(f,p,h){var g=-1,w=t,v=f.length,N=!0,x=[],S=x;if(h)N=!1,w=n;else if(v>=l){var _=p?null:a(f);if(_)return i(_);N=!1,w=s,S=new e}else S=p?[]:x;e:for(;++g<v;){var j=f[g],E=p?p(j):j;if(j=h||j!==0?j:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),x.push(j)}else w(S,E,h)||(S!==x&&S.push(E),x.push(j))}return x}return Yg=d,Yg}var Kg,XN;function lA(){if(XN)return Kg;XN=1;var e=Jr(),t=jr();function n(s){return t(s)&&e(s)}return Kg=n,Kg}var Xg,QN;function sB(){if(QN)return Xg;QN=1;var e=b0(),t=Nd(),n=rB(),s=lA(),a=t(function(i){return n(e(i,1,s,!0))});return Xg=a,Xg}var Qg,ZN;function aB(){if(ZN)return Qg;ZN=1;var e=kd();function t(n,s){return e(s,function(a){return n[a]})}return Qg=t,Qg}var Zg,JN;function cA(){if(JN)return Zg;JN=1;var e=aB(),t=Ds();function n(s){return s==null?[]:e(s,t(s))}return Zg=n,Zg}var Jg,ej;function Vn(){if(ej)return Jg;ej=1;var e;if(typeof o0=="function")try{e={clone:hz(),constant:g0(),each:BR(),filter:JR(),has:eA(),isArray:Mt(),isEmpty:Pz(),isFunction:Hl(),isUndefined:tA(),keys:Ds(),map:rA(),reduce:sA(),size:Wz(),transform:Hz(),union:sB(),values:cA()}}catch{}return e||(e=window._),Jg=e,Jg}var ey,tj;function k0(){if(tj)return ey;tj=1;var e=Vn();ey=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._in[g])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._out[g])})},a.prototype.setNodes=function(h,g){var w=arguments,v=this;return e.each(h,function(N){w.length>1?v.setNode(N,g):v.setNode(N)}),this},a.prototype.setNode=function(h,g){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=g),this):(this._nodes[h]=arguments.length>1?g:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var g=this;if(e.has(this._nodes,h)){var w=function(v){g.removeEdge(g._edgeObjs[v])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(v){g.setParent(v)}),delete this._children[h]),e.each(e.keys(this._in[h]),w),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),w),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var w=g;!e.isUndefined(w);w=this.parent(w))if(w===h)throw new Error("Setting "+g+" as parent of "+h+" would create a cycle");this.setNode(g)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=g,this._children[g][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var g=this._parent[h];if(g!==n)return g}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var g=this._children[h];if(g)return e.keys(g)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var g=this._preds[h];if(g)return e.keys(g)},a.prototype.successors=function(h){var g=this._sucs[h];if(g)return e.keys(g)},a.prototype.neighbors=function(h){var g=this.predecessors(h);if(g)return e.union(g,this.successors(h))},a.prototype.isLeaf=function(h){var g;return this.isDirected()?g=this.successors(h):g=this.neighbors(h),g.length===0},a.prototype.filterNodes=function(h){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var w=this;e.each(this._nodes,function(x,S){h(S)&&g.setNode(S,x)}),e.each(this._edgeObjs,function(x){g.hasNode(x.v)&&g.hasNode(x.w)&&g.setEdge(x,w.edge(x))});var v={};function N(x){var S=w.parent(x);return S===void 0||g.hasNode(S)?(v[x]=S,S):S in v?v[S]:N(S)}return this._isCompound&&e.each(g.nodes(),function(x){g.setParent(x,N(x))}),g},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,g){var w=this,v=arguments;return e.reduce(h,function(N,x){return v.length>1?w.setEdge(N,x,g):w.setEdge(N,x),x}),this},a.prototype.setEdge=function(){var h,g,w,v,N=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(h=x.v,g=x.w,w=x.name,arguments.length===2&&(v=arguments[1],N=!0)):(h=x,g=arguments[1],w=arguments[3],arguments.length>2&&(v=arguments[2],N=!0)),h=""+h,g=""+g,e.isUndefined(w)||(w=""+w);var S=d(this._isDirected,h,g,w);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=v),this;if(!e.isUndefined(w)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[S]=N?v:this._defaultEdgeLabelFn(h,g,w);var _=f(this._isDirected,h,g,w);return h=_.v,g=_.w,Object.freeze(_),this._edgeObjs[S]=_,i(this._preds[g],h),i(this._sucs[h],g),this._in[g][S]=_,this._out[h][S]=_,this._edgeCount++,this},a.prototype.edge=function(h,g,w){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,w);return this._edgeLabels[v]},a.prototype.hasEdge=function(h,g,w){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,w);return e.has(this._edgeLabels,v)},a.prototype.removeEdge=function(h,g,w){var v=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,w),N=this._edgeObjs[v];return N&&(h=N.v,g=N.w,delete this._edgeLabels[v],delete this._edgeObjs[v],l(this._preds[g],h),l(this._sucs[h],g),delete this._in[g][v],delete this._out[h][v],this._edgeCount--),this},a.prototype.inEdges=function(h,g){var w=this._in[h];if(w){var v=e.values(w);return g?e.filter(v,function(N){return N.v===g}):v}},a.prototype.outEdges=function(h,g){var w=this._out[h];if(w){var v=e.values(w);return g?e.filter(v,function(N){return N.w===g}):v}},a.prototype.nodeEdges=function(h,g){var w=this.inEdges(h,g);if(w)return w.concat(this.outEdges(h,g))};function i(h,g){h[g]?h[g]++:h[g]=1}function l(h,g){--h[g]||delete h[g]}function d(h,g,w,v){var N=""+g,x=""+w;if(!h&&N>x){var S=N;N=x,x=S}return N+s+x+s+(e.isUndefined(v)?t:v)}function f(h,g,w,v){var N=""+g,x=""+w;if(!h&&N>x){var S=N;N=x,x=S}var _={v:N,w:x};return v&&(_.name=v),_}function p(h,g){return d(h,g.v,g.w,g.name)}return ey}var ty,nj;function oB(){return nj||(nj=1,ty="2.1.8"),ty}var ny,rj;function iB(){return rj||(rj=1,ny={Graph:k0(),version:oB()}),ny}var ry,sj;function lB(){if(sj)return ry;sj=1;var e=Vn(),t=k0();ry={write:n,read:i};function n(l){var d={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:a(l)};return e.isUndefined(l.graph())||(d.value=e.clone(l.graph())),d}function s(l){return e.map(l.nodes(),function(d){var f=l.node(d),p=l.parent(d),h={v:d};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(l){return e.map(l.edges(),function(d){var f=l.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(f)||(p.value=f),p})}function i(l){var d=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){d.setNode(f.v,f.value),f.parent&&d.setParent(f.v,f.parent)}),e.each(l.edges,function(f){d.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),d}return ry}var sy,aj;function cB(){if(aj)return sy;aj=1;var e=Vn();sy=t;function t(n){var s={},a=[],i;function l(d){e.has(s,d)||(s[d]=!0,i.push(d),e.each(n.successors(d),l),e.each(n.predecessors(d),l))}return e.each(n.nodes(),function(d){i=[],l(d),i.length&&a.push(i)}),a}return sy}var ay,oj;function uA(){if(oj)return ay;oj=1;var e=Vn();ay=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,l=i.length;return a[n]=l,i.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,l=n;a<s.length&&(l=s[a].priority<s[l].priority?a:l,i<s.length&&(l=s[i].priority<s[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,l=a[n],d=a[s];a[n]=d,a[s]=l,i[d.key]=n,i[l.key]=s},ay}var oy,ij;function dA(){if(ij)return oy;ij=1;var e=Vn(),t=uA();oy=s;var n=e.constant(1);function s(i,l,d,f){return a(i,String(l),d||n,f||function(p){return i.outEdges(p)})}function a(i,l,d,f){var p={},h=new t,g,w,v=function(N){var x=N.v!==g?N.v:N.w,S=p[x],_=d(N),j=w.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+_);j<S.distance&&(S.distance=j,S.predecessor=g,h.decrease(x,j))};for(i.nodes().forEach(function(N){var x=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:x},h.add(N,x)});h.size()>0&&(g=h.removeMin(),w=p[g],w.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(v);return p}return oy}var iy,lj;function uB(){if(lj)return iy;lj=1;var e=dA(),t=Vn();iy=n;function n(s,a,i){return t.transform(s.nodes(),function(l,d){l[d]=e(s,d,a,i)},{})}return iy}var ly,cj;function hA(){if(cj)return ly;cj=1;var e=Vn();ly=t;function t(n){var s=0,a=[],i={},l=[];function d(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(w){e.has(i,w)?i[w].onStack&&(p.lowlink=Math.min(p.lowlink,i[w].index)):(d(w),p.lowlink=Math.min(p.lowlink,i[w].lowlink))}),p.lowlink===p.index){var h=[],g;do g=a.pop(),i[g].onStack=!1,h.push(g);while(f!==g);l.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||d(f)}),l}return ly}var cy,uj;function dB(){if(uj)return cy;uj=1;var e=Vn(),t=hA();cy=n;function n(s){return e.filter(t(s),function(a){return a.length>1||a.length===1&&s.hasEdge(a[0],a[0])})}return cy}var uy,dj;function hB(){if(dj)return uy;dj=1;var e=Vn();uy=n;var t=e.constant(1);function n(a,i,l){return s(a,i||t,l||function(d){return a.outEdges(d)})}function s(a,i,l){var d={},f=a.nodes();return f.forEach(function(p){d[p]={},d[p][p]={distance:0},f.forEach(function(h){p!==h&&(d[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var g=h.v===p?h.w:h.v,w=i(h);d[p][g]={distance:w,predecessor:p}})}),f.forEach(function(p){var h=d[p];f.forEach(function(g){var w=d[g];f.forEach(function(v){var N=w[p],x=h[v],S=w[v],_=N.distance+x.distance;_<S.distance&&(S.distance=_,S.predecessor=x.predecessor)})})}),d}return uy}var dy,hj;function fA(){if(hj)return dy;hj=1;var e=Vn();dy=t,t.CycleException=n;function t(s){var a={},i={},l=[];function d(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),d),delete i[f],l.push(f))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,dy}var hy,fj;function fB(){if(fj)return hy;fj=1;var e=fA();hy=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return hy}var fy,pj;function pA(){if(pj)return fy;pj=1;var e=Vn();fy=t;function t(s,a,i){e.isArray(a)||(a=[a]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,l,d)}),d}function n(s,a,i,l,d,f){e.has(l,a)||(l[a]=!0,i||f.push(a),e.each(d(a),function(p){n(s,p,i,l,d,f)}),i&&f.push(a))}return fy}var py,mj;function pB(){if(mj)return py;mj=1;var e=pA();py=t;function t(n,s){return e(n,s,"post")}return py}var my,gj;function mB(){if(gj)return my;gj=1;var e=pA();my=t;function t(n,s){return e(n,s,"pre")}return my}var gy,yj;function gB(){if(yj)return gy;yj=1;var e=Vn(),t=k0(),n=uA();gy=s;function s(a,i){var l=new t,d={},f=new n,p;function h(w){var v=w.v===p?w.w:w.v,N=f.priority(v);if(N!==void 0){var x=i(w);x<N&&(d[v]=p,f.decrease(v,x))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(w){f.add(w,Number.POSITIVE_INFINITY),l.setNode(w)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(d,p))l.setEdge(p,d[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return l}return gy}var yy,wj;function yB(){return wj||(wj=1,yy={components:cB(),dijkstra:dA(),dijkstraAll:uB(),findCycles:dB(),floydWarshall:hB(),isAcyclic:fB(),postorder:pB(),preorder:mB(),prim:gB(),tarjan:hA(),topsort:fA()}),yy}var wy,vj;function wB(){if(vj)return wy;vj=1;var e=iB();return wy={Graph:e.Graph,json:lB(),alg:yB(),version:e.version},wy}var vy,xj;function dr(){if(xj)return vy;xj=1;var e;if(typeof o0=="function")try{e=wB()}catch{}return e||(e=window.graphlib),vy=e,vy}var xy,bj;function vB(){if(bj)return xy;bj=1;var e=DR(),t=1,n=4;function s(a){return e(a,t|n)}return xy=s,xy}var by,kj;function jd(){if(kj)return by;kj=1;var e=si(),t=Jr(),n=yd(),s=Gn();function a(i,l,d){if(!s(d))return!1;var f=typeof l;return(f=="number"?t(d)&&n(l,d.length):f=="string"&&l in d)?e(d[l],i):!1}return by=a,by}var ky,_j;function xB(){if(_j)return ky;_j=1;var e=Nd(),t=si(),n=jd(),s=Ia(),a=Object.prototype,i=a.hasOwnProperty,l=e(function(d,f){d=Object(d);var p=-1,h=f.length,g=h>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(h=1);++p<h;)for(var w=f[p],v=s(w),N=-1,x=v.length;++N<x;){var S=v[N],_=d[S];(_===void 0||t(_,a[S])&&!i.call(d,S))&&(d[S]=w[S])}return d});return ky=l,ky}var _y,Sj;function bB(){if(Sj)return _y;Sj=1;var e=es(),t=Jr(),n=Ds();function s(a){return function(i,l,d){var f=Object(i);if(!t(i)){var p=e(l,3);i=n(i),l=function(g){return p(f[g],g,f)}}var h=a(i,l,d);return h>-1?f[p?i[h]:h]:void 0}}return _y=s,_y}var Sy,Nj;function kB(){if(Nj)return Sy;Nj=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Sy=t,Sy}var Ny,jj;function _B(){if(jj)return Ny;jj=1;var e=kB(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Ny=n,Ny}var jy,Ej;function SB(){if(Ej)return jy;Ej=1;var e=_B(),t=Gn(),n=li(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=i.test(p);return g||l.test(p)?d(p.slice(2),g?2:8):a.test(p)?s:+p}return jy=f,jy}var Ey,Cj;function mA(){if(Cj)return Ey;Cj=1;var e=SB(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return Ey=s,Ey}var Cy,Tj;function NB(){if(Tj)return Cy;Tj=1;var e=mA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Cy=t,Cy}var Ty,Rj;function jB(){if(Rj)return Ty;Rj=1;var e=iA(),t=es(),n=NB(),s=Math.max;function a(i,l,d){var f=i==null?0:i.length;if(!f)return-1;var p=d==null?0:n(d);return p<0&&(p=s(f+p,0)),e(i,t(l,3),p)}return Ty=a,Ty}var Ry,Aj;function EB(){if(Aj)return Ry;Aj=1;var e=bB(),t=jB(),n=e(t);return Ry=n,Ry}var Ay,Mj;function gA(){if(Mj)return Ay;Mj=1;var e=b0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Ay=t,Ay}var My,Ij;function CB(){if(Ij)return My;Ij=1;var e=y0(),t=FR(),n=Ia();function s(a,i){return a==null?a:e(a,t(i),n)}return My=s,My}var Iy,$j;function TB(){if($j)return Iy;$j=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Iy=e,Iy}var $y,Oj;function RB(){if(Oj)return $y;Oj=1;var e=md(),t=w0(),n=es();function s(a,i){var l={};return i=n(i,3),t(a,function(d,f,p){e(l,f,i(d,f,p))}),l}return $y=s,$y}var Oy,Pj;function _0(){if(Pj)return Oy;Pj=1;var e=li();function t(n,s,a){for(var i=-1,l=n.length;++i<l;){var d=n[i],f=s(d);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=d}return h}return Oy=t,Oy}var Py,Lj;function AB(){if(Lj)return Py;Lj=1;function e(t,n){return t>n}return Py=e,Py}var Ly,qj;function MB(){if(qj)return Ly;qj=1;var e=_0(),t=AB(),n=$a();function s(a){return a&&a.length?e(a,n,t):void 0}return Ly=s,Ly}var qy,Dj;function yA(){if(Dj)return qy;Dj=1;var e=md(),t=si();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return qy=n,qy}var Dy,Fj;function IB(){if(Fj)return Dy;Fj=1;var e=Aa(),t=xd(),n=jr(),s="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,d=i.hasOwnProperty,f=l.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var g=t(h);if(g===null)return!0;var w=d.call(g,"constructor")&&g.constructor;return typeof w=="function"&&w instanceof w&&l.call(w)==f}return Dy=p,Dy}var Fy,zj;function wA(){if(zj)return Fy;zj=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Fy=e,Fy}var zy,Bj;function $B(){if(Bj)return zy;Bj=1;var e=Gl(),t=Ia();function n(s){return e(s,t(s))}return zy=n,zy}var By,Uj;function OB(){if(Uj)return By;Uj=1;var e=yA(),t=ER(),n=PR(),s=CR(),a=qR(),i=Vl(),l=Mt(),d=lA(),f=oi(),p=Hl(),h=Gn(),g=IB(),w=Yl(),v=wA(),N=$B();function x(S,_,j,E,C,A,O){var $=v(S,j),z=v(_,j),P=O.get(z);if(P){e(S,j,P);return}var M=A?A($,z,j+"",S,_,O):void 0,F=M===void 0;if(F){var H=l(z),Z=!H&&f(z),R=!H&&!Z&&w(z);M=z,H||Z||R?l($)?M=$:d($)?M=s($):Z?(F=!1,M=t(z,!0)):R?(F=!1,M=n(z,!0)):M=[]:g(z)||i(z)?(M=$,i($)?M=N($):(!h($)||p($))&&(M=a(z))):F=!1}F&&(O.set(z,M),C(M,z,E,A,O),O.delete(z)),e(S,j,M)}return By=x,By}var Uy,Wj;function PB(){if(Wj)return Uy;Wj=1;var e=pd(),t=yA(),n=y0(),s=OB(),a=Gn(),i=Ia(),l=wA();function d(f,p,h,g,w){f!==p&&n(p,function(v,N){if(w||(w=new e),a(v))s(f,p,N,h,d,g,w);else{var x=g?g(l(f,N),v,N+"",f,p,w):void 0;x===void 0&&(x=v),t(f,N,x)}},i)}return Uy=d,Uy}var Wy,Hj;function LB(){if(Hj)return Wy;Hj=1;var e=Nd(),t=jd();function n(s){return e(function(a,i){var l=-1,d=i.length,f=d>1?i[d-1]:void 0,p=d>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(d--,f):void 0,p&&t(i[0],i[1],p)&&(f=d<3?void 0:f,d=1),a=Object(a);++l<d;){var h=i[l];h&&s(a,h,l,f)}return a})}return Wy=n,Wy}var Hy,Gj;function qB(){if(Gj)return Hy;Gj=1;var e=PB(),t=LB(),n=t(function(s,a,i){e(s,a,i)});return Hy=n,Hy}var Gy,Vj;function vA(){if(Vj)return Gy;Vj=1;function e(t,n){return t<n}return Gy=e,Gy}var Vy,Yj;function DB(){if(Yj)return Vy;Yj=1;var e=_0(),t=vA(),n=$a();function s(a){return a&&a.length?e(a,n,t):void 0}return Vy=s,Vy}var Yy,Kj;function FB(){if(Kj)return Yy;Kj=1;var e=_0(),t=es(),n=vA();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Yy=s,Yy}var Ky,Xj;function zB(){if(Xj)return Ky;Xj=1;var e=fr(),t=function(){return e.Date.now()};return Ky=t,Ky}var Xy,Qj;function BB(){if(Qj)return Xy;Qj=1;var e=gd(),t=_d(),n=yd(),s=Gn(),a=Kl();function i(l,d,f,p){if(!s(l))return l;d=t(d,l);for(var h=-1,g=d.length,w=g-1,v=l;v!=null&&++h<g;){var N=a(d[h]),x=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(h!=w){var S=v[N];x=p?p(S,N,v):void 0,x===void 0&&(x=s(S)?S:n(d[h+1])?[]:{})}e(v,N,x),v=v[N]}return l}return Xy=i,Xy}var Qy,Zj;function UB(){if(Zj)return Qy;Zj=1;var e=Sd(),t=BB(),n=_d();function s(a,i,l){for(var d=-1,f=i.length,p={};++d<f;){var h=i[d],g=e(a,h);l(g,h)&&t(p,n(h,a),g)}return p}return Qy=s,Qy}var Zy,Jj;function WB(){if(Jj)return Zy;Jj=1;var e=UB(),t=QR();function n(s,a){return e(s,a,function(i,l){return t(s,l)})}return Zy=n,Zy}var Jy,eE;function HB(){if(eE)return Jy;eE=1;var e=gA(),t=aA(),n=oA();function s(a){return n(t(a,void 0,e),a+"")}return Jy=s,Jy}var ew,tE;function GB(){if(tE)return ew;tE=1;var e=WB(),t=HB(),n=t(function(s,a){return s==null?{}:e(s,a)});return ew=n,ew}var tw,nE;function VB(){if(nE)return tw;nE=1;var e=Math.ceil,t=Math.max;function n(s,a,i,l){for(var d=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[l?f:++d]=s,s+=i;return p}return tw=n,tw}var nw,rE;function YB(){if(rE)return nw;rE=1;var e=VB(),t=jd(),n=mA();function s(a){return function(i,l,d){return d&&typeof d!="number"&&t(i,l,d)&&(l=d=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),d=d===void 0?i<l?1:-1:n(d),e(i,l,d,a)}}return nw=s,nw}var rw,sE;function KB(){if(sE)return rw;sE=1;var e=YB(),t=e();return rw=t,rw}var sw,aE;function XB(){if(aE)return sw;aE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return sw=e,sw}var aw,oE;function QB(){if(oE)return aw;oE=1;var e=li();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,l=n===n,d=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!d&&n>s||d&&f&&h&&!p&&!g||i&&f&&h||!a&&h||!l)return 1;if(!i&&!d&&!g&&n<s||g&&a&&l&&!i&&!d||p&&a&&l||!f&&l||!h)return-1}return 0}return aw=t,aw}var ow,iE;function ZB(){if(iE)return ow;iE=1;var e=QB();function t(n,s,a){for(var i=-1,l=n.criteria,d=s.criteria,f=l.length,p=a.length;++i<f;){var h=e(l[i],d[i]);if(h){if(i>=p)return h;var g=a[i];return h*(g=="desc"?-1:1)}}return n.index-s.index}return ow=t,ow}var iw,lE;function JB(){if(lE)return iw;lE=1;var e=kd(),t=Sd(),n=es(),s=nA(),a=XB(),i=wd(),l=ZB(),d=$a(),f=Mt();function p(h,g,w){g.length?g=e(g,function(x){return f(x)?function(S){return t(S,x.length===1?x[0]:x)}:x}):g=[d];var v=-1;g=e(g,i(n));var N=s(h,function(x,S,_){var j=e(g,function(E){return E(x)});return{criteria:j,index:++v,value:x}});return a(N,function(x,S){return l(x,S,w)})}return iw=p,iw}var lw,cE;function e8(){if(cE)return lw;cE=1;var e=b0(),t=JB(),n=Nd(),s=jd(),a=n(function(i,l){if(i==null)return[];var d=l.length;return d>1&&s(i,l[0],l[1])?l=[]:d>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return lw=a,lw}var cw,uE;function t8(){if(uE)return cw;uE=1;var e=KR(),t=0;function n(s){var a=++t;return e(s)+a}return cw=n,cw}var uw,dE;function n8(){if(dE)return uw;dE=1;function e(t,n,s){for(var a=-1,i=t.length,l=n.length,d={};++a<i;){var f=a<l?n[a]:void 0;s(d,t[a],f)}return d}return uw=e,uw}var dw,hE;function r8(){if(hE)return dw;hE=1;var e=gd(),t=n8();function n(s,a){return t(s||[],a||[],e)}return dw=n,dw}var hw,fE;function gt(){if(fE)return hw;fE=1;var e;if(typeof o0=="function")try{e={cloneDeep:vB(),constant:g0(),defaults:xB(),each:BR(),filter:JR(),find:EB(),flatten:gA(),forEach:zR(),forIn:CB(),has:eA(),isUndefined:tA(),last:TB(),map:rA(),mapValues:RB(),max:MB(),merge:qB(),min:DB(),minBy:FB(),now:zB(),pick:GB(),range:KB(),reduce:sA(),sortBy:e8(),uniqueId:t8(),values:cA(),zipObject:r8()}}catch{}return e||(e=window._),hw=e,hw}var fw,pE;function s8(){if(pE)return fw;pE=1,fw=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,a){if(s!=="_next"&&s!=="_prev")return a}return fw}var pw,mE;function a8(){if(mE)return pw;mE=1;var e=gt(),t=dr().Graph,n=s8();pw=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=d(p,h||s),w=i(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(w,function(v){return p.outEdges(v.v,v.w)}),!0)}function i(p,h,g){for(var w=[],v=h[h.length-1],N=h[0],x;p.nodeCount();){for(;x=N.dequeue();)l(p,h,g,x);for(;x=v.dequeue();)l(p,h,g,x);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(x=h[S].dequeue(),x){w=w.concat(l(p,h,g,x,!0));break}}}return w}function l(p,h,g,w,v){var N=v?[]:void 0;return e.forEach(p.inEdges(w.v),function(x){var S=p.edge(x),_=p.node(x.v);v&&N.push({v:x.v,w:x.w}),_.out-=S,f(h,g,_)}),e.forEach(p.outEdges(w.v),function(x){var S=p.edge(x),_=x.w,j=p.node(_);j.in-=S,f(h,g,j)}),p.removeNode(w.v),N}function d(p,h){var g=new t,w=0,v=0;e.forEach(p.nodes(),function(S){g.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var _=g.edge(S.v,S.w)||0,j=h(S),E=_+j;g.setEdge(S.v,S.w,E),v=Math.max(v,g.node(S.v).out+=j),w=Math.max(w,g.node(S.w).in+=j)});var N=e.range(v+w+3).map(function(){return new n}),x=w+1;return e.forEach(g.nodes(),function(S){f(N,x,g.node(S))}),{graph:g,buckets:N,zeroIdx:x}}function f(p,h,g){g.out?g.in?p[g.out-g.in+h].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return pw}var mw,gE;function o8(){if(gE)return mw;gE=1;var e=gt(),t=a8();mw={run:n,undo:a};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,d(i)):s(i);e.forEach(l,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function d(f){return function(p){return f.edge(p).weight}}}function s(i){var l=[],d={},f={};function p(h){e.has(f,h)||(f[h]=!0,d[h]=!0,e.forEach(i.outEdges(h),function(g){e.has(d,g.w)?l.push(g):p(g.w)}),delete d[h])}return e.forEach(i.nodes(),p),l}function a(i){e.forEach(i.edges(),function(l){var d=i.edge(l);if(d.reversed){i.removeEdge(l);var f=d.forwardName;delete d.reversed,delete d.forwardName,i.setEdge(l.w,l.v,d,f)}})}return mw}var gw,yE;function wn(){if(yE)return gw;yE=1;var e=gt(),t=dr().Graph;gw={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:l,intersectRect:d,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:w,partition:v,time:N,notime:x};function n(S,_,j,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return j.dummy=_,S.setNode(C,j),C}function s(S){var _=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(j){_.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){var E=_.edge(j.v,j.w)||{weight:0,minlen:1},C=S.edge(j);_.setEdge(j.v,j.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),_}function a(S){var _=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(j){S.children(j).length||_.setNode(j,S.node(j))}),e.forEach(S.edges(),function(j){_.setEdge(j,S.edge(j))}),_}function i(S){var _=e.map(S.nodes(),function(j){var E={};return e.forEach(S.outEdges(j),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),_)}function l(S){var _=e.map(S.nodes(),function(j){var E={};return e.forEach(S.inEdges(j),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),_)}function d(S,_){var j=S.x,E=S.y,C=_.x-j,A=_.y-E,O=S.width/2,$=S.height/2;if(!C&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var z,P;return Math.abs(A)*O>Math.abs(C)*$?(A<0&&($=-$),z=$*C/A,P=$):(C<0&&(O=-O),z=O,P=O*A/C),{x:j+z,y:E+P}}function f(S){var _=e.map(e.range(w(S)+1),function(){return[]});return e.forEach(S.nodes(),function(j){var E=S.node(j),C=E.rank;e.isUndefined(C)||(_[C][E.order]=j)}),_}function p(S){var _=e.min(e.map(S.nodes(),function(j){return S.node(j).rank}));e.forEach(S.nodes(),function(j){var E=S.node(j);e.has(E,"rank")&&(E.rank-=_)})}function h(S){var _=e.min(e.map(S.nodes(),function(A){return S.node(A).rank})),j=[];e.forEach(S.nodes(),function(A){var O=S.node(A).rank-_;j[O]||(j[O]=[]),j[O].push(A)});var E=0,C=S.graph().nodeRankFactor;e.forEach(j,function(A,O){e.isUndefined(A)&&O%C!==0?--E:E&&e.forEach(A,function($){S.node($).rank+=E})})}function g(S,_,j,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=j,C.order=E),n(S,"border",C,_)}function w(S){return e.max(e.map(S.nodes(),function(_){var j=S.node(_).rank;if(!e.isUndefined(j))return j}))}function v(S,_){var j={lhs:[],rhs:[]};return e.forEach(S,function(E){_(E)?j.lhs.push(E):j.rhs.push(E)}),j}function N(S,_){var j=e.now();try{return _()}finally{console.log(S+" time: "+(e.now()-j)+"ms")}}function x(S,_){return _()}return gw}var yw,wE;function i8(){if(wE)return yw;wE=1;var e=gt(),t=wn();yw={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){s(i,l)})}function s(i,l){var d=l.v,f=i.node(d).rank,p=l.w,h=i.node(p).rank,g=l.name,w=i.edge(l),v=w.labelRank;if(h!==f+1){i.removeEdge(l);var N,x,S;for(S=0,++f;f<h;++S,++f)w.points=[],x={width:0,height:0,edgeLabel:w,edgeObj:l,rank:f},N=t.addDummyNode(i,"edge",x,"_d"),f===v&&(x.width=w.width,x.height=w.height,x.dummy="edge-label",x.labelpos=w.labelpos),i.setEdge(d,N,{weight:w.weight},g),S===0&&i.graph().dummyChains.push(N),d=N;i.setEdge(d,p,{weight:w.weight},g)}}function a(i){e.forEach(i.graph().dummyChains,function(l){var d=i.node(l),f=d.edgeLabel,p;for(i.setEdge(d.edgeObj,f);d.dummy;)p=i.successors(l)[0],i.removeNode(l),f.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(f.x=d.x,f.y=d.y,f.width=d.width,f.height=d.height),l=p,d=i.node(l)})}return yw}var ww,vE;function Ku(){if(vE)return ww;vE=1;var e=gt();ww={longestPath:t,slack:n};function t(s){var a={};function i(l){var d=s.node(l);if(e.has(a,l))return d.rank;a[l]=!0;var f=e.min(e.map(s.outEdges(l),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),d.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return ww}var vw,xE;function xA(){if(xE)return vw;xE=1;var e=gt(),t=dr().Graph,n=Ku().slack;vw=s;function s(d){var f=new t({directed:!1}),p=d.nodes()[0],h=d.nodeCount();f.setNode(p,{});for(var g,w;a(f,d)<h;)g=i(f,d),w=f.hasNode(g.v)?n(d,g):-n(d,g),l(f,d,w);return f}function a(d,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var w=g.v,v=h===w?g.w:w;!d.hasNode(v)&&!n(f,g)&&(d.setNode(v,{}),d.setEdge(h,v,{}),p(v))})}return e.forEach(d.nodes(),p),d.nodeCount()}function i(d,f){return e.minBy(f.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(f,p)})}function l(d,f,p){e.forEach(d.nodes(),function(h){f.node(h).rank+=p})}return vw}var xw,bE;function l8(){if(bE)return xw;bE=1;var e=gt(),t=xA(),n=Ku().slack,s=Ku().longestPath,a=dr().alg.preorder,i=dr().alg.postorder,l=wn().simplify;xw=d,d.initLowLimValues=g,d.initCutValues=f,d.calcCutValue=h,d.leaveEdge=v,d.enterEdge=N,d.exchangeEdges=x;function d(E){E=l(E),s(E);var C=t(E);g(C),f(C,E);for(var A,O;A=v(C);)O=N(C,E,A),x(C,E,A,O)}function f(E,C){var A=i(E,E.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(O){p(E,C,O)})}function p(E,C,A){var O=E.node(A),$=O.parent;E.edge(A,$).cutvalue=h(E,C,A)}function h(E,C,A){var O=E.node(A),$=O.parent,z=!0,P=C.edge(A,$),M=0;return P||(z=!1,P=C.edge($,A)),M=P.weight,e.forEach(C.nodeEdges(A),function(F){var H=F.v===A,Z=H?F.w:F.v;if(Z!==$){var R=H===z,Q=C.edge(F).weight;if(M+=R?Q:-Q,_(E,A,Z)){var B=E.edge(A,Z).cutvalue;M+=R?-B:B}}}),M}function g(E,C){arguments.length<2&&(C=E.nodes()[0]),w(E,{},1,C)}function w(E,C,A,O,$){var z=A,P=E.node(O);return C[O]=!0,e.forEach(E.neighbors(O),function(M){e.has(C,M)||(A=w(E,C,A,M,O))}),P.low=z,P.lim=A++,$?P.parent=$:delete P.parent,A}function v(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,A){var O=A.v,$=A.w;C.hasEdge(O,$)||(O=A.w,$=A.v);var z=E.node(O),P=E.node($),M=z,F=!1;z.lim>P.lim&&(M=P,F=!0);var H=e.filter(C.edges(),function(Z){return F===j(E,E.node(Z.v),M)&&F!==j(E,E.node(Z.w),M)});return e.minBy(H,function(Z){return n(C,Z)})}function x(E,C,A,O){var $=A.v,z=A.w;E.removeEdge($,z),E.setEdge(O.v,O.w,{}),g(E),f(E,C),S(E,C)}function S(E,C){var A=e.find(E.nodes(),function($){return!C.node($).parent}),O=a(E,A);O=O.slice(1),e.forEach(O,function($){var z=E.node($).parent,P=C.edge($,z),M=!1;P||(P=C.edge(z,$),M=!0),C.node($).rank=C.node(z).rank+(M?P.minlen:-P.minlen)})}function _(E,C,A){return E.hasEdge(C,A)}function j(E,C,A){return A.low<=C.lim&&C.lim<=A.lim}return xw}var bw,kE;function c8(){if(kE)return bw;kE=1;var e=Ku(),t=e.longestPath,n=xA(),s=l8();bw=a;function a(f){switch(f.graph().ranker){case"network-simplex":d(f);break;case"tight-tree":l(f);break;case"longest-path":i(f);break;default:d(f)}}var i=t;function l(f){t(f),n(f)}function d(f){s(f)}return bw}var kw,_E;function u8(){if(_E)return kw;_E=1;var e=gt();kw=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(l){for(var d=a.node(l),f=d.edgeObj,p=n(a,i,f.v,f.w),h=p.path,g=p.lca,w=0,v=h[w],N=!0;l!==f.w;){if(d=a.node(l),N){for(;(v=h[w])!==g&&a.node(v).maxRank<d.rank;)w++;v===g&&(N=!1)}if(!N){for(;w<h.length-1&&a.node(v=h[w+1]).minRank<=d.rank;)w++;v=h[w]}a.setParent(l,v),l=a.successors(l)[0]}})}function n(a,i,l,d){var f=[],p=[],h=Math.min(i[l].low,i[d].low),g=Math.max(i[l].lim,i[d].lim),w,v;w=l;do w=a.parent(w),f.push(w);while(w&&(i[w].low>h||g>i[w].lim));for(v=w,w=d;(w=a.parent(w))!==v;)p.push(w);return{path:f.concat(p.reverse()),lca:v}}function s(a){var i={},l=0;function d(f){var p=l;e.forEach(a.children(f),d),i[f]={low:p,lim:l++}}return e.forEach(a.children(),d),i}return kw}var _w,SE;function d8(){if(SE)return _w;SE=1;var e=gt(),t=wn();_w={run:n,cleanup:l};function n(d){var f=t.addDummyNode(d,"root",{},"_root"),p=a(d),h=e.max(e.values(p))-1,g=2*h+1;d.graph().nestingRoot=f,e.forEach(d.edges(),function(v){d.edge(v).minlen*=g});var w=i(d)+1;e.forEach(d.children(),function(v){s(d,f,g,w,h,p,v)}),d.graph().nodeRankFactor=g}function s(d,f,p,h,g,w,v){var N=d.children(v);if(!N.length){v!==f&&d.setEdge(f,v,{weight:0,minlen:p});return}var x=t.addBorderNode(d,"_bt"),S=t.addBorderNode(d,"_bb"),_=d.node(v);d.setParent(x,v),_.borderTop=x,d.setParent(S,v),_.borderBottom=S,e.forEach(N,function(j){s(d,f,p,h,g,w,j);var E=d.node(j),C=E.borderTop?E.borderTop:j,A=E.borderBottom?E.borderBottom:j,O=E.borderTop?h:2*h,$=C!==A?1:g-w[v]+1;d.setEdge(x,C,{weight:O,minlen:$,nestingEdge:!0}),d.setEdge(A,S,{weight:O,minlen:$,nestingEdge:!0})}),d.parent(v)||d.setEdge(f,x,{weight:0,minlen:g+w[v]})}function a(d){var f={};function p(h,g){var w=d.children(h);w&&w.length&&e.forEach(w,function(v){p(v,g+1)}),f[h]=g}return e.forEach(d.children(),function(h){p(h,1)}),f}function i(d){return e.reduce(d.edges(),function(f,p){return f+d.edge(p).weight},0)}function l(d){var f=d.graph();d.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(d.edges(),function(p){var h=d.edge(p);h.nestingEdge&&d.removeEdge(p)})}return _w}var Sw,NE;function h8(){if(NE)return Sw;NE=1;var e=gt(),t=wn();Sw=n;function n(a){function i(l){var d=a.children(l),f=a.node(l);if(d.length&&e.forEach(d,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",l,f,p),s(a,"borderRight","_br",l,f,p)}}e.forEach(a.children(),i)}function s(a,i,l,d,f,p){var h={width:0,height:0,rank:p,borderType:i},g=f[i][p-1],w=t.addDummyNode(a,"border",h,l);f[i][p]=w,a.setParent(w,d),g&&a.setEdge(g,w,{weight:1})}return Sw}var Nw,jE;function f8(){if(jE)return Nw;jE=1;var e=gt();Nw={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(d(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function d(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return Nw}var jw,EE;function p8(){if(EE)return jw;EE=1;var e=gt();jw=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),l=e.map(e.range(i+1),function(){return[]});function d(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);l[h.rank].push(p),e.forEach(n.successors(p),d)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,d),l}return jw}var Ew,CE;function m8(){if(CE)return Ew;CE=1;var e=gt();Ew=t;function t(s,a){for(var i=0,l=1;l<a.length;++l)i+=n(s,a[l-1],a[l]);return i}function n(s,a,i){for(var l=e.zipObject(i,e.map(i,function(w,v){return v})),d=e.flatten(e.map(a,function(w){return e.sortBy(e.map(s.outEdges(w),function(v){return{pos:l[v.w],weight:s.edge(v).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(d.forEach(function(w){var v=w.pos+f;h[v]+=w.weight;for(var N=0;v>0;)v%2&&(N+=h[v+1]),v=v-1>>1,h[v]+=w.weight;g+=w.weight*N})),g}return Ew}var Cw,TE;function g8(){if(TE)return Cw;TE=1;var e=gt();Cw=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var l=e.reduce(i,function(d,f){var p=n.edge(f),h=n.node(f.v);return{sum:d.sum+p.weight*h.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Cw}var Tw,RE;function y8(){if(RE)return Tw;RE=1;var e=gt();Tw=t;function t(a,i){var l={};e.forEach(a,function(f,p){var h=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=l[f.v],h=l[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[f.w]))});var d=e.filter(l,function(f){return!f.indegree});return n(d)}function n(a){var i=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function d(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),l(f)),e.forEach(f.out,d(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var l=0,d=0;a.weight&&(l+=a.barycenter*a.weight,d+=a.weight),i.weight&&(l+=i.barycenter*i.weight,d+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=l/d,a.weight=d,a.i=Math.min(i.i,a.i),i.merged=!0}return Tw}var Rw,AE;function w8(){if(AE)return Rw;AE=1;var e=gt(),t=wn();Rw=n;function n(i,l){var d=t.partition(i,function(x){return e.has(x,"barycenter")}),f=d.lhs,p=e.sortBy(d.rhs,function(x){return-x.i}),h=[],g=0,w=0,v=0;f.sort(a(!!l)),v=s(h,p,v),e.forEach(f,function(x){v+=x.vs.length,h.push(x.vs),g+=x.barycenter*x.weight,w+=x.weight,v=s(h,p,v)});var N={vs:e.flatten(h,!0)};return w&&(N.barycenter=g/w,N.weight=w),N}function s(i,l,d){for(var f;l.length&&(f=e.last(l)).i<=d;)l.pop(),i.push(f.vs),d++;return d}function a(i){return function(l,d){return l.barycenter<d.barycenter?-1:l.barycenter>d.barycenter?1:i?d.i-l.i:l.i-d.i}}return Rw}var Aw,ME;function v8(){if(ME)return Aw;ME=1;var e=gt(),t=g8(),n=y8(),s=w8();Aw=a;function a(d,f,p,h){var g=d.children(f),w=d.node(f),v=w?w.borderLeft:void 0,N=w?w.borderRight:void 0,x={};v&&(g=e.filter(g,function(A){return A!==v&&A!==N}));var S=t(d,g);e.forEach(S,function(A){if(d.children(A.v).length){var O=a(d,A.v,p,h);x[A.v]=O,e.has(O,"barycenter")&&l(A,O)}});var _=n(S,p);i(_,x);var j=s(_,h);if(v&&(j.vs=e.flatten([v,j.vs,N],!0),d.predecessors(v).length)){var E=d.node(d.predecessors(v)[0]),C=d.node(d.predecessors(N)[0]);e.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+E.order+C.order)/(j.weight+2),j.weight+=2}return j}function i(d,f){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function l(d,f){e.isUndefined(d.barycenter)?(d.barycenter=f.barycenter,d.weight=f.weight):(d.barycenter=(d.barycenter*d.weight+f.barycenter*f.weight)/(d.weight+f.weight),d.weight+=f.weight)}return Aw}var Mw,IE;function x8(){if(IE)return Mw;IE=1;var e=gt(),t=dr().Graph;Mw=n;function n(a,i,l){var d=s(a),f=new t({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),g=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,g||d),e.forEach(a[l](p),function(w){var v=w.v===p?w.w:w.v,N=f.edge(v,p),x=e.isUndefined(N)?0:N.weight;f.setEdge(v,p,{weight:a.edge(w).weight+x})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return Mw}var Iw,$E;function b8(){if($E)return Iw;$E=1;var e=gt();Iw=t;function t(n,s,a){var i={},l;e.forEach(a,function(d){for(var f=n.parent(d),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=l,l=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return Iw}var $w,OE;function k8(){if(OE)return $w;OE=1;var e=gt(),t=p8(),n=m8(),s=v8(),a=x8(),i=b8(),l=dr().Graph,d=wn();$w=f;function f(w){var v=d.maxRank(w),N=p(w,e.range(1,v+1),"inEdges"),x=p(w,e.range(v-1,-1,-1),"outEdges"),S=t(w);g(w,S);for(var _=Number.POSITIVE_INFINITY,j,E=0,C=0;C<4;++E,++C){h(E%2?N:x,E%4>=2),S=d.buildLayerMatrix(w);var A=n(w,S);A<_&&(C=0,j=e.cloneDeep(S),_=A)}g(w,j)}function p(w,v,N){return e.map(v,function(x){return a(w,x,N)})}function h(w,v){var N=new l;e.forEach(w,function(x){var S=x.graph().root,_=s(x,S,N,v);e.forEach(_.vs,function(j,E){x.node(j).order=E}),i(x,N,_.vs)})}function g(w,v){e.forEach(v,function(N){e.forEach(N,function(x,S){w.node(x).order=S})})}return $w}var Ow,PE;function _8(){if(PE)return Ow;PE=1;var e=gt(),t=dr().Graph,n=wn();Ow={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:l,hasConflict:d,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:w,findSmallestWidthAlignment:g,balance:v};function s(_,j){var E={};function C(A,O){var $=0,z=0,P=A.length,M=e.last(O);return e.forEach(O,function(F,H){var Z=i(_,F),R=Z?_.node(Z).order:P;(Z||F===M)&&(e.forEach(O.slice(z,H+1),function(Q){e.forEach(_.predecessors(Q),function(B){var te=_.node(B),J=te.order;(J<$||R<J)&&!(te.dummy&&_.node(Q).dummy)&&l(E,B,Q)})}),z=H+1,$=R)}),O}return e.reduce(j,C),E}function a(_,j){var E={};function C(O,$,z,P,M){var F;e.forEach(e.range($,z),function(H){F=O[H],_.node(F).dummy&&e.forEach(_.predecessors(F),function(Z){var R=_.node(Z);R.dummy&&(R.order<P||R.order>M)&&l(E,Z,F)})})}function A(O,$){var z=-1,P,M=0;return e.forEach($,function(F,H){if(_.node(F).dummy==="border"){var Z=_.predecessors(F);Z.length&&(P=_.node(Z[0]).order,C($,M,H,z,P),M=H,z=P)}C($,M,$.length,P,O.length)}),$}return e.reduce(j,A),E}function i(_,j){if(_.node(j).dummy)return e.find(_.predecessors(j),function(E){return _.node(E).dummy})}function l(_,j,E){if(j>E){var C=j;j=E,E=C}var A=_[j];A||(_[j]=A={}),A[E]=!0}function d(_,j,E){if(j>E){var C=j;j=E,E=C}return e.has(_[j],E)}function f(_,j,E,C){var A={},O={},$={};return e.forEach(j,function(z){e.forEach(z,function(P,M){A[P]=P,O[P]=P,$[P]=M})}),e.forEach(j,function(z){var P=-1;e.forEach(z,function(M){var F=C(M);if(F.length){F=e.sortBy(F,function(B){return $[B]});for(var H=(F.length-1)/2,Z=Math.floor(H),R=Math.ceil(H);Z<=R;++Z){var Q=F[Z];O[M]===M&&P<$[Q]&&!d(E,M,Q)&&(O[Q]=M,O[M]=A[M]=A[Q],P=$[Q])}}})}),{root:A,align:O}}function p(_,j,E,C,A){var O={},$=h(_,j,E,A),z=A?"borderLeft":"borderRight";function P(H,Z){for(var R=$.nodes(),Q=R.pop(),B={};Q;)B[Q]?H(Q):(B[Q]=!0,R.push(Q),R=R.concat(Z(Q))),Q=R.pop()}function M(H){O[H]=$.inEdges(H).reduce(function(Z,R){return Math.max(Z,O[R.v]+$.edge(R))},0)}function F(H){var Z=$.outEdges(H).reduce(function(Q,B){return Math.min(Q,O[B.w]-$.edge(B))},Number.POSITIVE_INFINITY),R=_.node(H);Z!==Number.POSITIVE_INFINITY&&R.borderType!==z&&(O[H]=Math.max(O[H],Z))}return P(M,$.predecessors.bind($)),P(F,$.successors.bind($)),e.forEach(C,function(H){O[H]=O[E[H]]}),O}function h(_,j,E,C){var A=new t,O=_.graph(),$=x(O.nodesep,O.edgesep,C);return e.forEach(j,function(z){var P;e.forEach(z,function(M){var F=E[M];if(A.setNode(F),P){var H=E[P],Z=A.edge(H,F);A.setEdge(H,F,Math.max($(_,M,P),Z||0))}P=M})}),A}function g(_,j){return e.minBy(e.values(j),function(E){var C=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(E,function(O,$){var z=S(_,$)/2;C=Math.max(O+z,C),A=Math.min(O-z,A)}),C-A})}function w(_,j){var E=e.values(j),C=e.min(E),A=e.max(E);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function($){var z=O+$,P=_[z],M;if(P!==j){var F=e.values(P);M=$==="l"?C-e.min(F):A-e.max(F),M&&(_[z]=e.mapValues(P,function(H){return H+M}))}})})}function v(_,j){return e.mapValues(_.ul,function(E,C){if(j)return _[j.toLowerCase()][C];var A=e.sortBy(e.map(_,C));return(A[1]+A[2])/2})}function N(_){var j=n.buildLayerMatrix(_),E=e.merge(s(_,j),a(_,j)),C={},A;e.forEach(["u","d"],function($){A=$==="u"?j:e.values(j).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(A=e.map(A,function(H){return e.values(H).reverse()}));var P=($==="u"?_.predecessors:_.successors).bind(_),M=f(_,A,E,P),F=p(_,A,M.root,M.align,z==="r");z==="r"&&(F=e.mapValues(F,function(H){return-H})),C[$+z]=F})});var O=g(_,C);return w(C,O),v(C,_.graph().align)}function x(_,j,E){return function(C,A,O){var $=C.node(A),z=C.node(O),P=0,M;if(P+=$.width/2,e.has($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":M=-$.width/2;break;case"r":M=$.width/2;break}if(M&&(P+=E?M:-M),M=0,P+=($.dummy?j:_)/2,P+=(z.dummy?j:_)/2,P+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":M=z.width/2;break;case"r":M=-z.width/2;break}return M&&(P+=E?M:-M),M=0,P}}function S(_,j){return _.node(j).width}return Ow}var Pw,LE;function S8(){if(LE)return Pw;LE=1;var e=gt(),t=wn(),n=_8().positionX;Pw=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(l,d){i.node(d).x=l})}function a(i){var l=t.buildLayerMatrix(i),d=i.graph().ranksep,f=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(g){return i.node(g).height}));e.forEach(p,function(g){i.node(g).y=f+h/2}),f+=h+d})}return Pw}var Lw,qE;function N8(){if(qE)return Lw;qE=1;var e=gt(),t=o8(),n=i8(),s=c8(),a=wn().normalizeRanks,i=u8(),l=wn().removeEmptyRanks,d=d8(),f=h8(),p=f8(),h=k8(),g=S8(),w=wn(),v=dr().Graph;Lw=N;function N(G,I){var X=I&&I.debugTiming?w.time:w.notime;X("layout",function(){var U=X(" buildLayoutGraph",function(){return P(G)});X(" runLayout",function(){x(U,X)}),X(" updateInputGraph",function(){S(G,U)})})}function x(G,I){I(" makeSpaceForEdgeLabels",function(){M(G)}),I(" removeSelfEdges",function(){q(G)}),I(" acyclic",function(){t.run(G)}),I(" nestingGraph.run",function(){d.run(G)}),I(" rank",function(){s(w.asNonCompoundGraph(G))}),I(" injectEdgeLabelProxies",function(){F(G)}),I(" removeEmptyRanks",function(){l(G)}),I(" nestingGraph.cleanup",function(){d.cleanup(G)}),I(" normalizeRanks",function(){a(G)}),I(" assignRankMinMax",function(){H(G)}),I(" removeEdgeLabelProxies",function(){Z(G)}),I(" normalize.run",function(){n.run(G)}),I(" parentDummyChains",function(){i(G)}),I(" addBorderSegments",function(){f(G)}),I(" order",function(){h(G)}),I(" insertSelfEdges",function(){Y(G)}),I(" adjustCoordinateSystem",function(){p.adjust(G)}),I(" position",function(){g(G)}),I(" positionSelfEdges",function(){L(G)}),I(" removeBorderNodes",function(){J(G)}),I(" normalize.undo",function(){n.undo(G)}),I(" fixupEdgeLabelCoords",function(){B(G)}),I(" undoCoordinateSystem",function(){p.undo(G)}),I(" translateGraph",function(){R(G)}),I(" assignNodeIntersects",function(){Q(G)}),I(" reversePoints",function(){te(G)}),I(" acyclic.undo",function(){t.undo(G)})}function S(G,I){e.forEach(G.nodes(),function(X){var U=G.node(X),oe=I.node(X);U&&(U.x=oe.x,U.y=oe.y,I.children(X).length&&(U.width=oe.width,U.height=oe.height))}),e.forEach(G.edges(),function(X){var U=G.edge(X),oe=I.edge(X);U.points=oe.points,e.has(oe,"x")&&(U.x=oe.x,U.y=oe.y)}),G.graph().width=I.graph().width,G.graph().height=I.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],A={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function P(G){var I=new v({multigraph:!0,compound:!0}),X=de(G.graph());return I.setGraph(e.merge({},j,K(X,_),e.pick(X,E))),e.forEach(G.nodes(),function(U){var oe=de(G.node(U));I.setNode(U,e.defaults(K(oe,C),A)),I.setParent(U,G.parent(U))}),e.forEach(G.edges(),function(U){var oe=de(G.edge(U));I.setEdge(U,e.merge({},$,K(oe,O),e.pick(oe,z)))}),I}function M(G){var I=G.graph();I.ranksep/=2,e.forEach(G.edges(),function(X){var U=G.edge(X);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(I.rankdir==="TB"||I.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}function F(G){e.forEach(G.edges(),function(I){var X=G.edge(I);if(X.width&&X.height){var U=G.node(I.v),oe=G.node(I.w),fe={rank:(oe.rank-U.rank)/2+U.rank,e:I};w.addDummyNode(G,"edge-proxy",fe,"_ep")}})}function H(G){var I=0;e.forEach(G.nodes(),function(X){var U=G.node(X);U.borderTop&&(U.minRank=G.node(U.borderTop).rank,U.maxRank=G.node(U.borderBottom).rank,I=e.max(I,U.maxRank))}),G.graph().maxRank=I}function Z(G){e.forEach(G.nodes(),function(I){var X=G.node(I);X.dummy==="edge-proxy"&&(G.edge(X.e).labelRank=X.rank,G.removeNode(I))})}function R(G){var I=Number.POSITIVE_INFINITY,X=0,U=Number.POSITIVE_INFINITY,oe=0,fe=G.graph(),me=fe.marginx||0,ke=fe.marginy||0;function Ye(Le){var qe=Le.x,je=Le.y,Ge=Le.width,be=Le.height;I=Math.min(I,qe-Ge/2),X=Math.max(X,qe+Ge/2),U=Math.min(U,je-be/2),oe=Math.max(oe,je+be/2)}e.forEach(G.nodes(),function(Le){Ye(G.node(Le))}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.has(qe,"x")&&Ye(qe)}),I-=me,U-=ke,e.forEach(G.nodes(),function(Le){var qe=G.node(Le);qe.x-=I,qe.y-=U}),e.forEach(G.edges(),function(Le){var qe=G.edge(Le);e.forEach(qe.points,function(je){je.x-=I,je.y-=U}),e.has(qe,"x")&&(qe.x-=I),e.has(qe,"y")&&(qe.y-=U)}),fe.width=X-I+me,fe.height=oe-U+ke}function Q(G){e.forEach(G.edges(),function(I){var X=G.edge(I),U=G.node(I.v),oe=G.node(I.w),fe,me;X.points?(fe=X.points[0],me=X.points[X.points.length-1]):(X.points=[],fe=oe,me=U),X.points.unshift(w.intersectRect(U,fe)),X.points.push(w.intersectRect(oe,me))})}function B(G){e.forEach(G.edges(),function(I){var X=G.edge(I);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function te(G){e.forEach(G.edges(),function(I){var X=G.edge(I);X.reversed&&X.points.reverse()})}function J(G){e.forEach(G.nodes(),function(I){if(G.children(I).length){var X=G.node(I),U=G.node(X.borderTop),oe=G.node(X.borderBottom),fe=G.node(e.last(X.borderLeft)),me=G.node(e.last(X.borderRight));X.width=Math.abs(me.x-fe.x),X.height=Math.abs(oe.y-U.y),X.x=fe.x+X.width/2,X.y=U.y+X.height/2}}),e.forEach(G.nodes(),function(I){G.node(I).dummy==="border"&&G.removeNode(I)})}function q(G){e.forEach(G.edges(),function(I){if(I.v===I.w){var X=G.node(I.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:I,label:G.edge(I)}),G.removeEdge(I)}})}function Y(G){var I=w.buildLayerMatrix(G);e.forEach(I,function(X){var U=0;e.forEach(X,function(oe,fe){var me=G.node(oe);me.order=fe+U,e.forEach(me.selfEdges,function(ke){w.addDummyNode(G,"selfedge",{width:ke.label.width,height:ke.label.height,rank:me.rank,order:fe+ ++U,e:ke.e,label:ke.label},"_se")}),delete me.selfEdges})})}function L(G){e.forEach(G.nodes(),function(I){var X=G.node(I);if(X.dummy==="selfedge"){var U=G.node(X.e.v),oe=U.x+U.width/2,fe=U.y,me=X.x-oe,ke=U.height/2;G.setEdge(X.e,X.label),G.removeNode(I),X.label.points=[{x:oe+2*me/3,y:fe-ke},{x:oe+5*me/6,y:fe-ke},{x:oe+me,y:fe},{x:oe+5*me/6,y:fe+ke},{x:oe+2*me/3,y:fe+ke}],X.label.x=X.x,X.label.y=X.y}})}function K(G,I){return e.mapValues(e.pick(G,I),Number)}function de(G){var I={};return e.forEach(G,function(X,U){I[U.toLowerCase()]=X}),I}return Lw}var qw,DE;function j8(){if(DE)return qw;DE=1;var e=gt(),t=wn(),n=dr().Graph;qw={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){l.setNode(d,{label:d}),l.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){l.setEdge(d.v,d.w,{},d.name)}),e.forEach(i,function(d,f){var p="layer"+f;l.setNode(p,{rank:"same"}),e.reduce(d,function(h,g){return l.setEdge(h,g,{style:"invis"}),g})}),l}return qw}var Dw,FE;function E8(){return FE||(FE=1,Dw="0.8.5"),Dw}var Fw,zE;function C8(){return zE||(zE=1,Fw={graphlib:dr(),layout:N8(),debug:j8(),util:{time:wn().time,notime:wn().notime},version:E8()}),Fw}var T8=C8();const BE=jv(T8),ti=240,Xu=130,Go=74,Ed=72,UE=Go+Ed;function R8(e,t){var s;let n=ti;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??ti);return n}const bA=420,A8=2;function Ml(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function M8(e,t){return((t==null?void 0:t.get(e))??0)>0?bA:0}function I8(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Il(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??ti)+M8(e,n),h:Math.max((s==null?void 0:s.height)??Xu,I8(e,n))}}function $8(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function O8(e,t,n,s,a,i){const l=new BE.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(_=>!a.has(_)),f=new Set(d);for(const _ of d){const{w:j,h:E}=Il(_,s,i);l.setNode(_,{width:j,height:E})}for(const _ of t)f.has(_.source)&&f.has(_.target)&&l.setEdge(_.source,_.target);BE.layout(l);const p=new Map;let h=1/0,g=1/0,w=-1/0,v=-1/0;for(const _ of d){const j=l.node(_);if(!j)continue;const E=s.get(_),C=(E==null?void 0:E.width)??ti,A=(E==null?void 0:E.height)??Xu,O=Il(_,s,i),$=j.x-O.w/2,z=j.y-O.h/2;p.set(_,{x:$,y:z}),$<h&&(h=$),z<g&&(g=z),$+C>w&&(w=$+C),z+A>v&&(v=z+A)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[_,j]of p)p.set(_,{x:j.x-h,y:j.y-g});const N=Number.isFinite(w)?w-h:0,x=Number.isFinite(v)?v-g:0;let S=null;for(const _ of e){const j=a.get(_);if(!j)continue;const E=s.get(_),C=(E==null?void 0:E.width)??ti,A=(E==null?void 0:E.height)??Xu;S=S===null?{minX:j.x,minY:j.y,maxX:j.x+C,maxY:j.y+A}:{minX:Math.min(S.minX,j.x),minY:Math.min(S.minY,j.y),maxX:Math.max(S.maxX,j.x+C),maxY:Math.max(S.maxY,j.y+A)}}return{positions:p,width:N,height:x,pinnedBox:S}}function P8(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,d=new Map;for(const _ of e){const j=Ml(_),E=d.get(j);E?E.push(_.id):d.set(j,[_.id])}const p=Array.from(d.keys()).sort().map(_=>({sid:_,...O8(d.get(_),t,s,i,a,l)})),h=R8(e,i),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,w=_=>{const j=[[]];let E=0;for(const C of p)j.length<_&&E>0&&E+C.height>g&&(j.push([]),E=0),j[j.length-1].push(C),E+=C.height+UE;return j},v=_=>_.reduce((j,E)=>Math.max(j,E.width),0)+bA;let N=w(n.availableWidth?A8:1);N.length>1&&N.reduce((j,E)=>j+v(E),0)+h*(N.length-1)>(n.availableWidth??0)&&(N=w(1));const x=new Map;let S=0;for(const _ of N){const j=v(_);let E=0;for(const{positions:C,height:A,pinnedBox:O}of _){for(const[z,P]of C)x.set(z,{x:P.x+S,y:P.y+E});let $=E+A;O&&O.maxY>$&&O.minX<S+j&&S<O.maxX&&($=O.maxY),E=$+UE}S+=j+h}return e.map(_=>{const j=a.get(_.id);if(j)return{..._,position:j};const E=x.get(_.id);return E?{..._,position:E}:_})}function L8(e,t,n,s,a){const l=Go+Ed,d=60,f=v=>Il(v,s,a),p=new Map(e.map(v=>[v.id,Ml(v)])),h=[],g=e.map(v=>({id:v.id,pos:n.get(v.id)??t.get(v.id)})).filter(v=>v.pos!=null).sort((v,N)=>v.pos.y-N.pos.y||v.pos.x-N.pos.x||v.id.localeCompare(N.id)),w=[];for(const{id:v,pos:N}of g){const{w:x,h:S}=f(v),_=p.get(v)??"_default";if(n.has(v)){h.push({x:N.x,y:N.y,w:x,h:S,sid:_});continue}let j=N.y;for(let E=0;E<h.length+1;E++){const C=h.find(A=>{const O=A.sid===_?24:d,$=A.sid===_?24:l;return N.x<A.x+A.w+O&&A.x<N.x+x+O&&j<A.y+A.h+$&&A.y<j+S+$});if(!C)break;j=C.y+C.h+(C.sid===_?24:l)}j!==N.y&&(t.set(v,{x:N.x,y:j}),w.push(v)),h.push({x:N.x,y:j,w:x,h:S,sid:_})}return w}function q8(e,t,n,s,a,i){const l=x=>Il(x,s,i),d=x=>n.get(x)??t.get(x),f=new Map;for(const x of e){if(!d(x.id))continue;const S=Ml(x),_=f.get(S);_?_.push(x):f.set(S,[x])}const p=new Set;for(const[x,S]of f)S.every(_=>a.has(_.id)&&!n.has(_.id))&&p.add(x);const h=new Map,g=[];for(const x of e){const S=d(x.id);if(!S)continue;const{w:_,h:j}=l(x.id),E=Ml(x);p.has(E)?(h.get(E)??h.set(E,[]).get(E)).push(x):g.push({x:S.x,y:S.y,w:_,h:j})}if(h.size===0)return[];const w=Go+Ed,v=(x,S,_,j)=>g.some(E=>x<E.x+E.w+Go&&E.x<x+_+Go&&S<E.y+E.h+w&&E.y<S+j+w),N=[];for(const x of[...h.keys()].sort()){const S=h.get(x);let _=1/0,j=1/0,E=-1/0,C=-1/0;for(const F of S){const H=d(F.id),{w:Z,h:R}=l(F.id);_=Math.min(_,H.x),j=Math.min(j,H.y),E=Math.max(E,H.x+Z),C=Math.max(C,H.y+R)}const A=E-_,O=C-j,$=[...new Set(g.map(F=>Math.round(F.x)))].sort((F,H)=>F-H),z=$.length?$:[_],P=[0,...g.map(F=>F.y+F.h+w)].sort((F,H)=>F-H);let M=null;e:for(const F of z)for(const H of P){if(H>=j)break;if(!v(F,H,A,O)){M={x:F,y:H};break e}}if(M){const F=M.x-_,H=M.y-j;for(const Z of S){const R=d(Z.id);t.set(Z.id,{x:R.x+F,y:R.y+H})}N.push(x)}for(const F of S){const H=d(F.id),{w:Z,h:R}=l(F.id);g.push({x:H.x,y:H.y,w:Z,h:R})}}return N}function D8(e,t,n,s,a,i=!1,l){const p=Go+Ed+1,h=8,g=1.75,w=200,v=.7,N=.01,x=M=>Il(M,s,l),S=M=>n.get(M)??t.get(M),_=new Map;for(const M of e){if(!S(M.id))continue;const F=Ml(M),H=_.get(F);H?H.push(M):_.set(F,[M])}const j=[],E=new Set,C=new Set,A=a.size===0;for(const M of[..._.keys()].sort()){const F=_.get(M);let H=1/0,Z=1/0,R=-1/0,Q=-1/0,B=!1;for(const Y of F){const L=S(Y.id),{w:K,h:de}=x(Y.id);H=Math.min(H,L.x),Z=Math.min(Z,L.y),R=Math.max(R,L.x+K),Q=Math.max(Q,L.y+de),n.has(Y.id)&&(B=!0)}const te=R-H,J=Q-Z;C.add(M);const q=a.get(M);q&&(te>q.w+h||J>q.h+h)&&E.add(M),a.set(M,{w:te,h:J}),j.push({sid:M,members:F.map(Y=>Y.id),x:H,y:Z,w:te,h:J,anchored:B,mass:1})}for(const M of[...a.keys()])C.has(M)||a.delete(M);if(i||A)return[];let O=!1;for(let M=0;M<j.length&&!O;M++)for(let F=M+1;F<j.length;F++){const H=j[M],Z=j[F];if(!(H.anchored&&Z.anchored)&&Math.abs(H.x+H.w/2-(Z.x+Z.w/2))<(H.w+Z.w)/2+61&&Math.abs(H.y+H.h/2-(Z.y+Z.h/2))<(H.h+Z.h)/2+p){O=!0;break}}if(E.size===0&&!O)return[];if(E.size>0)for(const M of j)E.has(M.sid)&&(M.mass=8);else for(const M of j)M.mass=Math.max(1,M.w*M.h/(ti*Xu));const $=new Map(j.map(M=>[M.sid,M.x])),z=new Map(j.map(M=>[M.sid,M.y]));for(let M=0;M<w;M++){const F=new Map,H=new Map;let Z=0;for(let R=0;R<j.length;R++)for(let Q=R+1;Q<j.length;Q++){const B=j[R],te=j[Q];if(B.anchored&&te.anchored)continue;const J=B.x+B.w/2,q=B.y+B.h/2,Y=te.x+te.w/2,L=te.y+te.h/2,K=(B.w+te.w)/2+61-Math.abs(J-Y),de=(B.h+te.h)/2+p-Math.abs(q-L);if(K<=0||de<=0)continue;const G=(Ke,pe)=>!Ke.anchored&&!(pe<0&&Ke.x<=0),I=(Ke,pe)=>!Ke.anchored&&!(pe<0&&Ke.y<=0),X=(Ke,pe,ve)=>{const Pe=Ke===pe,Ue=Pe?B.sid<te.sid?-1:1:Math.sign(Ke-pe);return ve(B,Ue)||ve(te,-Ue)?Ue:Pe&&(ve(B,-Ue)||ve(te,Ue))?-Ue:0},U=X(J,Y,G),oe=X(q,L,I),fe=U!==0,me=oe!==0;if(!fe&&!me)continue;const ke=fe&&(!me||K*g<de),[Ye,Le,qe,je]=ke?[U,K,F,G]:[oe,de,H,I],Ge=je(B,Ye),be=je(te,-Ye),se=B.mass,Ze=te.mass,ht=Ge?be?Ze/(se+Ze):1:0,ct=be?Ge?se/(se+Ze):1:0,at=Le*v;qe.set(B.sid,(qe.get(B.sid)??0)+Ye*at*ht),qe.set(te.sid,(qe.get(te.sid)??0)-Ye*at*ct),Z+=at}for(const R of j)R.anchored||(R.x=Math.max(0,R.x+(F.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(Z<N)break}const P=[];for(const M of j){const F=M.x-$.get(M.sid),H=M.y-z.get(M.sid);if(!(Math.abs(F)<1&&Math.abs(H)<1)){for(const Z of M.members){if(n.has(Z))continue;const R=t.get(Z);R&&t.set(Z,{x:R.x+F,y:R.y+H})}P.push(M.sid)}}return P}const F8=600;function kv(e,t){return!(e.exitAt!=null&&t-e.exitAt>F8||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function z8(e,t){const n=new Set;for(const s of e.agents.values())kv(s,t)&&n.add(s.id);return n}function B8(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 U8(e,t,n=0){if(!e)return!1;for(const s of t)if(B8(e,s,n))return!0;return!1}const kA="sessionGroup";function W8(e,t){var s;if(e.type===kA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const _A=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function WE(e){const t={};for(const n of _A)t[n]=e(n);return t}function H8(e){return t=>e[t]??""}function G8(e,t){return _A.every(n=>e[n]===t[n])}function V8(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const Y8=1200,K8=1e3;function HE(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<Y8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<K8}function zw({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function X8(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&l>0&&a<n.height}function Q8({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const a of n)if(s=!0,X8(a,t,e))return!1;return s}const Z8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Bw="click for what's new";function J8(e){if(e.checkDisabled)return`${Z8} · ${Bw}`;if(e.checking)return`Asking npm for the newest release… · ${Bw}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${Bw}, and to check npm now`}function eU(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function tU(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 nU(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 _v={kind:"assumed",claude:!0,codex:!0};function rU(e){if(!e||typeof e!="object")return _v;const t=e.providers;if(!t||typeof t!="object")return _v;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Qu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const GE=99;function sU(e){const t=Math.max(0,Math.floor(e));return t>GE?`${GE}+`:String(t)}const aU="Pause the canvas";function oU(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 — ${Qu(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)":`${Qu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function iU(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 SA="paused · full",lU=(e,t)=>t>0?SA:e>0?`paused · ${sU(e)}`:"paused";function cU(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:lU(e.held,t),widest:SA,title:t>0?`Connected — the pause is full at ${Qu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Qu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function VE(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const uU={agent:F3,sessionGroup:r4},NA="react-flow__node";function YE(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,NA))===!0}function dU(e){try{const t=document.querySelector(`.${NA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const hU=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),fU=420,Su=18,pU=200,mU=5*6e4,gU=6,yU=2*6e4,KE=400,S0="agent-dag.layout",N0="agent-dag.viewport",jA="agent-dag.summariesDismissed",EA="agent-dag.sessionListOpen",CA="agent-dag.detailOpen",TA="agent-dag.usagePanelOpen",RA="agent-dag.systemPanelOpen",XE="agent-dag.accountsPanelOpen",Uw="agent-dag.versionNoticeDismissed",QE="agent-dag.oldNameNoticeDismissed",wU=15*6e4,Ww={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:"},ZE="agent-dag.autoRestart",JE="agent-dag.bundleReloadedFor";function vU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(EA)==="1"}catch{return!1}}function xU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(EA,e?"1":"0")}catch{}}function bU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(CA)==="1"}catch{return!1}}function kU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(CA,e?"1":"0")}catch{}}function _U(){const e=ri(TA);return e===null?!0:e==="1"}function SU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(TA,e?"1":"0")}catch{}}function NU(){return ri(RA)==="1"}function jU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(RA,e?"1":"0")}catch{}}function EU(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(jA);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function eC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(jA,JSON.stringify(n))}catch{}}function CU(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(S0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Hw(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(S0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function TU(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(N0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function RU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(N0,JSON.stringify(e))}catch{}}function tC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(S0)}catch{}try{window.localStorage.removeItem(N0)}catch{}}}function AU(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},i=JSON.stringify(a,null,2),l=new Blob([i],{type:"application/json"}),d=URL.createObjectURL(l),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=d,f.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const Sv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Nv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},AA=zT;function MU(e,t,n,s,a,i,l,d,f,p,h,g,w,v,N,x,S,_){const j=[],E=[];for(const M of e.agents.values()){if(!S.has(M.id))continue;const F=M.exitAt!=null,H=x!=null&&!x.has(M.id),Z=[F?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=i.get(M.id);if(j.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:_},className:Z,...R?{width:R.width,height:R.height}:null}),M.parentId&&S.has(M.parentId)){const Q=Gv(M.sessionId),B=F,te=N.size>0&&(N.has(M.id)||N.has(M.parentId)),J=x!=null&&!x.has(M.id)&&!x.has(M.parentId),q=M.state==="active"?2:1.5,Y=te?q+1.5:q,L=B?.2:J?.12:1,K=["sess-edge",M.state==="active"?"sess-live":"sess-idle",B?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!B,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:Y,opacity:L,transition:"var(--edge-transition)"},className:K})}}const C=new Map;for(const M of e.agents.values())M.tools.length>0&&C.set(M.id,Math.min(4,M.tools.length));const A=`${w}#lanes:${$8(C)}`,O=j.filter(M=>jF(M.id,a,h,g));if(O.length>0||A!==v.current){if(O.length>0){const M=P8(j,E,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:C});for(const F of M)wR(F.id,h,g)&&CF(F.id,F.position,h,g);q8(j,h,a,i,new Set(O.map(F=>F.id)),C)}L8(j,h,a,i,C),v.current=A}const $=D8(j,h,a,i,l,!f||p,C);$.length>0&&d($),wu(h,e.agents),wu(g,e.agents),wu(a,e.agents),wu(i,_F(e.agents.values()));const z=[];let P=!1;for(const M of j){let F=a.get(M.id)??h.get(M.id);F||(F=EF(M.id,h,g),P=!0),z.push({...M,position:F})}return P&&(v.current=""),{nodes:z,edges:E}}function IU(){return c.jsx(Wv,{children:c.jsx($U,{})})}function $U(){var uo,ps,ho,Li;const e=ql(),t=At(),n=k.useState(lv)[0],s=k.useRef(n),[,a]=k.useState(0),i=k.useCallback(()=>a(D=>D+1),[]),[l,d]=k.useState(()=>new Set),[f,p]=k.useState(null),[h,g]=k.useState(null),w=k.useCallback((D,W)=>{d(ie=>{if(!W)return new Set([D]);const ue=new Set(ie);return ue.has(D)?ue.delete(D):ue.add(D),ue}),p(ie=>W&&ie===D?ie:D)},[]),v=k.useCallback(()=>{d(new Set),p(null)},[]),[N,x]=k.useState(null),[S,_]=k.useState(null),j=k.useCallback(D=>_(D),[]),[E,C]=k.useState(!1),[A,O]=k.useState(!1),$=k.useState(EU)[0],[z,P]=k.useState(vU);k.useEffect(()=>{xU(z)},[z]);const[M,F]=k.useState(bU);k.useEffect(()=>{kU(M)},[M]);const[H,Z]=k.useState(_U);k.useEffect(()=>{SU(H)},[H]);const[R,Q]=k.useState(NU);k.useEffect(()=>{jU(R)},[R]);const[B,te]=k.useState(()=>{try{const D=window.localStorage.getItem(XE);return D===null?!0:D==="1"}catch{return!0}});k.useEffect(()=>{try{window.localStorage.setItem(XE,B?"1":"0")}catch{}},[B]);const[J,q]=k.useState(null);k.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}q(D===null?!0:D==="on")},[]);const Y=k.useCallback(()=>{q(D=>{var ie;const W=D!==!0;try{localStorage.setItem("agent-dag.sound",W?"on":"off")}catch{}return W&&((ie=Le.current)==null||ie.unlock()),W})},[]),L=k.useCallback(D=>{Y()},[Y]),K=k.useRef(L);K.current=L;const de=k.useRef(J);de.current=J;const[G,I]=k.useState(()=>G5(ri)),X=k.useRef(G);X.current=G;const U=k.useRef(null),oe=k.useCallback((D,W=!1)=>{var ie,ue;if((ie=Le.current)==null||ie.unlock(),U.current!==null&&clearTimeout(U.current),U.current=null,!W){(ue=Le.current)==null||ue.play(D,!0);return}U.current=setTimeout(()=>{var Ee;U.current=null,(Ee=Le.current)==null||Ee.play(D,!0)},z5)},[]),fe=k.useCallback((D,W)=>{I(ie=>{const ue={level:Al(W.level??ie[D].level),figure:hR(D,W.figure??ie[D].figure)};try{localStorage.setItem(fR[D],String(ue.level)),localStorage.setItem(pR[D],ue.figure)}catch{}return{...ie,[D]:ue}}),oe(D,!0)},[oe]);k.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current)},[]);const[me,ke]=k.useState(!1),Ye=k.useRef(null),Le=k.useRef(null),[qe,je]=k.useState("locked");k.useEffect(()=>{const D=K5({enabled:()=>de.current===!0,prefs:()=>X.current,onState:je});Le.current=D,je(D.state());const W=()=>D.unlock();return window.addEventListener("pointerdown",W,{once:!0,capture:!0}),window.addEventListener("keydown",W,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",W,{capture:!0}),window.removeEventListener("keydown",W,{capture:!0})}},[]);const[Ge,be]=k.useState(!1),[se,Ze]=k.useState(null),[ht,ct]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Uw)??""}catch{return""}}),[at,Ke]=k.useState(!1),pe=k.useRef(0),[ve,Pe]=k.useState(!1),Ue=k.useCallback((D=!1)=>(D&&(pe.current=Date.now(),Pe(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(W=>W.ok?W.json():null).then(W=>{W&&Ze(W)}).catch(()=>{}).finally(()=>{D&&Pe(!1)})),[]),ot=k.useCallback(()=>{Ue(Date.now()-pe.current>=wU)},[Ue]);k.useEffect(()=>{Ue();const D=window.setInterval(ot,5*6e4),W=()=>{document.visibilityState==="visible"&&ot()};return document.addEventListener("visibilitychange",W),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",W)}},[Ue,ot]),k.useEffect(()=>{Ge&&Ue()},[Ge,Ue]);const $e=(se==null?void 0:se.notice)??null,[re,Se]=k.useState(null),De=k.useRef(!1);k.useEffect(()=>{if(De.current)return;const D=cF(),W=uF(D),ie=fF({stored:W,running:(se==null?void 0:se.running)??null,notes:m1,remembers:dF(D)});ie.reason!=="no-version"&&(De.current=!0,ie.record&&hF(D,ie.record),ie.show.length&&Se({entries:ie.show,since:W,firstRun:ie.reason==="welcome"}))},[se==null?void 0:se.running]);const _e=(se==null?void 0:se.running)??"3.20.0",Be=k.useMemo(()=>mR(m1,null,_e),[_e]),kt=k.useCallback(()=>{Se({entries:Be,since:null,firstRun:!1})},[Be]),[yt,Ne]=k.useState(null),[rt,wt]=k.useState(_v);k.useEffect(()=>{let D=!1;return fetch("/api/health").then(W=>W.ok?W.json():null).then(W=>{D||(wt(rU(W)),!(!W||typeof W.workspace!="string")&&Ne(W.workspace))}).catch(()=>{}),()=>{D=!0}},[Ge]);const vt=k.useRef(rt);vt.current=rt;const Jt=$e?`${$e.kind}:${$e.to}`:"",en=$e!=null&&ht!==Jt,Mn=k.useCallback(()=>{ct("");try{window.localStorage.setItem(Uw,"")}catch{}},[]),Oa=k.useCallback(()=>{if($e){ct(Jt);try{window.localStorage.setItem(Uw,Jt)}catch{}}},[$e,Jt]),[Pa,La]=k.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(QE)??""}catch{return""}}),vn=se!=null&&se.invokedAs&&se.invokedAs!==zt?se.invokedAs:null,Fs=vn!=null&&Pa!==vn,qa=k.useCallback(()=>{if(vn){La(vn);try{window.localStorage.setItem(QE,vn)}catch{}}},[vn]),It=((uo=se==null?void 0:se.upgrade)==null?void 0:uo.state)??"idle",pr=x5(se==null?void 0:se.upgrade),Yn=k.useRef(!1),ci=k.useCallback(async()=>{if(cr(Yn.current||It==="running")){Yn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ue(),Yn.current=!1}},[It,Ue]);k.useEffect(()=>{if(It!=="running")return;const D=window.setInterval(Ue,3e3);return()=>window.clearInterval(D)},[It,Ue]);const Er=k.useCallback(async()=>{const D=se==null?void 0:se.command;!D||!await dR(D)||(Ke(!0),window.setTimeout(()=>Ke(!1),1600))},[se==null?void 0:se.command]),Cr=k.useCallback(()=>{P(D=>(D||te(!1),!D))},[]),Tr=k.useCallback(()=>{te(D=>(D||P(!1),!D))},[]),[ts,zs]=k.useState(!1),[Da,Bs]=k.useState(!1),[In,Fa]=k.useState(()=>{try{return Number(localStorage.getItem(v1))||0}catch{return 0}}),[Us,ui]=k.useState([]),[Rr,Ws]=k.useState(!1);k.useEffect(()=>{let D=!0;const W=()=>{fetch("/api/browser-watch?live=0").then(ue=>ue.ok?ue.json():null).then(ue=>{var Ee;!D||!(ue!=null&&ue.ok)||(ui(ue.episodes??[]),Ws(((Ee=ue.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};W();const ie=setInterval(W,5*6e4);return()=>{D=!1,clearInterval(ie)}},[]);const[za,Ar]=k.useState([]),Hs=k.useRef(new Set),[ns,ut]=k.useState(null);k.useEffect(()=>{let D=!0,W=0;const ie=()=>{fetch("/api/lan").then(ue=>ue.ok?ue.json():null).then(ue=>D?(ue!=null&&ue.ok&&Ar(Array.isArray(ue.pending)?ue.pending:[]),ue):null).catch(()=>null).then(ue=>{D&&(W=window.setTimeout(ie,(ue==null?void 0:ue.enabled)===!0?wv:iR))})};return ie(),()=>{D=!1,window.clearTimeout(W)}},[]);const Ba=k.useCallback(async(D,W)=>{if(!ns){ut(D);try{const ue=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:W})})).json().catch(()=>null);ue&&Array.isArray(ue.pending)?Ar(ue.pending):Ar(Ee=>Ee.filter(Ae=>Ae.fp!==W))}catch{}finally{ut(null)}}},[ns]),$n=k.useMemo(()=>n6(Us,In).length,[Us,In]),[Ua,Mr]=k.useState(0),Gs=k.useRef(null),[Wa,Ir]=k.useState(!1),Lt=k.useRef(null),[Vs,on]=k.useState(0),xn=k.useState(()=>IF({protect:D=>GL(s.current,D)}))[0],[Ha,Cd]=k.useState(!1),rs=k.useCallback(()=>{const D=xn.paused&&xn.dropped>0,W=xn.setPaused(!xn.paused);D&&VL(s.current);for(const ie of W)s.current=gk(s.current,ie);Cd(xn.paused)},[xn]),[_t,Ys]=k.useState(Date.now()),[On,Td]=k.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(ZE)!=="0"}catch{return!0}}),Rd=k.useCallback(()=>{Td(D=>{const W=!D;try{window.localStorage.setItem(ZE,W?"1":"0")}catch{}return W})},[]),[Pn,Ks]=k.useState(!1),[di,Xs]=k.useState("restart"),[Xl,Ga]=k.useState(null),Je=k.useRef(!1),hi=k.useRef(null),fi=k.useRef(0),ss=k.useCallback(async D=>{if(!cr(Je.current))return;const W=(D==null?void 0:D.upgrade)===!0;Je.current=!0,hi.current=pr;const ie=++fi.current;Xs(W?"npx":"restart"),Ks(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",($e==null?void 0:$e.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:W})})}catch{}window.setTimeout(()=>{if(fi.current===ie&&Je.current){Je.current=!1,Ks(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},W?18e4:3e4)},[$e==null?void 0:$e.to,pr]),Va=k.useRef(null);k.useEffect(()=>{const D=u1(s.current.agents.values())>0,W=N5({enabled:On,kind:$e==null?void 0:$e.kind,canRestart:(se==null?void 0:se.canRestart)===!0,noticeOpen:en,visible:document.visibilityState==="visible",busy:D,idleSince:Va.current,now:_t});Va.current=W.idleSince,W.restart&&ss()},[On,$e==null?void 0:$e.kind,se==null?void 0:se.canRestart,en,_t,ss]);const pi=u1(s.current.agents.values()),mi=S5(pi),Ya=uR({enabled:On,kind:$e==null?void 0:$e.kind,canRestart:(se==null?void 0:se.canRestart)===!0,noticeOpen:en,visible:document.visibilityState==="visible",busy:pi>0,idleSince:Va.current,now:_t});k.useEffect(()=>{const D=se==null?void 0:se.running;let W=null,ie=null;try{W=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(JE)}catch{return}const ue=v5({bundle:"3.20.0",running:D,pending:W,lastTried:ie});if(ue==="reload"){try{window.sessionStorage.setItem(JE,D??"")}catch{return}window.location.reload();return}if(ue!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Je.current=!1,Ks(!1),Ga(D??null);const Ee=window.setTimeout(()=>Ga(null),6e3);return()=>window.clearTimeout(Ee)},[se==null?void 0:se.running]),k.useEffect(()=>{if(Pn&&b5({asked:hi.current,reported:pr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Je.current=!1,Ks(!1)}},[Pn,pr]);const Qs=k.useState(()=>V8(CU()))[0],St=k.useRef(Qs.pinned),bn=k.useRef(null),kn=k.useState(()=>TU())[0],[$r,Zs]=k.useState(()=>new Set),[ln,Ql]=k.useState(OF),[Kn,Js]=k.useState(()=>WE(VE)),Zl=k.useMemo(()=>H8(Kn),[Kn]),Jl=k.useCallback(D=>W8(D,Zl),[Zl]),Ka=k.useMemo(()=>({background:Kn["--panel"],border:`1px solid ${Kn["--line"]}`,borderRadius:8}),[Kn]),[gi,Ad]=k.useState(!1);k.useEffect(()=>{document.documentElement.dataset.theme=ln;try{window.localStorage.setItem(vR,ln)}catch{}Js(D=>{const W=WE(VE);return G8(D,W)?D:W})},[ln]);const _n=k.useCallback((D,W)=>{if(zw({durationMs:W,documentHidden:document.hidden})){e.setViewport(D,{duration:W});return}const{d3Zoom:ie,d3Selection:ue}=t.getState(),Ee=ue==null?void 0:ue.property("__zoom");if(ie&&ue&&Ee&&Ee.k>0&&D.zoom>0){ie.transform(ue,Ee.scale(D.zoom/Ee.k).translate((D.x-Ee.x)/D.zoom,(D.y-Ee.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,t]),Xn=k.useRef(null);k.useEffect(()=>{if(!kn)return;const D=window.setTimeout(()=>{try{_n(kn,0)}catch{}Qn.current=Date.now()},60);return()=>window.clearTimeout(D)},[_n,kn]);const Or=k.useRef(!0);k.useEffect(()=>{const D=new EventSource("/events"),W=AF(i,{now:()=>Date.now(),setTimeout:(ie,ue)=>window.setTimeout(ie,ue),clearTimeout:ie=>window.clearTimeout(ie)});return D.addEventListener("open",()=>{be(!0),Ad(!0)}),D.addEventListener("error",()=>be(!1)),D.addEventListener("replay-end",()=>{Or.current=!1,W.flush()}),D.addEventListener("hook",ie=>{var ue;try{const Ee=JSON.parse(ie.data);if(!xn.accept(Ee))return;s.current=gk(s.current,Ee);const Ae=Ee.replay===!0||Or.current||Date.now()-Ee.receivedAt>3e4;Ae?W.replay():W.live();const He=Y5(Ee,Ae);He&&((ue=Le.current)==null||ue.play(He))}catch{}}),()=>{D.close(),W.cancel()}},[i]),k.useEffect(()=>{const D=setInterval(()=>{const W=Date.now();Ys(W);let ie=YL(s.current,W,mk);KL(s.current,W,mk)&&(ie=!0),WL(s.current,W,pU,mU)&&(ie=!0),HL(s.current,W,gU,yU)&&(ie=!0),d(ue=>kF(ue,s.current.agents)),p(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),_(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),x(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),ie&&i()},250);return()=>clearInterval(D)},[i]);const as=k.useRef(null),Qn=k.useRef(0),Md=420,cn=k.useCallback((D=500)=>{try{const Ae=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ve=>Ve.offsetWidth>0);if(!Ae||He.length===0)return;const tt=Ae.getBoundingClientRect(),ft=e.getViewport();if(!Number.isFinite(ft.zoom)||ft.zoom<=0)return;const it=Ve=>(Ve-tt.left-ft.x)/ft.zoom,nn=Ve=>(Ve-tt.top-ft.y)/ft.zoom,Nn=He.map(Ve=>Ve.getBoundingClientRect()),fo=Math.min(...Nn.map(Ve=>it(Ve.left))),qi=Math.max(...Nn.map(Ve=>it(Ve.right))),hc=Math.min(...Nn.map(Ve=>nn(Ve.top))),Ud=Math.max(...Nn.map(Ve=>nn(Ve.bottom))),ms=qi-fo,Di=Ud-hc;if(!(ms>0&&Di>0))return;const gs=Math.max(.2,Math.min(1,(tt.width-160)/(ms+Md)*.86,(tt.height-160)/Di*.86)),ys={x:80-fo*gs,y:Math.max(80,(tt.height-Di*gs)/2)-hc*gs,zoom:gs};_n(ys,D),Qn.current=Date.now(),Xn.current=zw({durationMs:D,documentHidden:document.hidden})?{target:ys,until:Date.now()+D+60}:null,window.setTimeout(()=>{var Ve;try{((Ve=Xn.current)==null?void 0:Ve.target)===ys&&(Xn.current=null);const po=e.getViewport();(Math.abs(po.zoom-gs)>.01||Math.abs(po.x-ys.x)>2)&&_n(ys,0)}catch{}},D+60)}catch{}},[e,_n]);k.useEffect(()=>{const D=()=>{if(!document.hidden)return;const W=Xn.current;if(Xn.current=null,!(!W||Date.now()>W.until)){try{_n(W.target,0)}catch{}Qn.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[_n]);const os=k.useRef(""),ea=k.useRef(null),yi=k.useRef(0),Sn=k.useCallback(()=>{yi.current=Date.now()},[]),ta=k.useRef(null),na=k.useRef(0),Xa=k.useCallback(()=>{na.current=Date.now()},[]),ra=k.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Qn.current,lastCanvasInputAt:na.current}),[]),is="agent-dag.autoFitDisabled",wi=k.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(is)==="1"}catch{return!1}})[0],Ct=k.useRef(wi),[Pr,Qa]=k.useState(wi),Lr=k.useCallback(()=>{if(!Ct.current){Ct.current=!0,Qa(!0);try{window.localStorage.setItem(is,"1")}catch{}}},[]),Id=k.useCallback(()=>{Ct.current=!1,Qa(!1);try{window.localStorage.removeItem(is)}catch{}cn(400)},[e,cn]);k.useEffect(()=>{const D=setInterval(()=>{if(Ct.current||Date.now()-yi.current<800)return;const W=s.current,ie=Date.now(),ue=[];for(const Ae of W.agents.values())kv(Ae,ie)&&ue.push({id:Ae.id});if(ue.length===0)return;const Ee=[];for(const{id:Ae}of ue){const He=mr.current.get(Ae),tt=St.current.get(Ae)??un.current.get(Ae);!He||!tt||Ee.push({x:tt.x,y:tt.y,width:He.width,height:He.height})}Q8({pane:ta.current,viewport:e.getViewport(),boxes:Ee})&&cn(600)},1500);return()=>clearInterval(D)},[e]);const sa=k.useRef(!1),mr=k.useRef(new Map),ls=k.useRef(0),Za=k.useCallback(D=>{const W=mr.current;let ie=!1;for(const ue of D.nodeInternals.values()){const Ee=ue.width,Ae=ue.height;if(Ee==null||Ae==null)continue;const He=W.get(ue.id);He?(Math.abs(He.height-Ae)>4||Math.abs(He.width-Ee)>4)&&(W.set(ue.id,{width:Ee,height:Ae}),ie=!0):(W.set(ue.id,{width:Ee,height:Ae}),ie=!0)}return ie&&(ls.current+=1),ls.current},[]),vi=lt(Za),[ec,$d]=k.useState(0);k.useEffect(()=>{let D=0;const W=()=>{const ue=mr.current;let Ee=!1;for(const Ae of document.querySelectorAll(".react-flow__node[data-id]")){const He=Ae.getAttribute("data-id");if(!He)continue;const tt=Ae.offsetWidth,ft=Ae.offsetHeight;if(!tt||!ft)continue;const it=ue.get(He);(!it||Math.abs(it.width-tt)>4||Math.abs(it.height-ft)>4)&&(ue.set(He,{width:tt,height:ft}),Ee=!0)}Ee&&$d(Ae=>Ae+1)};if(sa.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(W,32):D=requestAnimationFrame(W),()=>{cancelAnimationFrame(D),window.clearTimeout(ie)}});const un=k.useRef(Qs.positions),xi=k.useRef(new Set),bi=k.useRef(""),cs=k.useMemo(()=>{const D=[];for(const W of s.current.agents.values())kv(W,_t)&&D.push(W.id+(W.parentId?`>${W.parentId}`:""));return D.sort(),`${D.join("|")}#sv${vi}.${ec}`},[s.current,s.current.revision,_t,vi,ec]),aa=k.useRef(null);k.useEffect(()=>(aa.current!=null&&window.clearTimeout(aa.current),aa.current=window.setTimeout(()=>{Hw(un.current,St.current)},1500),()=>{aa.current!=null&&window.clearTimeout(aa.current)}),[cs]),k.useEffect(()=>{if(os.current===cs)return;const D=os.current;if(os.current=cs,!D||Ct.current)return;Date.now()-Qn.current>1200&&cn(400),as.current&&window.clearTimeout(as.current),as.current=window.setTimeout(()=>{Ct.current||cn(500)},280)},[cs,e,cn]);const ki=k.useMemo(()=>NF(s.current,l),[s.current,s.current.revision,l]),_i=k.useMemo(()=>z8(s.current,_t),[s.current,s.current.revision,_t]),Si=k.useRef(null),[Ja,tc]=k.useState({w:0,h:0});k.useEffect(()=>{const D=Si.current;if(!D||typeof ResizeObserver>"u")return;const W=new ResizeObserver(ie=>{var Ee;const ue=(Ee=ie[0])==null?void 0:Ee.contentRect;ue&&(ta.current={width:ue.width,height:ue.height},tc(Ae=>Math.abs(Ae.w-ue.width)>40||Math.abs(Ae.h-ue.height)>40?{w:ue.width,h:ue.height}:Ae))});return W.observe(D),ta.current={width:D.clientWidth,height:D.clientHeight},tc({w:D.clientWidth,h:D.clientHeight}),()=>W.disconnect()},[]);const Od=k.useCallback(D=>{var ie,ue;const W=D.target;!(W!=null&&W.closest)||W.closest(hU)!==D.currentTarget||(D.preventDefault(),(ue=(ie=document.activeElement)==null?void 0:ie.blur)==null||ue.call(ie))},[]),Pd=k.useRef(new Map),[eo,Ld]=k.useState(!1);k.useEffect(()=>{const D=window.setTimeout(()=>Ld(!0),2500);return()=>window.clearTimeout(D)},[]);const[qd,Ni]=k.useState(!1),Zn=k.useRef(null),[ji,nc]=k.useState(!1),Dd=k.useCallback(()=>{Zn.current&&(window.clearTimeout(Zn.current),Zn.current=null),Ni(!1)},[]),Fd=k.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{Ni(!0),Zn.current&&window.clearTimeout(Zn.current),Zn.current=window.setTimeout(()=>Ni(!1),fU+80)})},[]);k.useEffect(()=>()=>{Zn.current&&window.clearTimeout(Zn.current)},[]);const rc=Ja.w>0?Ja.w*.92:0,sc=Ja.h>0?Ja.h:0,{nodes:gr,edges:Ei}=k.useMemo(()=>MU(s.current,_t,rc,sc,St.current,mr.current,Pd.current,Fd,eo,ji,un.current,xi.current,cs,bi,l,ki,_i,j),[s.current,s.current.revision,_t,rc,sc,eo,ji,cs,l,ki,_i,j,Ua]),us=k.useMemo(()=>{const D=new Map;for(const ie of gr){const ue=ie.data;if(!(ue!=null&&ue.sessionId)||ue.exitAt!=null)continue;const Ee=ie.width,Ae=ie.height;if(Ee==null||Ae==null)continue;const He=ie.position.x,tt=ie.position.y,ft=He+Ee,it=tt+Ae,nn=D.get(ue.sessionId);nn?(nn.minX=Math.min(nn.minX,He),nn.minY=Math.min(nn.minY,tt),nn.maxX=Math.max(nn.maxX,ft),nn.maxY=Math.max(nn.maxY,it)):D.set(ue.sessionId,{minX:He,minY:tt,maxX:ft,maxY:it})}const W=[];for(const[ie,ue]of D){const Ee=ue.maxX-ue.minX+Su*2,Ae=ue.maxY-ue.minY+Su*2;W.push({id:`group:${ie}`,type:kA,position:{x:ue.minX-Su,y:ue.minY-Su},data:{sessionId:ie,w:Ee,h:Ae},width:Ee,height:Ae,style:{width:Ee,height:Ae},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return W},[gr,_t]),zd=k.useMemo(()=>{const D=[...us,...gr],W=Lt.current;return!W||W.size===0?D:D.map(ie=>{const ue=W.get(ie.id);return ue?{...ie,position:ue}:ie})},[us,gr,Vs]),oa=k.useMemo(()=>{const D=new Set;for(const W of s.current.agents.values())for(const ie of W.tools)D.add(AA(ie.name));return Object.keys(Sv).filter(W=>D.has(W))},[s.current,s.current.revision]);k.useEffect(()=>{if(oa.length<=1){Ir(!1);return}let D=0;const W=()=>{const ie=Gs.current;if(ie&&!document.hidden){const ue=ie.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),Ae=U8(ue,Ee,8);Ir(He=>He===Ae?He:Ae)}D=window.setTimeout(W,300)};return W(),()=>window.clearTimeout(D)},[oa.length]);const ac=k.useCallback(D=>{Zs(W=>{const ie=new Set(W);return ie.has(D)?ie.delete(D):ie.add(D),ie})},[]),Vt=f?s.current.agents.get(f):null,to=h?Array.from(s.current.agents.values()).flatMap(D=>D.tools).find(D=>D.id===h)??null:null,Ci=k.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=lv(),St.current.clear(),mr.current.clear(),un.current.clear(),bi.current="",tC(),v(),i()},[i,v]),qr=k.useRef(E);qr.current=E;const oc=k.useRef(A);oc.current=A;const Ti=k.useRef(!1);Ti.current=to!=null||ts||S!=null||N!=null||Da||A||re!=null;const no=k.useCallback(D=>{const W=j5(D,{confirmOpen:qr.current,modalOpen:Ti.current});W==="confirm"?C(!0):W==="clear"&&(C(!1),Ci())},[Ci]),ro=k.useCallback(()=>{St.current.clear(),un.current.clear(),bi.current="",tC(),i(),window.setTimeout(()=>cn(500),80)},[i,e,cn]),Ri=k.useCallback(()=>cn(500),[cn]),yr=k.useRef(gr);yr.current=gr;const ds=k.useRef(f);ds.current=f;const Ai=k.useCallback(D=>{const W=yr.current,ie=yF(W.map(Ae=>({id:Ae.id,x:Ae.position.x,y:Ae.position.y})),ds.current,D),ue=ie?W.find(Ae=>Ae.id===ie):void 0;if(!ue)return;const Ee=YE(document.activeElement);w(ue.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[ue]})}catch{}Qn.current=Date.now(),Ee&&dU(ue.id)},30)},[w,e]),hs=k.useCallback(D=>{w(D,!1),window.setTimeout(()=>{try{const W=yr.current.find(ie=>ie.id===D);W&&e.fitView({padding:.3,duration:500,nodes:[W]}),Qn.current=Date.now()}catch{}},60)},[w,e]);k.useEffect(()=>{const D=W=>{var tt,ft;const ie=W.target,ue={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(tt=ie==null?void 0:ie.getAttribute)==null?void 0:tt.call(ie,"role"),type:ie==null?void 0:ie.type};if(W.key==="Escape"){const it=_3({overlayOpen:Wu.depth()>0,typing:Xv(ue)});it==="dismiss"?Wu.dismissTop():it==="blur"?ie==null||ie.blur():(bF(ue)&&(ie==null||ie.blur()),v());return}if(Kv(W))return;const Ee=YE(ie)?(ft=ie==null?void 0:ie.getAttribute)==null?void 0:ft.call(ie,"data-id"):null,Ae=Ee&&yr.current.some(it=>it.id===Ee)?Ee:null,He=vF(W,Ae);if(He.kind==="activate"){W.preventDefault(),w(He.nodeId,He.additive);return}He.kind!=="node"&&(He.nodeId==null&&A3(ue)||M3({key:W.key,modalOpen:Ti.current,sheetOpen:oc.current})||(W.key===" "&&(W.preventDefault(),rs()),(W.key==="c"||W.key==="C")&&no("shortcut"),(W.key==="r"||W.key==="R")&&ro(),(W.key==="f"||W.key==="F")&&Ri(),(W.key==="l"||W.key==="L")&&Cr(),(W.key==="d"||W.key==="D")&&F(it=>!it),(W.key==="h"||W.key==="H")&&zs(it=>!it),(W.key==="u"||W.key==="U")&&Z(it=>!it),(W.key==="a"||W.key==="A")&&vt.current.claude&&Tr(),(W.key==="j"||W.key==="J")&&Ai(1),(W.key==="k"||W.key==="K")&&Ai(-1),(W.key==="t"||W.key==="T")&&Ql(it=>it==="dark"?"light":"dark"),(W.key==="m"||W.key==="M")&&vt.current.claude&&de.current!==null&&K.current(W.shiftKey),W.key==="?"&&O(it=>!it)))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[no,ro,Ri,v,w,Ai,rs]);const ic=s.current.agents.size,Bt=k.useMemo(()=>m3(s.current.agents.values()),[s.current,s.current.revision]),so=k.useMemo(()=>g3(s.current.agents.values()),[s.current,s.current.revision]),ao=k.useRef(null);k.useEffect(()=>{const D=PF({waiting:Bt.length,running:so,connected:Ge}),W=ao.current;if(ao.current=D,(W==null?void 0:W.title)!==D.title&&(document.title=D.title),(W==null?void 0:W.icon)!==D.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=LF[D.icon])}},[Bt.length,so,Ge]);const[lc,cc]=k.useState(""),Mi=DF(Bt);k.useEffect(()=>{cc(D=>FF(D,Mi))},[Mi]);const[oo,Bd]=k.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Dr,Ii]=k.useState(null),[io,tn]=k.useState(!0),[ia,$i]=k.useState(!1);k.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(W=>W.ok?W.json():null).then(W=>{var ie;!D||!(W!=null&&W.ok)||(tn(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),$i(W.notificationsVetoed===!0))}).catch(()=>{}),()=>{D=!1}},[]);const Oi=k.useRef(()=>{}),uc=k.useCallback(()=>{const D=!io;tn(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&Oi.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(W=>W.ok?W.json():null).then(W=>{var ie;W!=null&&W.ok&&(tn(((ie=W.prefs)==null?void 0:ie.notifications)!==!1),$i(W.notificationsVetoed===!0))}).catch(()=>{})},[io]),dc=typeof Notification<"u";k.useEffect(()=>{if(!Dr)return;const W=setTimeout(()=>Ii(null),Dr==="blocked"?8e3:4e3);return()=>clearTimeout(W)},[Dr]);const lo=k.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const W=D;Bd(W),W==="granted"?Ii("on"):W==="denied"&&Ii("blocked")})},[]);Oi.current=lo;const co=k.useRef(new Set),Pi=k.useRef(null),fs=Bt.map(D=>od(D.id,D.waiting)).join("|");return k.useEffect(()=>{x3(Pi.current,oo)&&(Pi.current=oo,co.current=vk(Bt))},[oo]),k.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||Pi.current===null)return;const D=typeof document>"u"||!document.hidden,W=w3(Bt,co.current,D,io);for(const ie of W)try{const ue=new Notification(ie.title,{body:ie.body,tag:ie.key});ue.onclick=()=>{window.focus(),hs(ie.sessionId),ue.close()}}catch{}co.current=D?vk(Bt):v3(Bt,W,co.current)},[fs]),c.jsxs("div",{className:"app",children:[c.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),c.jsxs("header",{className:"topbar",children:[c.jsxs("div",{className:"readout",children:[c.jsxs("div",{className:"brand",children:[c.jsx("span",{className:"logo"}),c.jsx("h1",{children:zt}),$e?c.jsxs("button",{type:"button",className:"v stale",onClick:()=>{kt(),Mn()},"aria-haspopup":"dialog","aria-label":tU({...$e,open:en}),title:$e.kind==="restart"?`Running v${$e.from}; v${$e.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${$e.from}; v${$e.to} is on npm · click for what's new`,children:["v",$e.from,c.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:_e,latest:se==null?void 0:se.latest,latestPending:se==null?void 0:se.latestPending,checkedAgo:se!=null&&se.checkedAt?pv(_t-se.checkedAt):null,checkDisabled:se==null?void 0:se.checkDisabled,checking:ve};return c.jsxs("button",{type:"button",className:ve?"v checking":"v",onClick:()=>{kt(),Ue(!0)},"aria-busy":ve||void 0,"aria-haspopup":"dialog","aria-label":eU(D),title:J8(D),children:["v",D.running]})})()]}),c.jsx("span",{className:"status",children:(()=>{const D=cU({connected:Ge,paused:Ha,held:xn.size,dropped:xn.dropped});return D.resting?null:c.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:c.jsxs("span",{className:"pill-box",children:[c.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),c.jsx("span",{className:"pill-label",children:D.label})]})})})()}),c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:lc}),Bt.length>0&&c.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>hs(Bt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
260
|
-
${Bt.map(D=>` ${D.label}: ${Tl(D.waiting)} (${pv(_t-D.waiting.since)})`).join(`
|
|
261
|
-
`)}`,"aria-label":`${Bt.length} session${Bt.length===1?"":"s"} waiting for you`,children:[c.jsx("span",{className:"ap-pulse","aria-hidden":!0}),c.jsx("b",{children:Bt.length})," waiting"]}),Dr&&c.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"})]}),Vt&&(()=>{const D=Rn(Vt),W=Math.max(0,((Vt.endedAt??_t)-Vt.startedAt)/1e3),ie=Vt.state==="active"?Yv(D.total,W):null,ue=l.size-1;return c.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Vt.label}`,onClick:()=>{try{const Ee=gr.find(Ae=>Ae.id===Vt.id);Ee&&e.fitView({padding:.35,duration:500,nodes:[Ee]}),Qn.current=Date.now()}catch{}},children:[c.jsx("span",{className:`state-pill state-${Vt.state}`,children:Vt.state==="active"?"live":Vt.state}),c.jsx("span",{className:"selected-label",children:Vt.label}),D.total>0&&c.jsxs("span",{className:"selected-cost",children:[et(D.total),ie?c.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),ue>0&&c.jsxs("span",{className:"selected-extra",children:["+",ue]}),c.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),v()},children:"×"})]})})(),c.jsxs("div",{className:"actions",children:[c.jsxs("div",{className:"action-run",children:[c.jsx("button",{className:"btn icon-btn",onClick:Cr,title:`${z?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":z,"aria-controls":z?"session-list":void 0,children:"☰"}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Z(D=>!D),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),rt.claude&&c.jsx("button",{className:"btn icon-btn",onClick:Tr,title:`${B?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":B,"aria-controls":B?"accounts-panel":void 0,children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),c.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Q(D=>!D),title:`${R?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":R,"aria-controls":R?"system-panel":void 0,children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),c.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"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>zs(D=>!D),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),c.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),c.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),c.jsxs("button",{className:`btn icon-btn bw-btn${$n>0?" has-findings":Rr?" watching":""}`,onClick:()=>Bs(D=>!D),title:Rr?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Rr?"watching":"not watching"}`+($n>0?`, ${$n} unread`:""),"aria-haspopup":"dialog",children:[c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[c.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"}),Rr||$n>0?c.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):c.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),$n>0&&c.jsx("span",{className:"bw-badge","aria-hidden":!0,children:$n})]})]}),c.jsxs("div",{className:"action-run",children:[rt.claude&&J!==null&&c.jsxs("div",{className:"sound-slot",children:[c.jsx("button",{ref:Ye,className:"btn icon-btn",onClick:()=>ke(D=>!D),...lr(!1),title:VF(rt,{on:J===!0,locked:qe==="locked",prefs:G}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":me,"aria-controls":me?"sound-menu":void 0,children:c.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:[c.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),J?c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),c.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M10 5.6l2.6 2.8"}),c.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),me&&c.jsx(eF,{onClose:()=>ke(!1),soundOn:J===!0,onToggleSound:Y,prefs:G,onLevel:(D,W)=>fe(D,{level:W}),onFigure:(D,W)=>fe(D,{figure:W}),onPreview:D=>oe(D),notifyOn:io,onToggleNotify:uc,notifyVetoed:ia,notifyPermission:dc?oo:"unsupported",onAskNotify:lo,openerRef:Ye})]}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Ql(D=>D==="dark"?"light":"dark"),title:`Switch to ${ln==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ln==="dark"?"☀":"☾"})]})]})]}),Xl?c.jsxs("div",{className:"ver-banner done",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:["Restarted — now running v",Xl,"."]}),c.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):gi&&!Ge?c.jsxs("div",{className:"conn-banner",role:"alert",children:[c.jsx("span",{className:"conn-dot"}),Pn?di==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const D=iU({connected:Ge,paused:Ha});return c.jsxs(c.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,D&&c.jsx("span",{className:"conn-sub",children:D})]})})()]}):en&&$e?c.jsxs("div",{className:`ver-banner ${$e.kind}`,role:"status",children:[c.jsx("span",{className:`ver-dot${Ya==null?"":" armed"}`}),$e.kind==="restart"?c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:["v",$e.to," is installed — this deck still runs v",$e.from,"."]}),se!=null&&se.canRestart?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"ver-act",onClick:()=>ss(),...lr(Pn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
262
|
-
|
|
263
|
-
Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:Pn?"restarting…":mi.label}),!Pn&&c.jsx("span",{className:"ver-sub",children:mi.clause}),c.jsxs("button",{type:"button",className:`ver-auto${On?" on":""}`,role:"switch","aria-checked":On,onClick:Rd,"aria-label":"Auto-restart when idle",title:On?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[c.jsx("i",{"aria-hidden":!0}),c.jsx("span",{"aria-hidden":!0,children:_5(On,Ya)})]})]}):c.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."})]}):c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[zt," v",$e.to," is out — you are on v",$e.from,"."]}),(se==null?void 0:se.upgradeMode)==="install"&&It!=="failed"&&c.jsx("button",{type:"button",className:"ver-act",onClick:ci,...lr(It==="running",It==="done"),title:`Runs ${((ps=se==null?void 0:se.upgrade)==null?void 0:ps.command)??(se==null?void 0:se.command)??"npm i -g"} here, then restarts once nothing is running.`,children:It==="running"?"installing…":It==="done"?"installed":"Update now"}),(se==null?void 0:se.upgradeMode)==="npx"&&(se==null?void 0:se.canRestart)&&c.jsx("button",{type:"button",className:"ver-act",onClick:()=>ss({upgrade:!0}),...lr(Pn),title:`Runs ${se==null?void 0:se.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Pn?"fetching…":It==="failed"?"Retry update":"Update & restart"}),It==="failed"?c.jsxs("span",{className:"ver-sub fail",title:((ho=se==null?void 0:se.upgrade)==null?void 0:ho.error)??"",children:[(se==null?void 0:se.upgradeMode)==="npx"?"update failed":"install failed",": ",((Li=se==null?void 0:se.upgrade)==null?void 0:Li.error)??"unknown error"," — run it yourself:"]}):(se==null?void 0:se.upgradeMode)==="npx"?c.jsx("span",{className:"ver-sub",children:se!=null&&se.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Ww.npx}):se!=null&&se.upgradeBlocked?c.jsx("span",{className:"ver-sub",children:Object.hasOwn(Ww,se.upgradeBlocked)?Ww[se.upgradeBlocked]:"cannot install from here"}):null,c.jsxs("button",{type:"button",className:"ver-cmd",onClick:Er,title:"Copy to clipboard",children:[c.jsx("code",{children:se==null?void 0:se.command}),c.jsx("span",{className:"ver-cmd-hint",children:at?"copied":"copy"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Oa,children:"×"})]}):Fs&&vn?c.jsxs("div",{className:"ver-banner",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:[vn," still works — the deck is called ",zt," now."]}),se!=null&&se.renameFix?c.jsx("span",{className:"ver-sub",children:se.renameFix}):null,c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:qa,children:"×"})]}):null,H&&c.jsx(bq,{state:s.current,now:_t,providers:rt,onClose:()=>Z(!1)}),B&&rt.claude&&c.jsx(g5,{onClose:()=>te(!1)}),R&&c.jsx(Qq,{usageOpen:H,onClose:()=>Q(!1)}),z&&c.jsx(W4,{state:s.current,now:_t,selectedIds:l,onSelect:hs,onClose:()=>P(!1)}),c.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${qd?" bubbling":""}${ji?" dragging-any":""}`,ref:Si,onMouseDownCapture:Od,onPointerDownCapture:Xa,onPointerUpCapture:Xa,onWheelCapture:Xa,children:[ic===0&&c.jsx(OU,{live:Ge,everConnected:gi,providers:rt,workspace:yt}),(oa.length>1||$r.size>0)&&c.jsx("div",{ref:Gs,className:`cat-filter-bar${Wa?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:oa.map(D=>{const W=$r.has(D);return c.jsxs("button",{type:"button",className:`cat-filter${W?" off":""}`,onClick:()=>ac(D),"aria-pressed":!W,title:`${W?"Show":"Hide"} ${Nv[D]} tools`,children:[c.jsx("span",{className:"cat-emoji",children:Sv[D]}),c.jsx("span",{className:"cat-name",children:Nv[D]})]},D)})}),c.jsxs(xT,{nodes:zd,edges:Ei,nodeTypes:uU,fitView:!kn,fitViewOptions:{padding:.25,duration:zw({durationMs:KE,documentHidden:document.hidden})?KE:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(D,W)=>{if(W.type==="sessionGroup"){v();return}w(W.id,D.shiftKey)},onPaneClick:()=>v(),onMoveStart:D=>{HE(ra(D))&&Lr()},onMove:(D,W)=>{Sn(),HE(ra(D))&&Lr(),ea.current&&window.clearTimeout(ea.current),ea.current=window.setTimeout(()=>RU(W),250)},onNodeDragStart:(D,W)=>{var ie;if(Dd(),sa.current=!0,Lt.current=new Map,nc(!0),Sn(),Lr(),W.type==="sessionGroup"){const ue=(ie=W.data)==null?void 0:ie.sessionId,Ee=new Map;if(ue)for(const Ae of gr){const He=Ae.data;(He==null?void 0:He.sessionId)===ue&&Ee.set(Ae.id,{x:Ae.position.x,y:Ae.position.y})}bn.current={start:{x:W.position.x,y:W.position.y},members:Ee};return}St.current.set(W.id,{x:W.position.x,y:W.position.y})},onNodeDrag:(D,W)=>{var ie;if(Sn(),W.type==="sessionGroup"){const ue=bn.current;if(!ue)return;const Ee=W.position.x-ue.start.x,Ae=W.position.y-ue.start.y;for(const[tt,ft]of ue.members){const it={x:ft.x+Ee,y:ft.y+Ae};St.current.set(tt,it),un.current.set(tt,it)}const He=Lt.current;if(He){for(const[tt,ft]of ue.members)He.set(tt,{x:ft.x+Ee,y:ft.y+Ae});He.set(W.id,{x:W.position.x,y:W.position.y})}on(tt=>tt+1);return}St.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),(ie=Lt.current)==null||ie.set(W.id,{x:W.position.x,y:W.position.y}),on(ue=>ue+1)},onNodeDragStop:(D,W)=>{if(Sn(),sa.current=!1,Lt.current=null,nc(!1),Mr(ie=>ie+1),W.type==="sessionGroup"){const ie=bn.current;if(ie){const ue=W.position.x-ie.start.x,Ee=W.position.y-ie.start.y;for(const[Ae,He]of ie.members){const tt={x:He.x+ue,y:He.y+Ee};St.current.set(Ae,tt),un.current.set(Ae,tt)}}bn.current=null,Hw(un.current,St.current),Mr(ue=>ue+1);return}St.current.set(W.id,{x:W.position.x,y:W.position.y}),un.current.set(W.id,{x:W.position.x,y:W.position.y}),Hw(un.current,St.current)},children:[c.jsx(CL,{gap:28,size:1,color:Kn["--grid-line"]}),c.jsx(t4,{onFit:()=>{Qn.current=Date.now()}}),c.jsx(P4,{agents:s.current.agents,visibleAgentIds:_i,positions:un.current,pinned:St.current,measured:mr.current,spotlight:ki,hiddenCategories:$r,now:_t,onOpenTool:g}),c.jsxs(kL,{showInteractive:!1,children:[c.jsx(_r,{onClick:Id,title:Pr?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Pr?{color:"var(--accent)"}:void 0,children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(_r,{onClick:rs,title:oU({paused:Ha,held:xn.size,dropped:xn.dropped}),"aria-label":aU,"aria-pressed":Ha,children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:c.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),c.jsx(_r,{onClick:ro,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),c.jsx(_r,{onClick:()=>no("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),c.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"}),c.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"}),c.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(_r,{onClick:()=>O(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.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"}),c.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),c.jsx(mL,{zoomable:!0,pannable:!0,nodeColor:Jl,nodeStrokeWidth:2,maskColor:Kn["--minimap-mask"],style:Ka})]})]}),M&&Vt?c.jsxs("aside",{className:"detail","aria-label":"Detail",children:[c.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>F(!1),children:"×"}),c.jsx(LU,{agent:Vt,now:_t,onOpenTool:g,onShowSummary:D=>{$.has(D)&&($.delete(D),eC($)),x(D)},onExportSession:D=>AU(s.current,D)})]}):null,to&&c.jsx(G3,{tool:to,onClose:()=>g(null)}),ts&&c.jsx(ZF,{providers:rt,onClose:()=>zs(!1)}),Da&&c.jsx(u6,{onClose:()=>Bs(!1),onSeen:D=>{Fa(D);try{localStorage.setItem(v1,String(D))}catch{}},onWatching:Ws,palette:Kn}),S&&(()=>{const D=s.current.agents.get(S);return D?c.jsx(q3,{agent:D,onClose:()=>_(null)}):null})(),N&&c.jsx(z4,{state:s.current,sessionId:N,onClose:()=>{$.add(N),eC($),x(null)}}),re&&c.jsx(mF,{entries:re.entries,since:re.since,firstRun:re.firstRun,running:_e,onClose:()=>Se(null)}),(()=>{const{request:D,waiting:W}=h6(za,Hs.current);return D?c.jsx(f6,{request:D,waiting:W,busy:ns,now:Date.now(),onAccept:()=>void Ba("accept",D.fp),onDecline:()=>void Ba("dismiss",D.fp),onLater:()=>{ns||(Hs.current.add(D.fp),Ar(ie=>[...ie]))}}):null})(),A&&c.jsx(I5,{onClose:()=>O(!1)}),E&&c.jsx(R5,{agentCount:ic,onConfirm:()=>no("confirmation"),onCancel:()=>C(!1)})]})}function OU({live:e,everConnected:t,providers:n,workspace:s}){const a=!e;return c.jsxs("div",{className:"empty-hero",children:[c.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[c.jsx("div",{className:"core"}),c.jsxs("div",{className:"orbit r1",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r2",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r3",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]})]}),a?c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),c.jsxs("p",{children:["The browser cannot reach ",c.jsx("code",{children:"/events"}),". Check that",c.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):PU(n,s)]})}function PU(e,t){const n=nU(t);return c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?c.jsxs("p",{children:[n.lead," ",c.jsx("code",{children:n.workspace}),n.tail]}):c.jsxs("p",{children:["Run ",c.jsx("code",{children:"claude"})," or ",c.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."]}),c.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",c.jsx("code",{children:zt})," is running."]}),GF(e).map(s=>c.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?c.jsx("code",{children:a.text},i):c.jsx("span",{children:a.text},i))},s.provider))]})}function LU({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=Uu(e.startedAt,e.endedAt,t),l=Rn(e),d=l.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const x=AA(N.name);p.set(x,(p.get(x)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,w=Array.from(p.entries()).sort((N,x)=>x[1]-N[1]),v=p.has("mcp")?A4(e.tools.map(N=>N.name)):null;return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"detail-hero",children:[c.jsxs("div",{className:"hero-line",children:[c.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),c.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),c.jsxs("div",{className:"hero-meta",children:[c.jsx("span",{className:"hero-meta-item",children:e.kind}),c.jsx("span",{className:"hero-sep",children:"·"}),c.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=OT(e);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hero-sep",children:"·"}),c.jsxs("span",{className:"model-chip","data-family":ad(e.model),title:N.length>0?`${e.model}
|
|
264
|
-
spend on this panel also covers:
|
|
265
|
-
${N.join(`
|
|
266
|
-
`)}`:e.model,children:[qs(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),d&&c.jsxs("div",{className:"hero-cost",children:[c.jsxs("div",{className:"hero-cost-headline",children:[c.jsx("span",{className:"hero-cost-value",children:et(l.total)}),c.jsx("span",{className:"hero-cost-label",children:"spend"})]}),c.jsx(Zv,{cost:l})]}),c.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&c.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&c.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Activity"}),c.jsxs("div",{className:"activity-row",children:[c.jsxs("div",{className:"activity-counters",children:[c.jsxs("span",{className:"ac-item",children:[c.jsx("b",{children:e.toolCount})," calls"]}),g>0&&c.jsxs("span",{className:"ac-item ac-live",children:[c.jsx("b",{children:g})," live"]}),h>0&&c.jsxs("span",{className:"ac-item ac-err",children:[c.jsx("b",{children:h})," err"]})]}),c.jsx("div",{className:"cat-strip",children:w.map(([N,x])=>{const S=N==="mcp"?v:null,_=S==null?void 0:S.hue,j=`${x} ${Nv[N]} call${x===1?"":"s"}`;return c.jsxs("span",{className:`cat-chip cat-${N}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:S?`${j}, all to ${S.label}`:j,children:[c.jsx("span",{className:"cat-emoji",children:Sv[N]}),c.jsx("span",{className:"cat-count",children:x}),S&&c.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),f>0&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Tokens"}),c.jsxs("div",{className:"tokens-grid",children:[c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"in"}),c.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"out"}),c.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache r"}),c.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache c"}),c.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Identity"}),c.jsxs("div",{children:[e.cwd&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"cwd"}),c.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"session"}),c.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"parent"}),c.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Prompts ",c.jsx("span",{className:"section-count",children:e.prompts.length})]}),c.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,x)=>{const S=aq(N.at,t);return c.jsxs("div",{className:"prompt-entry",children:[c.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),c.jsx("div",{className:"prompt-text",children:N.text})]},x)})})]}),c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Tool calls ",c.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&c.jsx("div",{className:"empty",children:"No tool calls yet."}),c.jsx("div",{children:e.tools.slice().reverse().map(N=>c.jsx(DU,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const qU={inflight:"in-flight",done:"done",err:"error"};function DU({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=LT(e,"…");return c.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[c.jsxs("span",{className:"name",children:[c.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:qU[n]}),e.name]}),c.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{rq(window.localStorage)}catch{}const FU=EM.createRoot(document.getElementById("root"));FU.render(c.jsx(IU,{}));
|