agent-dag 3.4.0 → 3.5.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.
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ew(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rf={exports:{}},La={},Af={exports:{}},Ze={};/**
|
|
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 Gx;function UA(){if(Gx)return Ze;Gx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,b={};function _($,G,Z){this.props=$,this.context=G,this.refs=b,this.updater=Z||w}_.prototype.isReactComponent={},_.prototype.setState=function($,G){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,G,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=_.prototype;function E($,G,Z){this.props=$,this.context=G,this.refs=b,this.updater=Z||w}var C=E.prototype=new k;C.constructor=E,N(C,_.prototype),C.isPureReactComponent=!0;var j=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function F($,G,Z){var D,L={},K=null,re=null;if(G!=null)for(D in G.ref!==void 0&&(re=G.ref),G.key!==void 0&&(K=""+G.key),G)I.call(G,D)&&!P.hasOwnProperty(D)&&(L[D]=G[D]);var he=arguments.length-2;if(he===1)L.children=Z;else if(1<he){for(var pe=Array(he),we=0;we<he;we++)pe[we]=arguments[we+2];L.children=pe}if($&&$.defaultProps)for(D in he=$.defaultProps,he)L[D]===void 0&&(L[D]=he[D]);return{$$typeof:e,type:$,key:K,ref:re,props:L,_owner:O.current}}function M($,G){return{$$typeof:e,type:$.type,key:G,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var G={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Z){return G[Z]})}var W=/\/+/g;function Y($,G){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):G.toString(36)}function T($,G,Z,D,L){var K=typeof $;(K==="undefined"||K==="boolean")&&($=null);var re=!1;if($===null)re=!0;else switch(K){case"string":case"number":re=!0;break;case"object":switch($.$$typeof){case e:case t:re=!0}}if(re)return re=$,L=L(re),$=D===""?"."+Y(re,0):D,j(L)?(Z="",$!=null&&(Z=$.replace(W,"$&/")+"/"),T(L,G,Z,"",function(we){return we})):L!=null&&(A(L)&&(L=M(L,Z+(!L.key||re&&re.key===L.key?"":(""+L.key).replace(W,"$&/")+"/")+$)),G.push(L)),1;if(re=0,D=D===""?".":D+":",j($))for(var he=0;he<$.length;he++){K=$[he];var pe=D+Y(K,he);re+=T(K,G,Z,pe,L)}else if(pe=y($),typeof pe=="function")for($=pe.call($),he=0;!(K=$.next()).done;)K=K.value,pe=D+Y(K,he++),re+=T(K,G,Z,pe,L);else if(K==="object")throw G=String($),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return re}function Q($,G,Z){if($==null)return $;var D=[],L=0;return T($,D,"","",function(K){return G.call(Z,K,L++)}),D}function U($){if($._status===-1){var G=$._result;G=G(),G.then(function(Z){($._status===0||$._status===-1)&&($._status=1,$._result=Z)},function(Z){($._status===0||$._status===-1)&&($._status=2,$._result=Z)}),$._status===-1&&($._status=0,$._result=G)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},H={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:O};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ze.Children={map:Q,forEach:function($,G,Z){Q($,function(){G.apply(this,arguments)},Z)},count:function($){var G=0;return Q($,function(){G++}),G},toArray:function($){return Q($,function(G){return G})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Ze.Component=_,Ze.Fragment=n,Ze.Profiler=i,Ze.PureComponent=E,Ze.StrictMode=s,Ze.Suspense=h,Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Ze.act=J,Ze.cloneElement=function($,G,Z){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var D=N({},$.props),L=$.key,K=$.ref,re=$._owner;if(G!=null){if(G.ref!==void 0&&(K=G.ref,re=O.current),G.key!==void 0&&(L=""+G.key),$.type&&$.type.defaultProps)var he=$.type.defaultProps;for(pe in G)I.call(G,pe)&&!P.hasOwnProperty(pe)&&(D[pe]=G[pe]===void 0&&he!==void 0?he[pe]:G[pe])}var pe=arguments.length-2;if(pe===1)D.children=Z;else if(1<pe){he=Array(pe);for(var we=0;we<pe;we++)he[we]=arguments[we+2];D.children=he}return{$$typeof:e,type:$.type,key:L,ref:K,props:D,_owner:re}},Ze.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Ze.createElement=F,Ze.createFactory=function($){var G=F.bind(null,$);return G.type=$,G},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function($){return{$$typeof:u,render:$}},Ze.isValidElement=A,Ze.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:U}},Ze.memo=function($,G){return{$$typeof:p,type:$,compare:G===void 0?null:G}},Ze.startTransition=function($){var G=X.transition;X.transition={};try{$()}finally{X.transition=G}},Ze.unstable_act=J,Ze.useCallback=function($,G){return ne.current.useCallback($,G)},Ze.useContext=function($){return ne.current.useContext($)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function($){return ne.current.useDeferredValue($)},Ze.useEffect=function($,G){return ne.current.useEffect($,G)},Ze.useId=function(){return ne.current.useId()},Ze.useImperativeHandle=function($,G,Z){return ne.current.useImperativeHandle($,G,Z)},Ze.useInsertionEffect=function($,G){return ne.current.useInsertionEffect($,G)},Ze.useLayoutEffect=function($,G){return ne.current.useLayoutEffect($,G)},Ze.useMemo=function($,G){return ne.current.useMemo($,G)},Ze.useReducer=function($,G,Z){return ne.current.useReducer($,G,Z)},Ze.useRef=function($){return ne.current.useRef($)},Ze.useState=function($){return ne.current.useState($)},Ze.useSyncExternalStore=function($,G,Z){return ne.current.useSyncExternalStore($,G,Z)},Ze.useTransition=function(){return ne.current.useTransition()},Ze.version="18.3.1",Ze}var Vx;function fl(){return Vx||(Vx=1,Af.exports=UA()),Af.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 Yx;function WA(){if(Yx)return La;Yx=1;var e=fl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:y,ref:w,props:g,_owner:i.current}}return La.Fragment=n,La.jsx=l,La.jsxs=l,La}var Kx;function HA(){return Kx||(Kx=1,Rf.exports=WA()),Rf.exports}var d=HA(),qc={},Mf={exports:{}},fn={},If={exports:{}},Of={};/**
|
|
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 Xx;function GA(){return Xx||(Xx=1,(function(e){function t(X,H){var J=X.length;X.push(H);e:for(;0<J;){var $=J-1>>>1,G=X[$];if(0<i(G,H))X[$]=H,X[J]=G,J=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var H=X[0],J=X.pop();if(J!==H){X[0]=J;e:for(var $=0,G=X.length,Z=G>>>1;$<Z;){var D=2*($+1)-1,L=X[D],K=D+1,re=X[K];if(0>i(L,J))K<G&&0>i(re,L)?(X[$]=re,X[K]=J,$=K):(X[$]=L,X[D]=J,$=D);else if(K<G&&0>i(re,J))X[$]=re,X[K]=J,$=K;else break e}}return H}function i(X,H){var J=X.sortIndex-H.sortIndex;return J!==0?J:X.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,y=3,w=!1,N=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(X){for(var H=n(p);H!==null;){if(H.callback===null)s(p);else if(H.startTime<=X)s(p),H.sortIndex=H.expirationTime,t(h,H);else break;H=n(p)}}function j(X){if(b=!1,C(X),!N)if(n(h)!==null)N=!0,U(I);else{var H=n(p);H!==null&&ne(j,H.startTime-X)}}function I(X,H){N=!1,b&&(b=!1,k(F),F=-1),w=!0;var J=y;try{for(C(H),g=n(h);g!==null&&(!(g.expirationTime>H)||X&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,y=g.priorityLevel;var G=$(g.expirationTime<=H);H=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(h)&&s(h),C(H)}else s(h);g=n(h)}if(g!==null)var Z=!0;else{var D=n(p);D!==null&&ne(j,D.startTime-H),Z=!1}return Z}finally{g=null,y=J,w=!1}}var O=!1,P=null,F=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function W(){if(P!==null){var X=e.unstable_now();A=X;var H=!0;try{H=P(!0,X)}finally{H?Y():(O=!1,P=null)}}else O=!1}var Y;if(typeof E=="function")Y=function(){E(W)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,Q=T.port2;T.port1.onmessage=W,Y=function(){Q.postMessage(null)}}else Y=function(){_(W,0)};function U(X){P=X,O||(O=!0,Y())}function ne(X,H){F=_(function(){X(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,U(I))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var J=y;y=H;try{return X()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,H){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var J=y;y=X;try{return H()}finally{y=J}},e.unstable_scheduleCallback=function(X,H,J){var $=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?$+J:$):J=$,X){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=J+G,X={id:f++,callback:H,priorityLevel:X,startTime:J,expirationTime:G,sortIndex:-1},J>$?(X.sortIndex=J,t(p,X),n(h)===null&&X===n(p)&&(b?(k(F),F=-1):b=!0,ne(j,J-$))):(X.sortIndex=G,t(h,X),N||w||(N=!0,U(I))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var H=y;return function(){var J=y;y=H;try{return X.apply(this,arguments)}finally{y=J}}}})(Of)),Of}var Qx;function VA(){return Qx||(Qx=1,If.exports=GA()),If.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 Zx;function YA(){if(Zx)return fn;Zx=1;var e=fl(),t=VA();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);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,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function y(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.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 b(r,o,c,m,v,x,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=R}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){_[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];_[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){_[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){_[r]=new b(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){_[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){_[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){_[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){_[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){_[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),_.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var v=_.hasOwnProperty(o)?_[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,v,m)&&(c=null),m||v===null?y(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):v.mustUseProperty?r[v.propertyName]=c===null?v.type===3?!1:"":c:(o=v.attributeName,m=v.attributeNamespace,c===null?r.removeAttribute(o):(v=v.type,c=v===3||v===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function H(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,$;function G(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
|
|
34
|
+
`+$+r}var Z=!1;function D(r,o){if(!r||Z)return"";Z=!0;var c=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(le){var m=le}Reflect.construct(r,[],o)}else{try{o.call()}catch(le){m=le}r.call(o.prototype)}else{try{throw Error()}catch(le){m=le}r()}}catch(le){if(le&&m&&typeof le.stack=="string"){for(var v=le.stack.split(`
|
|
35
|
+
`),x=m.stack.split(`
|
|
36
|
+
`),R=v.length-1,B=x.length-1;1<=R&&0<=B&&v[R]!==x[B];)B--;for(;1<=R&&0<=B;R--,B--)if(v[R]!==x[B]){if(R!==1||B!==1)do if(R--,B--,0>B||v[R]!==x[B]){var ee=`
|
|
37
|
+
`+v[R].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=R&&0<=B);break}}}finally{Z=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?G(r):""}function L(r){switch(r.tag){case 5:return G(r.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return r=D(r.type,!1),r;case 11:return r=D(r.type.render,!1),r;case 1:return r=D(r.type,!0),r;default:return""}}function K(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 P:return"Fragment";case O:return"Portal";case M:return"Profiler";case F:return"StrictMode";case Y:return"Suspense";case T:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case W: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:K(r.type)||"Memo";case U:o=r._payload,r=r._init;try{return K(r(o))}catch{}}return null}function re(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function he(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function we(r){var o=pe(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var v=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(R){m=""+R,x.call(this,R)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(R){m=""+R},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ce(r){r._valueTracker||(r._valueTracker=we(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Be(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 Le(r,o){var c=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function Se(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=he(o.value!=null?o.value:c),r._wrapperState={initialChecked:m,initialValue:c,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ce(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function be(r,o){ce(r,o);var c=he(o.value),m=o.type;if(c!=null)m==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+c):r.value!==""+c&&(r.value=""+c);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ke(r,o.type,c):o.hasOwnProperty("defaultValue")&&Ke(r,o.type,he(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function xe(r,o,c){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,c||o===r.value||(r.value=o),r.defaultValue=o}c=r.name,c!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,c!==""&&(r.name=c)}function Ke(r,o,c){(o!=="number"||Be(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var ut=Array.isArray;function at(r,o,c,m){if(r=r.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=o.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&m&&(r[c].defaultSelected=!0)}else{for(c=""+he(c),o=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function de(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function _e(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(ut(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:he(c)}}function De(r,o){var c=he(o.value),m=he(o.defaultValue);c!=null&&(c=""+c,c!==r.value&&(r.value=c),o.defaultValue==null&&r.defaultValue!==c&&(r.defaultValue=c)),m!=null&&(r.defaultValue=""+m)}function Ge(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function lt(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 je(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?lt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var We,Xe=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(We=We||document.createElement("div"),We.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=We.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function oe(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var Oe={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},Pe=["Webkit","ms","Moz","O"];Object.keys(Oe).forEach(function(r){Pe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Oe[o]=Oe[r]})});function Te(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Oe.hasOwnProperty(r)&&Oe[r]?(""+o).trim():o+"px"}function Qe(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,v=Te(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,v):r[c]=v}}var Ct=J({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 st(r,o){if(o){if(Ct[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 Me(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 bt=null;function dt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var St=null,Nn=null,zn=null;function En(r){if(r=_a(r)){if(typeof St!="function")throw Error(n(280));var o=r.stateNode;o&&(o=Zl(o),St(r.stateNode,r.type,o))}}function Co(r){Nn?zn?zn.push(r):zn=[r]:Nn=r}function gn(){if(Nn){var r=Nn,o=zn;if(zn=Nn=null,En(r),o)for(r=0;r<o.length;r++)En(o[r])}}function jo(r,o){return r(o)}function To(){}var Bt=!1;function jr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return jo(r,o,c)}finally{Bt=!1,(Nn!==null||zn!==null)&&(To(),gn())}}function Bn(r,o){var c=r.stateNode;if(c===null)return null;var m=Zl(c);if(m===null)return null;c=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(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var Ps=!1;if(u)try{var Tr={};Object.defineProperty(Tr,"passive",{get:function(){Ps=!0}}),window.addEventListener("test",Tr,Tr),window.removeEventListener("test",Tr,Tr)}catch{Ps=!1}function Qi(r,o,c,m,v,x,R,B,ee){var le=Array.prototype.slice.call(arguments,3);try{o.apply(c,le)}catch(ge){this.onError(ge)}}var fr=!1,Rr=null,hr=!1,es=null,Ro={onError:function(r){fr=!0,Rr=r}};function Ao(r,o,c,m,v,x,R,B,ee){fr=!1,Rr=null,Qi.apply(Ro,arguments)}function Mo(r,o,c,m,v,x,R,B,ee){if(Ao.apply(this,arguments),fr){if(fr){var le=Rr;fr=!1,Rr=null}else throw Error(n(198));hr||(hr=!0,es=le)}}function Cn(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function Io(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 Ar(r){if(Cn(r)!==r)throw Error(n(188))}function Oo(r){var o=r.alternate;if(!o){if(o=Cn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){c=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return Ar(v),r;if(x===m)return Ar(v),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=v,m=x;else{for(var R=!1,B=v.child;B;){if(B===c){R=!0,c=v,m=x;break}if(B===m){R=!0,m=v,c=x;break}B=B.sibling}if(!R){for(B=x.child;B;){if(B===c){R=!0,c=x,m=v;break}if(B===m){R=!0,m=x,c=v;break}B=B.sibling}if(!R)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Un(r){return r=Oo(r),r!==null?Po(r):null}function Po(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Po(r);if(o!==null)return o;r=r.sibling}return null}var $s=t.unstable_scheduleCallback,Ls=t.unstable_cancelCallback,$o=t.unstable_shouldYield,Lo=t.unstable_requestPaint,ot=t.unstable_now,Zi=t.unstable_getCurrentPriorityLevel,ts=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Wn=t.unstable_NormalPriority,qo=t.unstable_LowPriority,ns=t.unstable_IdlePriority,gt=null,sn=null;function Hn(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(gt,r,void 0,(r.current.flags&128)===128)}catch{}}var vn=Math.clz32?Math.clz32:Do,rd=Math.log,Mr=Math.LN2;function Do(r){return r>>>=0,r===0?32:31-(rd(r)/Mr|0)|0}var Fo=64,zo=4194304;function rs(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 qs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,R=c&268435455;if(R!==0){var B=R&~v;B!==0?m=rs(B):(x&=R,x!==0&&(m=rs(x)))}else R=c&~v,R!==0?m=rs(R):x!==0&&(m=rs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-vn(o),v=1<<c,m|=r[c],o&=~v;return m}function ss(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 Cl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var R=31-vn(x),B=1<<R,ee=v[R];ee===-1?((B&c)===0||(B&m)!==0)&&(v[R]=ss(B,o)):ee<=o&&(r.expiredLanes|=B),x&=~B}}function Bo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Ds(){var r=Fo;return Fo<<=1,(Fo&4194240)===0&&(Fo=64),r}function Uo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function os(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-vn(o),r[o]=c}function Jt(r,o){var c=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<c;){var v=31-vn(c),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,c&=~x}}function is(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-vn(c),v=1<<m;v&o|r[m]&o&&(r[m]|=o),c&=~v}}var et=0;function Ji(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var jl,Ir,ea,Gn,Tl,Wo=!1,Ho=[],pr=null,Vn=null,mr=null,yn=new Map,Yn=new Map,Kn=[],ta="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 Xn(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":yn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yn.delete(o.pointerId)}}function Fs(r,o,c,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=_a(o),o!==null&&Ir(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function jn(r,o,c,m,v){switch(o){case"focusin":return pr=Fs(pr,r,o,c,m,v),!0;case"dragenter":return Vn=Fs(Vn,r,o,c,m,v),!0;case"mouseover":return mr=Fs(mr,r,o,c,m,v),!0;case"pointerover":var x=v.pointerId;return yn.set(x,Fs(yn.get(x)||null,r,o,c,m,v)),!0;case"gotpointercapture":return x=v.pointerId,Yn.set(x,Fs(Yn.get(x)||null,r,o,c,m,v)),!0}return!1}function Go(r){var o=eo(r.target);if(o!==null){var c=Cn(o);if(c!==null){if(o=c.tag,o===13){if(o=Io(c),o!==null){r.blockedOn=o,Tl(r.priority,function(){ea(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function as(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Yo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);bt=m,c.target.dispatchEvent(m),bt=null}else return o=_a(c),o!==null&&Ir(o),r.blockedOn=c,!1;o.shift()}return!0}function na(r,o,c){as(r)&&c.delete(o)}function Vo(){Wo=!1,pr!==null&&as(pr)&&(pr=null),Vn!==null&&as(Vn)&&(Vn=null),mr!==null&&as(mr)&&(mr=null),yn.forEach(na),Yn.forEach(na)}function Or(r,o){r.blockedOn===o&&(r.blockedOn=null,Wo||(Wo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vo)))}function ls(r){function o(v){return Or(v,r)}if(0<Ho.length){Or(Ho[0],r);for(var c=1;c<Ho.length;c++){var m=Ho[c];m.blockedOn===r&&(m.blockedOn=null)}}for(pr!==null&&Or(pr,r),Vn!==null&&Or(Vn,r),mr!==null&&Or(mr,r),yn.forEach(o),Yn.forEach(o),c=0;c<Kn.length;c++)m=Kn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Kn.length&&(c=Kn[0],c.blockedOn===null);)Go(c),c.blockedOn===null&&Kn.shift()}var gr=j.ReactCurrentBatchConfig,zs=!0;function ra(r,o,c,m){var v=et,x=gr.transition;gr.transition=null;try{et=1,vr(r,o,c,m)}finally{et=v,gr.transition=x}}function Rl(r,o,c,m){var v=et,x=gr.transition;gr.transition=null;try{et=4,vr(r,o,c,m)}finally{et=v,gr.transition=x}}function vr(r,o,c,m){if(zs){var v=Yo(r,o,c,m);if(v===null)wd(r,o,m,Bs,c),Xn(r,m);else if(jn(v,r,o,c,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<ta.indexOf(r)){for(;v!==null;){var x=_a(v);if(x!==null&&jl(x),x=Yo(r,o,c,m),x===null&&wd(r,o,m,Bs,c),x===v)break;v=x}v!==null&&m.stopPropagation()}else wd(r,o,m,null,c)}}var Bs=null;function Yo(r,o,c,m){if(Bs=null,r=dt(m),r=eo(r),r!==null)if(o=Cn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Io(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Bs=r,null}function Ko(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(Zi()){case ts:return 1;case Gt:return 4;case Wn:case qo:return 16;case ns:return 536870912;default:return 16}default:return 16}}var yr=null,Us=null,Qn=null;function sa(){if(Qn)return Qn;var r,o=Us,c=o.length,m,v="value"in yr?yr.value:yr.textContent,x=v.length;for(r=0;r<c&&o[r]===v[r];r++);var R=c-r;for(m=1;m<=R&&o[c-m]===v[x-m];m++);return Qn=v.slice(r,1<m?1-m:void 0)}function Xo(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 Ws(){return!0}function oa(){return!1}function en(r){function o(c,m,v,x,R){this._reactName=c,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ws:oa,this.isPropagationStopped=oa,this}return J(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),o}var It={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ia=en(It),Pr=J({},It,{view:0,detail:0}),cs=en(Pr),$r,Hs,Lr,Gs=J({},Pr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,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!==Lr&&(Lr&&r.type==="mousemove"?($r=r.screenX-Lr.screenX,Hs=r.screenY-Lr.screenY):Hs=$r=0,Lr=r),$r)},movementY:function(r){return"movementY"in r?r.movementY:Hs}}),Vs=en(Gs),Al=J({},Gs,{dataTransfer:0}),sd=en(Al),od=J({},Pr,{relatedTarget:0}),Qo=en(od),id=J({},It,{animationName:0,elapsedTime:0,pseudoElement:0}),ad=en(id),aa=J({},It,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wr=en(aa),la=J({},It,{data:0}),ca=en(la),ld={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cd={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"},Ml={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Il(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Ml[r])?!!o[r]:!1}function Tn(){return Il}var ud=J({},Pr,{key:function(r){if(r.key){var o=ld[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?cd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(r){return r.type==="keypress"?Xo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ol=en(ud),dd=J({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ys=en(dd),fd=J({},Pr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn}),tn=en(fd),ua=J({},It,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pl=en(ua),$l=J({},Gs,{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}),Ll=en($l),da=[9,13,27,32],us=u&&"CompositionEvent"in window,qr=null;u&&"documentMode"in document&&(qr=document.documentMode);var ql=u&&"TextEvent"in window&&!qr,Ks=u&&(!us||qr&&8<qr&&11>=qr),fa=" ",Zo=!1;function ha(r,o){switch(r){case"keyup":return da.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jo(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Vt=!1;function Dl(r,o){switch(r){case"compositionend":return Jo(o);case"keypress":return o.which!==32?null:(Zo=!0,fa);case"textInput":return r=o.data,r===fa&&Zo?null:r;default:return null}}function Fl(r,o){if(Vt)return r==="compositionend"||!us&&ha(r,o)?(r=sa(),Qn=Us=yr=null,Vt=!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 Ks&&o.locale!=="ko"?null:o.data;default:return null}}var hd={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 zl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!hd[r.type]:o==="textarea"}function pa(r,o,c,m){Co(m),o=Kl(o,"onChange"),0<o.length&&(c=new ia("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Lt=null,ds=null;function Bl(r){l0(r,0)}function Xs(r){var o=si(r);if(Ve(o))return r}function Ul(r,o){if(r==="change")return o}var z=!1;if(u){var V;if(u){var ae="oninput"in document;if(!ae){var fe=document.createElement("div");fe.setAttribute("oninput","return;"),ae=typeof fe.oninput=="function"}V=ae}else V=!1;z=V&&(!document.documentMode||9<document.documentMode)}function ke(){Lt&&(Lt.detachEvent("onpropertychange",Ae),ds=Lt=null)}function Ae(r){if(r.propertyName==="value"&&Xs(ds)){var o=[];pa(o,ds,r,dt(r)),jr(Bl,o)}}function He(r,o,c){r==="focusin"?(ke(),Lt=o,ds=c,Lt.attachEvent("onpropertychange",Ae)):r==="focusout"&&ke()}function nt(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Xs(ds)}function vt(r,o){if(r==="click")return Xs(o)}function ct(r,o){if(r==="input"||r==="change")return Xs(o)}function on(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Yt=typeof Object.is=="function"?Object.is:on;function fs(r,o){if(Yt(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var v=c[m];if(!h.call(o,v)||!Yt(r[v],o[v]))return!1}return!0}function Wl(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ma(r,o){var c=Wl(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Wl(c)}}function Hl(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Hl(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ga(){for(var r=window,o=Be();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Be(r.document)}return o}function Qs(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 Zs(r){var o=ga(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Hl(c.ownerDocument.documentElement,c)){if(m!==null&&Qs(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=c.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=ma(c,x);var R=ma(c,m);v&&R&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==R.node||r.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Js=u&&"documentMode"in document&&11>=document.documentMode,ht=null,ei=null,va=null,pd=!1;function Jw(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;pd||ht==null||ht!==Be(m)||(m=ht,"selectionStart"in m&&Qs(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}),va&&fs(va,m)||(va=m,m=Kl(ei,"onSelect"),0<m.length&&(o=new ia("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=ht)))}function Gl(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var ti={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionend:Gl("Transition","TransitionEnd")},md={},e0={};u&&(e0=document.createElement("div").style,"AnimationEvent"in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),"TransitionEvent"in window||delete ti.transitionend.transition);function Vl(r){if(md[r])return md[r];if(!ti[r])return r;var o=ti[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in e0)return md[r]=o[c];return r}var t0=Vl("animationend"),n0=Vl("animationiteration"),r0=Vl("animationstart"),s0=Vl("transitionend"),o0=new Map,i0="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 hs(r,o){o0.set(r,o),a(o,[r])}for(var gd=0;gd<i0.length;gd++){var vd=i0[gd],ZR=vd.toLowerCase(),JR=vd[0].toUpperCase()+vd.slice(1);hs(ZR,"on"+JR)}hs(t0,"onAnimationEnd"),hs(n0,"onAnimationIteration"),hs(r0,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(s0,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ya="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(" "),eA=new Set("cancel close invalid load scroll toggle".split(" ").concat(ya));function a0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Mo(m,o,void 0,r),r.currentTarget=null}function l0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var R=m.length-1;0<=R;R--){var B=m[R],ee=B.instance,le=B.currentTarget;if(B=B.listener,ee!==x&&v.isPropagationStopped())break e;a0(v,B,le),x=ee}else for(R=0;R<m.length;R++){if(B=m[R],ee=B.instance,le=B.currentTarget,B=B.listener,ee!==x&&v.isPropagationStopped())break e;a0(v,B,le),x=ee}}}if(hr)throw r=es,hr=!1,es=null,r}function pt(r,o){var c=o[Nd];c===void 0&&(c=o[Nd]=new Set);var m=r+"__bubble";c.has(m)||(c0(o,r,2,!1),c.add(m))}function yd(r,o,c){var m=0;o&&(m|=4),c0(c,r,m,o)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function wa(r){if(!r[Yl]){r[Yl]=!0,s.forEach(function(c){c!=="selectionchange"&&(eA.has(c)||yd(c,!1,r),yd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Yl]||(o[Yl]=!0,yd("selectionchange",!1,o))}}function c0(r,o,c,m){switch(Ko(o)){case 1:var v=ra;break;case 4:v=Rl;break;default:v=vr}c=v.bind(null,o,c,r),v=void 0,!Ps||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,c,{capture:!0,passive:v}):r.addEventListener(o,c,!0):v!==void 0?r.addEventListener(o,c,{passive:v}):r.addEventListener(o,c,!1)}function wd(r,o,c,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var B=m.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(R===4)for(R=m.return;R!==null;){var ee=R.tag;if((ee===3||ee===4)&&(ee=R.stateNode.containerInfo,ee===v||ee.nodeType===8&&ee.parentNode===v))return;R=R.return}for(;B!==null;){if(R=eo(B),R===null)return;if(ee=R.tag,ee===5||ee===6){m=x=R;continue e}B=B.parentNode}}m=m.return}jr(function(){var le=x,ge=dt(c),ve=[];e:{var me=o0.get(r);if(me!==void 0){var Ne=ia,Re=r;switch(r){case"keypress":if(Xo(c)===0)break e;case"keydown":case"keyup":Ne=Ol;break;case"focusin":Re="focus",Ne=Qo;break;case"focusout":Re="blur",Ne=Qo;break;case"beforeblur":case"afterblur":Ne=Qo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=Vs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=sd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=tn;break;case t0:case n0:case r0:Ne=ad;break;case s0:Ne=Pl;break;case"scroll":Ne=cs;break;case"wheel":Ne=Ll;break;case"copy":case"cut":case"paste":Ne=wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=Ys}var Ie=(o&4)!==0,jt=!Ie&&r==="scroll",se=Ie?me!==null?me+"Capture":null:me;Ie=[];for(var te=le,ie;te!==null;){ie=te;var ye=ie.stateNode;if(ie.tag===5&&ye!==null&&(ie=ye,se!==null&&(ye=Bn(te,se),ye!=null&&Ie.push(xa(te,ye,ie)))),jt)break;te=te.return}0<Ie.length&&(me=new Ne(me,Re,null,c,ge),ve.push({event:me,listeners:Ie}))}}if((o&7)===0){e:{if(me=r==="mouseover"||r==="pointerover",Ne=r==="mouseout"||r==="pointerout",me&&c!==bt&&(Re=c.relatedTarget||c.fromElement)&&(eo(Re)||Re[Dr]))break e;if((Ne||me)&&(me=ge.window===ge?ge:(me=ge.ownerDocument)?me.defaultView||me.parentWindow:window,Ne?(Re=c.relatedTarget||c.toElement,Ne=le,Re=Re?eo(Re):null,Re!==null&&(jt=Cn(Re),Re!==jt||Re.tag!==5&&Re.tag!==6)&&(Re=null)):(Ne=null,Re=le),Ne!==Re)){if(Ie=Vs,ye="onMouseLeave",se="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Ie=Ys,ye="onPointerLeave",se="onPointerEnter",te="pointer"),jt=Ne==null?me:si(Ne),ie=Re==null?me:si(Re),me=new Ie(ye,te+"leave",Ne,c,ge),me.target=jt,me.relatedTarget=ie,ye=null,eo(ge)===le&&(Ie=new Ie(se,te+"enter",Re,c,ge),Ie.target=ie,Ie.relatedTarget=jt,ye=Ie),jt=ye,Ne&&Re)t:{for(Ie=Ne,se=Re,te=0,ie=Ie;ie;ie=ni(ie))te++;for(ie=0,ye=se;ye;ye=ni(ye))ie++;for(;0<te-ie;)Ie=ni(Ie),te--;for(;0<ie-te;)se=ni(se),ie--;for(;te--;){if(Ie===se||se!==null&&Ie===se.alternate)break t;Ie=ni(Ie),se=ni(se)}Ie=null}else Ie=null;Ne!==null&&u0(ve,me,Ne,Ie,!1),Re!==null&&jt!==null&&u0(ve,jt,Re,Ie,!0)}}e:{if(me=le?si(le):window,Ne=me.nodeName&&me.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&me.type==="file")var $e=Ul;else if(zl(me))if(z)$e=ct;else{$e=nt;var Fe=He}else(Ne=me.nodeName)&&Ne.toLowerCase()==="input"&&(me.type==="checkbox"||me.type==="radio")&&($e=vt);if($e&&($e=$e(r,le))){pa(ve,$e,c,ge);break e}Fe&&Fe(r,me,le),r==="focusout"&&(Fe=me._wrapperState)&&Fe.controlled&&me.type==="number"&&Ke(me,"number",me.value)}switch(Fe=le?si(le):window,r){case"focusin":(zl(Fe)||Fe.contentEditable==="true")&&(ht=Fe,ei=le,va=null);break;case"focusout":va=ei=ht=null;break;case"mousedown":pd=!0;break;case"contextmenu":case"mouseup":case"dragend":pd=!1,Jw(ve,c,ge);break;case"selectionchange":if(Js)break;case"keydown":case"keyup":Jw(ve,c,ge)}var ze;if(us)e:{switch(r){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else Vt?ha(r,c)&&(Ue="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Ue="onCompositionStart");Ue&&(Ks&&c.locale!=="ko"&&(Vt||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&Vt&&(ze=sa()):(yr=ge,Us="value"in yr?yr.value:yr.textContent,Vt=!0)),Fe=Kl(le,Ue),0<Fe.length&&(Ue=new ca(Ue,r,null,c,ge),ve.push({event:Ue,listeners:Fe}),ze?Ue.data=ze:(ze=Jo(c),ze!==null&&(Ue.data=ze)))),(ze=ql?Dl(r,c):Fl(r,c))&&(le=Kl(le,"onBeforeInput"),0<le.length&&(ge=new ca("onBeforeInput","beforeinput",null,c,ge),ve.push({event:ge,listeners:le}),ge.data=ze))}l0(ve,o)})}function xa(r,o,c){return{instance:r,listener:o,currentTarget:c}}function Kl(r,o){for(var c=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Bn(r,c),x!=null&&m.unshift(xa(r,x,v)),x=Bn(r,o),x!=null&&m.push(xa(r,x,v))),r=r.return}return m}function ni(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function u0(r,o,c,m,v){for(var x=o._reactName,R=[];c!==null&&c!==m;){var B=c,ee=B.alternate,le=B.stateNode;if(ee!==null&&ee===m)break;B.tag===5&&le!==null&&(B=le,v?(ee=Bn(c,x),ee!=null&&R.unshift(xa(c,ee,B))):v||(ee=Bn(c,x),ee!=null&&R.push(xa(c,ee,B)))),c=c.return}R.length!==0&&r.push({event:o,listeners:R})}var tA=/\r\n?/g,nA=/\u0000|\uFFFD/g;function d0(r){return(typeof r=="string"?r:""+r).replace(tA,`
|
|
38
|
+
`).replace(nA,"")}function Xl(r,o,c){if(o=d0(o),d0(r)!==o&&c)throw Error(n(425))}function Ql(){}var xd=null,bd=null;function _d(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 kd=typeof setTimeout=="function"?setTimeout:void 0,rA=typeof clearTimeout=="function"?clearTimeout:void 0,f0=typeof Promise=="function"?Promise:void 0,sA=typeof queueMicrotask=="function"?queueMicrotask:typeof f0<"u"?function(r){return f0.resolve(null).then(r).catch(oA)}:kd;function oA(r){setTimeout(function(){throw r})}function Sd(r,o){var c=o,m=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(m===0){r.removeChild(v),ls(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=v}while(c);ls(o)}function ps(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 h0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ri=Math.random().toString(36).slice(2),xr="__reactFiber$"+ri,ba="__reactProps$"+ri,Dr="__reactContainer$"+ri,Nd="__reactEvents$"+ri,iA="__reactListeners$"+ri,aA="__reactHandles$"+ri;function eo(r){var o=r[xr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Dr]||c[xr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=h0(r);r!==null;){if(c=r[xr])return c;r=h0(r)}return o}r=c,c=r.parentNode}return null}function _a(r){return r=r[xr]||r[Dr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function si(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function Zl(r){return r[ba]||null}var Ed=[],oi=-1;function ms(r){return{current:r}}function mt(r){0>oi||(r.current=Ed[oi],Ed[oi]=null,oi--)}function ft(r,o){oi++,Ed[oi]=r.current,r.current=o}var gs={},Kt=ms(gs),an=ms(!1),to=gs;function ii(r,o){var c=r.type.contextTypes;if(!c)return gs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in c)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function ln(r){return r=r.childContextTypes,r!=null}function Jl(){mt(an),mt(Kt)}function p0(r,o,c){if(Kt.current!==gs)throw Error(n(168));ft(Kt,o),ft(an,c)}function m0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,re(r)||"Unknown",v));return J({},c,m)}function ec(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||gs,to=Kt.current,ft(Kt,r),ft(an,an.current),!0}function g0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=m0(r,o,to),m.__reactInternalMemoizedMergedChildContext=r,mt(an),mt(Kt),ft(Kt,r)):mt(an),ft(an,c)}var Fr=null,tc=!1,Cd=!1;function v0(r){Fr===null?Fr=[r]:Fr.push(r)}function lA(r){tc=!0,v0(r)}function vs(){if(!Cd&&Fr!==null){Cd=!0;var r=0,o=et;try{var c=Fr;for(et=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Fr=null,tc=!1}catch(v){throw Fr!==null&&(Fr=Fr.slice(r+1)),$s(ts,vs),v}finally{et=o,Cd=!1}}return null}var ai=[],li=0,nc=null,rc=0,Rn=[],An=0,no=null,zr=1,Br="";function ro(r,o){ai[li++]=rc,ai[li++]=nc,nc=r,rc=o}function y0(r,o,c){Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,no=r;var m=zr;r=Br;var v=32-vn(m)-1;m&=~(1<<v),c+=1;var x=32-vn(o)+v;if(30<x){var R=v-v%5;x=(m&(1<<R)-1).toString(32),m>>=R,v-=R,zr=1<<32-vn(o)+v|c<<v|m,Br=x+r}else zr=1<<x|c<<v|m,Br=r}function jd(r){r.return!==null&&(ro(r,1),y0(r,1,0))}function Td(r){for(;r===nc;)nc=ai[--li],ai[li]=null,rc=ai[--li],ai[li]=null;for(;r===no;)no=Rn[--An],Rn[An]=null,Br=Rn[--An],Rn[An]=null,zr=Rn[--An],Rn[An]=null}var wn=null,xn=null,yt=!1,Zn=null;function w0(r,o){var c=Pn(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function x0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,wn=r,xn=ps(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,wn=r,xn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=no!==null?{id:zr,overflow:Br}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=Pn(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,wn=r,xn=null,!0):!1;default:return!1}}function Rd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Ad(r){if(yt){var o=xn;if(o){var c=o;if(!x0(r,o)){if(Rd(r))throw Error(n(418));o=ps(c.nextSibling);var m=wn;o&&x0(r,o)?w0(m,c):(r.flags=r.flags&-4097|2,yt=!1,wn=r)}}else{if(Rd(r))throw Error(n(418));r.flags=r.flags&-4097|2,yt=!1,wn=r}}}function b0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;wn=r}function sc(r){if(r!==wn)return!1;if(!yt)return b0(r),yt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!_d(r.type,r.memoizedProps)),o&&(o=xn)){if(Rd(r))throw _0(),Error(n(418));for(;o;)w0(r,o),o=ps(o.nextSibling)}if(b0(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 c=r.data;if(c==="/$"){if(o===0){xn=ps(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}xn=null}}else xn=wn?ps(r.stateNode.nextSibling):null;return!0}function _0(){for(var r=xn;r;)r=ps(r.nextSibling)}function ci(){xn=wn=null,yt=!1}function Md(r){Zn===null?Zn=[r]:Zn.push(r)}var cA=j.ReactCurrentBatchConfig;function ka(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(R){var B=v.refs;R===null?delete B[x]:B[x]=R},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function oc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function k0(r){var o=r._init;return o(r._payload)}function S0(r){function o(se,te){if(r){var ie=se.deletions;ie===null?(se.deletions=[te],se.flags|=16):ie.push(te)}}function c(se,te){if(!r)return null;for(;te!==null;)o(se,te),te=te.sibling;return null}function m(se,te){for(se=new Map;te!==null;)te.key!==null?se.set(te.key,te):se.set(te.index,te),te=te.sibling;return se}function v(se,te){return se=Ns(se,te),se.index=0,se.sibling=null,se}function x(se,te,ie){return se.index=ie,r?(ie=se.alternate,ie!==null?(ie=ie.index,ie<te?(se.flags|=2,te):ie):(se.flags|=2,te)):(se.flags|=1048576,te)}function R(se){return r&&se.alternate===null&&(se.flags|=2),se}function B(se,te,ie,ye){return te===null||te.tag!==6?(te=Sf(ie,se.mode,ye),te.return=se,te):(te=v(te,ie),te.return=se,te)}function ee(se,te,ie,ye){var $e=ie.type;return $e===P?ge(se,te,ie.props.children,ye,ie.key):te!==null&&(te.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&k0($e)===te.type)?(ye=v(te,ie.props),ye.ref=ka(se,te,ie),ye.return=se,ye):(ye=Tc(ie.type,ie.key,ie.props,null,se.mode,ye),ye.ref=ka(se,te,ie),ye.return=se,ye)}function le(se,te,ie,ye){return te===null||te.tag!==4||te.stateNode.containerInfo!==ie.containerInfo||te.stateNode.implementation!==ie.implementation?(te=Nf(ie,se.mode,ye),te.return=se,te):(te=v(te,ie.children||[]),te.return=se,te)}function ge(se,te,ie,ye,$e){return te===null||te.tag!==7?(te=fo(ie,se.mode,ye,$e),te.return=se,te):(te=v(te,ie),te.return=se,te)}function ve(se,te,ie){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Sf(""+te,se.mode,ie),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return ie=Tc(te.type,te.key,te.props,null,se.mode,ie),ie.ref=ka(se,null,te),ie.return=se,ie;case O:return te=Nf(te,se.mode,ie),te.return=se,te;case U:var ye=te._init;return ve(se,ye(te._payload),ie)}if(ut(te)||H(te))return te=fo(te,se.mode,ie,null),te.return=se,te;oc(se,te)}return null}function me(se,te,ie,ye){var $e=te!==null?te.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return $e!==null?null:B(se,te,""+ie,ye);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===$e?ee(se,te,ie,ye):null;case O:return ie.key===$e?le(se,te,ie,ye):null;case U:return $e=ie._init,me(se,te,$e(ie._payload),ye)}if(ut(ie)||H(ie))return $e!==null?null:ge(se,te,ie,ye,null);oc(se,ie)}return null}function Ne(se,te,ie,ye,$e){if(typeof ye=="string"&&ye!==""||typeof ye=="number")return se=se.get(ie)||null,B(te,se,""+ye,$e);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case I:return se=se.get(ye.key===null?ie:ye.key)||null,ee(te,se,ye,$e);case O:return se=se.get(ye.key===null?ie:ye.key)||null,le(te,se,ye,$e);case U:var Fe=ye._init;return Ne(se,te,ie,Fe(ye._payload),$e)}if(ut(ye)||H(ye))return se=se.get(ie)||null,ge(te,se,ye,$e,null);oc(te,ye)}return null}function Re(se,te,ie,ye){for(var $e=null,Fe=null,ze=te,Ue=te=0,Ft=null;ze!==null&&Ue<ie.length;Ue++){ze.index>Ue?(Ft=ze,ze=null):Ft=ze.sibling;var rt=me(se,ze,ie[Ue],ye);if(rt===null){ze===null&&(ze=Ft);break}r&&ze&&rt.alternate===null&&o(se,ze),te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt,ze=Ft}if(Ue===ie.length)return c(se,ze),yt&&ro(se,Ue),$e;if(ze===null){for(;Ue<ie.length;Ue++)ze=ve(se,ie[Ue],ye),ze!==null&&(te=x(ze,te,Ue),Fe===null?$e=ze:Fe.sibling=ze,Fe=ze);return yt&&ro(se,Ue),$e}for(ze=m(se,ze);Ue<ie.length;Ue++)Ft=Ne(ze,se,Ue,ie[Ue],ye),Ft!==null&&(r&&Ft.alternate!==null&&ze.delete(Ft.key===null?Ue:Ft.key),te=x(Ft,te,Ue),Fe===null?$e=Ft:Fe.sibling=Ft,Fe=Ft);return r&&ze.forEach(function(Es){return o(se,Es)}),yt&&ro(se,Ue),$e}function Ie(se,te,ie,ye){var $e=H(ie);if(typeof $e!="function")throw Error(n(150));if(ie=$e.call(ie),ie==null)throw Error(n(151));for(var Fe=$e=null,ze=te,Ue=te=0,Ft=null,rt=ie.next();ze!==null&&!rt.done;Ue++,rt=ie.next()){ze.index>Ue?(Ft=ze,ze=null):Ft=ze.sibling;var Es=me(se,ze,rt.value,ye);if(Es===null){ze===null&&(ze=Ft);break}r&&ze&&Es.alternate===null&&o(se,ze),te=x(Es,te,Ue),Fe===null?$e=Es:Fe.sibling=Es,Fe=Es,ze=Ft}if(rt.done)return c(se,ze),yt&&ro(se,Ue),$e;if(ze===null){for(;!rt.done;Ue++,rt=ie.next())rt=ve(se,rt.value,ye),rt!==null&&(te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt);return yt&&ro(se,Ue),$e}for(ze=m(se,ze);!rt.done;Ue++,rt=ie.next())rt=Ne(ze,se,Ue,rt.value,ye),rt!==null&&(r&&rt.alternate!==null&&ze.delete(rt.key===null?Ue:rt.key),te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt);return r&&ze.forEach(function(BA){return o(se,BA)}),yt&&ro(se,Ue),$e}function jt(se,te,ie,ye){if(typeof ie=="object"&&ie!==null&&ie.type===P&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var $e=ie.key,Fe=te;Fe!==null;){if(Fe.key===$e){if($e=ie.type,$e===P){if(Fe.tag===7){c(se,Fe.sibling),te=v(Fe,ie.props.children),te.return=se,se=te;break e}}else if(Fe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&k0($e)===Fe.type){c(se,Fe.sibling),te=v(Fe,ie.props),te.ref=ka(se,Fe,ie),te.return=se,se=te;break e}c(se,Fe);break}else o(se,Fe);Fe=Fe.sibling}ie.type===P?(te=fo(ie.props.children,se.mode,ye,ie.key),te.return=se,se=te):(ye=Tc(ie.type,ie.key,ie.props,null,se.mode,ye),ye.ref=ka(se,te,ie),ye.return=se,se=ye)}return R(se);case O:e:{for(Fe=ie.key;te!==null;){if(te.key===Fe)if(te.tag===4&&te.stateNode.containerInfo===ie.containerInfo&&te.stateNode.implementation===ie.implementation){c(se,te.sibling),te=v(te,ie.children||[]),te.return=se,se=te;break e}else{c(se,te);break}else o(se,te);te=te.sibling}te=Nf(ie,se.mode,ye),te.return=se,se=te}return R(se);case U:return Fe=ie._init,jt(se,te,Fe(ie._payload),ye)}if(ut(ie))return Re(se,te,ie,ye);if(H(ie))return Ie(se,te,ie,ye);oc(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,te!==null&&te.tag===6?(c(se,te.sibling),te=v(te,ie),te.return=se,se=te):(c(se,te),te=Sf(ie,se.mode,ye),te.return=se,se=te),R(se)):c(se,te)}return jt}var ui=S0(!0),N0=S0(!1),ic=ms(null),ac=null,di=null,Id=null;function Od(){Id=di=ac=null}function Pd(r){var o=ic.current;mt(ic),r._currentValue=o}function $d(r,o,c){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===c)break;r=r.return}}function fi(r,o){ac=r,Id=di=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(cn=!0),r.firstContext=null)}function Mn(r){var o=r._currentValue;if(Id!==r)if(r={context:r,memoizedValue:o,next:null},di===null){if(ac===null)throw Error(n(308));di=r,ac.dependencies={lanes:0,firstContext:r}}else di=di.next=r;return o}var so=null;function Ld(r){so===null?so=[r]:so.push(r)}function E0(r,o,c,m){var v=o.interleaved;return v===null?(c.next=c,Ld(o)):(c.next=v.next,v.next=c),o.interleaved=c,Ur(r,m)}function Ur(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var ys=!1;function qd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function C0(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 Wr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function ws(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Ur(r,c)}return v=m.interleaved,v===null?(o.next=o,Ld(m)):(o.next=v.next,v.next=o),m.interleaved=o,Ur(r,c)}function lc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}function j0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var R={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?v=x=R:x=x.next=R,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function cc(r,o,c,m){var v=r.updateQueue;ys=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var ee=B,le=ee.next;ee.next=null,R===null?x=le:R.next=le,R=ee;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,B=ge.lastBaseUpdate,B!==R&&(B===null?ge.firstBaseUpdate=le:B.next=le,ge.lastBaseUpdate=ee))}if(x!==null){var ve=v.baseState;R=0,ge=le=ee=null,B=x;do{var me=B.lane,Ne=B.eventTime;if((m&me)===me){ge!==null&&(ge=ge.next={eventTime:Ne,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Re=r,Ie=B;switch(me=o,Ne=c,Ie.tag){case 1:if(Re=Ie.payload,typeof Re=="function"){ve=Re.call(Ne,ve,me);break e}ve=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ie.payload,me=typeof Re=="function"?Re.call(Ne,ve,me):Re,me==null)break e;ve=J({},ve,me);break e;case 2:ys=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,me=v.effects,me===null?v.effects=[B]:me.push(B))}else Ne={eventTime:Ne,lane:me,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ge===null?(le=ge=Ne,ee=ve):ge=ge.next=Ne,R|=me;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;me=B,B=me.next,me.next=null,v.lastBaseUpdate=me,v.shared.pending=null}}while(!0);if(ge===null&&(ee=ve),v.baseState=ee,v.firstBaseUpdate=le,v.lastBaseUpdate=ge,o=v.shared.interleaved,o!==null){v=o;do R|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);ao|=R,r.lanes=R,r.memoizedState=ve}}function T0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=c,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Sa={},br=ms(Sa),Na=ms(Sa),Ea=ms(Sa);function oo(r){if(r===Sa)throw Error(n(174));return r}function Dd(r,o){switch(ft(Ea,o),ft(Na,r),ft(br,Sa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:je(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=je(o,r)}mt(br),ft(br,o)}function hi(){mt(br),mt(Na),mt(Ea)}function R0(r){oo(Ea.current);var o=oo(br.current),c=je(o,r.type);o!==c&&(ft(Na,r),ft(br,c))}function Fd(r){Na.current===r&&(mt(br),mt(Na))}var _t=ms(0);function uc(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.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 zd=[];function Bd(){for(var r=0;r<zd.length;r++)zd[r]._workInProgressVersionPrimary=null;zd.length=0}var dc=j.ReactCurrentDispatcher,Ud=j.ReactCurrentBatchConfig,io=0,kt=null,Ot=null,qt=null,fc=!1,Ca=!1,ja=0,uA=0;function Xt(){throw Error(n(321))}function Wd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!Yt(r[c],o[c]))return!1;return!0}function Hd(r,o,c,m,v,x){if(io=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,dc.current=r===null||r.memoizedState===null?pA:mA,r=c(m,v),Ca){x=0;do{if(Ca=!1,ja=0,25<=x)throw Error(n(301));x+=1,qt=Ot=null,o.updateQueue=null,dc.current=gA,r=c(m,v)}while(Ca)}if(dc.current=mc,o=Ot!==null&&Ot.next!==null,io=0,qt=Ot=kt=null,fc=!1,o)throw Error(n(300));return r}function Gd(){var r=ja!==0;return ja=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?kt.memoizedState=qt=r:qt=qt.next=r,qt}function In(){if(Ot===null){var r=kt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=qt===null?kt.memoizedState:qt.next;if(o!==null)qt=o,Ot=r;else{if(r===null)throw Error(n(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},qt===null?kt.memoizedState=qt=r:qt=qt.next=r}return qt}function Ta(r,o){return typeof o=="function"?o(r):o}function Vd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Ot,v=m.baseQueue,x=c.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}m.baseQueue=v=x,c.pending=null}if(v!==null){x=v.next,m=m.baseState;var B=R=null,ee=null,le=x;do{var ge=le.lane;if((io&ge)===ge)ee!==null&&(ee=ee.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),m=le.hasEagerState?le.eagerState:r(m,le.action);else{var ve={lane:ge,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};ee===null?(B=ee=ve,R=m):ee=ee.next=ve,kt.lanes|=ge,ao|=ge}le=le.next}while(le!==null&&le!==x);ee===null?R=m:ee.next=B,Yt(m,o.memoizedState)||(cn=!0),o.memoizedState=m,o.baseState=R,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){v=r;do x=v.lane,kt.lanes|=x,ao|=x,v=v.next;while(v!==r)}else v===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function Yd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var R=v=v.next;do x=r(x,R.action),R=R.next;while(R!==v);Yt(x,o.memoizedState)||(cn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function A0(){}function M0(r,o){var c=kt,m=In(),v=o(),x=!Yt(m.memoizedState,v);if(x&&(m.memoizedState=v,cn=!0),m=m.queue,Kd(P0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ra(9,O0.bind(null,c,m,v,o),void 0,null),Dt===null)throw Error(n(349));(io&30)!==0||I0(c,o,v)}return v}function I0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function O0(r,o,c,m){o.value=c,o.getSnapshot=m,$0(o)&&L0(r)}function P0(r,o,c){return c(function(){$0(o)&&L0(r)})}function $0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!Yt(r,c)}catch{return!0}}function L0(r){var o=Ur(r,1);o!==null&&nr(o,r,1,-1)}function q0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:r},o.queue=r,r=r.dispatch=hA.bind(null,kt,r),[o.memoizedState,r]}function Ra(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function D0(){return In().memoizedState}function hc(r,o,c,m){var v=_r();kt.flags|=r,v.memoizedState=Ra(1|o,c,void 0,m===void 0?null:m)}function pc(r,o,c,m){var v=In();m=m===void 0?null:m;var x=void 0;if(Ot!==null){var R=Ot.memoizedState;if(x=R.destroy,m!==null&&Wd(m,R.deps)){v.memoizedState=Ra(o,c,x,m);return}}kt.flags|=r,v.memoizedState=Ra(1|o,c,x,m)}function F0(r,o){return hc(8390656,8,r,o)}function Kd(r,o){return pc(2048,8,r,o)}function z0(r,o){return pc(4,2,r,o)}function B0(r,o){return pc(4,4,r,o)}function U0(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 W0(r,o,c){return c=c!=null?c.concat([r]):null,pc(4,4,U0.bind(null,o,r),c)}function Xd(){}function H0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Wd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function G0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Wd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function V0(r,o,c){return(io&21)===0?(r.baseState&&(r.baseState=!1,cn=!0),r.memoizedState=c):(Yt(c,o)||(c=Ds(),kt.lanes|=c,ao|=c,r.baseState=!0),o)}function dA(r,o){var c=et;et=c!==0&&4>c?c:4,r(!0);var m=Ud.transition;Ud.transition={};try{r(!1),o()}finally{et=c,Ud.transition=m}}function Y0(){return In().memoizedState}function fA(r,o,c){var m=ks(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},K0(r))X0(o,c);else if(c=E0(r,o,c,m),c!==null){var v=rn();nr(c,r,m,v),Q0(c,o,m)}}function hA(r,o,c){var m=ks(r),v={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(K0(r))X0(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var R=o.lastRenderedState,B=x(R,c);if(v.hasEagerState=!0,v.eagerState=B,Yt(B,R)){var ee=o.interleaved;ee===null?(v.next=v,Ld(o)):(v.next=ee.next,ee.next=v),o.interleaved=v;return}}catch{}finally{}c=E0(r,o,v,m),c!==null&&(v=rn(),nr(c,r,m,v),Q0(c,o,m))}}function K0(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function X0(r,o){Ca=fc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function Q0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}var mc={readContext:Mn,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},pA={readContext:Mn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Mn,useEffect:F0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,hc(4194308,4,U0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return hc(4194308,4,r,o)},useInsertionEffect:function(r,o){return hc(4,2,r,o)},useMemo:function(r,o){var c=_r();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=_r();return o=c!==void 0?c(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=fA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:q0,useDebugValue:Xd,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=q0(!1),o=r[0];return r=dA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=kt,v=_r();if(yt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(io&30)!==0||I0(m,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,F0(P0.bind(null,m,x,r),[r]),m.flags|=2048,Ra(9,O0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Dt.identifierPrefix;if(yt){var c=Br,m=zr;c=(m&~(1<<32-vn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=ja++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=uA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},mA={readContext:Mn,useCallback:H0,useContext:Mn,useEffect:Kd,useImperativeHandle:W0,useInsertionEffect:z0,useLayoutEffect:B0,useMemo:G0,useReducer:Vd,useRef:D0,useState:function(){return Vd(Ta)},useDebugValue:Xd,useDeferredValue:function(r){var o=In();return V0(o,Ot.memoizedState,r)},useTransition:function(){var r=Vd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:A0,useSyncExternalStore:M0,useId:Y0,unstable_isNewReconciler:!1},gA={readContext:Mn,useCallback:H0,useContext:Mn,useEffect:Kd,useImperativeHandle:W0,useInsertionEffect:z0,useLayoutEffect:B0,useMemo:G0,useReducer:Yd,useRef:D0,useState:function(){return Yd(Ta)},useDebugValue:Xd,useDeferredValue:function(r){var o=In();return Ot===null?o.memoizedState=r:V0(o,Ot.memoizedState,r)},useTransition:function(){var r=Yd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:A0,useSyncExternalStore:M0,useId:Y0,unstable_isNewReconciler:!1};function Jn(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function Qd(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:J({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var gc={isMounted:function(r){return(r=r._reactInternals)?Cn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=rn(),m=ks(r),v=Wr(c,m);v.tag=2,o!=null&&(v.callback=o),o=ws(r,v,m),o!==null&&(nr(o,r,m,c),lc(o,r,m))}};function Z0(r,o,c,m,v,x,R){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,R):o.prototype&&o.prototype.isPureReactComponent?!fs(c,m)||!fs(v,x):!0}function J0(r,o,c){var m=!1,v=gs,x=o.contextType;return typeof x=="object"&&x!==null?x=Mn(x):(v=ln(o)?to:Kt.current,m=o.contextTypes,x=(m=m!=null)?ii(r,v):gs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=gc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function ex(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&gc.enqueueReplaceState(o,o.state,null)}function Zd(r,o,c,m){var v=r.stateNode;v.props=c,v.state=r.memoizedState,v.refs={},qd(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Mn(x):(x=ln(o)?to:Kt.current,v.context=ii(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(Qd(r,o,x,c),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&gc.enqueueReplaceState(v,v.state,null),cc(r,c,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function pi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var v=c}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:v,digest:null}}function Jd(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function ef(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var vA=typeof WeakMap=="function"?WeakMap:Map;function tx(r,o,c){c=Wr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){kc||(kc=!0,gf=m),ef(r,o)},c}function nx(r,o,c){c=Wr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;c.payload=function(){return m(v)},c.callback=function(){ef(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){ef(r,o),typeof m!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),c}function rx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new vA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(c)||(v.add(c),r=AA.bind(null,r,o,c),o.then(r,r))}function sx(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 ox(r,o,c,m,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Wr(-1,1),o.tag=2,ws(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var yA=j.ReactCurrentOwner,cn=!1;function nn(r,o,c,m){o.child=r===null?N0(o,null,c,m):ui(o,r.child,c,m)}function ix(r,o,c,m,v){c=c.render;var x=o.ref;return fi(o,v),m=Hd(r,o,c,m,x,v),c=Gd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(yt&&c&&jd(o),o.flags|=1,nn(r,o,m,v),o.child)}function ax(r,o,c,m,v){if(r===null){var x=c.type;return typeof x=="function"&&!kf(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,lx(r,o,x,m,v)):(r=Tc(c.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var R=x.memoizedProps;if(c=c.compare,c=c!==null?c:fs,c(R,m)&&r.ref===o.ref)return Hr(r,o,v)}return o.flags|=1,r=Ns(x,m),r.ref=o.ref,r.return=o,o.child=r}function lx(r,o,c,m,v){if(r!==null){var x=r.memoizedProps;if(fs(x,m)&&r.ref===o.ref)if(cn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(cn=!0);else return o.lanes=r.lanes,Hr(r,o,v)}return tf(r,o,c,m,v)}function cx(r,o,c){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ft(gi,bn),bn|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ft(gi,bn),bn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ft(gi,bn),bn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ft(gi,bn),bn|=m;return nn(r,o,v,c),o.child}function ux(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function tf(r,o,c,m,v){var x=ln(c)?to:Kt.current;return x=ii(o,x),fi(o,v),c=Hd(r,o,c,m,x,v),m=Gd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(yt&&m&&jd(o),o.flags|=1,nn(r,o,c,v),o.child)}function dx(r,o,c,m,v){if(ln(c)){var x=!0;ec(o)}else x=!1;if(fi(o,v),o.stateNode===null)yc(r,o),J0(o,c,m),Zd(o,c,m,v),m=!0;else if(r===null){var R=o.stateNode,B=o.memoizedProps;R.props=B;var ee=R.context,le=c.contextType;typeof le=="object"&&le!==null?le=Mn(le):(le=ln(c)?to:Kt.current,le=ii(o,le));var ge=c.getDerivedStateFromProps,ve=typeof ge=="function"||typeof R.getSnapshotBeforeUpdate=="function";ve||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==m||ee!==le)&&ex(o,R,m,le),ys=!1;var me=o.memoizedState;R.state=me,cc(o,m,R,v),ee=o.memoizedState,B!==m||me!==ee||an.current||ys?(typeof ge=="function"&&(Qd(o,c,ge,m),ee=o.memoizedState),(B=ys||Z0(o,c,B,m,me,ee,le))?(ve||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),R.props=m,R.state=ee,R.context=le,m=B):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{R=o.stateNode,C0(r,o),B=o.memoizedProps,le=o.type===o.elementType?B:Jn(o.type,B),R.props=le,ve=o.pendingProps,me=R.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=Mn(ee):(ee=ln(c)?to:Kt.current,ee=ii(o,ee));var Ne=c.getDerivedStateFromProps;(ge=typeof Ne=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==ve||me!==ee)&&ex(o,R,m,ee),ys=!1,me=o.memoizedState,R.state=me,cc(o,m,R,v);var Re=o.memoizedState;B!==ve||me!==Re||an.current||ys?(typeof Ne=="function"&&(Qd(o,c,Ne,m),Re=o.memoizedState),(le=ys||Z0(o,c,le,m,me,Re,ee)||!1)?(ge||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(m,Re,ee),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(m,Re,ee)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Re),R.props=m,R.state=Re,R.context=ee,m=le):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),m=!1)}return nf(r,o,c,m,x,v)}function nf(r,o,c,m,v,x){ux(r,o);var R=(o.flags&128)!==0;if(!m&&!R)return v&&g0(o,c,!1),Hr(r,o,x);m=o.stateNode,yA.current=o;var B=R&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&R?(o.child=ui(o,r.child,null,x),o.child=ui(o,null,B,x)):nn(r,o,B,x),o.memoizedState=m.state,v&&g0(o,c,!0),o.child}function fx(r){var o=r.stateNode;o.pendingContext?p0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&p0(r,o.context,!1),Dd(r,o.containerInfo)}function hx(r,o,c,m,v){return ci(),Md(v),o.flags|=256,nn(r,o,c,m),o.child}var rf={dehydrated:null,treeContext:null,retryLane:0};function sf(r){return{baseLanes:r,cachePool:null,transitions:null}}function px(r,o,c){var m=o.pendingProps,v=_t.current,x=!1,R=(o.flags&128)!==0,B;if((B=R)||(B=r!==null&&r.memoizedState===null?!1:(v&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ft(_t,v&1),r===null)return Ad(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):(R=m.children,r=m.fallback,x?(m=o.mode,x=o.child,R={mode:"hidden",children:R},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Rc(R,m,0,null),r=fo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=sf(c),o.memoizedState=rf,r):of(o,R));if(v=r.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return wA(r,o,R,m,B,v,c);if(x){x=m.fallback,R=o.mode,v=r.child,B=v.sibling;var ee={mode:"hidden",children:m.children};return(R&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Ns(v,ee),m.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=Ns(B,x):(x=fo(x,R,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,R=r.child.memoizedState,R=R===null?sf(c):{baseLanes:R.baseLanes|c,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=r.childLanes&~c,o.memoizedState=rf,m}return x=r.child,r=x.sibling,m=Ns(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function of(r,o){return o=Rc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function vc(r,o,c,m){return m!==null&&Md(m),ui(o,r.child,null,c),r=of(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function wA(r,o,c,m,v,x,R){if(c)return o.flags&256?(o.flags&=-257,m=Jd(Error(n(422))),vc(r,o,R,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Rc({mode:"visible",children:m.children},v,0,null),x=fo(x,v,R,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&ui(o,r.child,null,R),o.child.memoizedState=sf(R),o.memoizedState=rf,x);if((o.mode&1)===0)return vc(r,o,R,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=Jd(x,m,void 0),vc(r,o,R,m)}if(B=(R&r.childLanes)!==0,cn||B){if(m=Dt,m!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Ur(r,v),nr(m,r,v,-1))}return _f(),m=Jd(Error(n(421))),vc(r,o,R,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=MA.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,xn=ps(v.nextSibling),wn=o,yt=!0,Zn=null,r!==null&&(Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,zr=r.id,Br=r.overflow,no=o),o=of(o,m.children),o.flags|=4096,o)}function mx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),$d(r.return,o,c)}function af(r,o,c,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=v)}function gx(r,o,c){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(nn(r,o,m.children,c),m=_t.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,c,o);else if(r.tag===19)mx(r,c,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(ft(_t,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(c=o.child,v=null;c!==null;)r=c.alternate,r!==null&&uc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),af(o,!1,v,c,x);break;case"backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&uc(r)===null){o.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}af(o,!0,c,null,x);break;case"together":af(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function yc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Hr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),ao|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Ns(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ns(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function xA(r,o,c){switch(o.tag){case 3:fx(o),ci();break;case 5:R0(o);break;case 1:ln(o.type)&&ec(o);break;case 4:Dd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ft(ic,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ft(_t,_t.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?px(r,o,c):(ft(_t,_t.current&1),r=Hr(r,o,c),r!==null?r.sibling:null);ft(_t,_t.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return gx(r,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ft(_t,_t.current),m)break;return null;case 22:case 23:return o.lanes=0,cx(r,o,c)}return Hr(r,o,c)}var vx,lf,yx,wx;vx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},lf=function(){},yx=function(r,o,c,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,oo(br.current);var x=null;switch(c){case"input":v=Le(r,v),m=Le(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=de(r,v),m=de(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=Ql)}st(c,m);var R;c=null;for(le in v)if(!m.hasOwnProperty(le)&&v.hasOwnProperty(le)&&v[le]!=null)if(le==="style"){var B=v[le];for(R in B)B.hasOwnProperty(R)&&(c||(c={}),c[R]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(i.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in m){var ee=m[le];if(B=v!=null?v[le]:void 0,m.hasOwnProperty(le)&&ee!==B&&(ee!=null||B!=null))if(le==="style")if(B){for(R in B)!B.hasOwnProperty(R)||ee&&ee.hasOwnProperty(R)||(c||(c={}),c[R]="");for(R in ee)ee.hasOwnProperty(R)&&B[R]!==ee[R]&&(c||(c={}),c[R]=ee[R])}else c||(x||(x=[]),x.push(le,c)),c=ee;else le==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,B=B?B.__html:void 0,ee!=null&&B!==ee&&(x=x||[]).push(le,ee)):le==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(le,""+ee):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(i.hasOwnProperty(le)?(ee!=null&&le==="onScroll"&&pt("scroll",r),x||B===ee||(x=[])):(x=x||[]).push(le,ee))}c&&(x=x||[]).push("style",c);var le=x;(o.updateQueue=le)&&(o.flags|=4)}},wx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Aa(r,o){if(!yt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Qt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function bA(r,o,c){var m=o.pendingProps;switch(Td(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(o),null;case 1:return ln(o.type)&&Jl(),Qt(o),null;case 3:return m=o.stateNode,hi(),mt(an),mt(Kt),Bd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Zn!==null&&(wf(Zn),Zn=null))),lf(r,o),Qt(o),null;case 5:Fd(o);var v=oo(Ea.current);if(c=o.type,r!==null&&o.stateNode!=null)yx(r,o,c,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Qt(o),null}if(r=oo(br.current),sc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[xr]=o,m[ba]=x,r=(o.mode&1)!==0,c){case"dialog":pt("cancel",m),pt("close",m);break;case"iframe":case"object":case"embed":pt("load",m);break;case"video":case"audio":for(v=0;v<ya.length;v++)pt(ya[v],m);break;case"source":pt("error",m);break;case"img":case"image":case"link":pt("error",m),pt("load",m);break;case"details":pt("toggle",m);break;case"input":Se(m,x),pt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},pt("invalid",m);break;case"textarea":_e(m,x),pt("invalid",m)}st(c,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var B=x[R];R==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",""+B]):i.hasOwnProperty(R)&&B!=null&&R==="onScroll"&&pt("scroll",m)}switch(c){case"input":Ce(m),xe(m,x,!0);break;case"textarea":Ce(m),Ge(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=Ql)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=lt(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=R.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=R.createElement(c,{is:m.is}):(r=R.createElement(c),c==="select"&&(R=r,m.multiple?R.multiple=!0:m.size&&(R.size=m.size))):r=R.createElementNS(r,c),r[xr]=o,r[ba]=m,vx(r,o,!1,!1),o.stateNode=r;e:{switch(R=Me(c,m),c){case"dialog":pt("cancel",r),pt("close",r),v=m;break;case"iframe":case"object":case"embed":pt("load",r),v=m;break;case"video":case"audio":for(v=0;v<ya.length;v++)pt(ya[v],r);v=m;break;case"source":pt("error",r),v=m;break;case"img":case"image":case"link":pt("error",r),pt("load",r),v=m;break;case"details":pt("toggle",r),v=m;break;case"input":Se(r,m),v=Le(r,m),pt("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),pt("invalid",r);break;case"textarea":_e(r,m),v=de(r,m),pt("invalid",r);break;default:v=m}st(c,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var ee=B[x];x==="style"?Qe(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Xe(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&oe(r,ee):typeof ee=="number"&&oe(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&pt("scroll",r):ee!=null&&C(r,x,ee,R))}switch(c){case"input":Ce(r),xe(r,m,!1);break;case"textarea":Ce(r),Ge(r);break;case"option":m.value!=null&&r.setAttribute("value",""+he(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?at(r,!!m.multiple,x,!1):m.defaultValue!=null&&at(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=Ql)}switch(c){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 Qt(o),null;case 6:if(r&&o.stateNode!=null)wx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=oo(Ea.current),oo(br.current),sc(o)){if(m=o.stateNode,c=o.memoizedProps,m[xr]=o,(x=m.nodeValue!==c)&&(r=wn,r!==null))switch(r.tag){case 3:Xl(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Xl(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[xr]=o,o.stateNode=m}return Qt(o),null;case 13:if(mt(_t),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(yt&&xn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)_0(),ci(),o.flags|=98560,x=!1;else if(x=sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[xr]=o}else ci(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Qt(o),x=!1}else Zn!==null&&(wf(Zn),Zn=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(_t.current&1)!==0?Pt===0&&(Pt=3):_f())),o.updateQueue!==null&&(o.flags|=4),Qt(o),null);case 4:return hi(),lf(r,o),r===null&&wa(o.stateNode.containerInfo),Qt(o),null;case 10:return Pd(o.type._context),Qt(o),null;case 17:return ln(o.type)&&Jl(),Qt(o),null;case 19:if(mt(_t),x=o.memoizedState,x===null)return Qt(o),null;if(m=(o.flags&128)!==0,R=x.rendering,R===null)if(m)Aa(x,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(R=uc(r),R!==null){for(o.flags|=128,Aa(x,!1),m=R.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,r=R.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ft(_t,_t.current&1|2),o.child}r=r.sibling}x.tail!==null&&ot()>vi&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304)}else{if(!m)if(r=uc(R),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Aa(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!yt)return Qt(o),null}else 2*ot()-x.renderingStartTime>vi&&c!==1073741824&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304);x.isBackwards?(R.sibling=o.child,o.child=R):(c=x.last,c!==null?c.sibling=R:o.child=R,x.last=R)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=ot(),o.sibling=null,c=_t.current,ft(_t,m?c&1|2:c&1),o):(Qt(o),null);case 22:case 23:return bf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(bn&1073741824)!==0&&(Qt(o),o.subtreeFlags&6&&(o.flags|=8192)):Qt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function _A(r,o){switch(Td(o),o.tag){case 1:return ln(o.type)&&Jl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return hi(),mt(an),mt(Kt),Bd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Fd(o),null;case 13:if(mt(_t),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ci()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return mt(_t),null;case 4:return hi(),null;case 10:return Pd(o.type._context),null;case 22:case 23:return bf(),null;case 24:return null;default:return null}}var wc=!1,Zt=!1,kA=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function mi(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){Nt(r,o,m)}else c.current=null}function cf(r,o,c){try{c()}catch(m){Nt(r,o,m)}}var xx=!1;function SA(r,o){if(xd=zs,r=ga(),Qs(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var R=0,B=-1,ee=-1,le=0,ge=0,ve=r,me=null;t:for(;;){for(var Ne;ve!==c||v!==0&&ve.nodeType!==3||(B=R+v),ve!==x||m!==0&&ve.nodeType!==3||(ee=R+m),ve.nodeType===3&&(R+=ve.nodeValue.length),(Ne=ve.firstChild)!==null;)me=ve,ve=Ne;for(;;){if(ve===r)break t;if(me===c&&++le===v&&(B=R),me===x&&++ge===m&&(ee=R),(Ne=ve.nextSibling)!==null)break;ve=me,me=ve.parentNode}ve=Ne}c=B===-1||ee===-1?null:{start:B,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(bd={focusedElem:r,selectionRange:c},zs=!1,Ee=o;Ee!==null;)if(o=Ee,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ee=r;else for(;Ee!==null;){o=Ee;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 Ie=Re.memoizedProps,jt=Re.memoizedState,se=o.stateNode,te=se.getSnapshotBeforeUpdate(o.elementType===o.type?Ie:Jn(o.type,Ie),jt);se.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var ie=o.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ye){Nt(o,o.return,ye)}if(r=o.sibling,r!==null){r.return=o.return,Ee=r;break}Ee=o.return}return Re=xx,xx=!1,Re}function Ma(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&cf(o,c,x)}v=v.next}while(v!==m)}}function xc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&r)===r){var m=c.create;c.destroy=m()}c=c.next}while(c!==o)}}function uf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function bx(r){var o=r.alternate;o!==null&&(r.alternate=null,bx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[xr],delete o[ba],delete o[Nd],delete o[iA],delete o[aA])),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 _x(r){return r.tag===5||r.tag===3||r.tag===4}function kx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_x(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 df(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.nodeType===8?c.parentNode.insertBefore(r,o):c.insertBefore(r,o):(c.nodeType===8?(o=c.parentNode,o.insertBefore(r,c)):(o=c,o.appendChild(r)),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ql));else if(m!==4&&(r=r.child,r!==null))for(df(r,o,c),r=r.sibling;r!==null;)df(r,o,c),r=r.sibling}function ff(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.insertBefore(r,o):c.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(ff(r,o,c),r=r.sibling;r!==null;)ff(r,o,c),r=r.sibling}var Ut=null,er=!1;function xs(r,o,c){for(c=c.child;c!==null;)Sx(r,o,c),c=c.sibling}function Sx(r,o,c){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(gt,c)}catch{}switch(c.tag){case 5:Zt||mi(c,o);case 6:var m=Ut,v=er;Ut=null,xs(r,o,c),Ut=m,er=v,Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?Sd(r.parentNode,c):r.nodeType===1&&Sd(r,c),ls(r)):Sd(Ut,c.stateNode));break;case 4:m=Ut,v=er,Ut=c.stateNode.containerInfo,er=!0,xs(r,o,c),Ut=m,er=v;break;case 0:case 11:case 14:case 15:if(!Zt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&cf(c,o,R),v=v.next}while(v!==m)}xs(r,o,c);break;case 1:if(!Zt&&(mi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){Nt(c,o,B)}xs(r,o,c);break;case 21:xs(r,o,c);break;case 22:c.mode&1?(Zt=(m=Zt)||c.memoizedState!==null,xs(r,o,c),Zt=m):xs(r,o,c);break;default:xs(r,o,c)}}function Nx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new kA),o.forEach(function(m){var v=IA.bind(null,r,m);c.has(m)||(c.add(m),m.then(v,v))})}}function tr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];try{var x=r,R=o,B=R;e:for(;B!==null;){switch(B.tag){case 5:Ut=B.stateNode,er=!1;break e;case 3:Ut=B.stateNode.containerInfo,er=!0;break e;case 4:Ut=B.stateNode.containerInfo,er=!0;break e}B=B.return}if(Ut===null)throw Error(n(160));Sx(x,R,v),Ut=null,er=!1;var ee=v.alternate;ee!==null&&(ee.return=null),v.return=null}catch(le){Nt(v,o,le)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Ex(o,r),o=o.sibling}function Ex(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(tr(o,r),kr(r),m&4){try{Ma(3,r,r.return),xc(3,r)}catch(Ie){Nt(r,r.return,Ie)}try{Ma(5,r,r.return)}catch(Ie){Nt(r,r.return,Ie)}}break;case 1:tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return);break;case 5:if(tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return),r.flags&32){var v=r.stateNode;try{oe(v,"")}catch(Ie){Nt(r,r.return,Ie)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,R=c!==null?c.memoizedProps:x,B=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&ce(v,x),Me(B,R);var le=Me(B,x);for(R=0;R<ee.length;R+=2){var ge=ee[R],ve=ee[R+1];ge==="style"?Qe(v,ve):ge==="dangerouslySetInnerHTML"?Xe(v,ve):ge==="children"?oe(v,ve):C(v,ge,ve,le)}switch(B){case"input":be(v,x);break;case"textarea":De(v,x);break;case"select":var me=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Ne=x.value;Ne!=null?at(v,!!x.multiple,Ne,!1):me!==!!x.multiple&&(x.defaultValue!=null?at(v,!!x.multiple,x.defaultValue,!0):at(v,!!x.multiple,x.multiple?[]:"",!1))}v[ba]=x}catch(Ie){Nt(r,r.return,Ie)}}break;case 6:if(tr(o,r),kr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Ie){Nt(r,r.return,Ie)}}break;case 3:if(tr(o,r),kr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{ls(o.containerInfo)}catch(Ie){Nt(r,r.return,Ie)}break;case 4:tr(o,r),kr(r);break;case 13:tr(o,r),kr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(mf=ot())),m&4&&Nx(r);break;case 22:if(ge=c!==null&&c.memoizedState!==null,r.mode&1?(Zt=(le=Zt)||ge,tr(o,r),Zt=le):tr(o,r),kr(r),m&8192){if(le=r.memoizedState!==null,(r.stateNode.isHidden=le)&&!ge&&(r.mode&1)!==0)for(Ee=r,ge=r.child;ge!==null;){for(ve=Ee=ge;Ee!==null;){switch(me=Ee,Ne=me.child,me.tag){case 0:case 11:case 14:case 15:Ma(4,me,me.return);break;case 1:mi(me,me.return);var Re=me.stateNode;if(typeof Re.componentWillUnmount=="function"){m=me,c=me.return;try{o=m,Re.props=o.memoizedProps,Re.state=o.memoizedState,Re.componentWillUnmount()}catch(Ie){Nt(m,c,Ie)}}break;case 5:mi(me,me.return);break;case 22:if(me.memoizedState!==null){Tx(ve);continue}}Ne!==null?(Ne.return=me,Ee=Ne):Tx(ve)}ge=ge.sibling}e:for(ge=null,ve=r;;){if(ve.tag===5){if(ge===null){ge=ve;try{v=ve.stateNode,le?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=ve.stateNode,ee=ve.memoizedProps.style,R=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,B.style.display=Te("display",R))}catch(Ie){Nt(r,r.return,Ie)}}}else if(ve.tag===6){if(ge===null)try{ve.stateNode.nodeValue=le?"":ve.memoizedProps}catch(Ie){Nt(r,r.return,Ie)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ge===ve&&(ge=null),ve=ve.return}ge===ve&&(ge=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:tr(o,r),kr(r),m&4&&Nx(r);break;case 21:break;default:tr(o,r),kr(r)}}function kr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(_x(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(oe(v,""),m.flags&=-33);var x=kx(r);ff(r,x,v);break;case 3:case 4:var R=m.stateNode.containerInfo,B=kx(r);df(r,B,R);break;default:throw Error(n(161))}}catch(ee){Nt(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function NA(r,o,c){Ee=r,Cx(r)}function Cx(r,o,c){for(var m=(r.mode&1)!==0;Ee!==null;){var v=Ee,x=v.child;if(v.tag===22&&m){var R=v.memoizedState!==null||wc;if(!R){var B=v.alternate,ee=B!==null&&B.memoizedState!==null||Zt;B=wc;var le=Zt;if(wc=R,(Zt=ee)&&!le)for(Ee=v;Ee!==null;)R=Ee,ee=R.child,R.tag===22&&R.memoizedState!==null?Rx(v):ee!==null?(ee.return=R,Ee=ee):Rx(v);for(;x!==null;)Ee=x,Cx(x),x=x.sibling;Ee=v,wc=B,Zt=le}jx(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ee=x):jx(r)}}function jx(r){for(;Ee!==null;){var o=Ee;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Zt||xc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Zt)if(c===null)m.componentDidMount();else{var v=o.elementType===o.type?c.memoizedProps:Jn(o.type,c.memoizedProps);m.componentDidUpdate(v,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&T0(o,x,m);break;case 3:var R=o.updateQueue;if(R!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}T0(o,R,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&c.focus();break;case"img":ee.src&&(c.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var le=o.alternate;if(le!==null){var ge=le.memoizedState;if(ge!==null){var ve=ge.dehydrated;ve!==null&&ls(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Zt||o.flags&512&&uf(o)}catch(me){Nt(o,o.return,me)}}if(o===r){Ee=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ee=c;break}Ee=o.return}}function Tx(r){for(;Ee!==null;){var o=Ee;if(o===r){Ee=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Ee=c;break}Ee=o.return}}function Rx(r){for(;Ee!==null;){var o=Ee;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{xc(4,o)}catch(ee){Nt(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(ee){Nt(o,v,ee)}}var x=o.return;try{uf(o)}catch(ee){Nt(o,x,ee)}break;case 5:var R=o.return;try{uf(o)}catch(ee){Nt(o,R,ee)}}}catch(ee){Nt(o,o.return,ee)}if(o===r){Ee=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Ee=B;break}Ee=o.return}}var EA=Math.ceil,bc=j.ReactCurrentDispatcher,hf=j.ReactCurrentOwner,On=j.ReactCurrentBatchConfig,tt=0,Dt=null,Rt=null,Wt=0,bn=0,gi=ms(0),Pt=0,Ia=null,ao=0,_c=0,pf=0,Oa=null,un=null,mf=0,vi=1/0,Gr=null,kc=!1,gf=null,bs=null,Sc=!1,_s=null,Nc=0,Pa=0,vf=null,Ec=-1,Cc=0;function rn(){return(tt&6)!==0?ot():Ec!==-1?Ec:Ec=ot()}function ks(r){return(r.mode&1)===0?1:(tt&2)!==0&&Wt!==0?Wt&-Wt:cA.transition!==null?(Cc===0&&(Cc=Ds()),Cc):(r=et,r!==0||(r=window.event,r=r===void 0?16:Ko(r.type)),r)}function nr(r,o,c,m){if(50<Pa)throw Pa=0,vf=null,Error(n(185));os(r,c,m),((tt&2)===0||r!==Dt)&&(r===Dt&&((tt&2)===0&&(_c|=c),Pt===4&&Ss(r,Wt)),dn(r,m),c===1&&tt===0&&(o.mode&1)===0&&(vi=ot()+500,tc&&vs()))}function dn(r,o){var c=r.callbackNode;Cl(r,o);var m=qs(r,r===Dt?Wt:0);if(m===0)c!==null&&Ls(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Ls(c),o===1)r.tag===0?lA(Mx.bind(null,r)):v0(Mx.bind(null,r)),sA(function(){(tt&6)===0&&vs()}),c=null;else{switch(Ji(m)){case 1:c=ts;break;case 4:c=Gt;break;case 16:c=Wn;break;case 536870912:c=ns;break;default:c=Wn}c=Fx(c,Ax.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Ax(r,o){if(Ec=-1,Cc=0,(tt&6)!==0)throw Error(n(327));var c=r.callbackNode;if(yi()&&r.callbackNode!==c)return null;var m=qs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=jc(r,m);else{o=m;var v=tt;tt|=2;var x=Ox();(Dt!==r||Wt!==o)&&(Gr=null,vi=ot()+500,co(r,o));do try{TA();break}catch(B){Ix(r,B)}while(!0);Od(),bc.current=x,tt=v,Rt!==null?o=0:(Dt=null,Wt=0,o=Pt)}if(o!==0){if(o===2&&(v=Bo(r),v!==0&&(m=v,o=yf(r,v))),o===1)throw c=Ia,co(r,0),Ss(r,m),dn(r,ot()),c;if(o===6)Ss(r,m);else{if(v=r.current.alternate,(m&30)===0&&!CA(v)&&(o=jc(r,m),o===2&&(x=Bo(r),x!==0&&(m=x,o=yf(r,x))),o===1))throw c=Ia,co(r,0),Ss(r,m),dn(r,ot()),c;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:uo(r,un,Gr);break;case 3:if(Ss(r,m),(m&130023424)===m&&(o=mf+500-ot(),10<o)){if(qs(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){rn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=kd(uo.bind(null,r,un,Gr),o);break}uo(r,un,Gr);break;case 4:if(Ss(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var R=31-vn(m);x=1<<R,R=o[R],R>v&&(v=R),m&=~x}if(m=v,m=ot()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*EA(m/1960))-m,10<m){r.timeoutHandle=kd(uo.bind(null,r,un,Gr),m);break}uo(r,un,Gr);break;case 5:uo(r,un,Gr);break;default:throw Error(n(329))}}}return dn(r,ot()),r.callbackNode===c?Ax.bind(null,r):null}function yf(r,o){var c=Oa;return r.current.memoizedState.isDehydrated&&(co(r,o).flags|=256),r=jc(r,o),r!==2&&(o=un,un=c,o!==null&&wf(o)),r}function wf(r){un===null?un=r:un.push.apply(un,r)}function CA(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var v=c[m],x=v.getSnapshot;v=v.value;try{if(!Yt(x(),v))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;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 Ss(r,o){for(o&=~pf,o&=~_c,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-vn(o),m=1<<c;r[c]=-1,o&=~m}}function Mx(r){if((tt&6)!==0)throw Error(n(327));yi();var o=qs(r,0);if((o&1)===0)return dn(r,ot()),null;var c=jc(r,o);if(r.tag!==0&&c===2){var m=Bo(r);m!==0&&(o=m,c=yf(r,m))}if(c===1)throw c=Ia,co(r,0),Ss(r,o),dn(r,ot()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,uo(r,un,Gr),dn(r,ot()),null}function xf(r,o){var c=tt;tt|=1;try{return r(o)}finally{tt=c,tt===0&&(vi=ot()+500,tc&&vs())}}function lo(r){_s!==null&&_s.tag===0&&(tt&6)===0&&yi();var o=tt;tt|=1;var c=On.transition,m=et;try{if(On.transition=null,et=1,r)return r()}finally{et=m,On.transition=c,tt=o,(tt&6)===0&&vs()}}function bf(){bn=gi.current,mt(gi)}function co(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,rA(c)),Rt!==null)for(c=Rt.return;c!==null;){var m=c;switch(Td(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Jl();break;case 3:hi(),mt(an),mt(Kt),Bd();break;case 5:Fd(m);break;case 4:hi();break;case 13:mt(_t);break;case 19:mt(_t);break;case 10:Pd(m.type._context);break;case 22:case 23:bf()}c=c.return}if(Dt=r,Rt=r=Ns(r.current,null),Wt=bn=o,Pt=0,Ia=null,pf=_c=ao=0,un=Oa=null,so!==null){for(o=0;o<so.length;o++)if(c=so[o],m=c.interleaved,m!==null){c.interleaved=null;var v=m.next,x=c.pending;if(x!==null){var R=x.next;x.next=v,m.next=R}c.pending=m}so=null}return r}function Ix(r,o){do{var c=Rt;try{if(Od(),dc.current=mc,fc){for(var m=kt.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}fc=!1}if(io=0,qt=Ot=kt=null,Ca=!1,ja=0,hf.current=null,c===null||c.return===null){Pt=1,Ia=o,Rt=null;break}e:{var x=r,R=c.return,B=c,ee=o;if(o=Wt,B.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var le=ee,ge=B,ve=ge.tag;if((ge.mode&1)===0&&(ve===0||ve===11||ve===15)){var me=ge.alternate;me?(ge.updateQueue=me.updateQueue,ge.memoizedState=me.memoizedState,ge.lanes=me.lanes):(ge.updateQueue=null,ge.memoizedState=null)}var Ne=sx(R);if(Ne!==null){Ne.flags&=-257,ox(Ne,R,B,x,o),Ne.mode&1&&rx(x,le,o),o=Ne,ee=le;var Re=o.updateQueue;if(Re===null){var Ie=new Set;Ie.add(ee),o.updateQueue=Ie}else Re.add(ee);break e}else{if((o&1)===0){rx(x,le,o),_f();break e}ee=Error(n(426))}}else if(yt&&B.mode&1){var jt=sx(R);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),ox(jt,R,B,x,o),Md(pi(ee,B));break e}}x=ee=pi(ee,B),Pt!==4&&(Pt=2),Oa===null?Oa=[x]:Oa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var se=tx(x,ee,o);j0(x,se);break e;case 1:B=ee;var te=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(bs===null||!bs.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var ye=nx(x,B,o);j0(x,ye);break e}}x=x.return}while(x!==null)}$x(c)}catch($e){o=$e,Rt===c&&c!==null&&(Rt=c=c.return);continue}break}while(!0)}function Ox(){var r=bc.current;return bc.current=mc,r===null?mc:r}function _f(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Dt===null||(ao&268435455)===0&&(_c&268435455)===0||Ss(Dt,Wt)}function jc(r,o){var c=tt;tt|=2;var m=Ox();(Dt!==r||Wt!==o)&&(Gr=null,co(r,o));do try{jA();break}catch(v){Ix(r,v)}while(!0);if(Od(),tt=c,bc.current=m,Rt!==null)throw Error(n(261));return Dt=null,Wt=0,Pt}function jA(){for(;Rt!==null;)Px(Rt)}function TA(){for(;Rt!==null&&!$o();)Px(Rt)}function Px(r){var o=Dx(r.alternate,r,bn);r.memoizedProps=r.pendingProps,o===null?$x(r):Rt=o,hf.current=null}function $x(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=bA(c,o,bn),c!==null){Rt=c;return}}else{if(c=_A(c,o),c!==null){c.flags&=32767,Rt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);Pt===0&&(Pt=5)}function uo(r,o,c){var m=et,v=On.transition;try{On.transition=null,et=1,RA(r,o,c,m)}finally{On.transition=v,et=m}return null}function RA(r,o,c,m){do yi();while(_s!==null);if((tt&6)!==0)throw Error(n(327));c=r.finishedWork;var v=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Jt(r,x),r===Dt&&(Rt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Sc||(Sc=!0,Fx(Wn,function(){return yi(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=On.transition,On.transition=null;var R=et;et=1;var B=tt;tt|=4,hf.current=null,SA(r,c),Ex(c,r),Zs(bd),zs=!!xd,bd=xd=null,r.current=c,NA(c),Lo(),tt=B,et=R,On.transition=x}else r.current=c;if(Sc&&(Sc=!1,_s=r,Nc=v),x=r.pendingLanes,x===0&&(bs=null),Hn(c.stateNode),dn(r,ot()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)v=o[c],m(v.value,{componentStack:v.stack,digest:v.digest});if(kc)throw kc=!1,r=gf,gf=null,r;return(Nc&1)!==0&&r.tag!==0&&yi(),x=r.pendingLanes,(x&1)!==0?r===vf?Pa++:(Pa=0,vf=r):Pa=0,vs(),null}function yi(){if(_s!==null){var r=Ji(Nc),o=On.transition,c=et;try{if(On.transition=null,et=16>r?16:r,_s===null)var m=!1;else{if(r=_s,_s=null,Nc=0,(tt&6)!==0)throw Error(n(331));var v=tt;for(tt|=4,Ee=r.current;Ee!==null;){var x=Ee,R=x.child;if((Ee.flags&16)!==0){var B=x.deletions;if(B!==null){for(var ee=0;ee<B.length;ee++){var le=B[ee];for(Ee=le;Ee!==null;){var ge=Ee;switch(ge.tag){case 0:case 11:case 15:Ma(8,ge,x)}var ve=ge.child;if(ve!==null)ve.return=ge,Ee=ve;else for(;Ee!==null;){ge=Ee;var me=ge.sibling,Ne=ge.return;if(bx(ge),ge===le){Ee=null;break}if(me!==null){me.return=Ne,Ee=me;break}Ee=Ne}}}var Re=x.alternate;if(Re!==null){var Ie=Re.child;if(Ie!==null){Re.child=null;do{var jt=Ie.sibling;Ie.sibling=null,Ie=jt}while(Ie!==null)}}Ee=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Ee=R;else e:for(;Ee!==null;){if(x=Ee,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ma(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Ee=se;break e}Ee=x.return}}var te=r.current;for(Ee=te;Ee!==null;){R=Ee;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Ee=ie;else e:for(R=te;Ee!==null;){if(B=Ee,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:xc(9,B)}}catch($e){Nt(B,B.return,$e)}if(B===R){Ee=null;break e}var ye=B.sibling;if(ye!==null){ye.return=B.return,Ee=ye;break e}Ee=B.return}}if(tt=v,vs(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(gt,r)}catch{}m=!0}return m}finally{et=c,On.transition=o}}return!1}function Lx(r,o,c){o=pi(c,o),o=tx(r,o,1),r=ws(r,o,1),o=rn(),r!==null&&(os(r,1,o),dn(r,o))}function Nt(r,o,c){if(r.tag===3)Lx(r,r,c);else for(;o!==null;){if(o.tag===3){Lx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(bs===null||!bs.has(m))){r=pi(c,r),r=nx(o,r,1),o=ws(o,r,1),r=rn(),o!==null&&(os(o,1,r),dn(o,r));break}}o=o.return}}function AA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=rn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&(Pt===4||Pt===3&&(Wt&130023424)===Wt&&500>ot()-mf?co(r,0):pf|=c),dn(r,o)}function qx(r,o){o===0&&((r.mode&1)===0?o=1:(o=zo,zo<<=1,(zo&130023424)===0&&(zo=4194304)));var c=rn();r=Ur(r,o),r!==null&&(os(r,o,c),dn(r,c))}function MA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),qx(r,c)}function IA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),qx(r,c)}var Dx;Dx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return cn=!1,xA(r,o,c);cn=(r.flags&131072)!==0}else cn=!1,yt&&(o.flags&1048576)!==0&&y0(o,rc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;yc(r,o),r=o.pendingProps;var v=ii(o,Kt.current);fi(o,c),v=Hd(null,o,m,r,v,c);var x=Gd();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(m)?(x=!0,ec(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,qd(o),v.updater=gc,o.stateNode=v,v._reactInternals=o,Zd(o,m,r,c),o=nf(null,o,m,!0,x,c)):(o.tag=0,yt&&x&&jd(o),nn(null,o,v,c),o=o.child),o;case 16:m=o.elementType;e:{switch(yc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=PA(m),r=Jn(m,r),v){case 0:o=tf(null,o,m,r,c);break e;case 1:o=dx(null,o,m,r,c);break e;case 11:o=ix(null,o,m,r,c);break e;case 14:o=ax(null,o,m,Jn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),tf(r,o,m,v,c);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),dx(r,o,m,v,c);case 3:e:{if(fx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,C0(r,o),cc(o,m,null,c);var R=o.memoizedState;if(m=R.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=pi(Error(n(423)),o),o=hx(r,o,m,c,v);break e}else if(m!==v){v=pi(Error(n(424)),o),o=hx(r,o,m,c,v);break e}else for(xn=ps(o.stateNode.containerInfo.firstChild),wn=o,yt=!0,Zn=null,c=N0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ci(),m===v){o=Hr(r,o,c);break e}nn(r,o,m,c)}o=o.child}return o;case 5:return R0(o),r===null&&Ad(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,R=v.children,_d(m,v)?R=null:x!==null&&_d(m,x)&&(o.flags|=32),ux(r,o),nn(r,o,R,c),o.child;case 6:return r===null&&Ad(o),null;case 13:return px(r,o,c);case 4:return Dd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=ui(o,null,m,c):nn(r,o,m,c),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),ix(r,o,m,v,c);case 7:return nn(r,o,o.pendingProps,c),o.child;case 8:return nn(r,o,o.pendingProps.children,c),o.child;case 12:return nn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,R=v.value,ft(ic,m._currentValue),m._currentValue=R,x!==null)if(Yt(x.value,R)){if(x.children===v.children&&!an.current){o=Hr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){R=x.child;for(var ee=B.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Wr(-1,c&-c),ee.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var ge=le.pending;ge===null?ee.next=ee:(ee.next=ge.next,ge.next=ee),le.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),$d(x.return,c,o),B.lanes|=c;break}ee=ee.next}}else if(x.tag===10)R=x.type===o.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(n(341));R.lanes|=c,B=R.alternate,B!==null&&(B.lanes|=c),$d(R,c,o),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===o){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}nn(r,o,v.children,c),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,fi(o,c),v=Mn(v),m=m(v),o.flags|=1,nn(r,o,m,c),o.child;case 14:return m=o.type,v=Jn(m,o.pendingProps),v=Jn(m.type,v),ax(r,o,m,v,c);case 15:return lx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),yc(r,o),o.tag=1,ln(m)?(r=!0,ec(o)):r=!1,fi(o,c),J0(o,m,v),Zd(o,m,v,c),nf(null,o,m,!0,r,c);case 19:return gx(r,o,c);case 22:return cx(r,o,c)}throw Error(n(156,o.tag))};function Fx(r,o){return $s(r,o)}function OA(r,o,c,m){this.tag=r,this.key=c,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 Pn(r,o,c,m){return new OA(r,o,c,m)}function kf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function PA(r){if(typeof r=="function")return kf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===W)return 11;if(r===Q)return 14}return 2}function Ns(r,o){var c=r.alternate;return c===null?(c=Pn(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function Tc(r,o,c,m,v,x){var R=2;if(m=r,typeof r=="function")kf(r)&&(R=1);else if(typeof r=="string")R=5;else e:switch(r){case P:return fo(c.children,v,x,o);case F:R=8,v|=8;break;case M:return r=Pn(12,c,o,v|2),r.elementType=M,r.lanes=x,r;case Y:return r=Pn(13,c,o,v),r.elementType=Y,r.lanes=x,r;case T:return r=Pn(19,c,o,v),r.elementType=T,r.lanes=x,r;case ne:return Rc(c,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:R=10;break e;case q:R=9;break e;case W:R=11;break e;case Q:R=14;break e;case U:R=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Pn(R,c,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function fo(r,o,c,m){return r=Pn(7,r,m,o),r.lanes=c,r}function Rc(r,o,c,m){return r=Pn(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Sf(r,o,c){return r=Pn(6,r,null,o),r.lanes=c,r}function Nf(r,o,c){return o=Pn(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function $A(r,o,c,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Ef(r,o,c,m,v,x,R,B,ee){return r=new $A(r,o,c,B,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Pn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},qd(x),r}function LA(r,o,c){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:c}}function zx(r){if(!r)return gs;r=r._reactInternals;e:{if(Cn(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(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(ln(c))return m0(r,c,o)}return o}function Bx(r,o,c,m,v,x,R,B,ee){return r=Ef(c,m,!0,r,v,x,R,B,ee),r.context=zx(null),c=r.current,m=rn(),v=ks(c),x=Wr(m,v),x.callback=o??null,ws(c,x,v),r.current.lanes=v,os(r,v,m),dn(r,m),r}function Ac(r,o,c,m){var v=o.current,x=rn(),R=ks(v);return c=zx(c),o.context===null?o.context=c:o.pendingContext=c,o=Wr(x,R),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=ws(v,o,R),r!==null&&(nr(r,v,R,x),lc(r,v,R)),R}function Mc(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 Ux(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Cf(r,o){Ux(r,o),(r=r.alternate)&&Ux(r,o)}function qA(){return null}var Wx=typeof reportError=="function"?reportError:function(r){console.error(r)};function jf(r){this._internalRoot=r}Ic.prototype.render=jf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Ac(r,o,null,null)},Ic.prototype.unmount=jf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;lo(function(){Ac(null,r,null,null)}),o[Dr]=null}};function Ic(r){this._internalRoot=r}Ic.prototype.unstable_scheduleHydration=function(r){if(r){var o=Gn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Kn.length&&o!==0&&o<Kn[c].priority;c++);Kn.splice(c,0,r),c===0&&Go(r)}};function Tf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Oc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Hx(){}function DA(r,o,c,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var le=Mc(R);x.call(le)}}var R=Bx(o,m,r,0,null,!1,!1,"",Hx);return r._reactRootContainer=R,r[Dr]=R.current,wa(r.nodeType===8?r.parentNode:r),lo(),R}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var B=m;m=function(){var le=Mc(ee);B.call(le)}}var ee=Ef(r,0,!1,null,null,!1,!1,"",Hx);return r._reactRootContainer=ee,r[Dr]=ee.current,wa(r.nodeType===8?r.parentNode:r),lo(function(){Ac(o,ee,c,m)}),ee}function Pc(r,o,c,m,v){var x=c._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var B=v;v=function(){var ee=Mc(R);B.call(ee)}}Ac(o,R,r,v)}else R=DA(c,o,r,v,m);return Mc(R)}jl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=rs(o.pendingLanes);c!==0&&(is(o,c|1),dn(o,ot()),(tt&6)===0&&(vi=ot()+500,vs()))}break;case 13:lo(function(){var m=Ur(r,1);if(m!==null){var v=rn();nr(m,r,1,v)}}),Cf(r,1)}},Ir=function(r){if(r.tag===13){var o=Ur(r,134217728);if(o!==null){var c=rn();nr(o,r,134217728,c)}Cf(r,134217728)}},ea=function(r){if(r.tag===13){var o=ks(r),c=Ur(r,o);if(c!==null){var m=rn();nr(c,r,o,m)}Cf(r,o)}},Gn=function(){return et},Tl=function(r,o){var c=et;try{return et=r,o()}finally{et=c}},St=function(r,o,c){switch(o){case"input":if(be(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var v=Zl(m);if(!v)throw Error(n(90));Ve(m),be(m,v)}}}break;case"textarea":De(r,c);break;case"select":o=c.value,o!=null&&at(r,!!c.multiple,o,!1)}},jo=xf,To=lo;var FA={usingClientEntryPoint:!1,Events:[_a,si,Zl,Co,gn,xf]},$a={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},zA={bundleType:$a.bundleType,version:$a.version,rendererPackageName:$a.rendererPackageName,rendererConfig:$a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Un(r),r===null?null:r.stateNode},findFiberByHostInstance:$a.findFiberByHostInstance||qA,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 $c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$c.isDisabled&&$c.supportsFiber)try{gt=$c.inject(zA),sn=$c}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=FA,fn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Tf(o))throw Error(n(200));return LA(r,o,null,c)},fn.createRoot=function(r,o){if(!Tf(r))throw Error(n(299));var c=!1,m="",v=Wx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Ef(r,1,!1,null,null,c,!1,m,v),r[Dr]=o.current,wa(r.nodeType===8?r.parentNode:r),new jf(o)},fn.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=Un(o),r=r===null?null:r.stateNode,r},fn.flushSync=function(r){return lo(r)},fn.hydrate=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!0,c)},fn.hydrateRoot=function(r,o,c){if(!Tf(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,v=!1,x="",R=Wx;if(c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(R=c.onRecoverableError)),o=Bx(o,null,r,1,c??null,v,!1,x,R),r[Dr]=o.current,wa(r),m)for(r=0;r<m.length;r++)c=m[r],v=c._getVersion,v=v(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,v]:o.mutableSourceEagerHydrationData.push(c,v);return new Ic(o)},fn.render=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!1,c)},fn.unmountComponentAtNode=function(r){if(!Oc(r))throw Error(n(40));return r._reactRootContainer?(lo(function(){Pc(null,null,r,!1,function(){r._reactRootContainer=null,r[Dr]=null})}),!0):!1},fn.unstable_batchedUpdates=xf,fn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Oc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Pc(r,o,c,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var Jx;function TC(){if(Jx)return Mf.exports;Jx=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(),Mf.exports=YA(),Mf.exports}var eb;function KA(){if(eb)return qc;eb=1;var e=TC();return qc.createRoot=e.createRoot,qc.hydrateRoot=e.hydrateRoot,qc}var XA=KA(),S=fl();const ue=ew(S);function Ht(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=Ht(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Pf={exports:{}},$f={},Lf={exports:{}},qf={};/**
|
|
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 tb;function QA(){if(tb)return qf;tb=1;var e=fl();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),b=N[0].inst,_=N[1];return a(function(){b.value=w,b.getSnapshot=y,h(b)&&_({inst:b})},[g,w,y]),i(function(){return h(b)&&_({inst:b}),g(function(){h(b)&&_({inst:b})})},[g]),l(w),w}function h(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return qf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,qf}var nb;function ZA(){return nb||(nb=1,Lf.exports=QA()),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 rb;function JA(){if(rb)return $f;rb=1;var e=fl(),t=ZA();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,h=e.useDebugValue;return $f.useSyncExternalStoreWithSelector=function(p,f,g,y,w){var N=a(null);if(N.current===null){var b={hasValue:!1,value:null};N.current=b}else b=N.current;N=u(function(){function k(O){if(!E){if(E=!0,C=O,O=y(O),w!==void 0&&b.hasValue){var P=b.value;if(w(P,O))return j=P}return j=O}if(P=j,s(C,O))return P;var F=y(O);return w!==void 0&&w(P,F)?(C=O,P):(C=O,j=F)}var E=!1,C,j,I=g===void 0?null:g;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,g,y,w]);var _=i(p,N[0],N[1]);return l(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},$f}var sb;function e2(){return sb||(sb=1,Pf.exports=JA()),Pf.exports}var t2=e2();const n2=ew(t2),r2={},ob=e=>{let t;const n=new Set,s=(f,g)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(r2?"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,i,h);return h},s2=e=>e?ob(e):ob,{useDebugValue:o2}=ue,{useSyncExternalStoreWithSelector:i2}=n2,a2=e=>e;function RC(e,t=a2,n){const s=i2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return o2(s),s}const ib=(e,t)=>{const n=s2(e),s=(i,a=t)=>RC(n,i,a);return Object.assign(s,n),s},l2=(e,t)=>e?ib(e,t):ib;function $t(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,i]of e)if(!Object.is(i,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 c2={value:()=>{}};function ju(){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 su(n)}function su(e){this._=e}function u2(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}su.prototype=ju.prototype={constructor:su,on:function(e,t){var n=this._,s=u2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=d2(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=ab(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ab(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new su(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,a;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[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],i=0,a=s.length;i<a;++i)s[i].value.apply(t,n)}};function d2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ab(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=c2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var xy="http://www.w3.org/1999/xhtml";const lb={svg:"http://www.w3.org/2000/svg",xhtml:xy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Tu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),lb.hasOwnProperty(t)?{space:lb[t],local:e}:e}function f2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xy&&t.documentElement.namespaceURI===xy?t.createElement(e):t.createElementNS(n,e)}}function h2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function AC(e){var t=Tu(e);return(t.local?h2:f2)(t)}function p2(){}function tw(e){return e==null?p2:function(){return this.querySelector(e)}}function m2(e){typeof e!="function"&&(e=tw(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new kn(s,this._parents)}function g2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function v2(){return[]}function MC(e){return e==null?v2:function(){return this.querySelectorAll(e)}}function y2(e){return function(){return g2(e.apply(this,arguments))}}function w2(e){typeof e=="function"?e=y2(e):e=MC(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new kn(s,i)}function IC(e){return function(){return this.matches(e)}}function OC(e){return function(t){return t.matches(e)}}var x2=Array.prototype.find;function b2(e){return function(){return x2.call(this.children,e)}}function _2(){return this.firstElementChild}function k2(e){return this.select(e==null?_2:b2(typeof e=="function"?e:OC(e)))}var S2=Array.prototype.filter;function N2(){return Array.from(this.children)}function E2(e){return function(){return S2.call(this.children,e)}}function C2(e){return this.selectAll(e==null?N2:E2(typeof e=="function"?e:OC(e)))}function j2(e){typeof e!="function"&&(e=IC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new kn(s,this._parents)}function PC(e){return new Array(e.length)}function T2(){return new kn(this._enter||this._groups.map(PC),this._parents)}function uu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}uu.prototype={constructor:uu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function R2(e){return function(){return e}}function A2(e,t,n,s,i,a){for(var l=0,u,h=t.length,p=a.length;l<p;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new uu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function M2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,y=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(y[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new uu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(y[u])===h&&(i[u]=h)}function I2(e){return e.__data__}function O2(e,t){if(!arguments.length)return Array.from(this,I2);var n=t?M2:A2,s=this._parents,i=this._groups;typeof e!="function"&&(e=R2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],y=g.length,w=P2(e.call(f,f&&f.__data__,p,s)),N=w.length,b=u[p]=new Array(N),_=l[p]=new Array(N),k=h[p]=new Array(y);n(f,g,b,_,k,w,t);for(var E=0,C=0,j,I;E<N;++E)if(j=b[E]){for(E>=C&&(C=E+1);!(I=_[C])&&++C<N;);j._next=I||null}}return l=new kn(l,s),l._enter=u,l._exit=h,l}function P2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $2(){return new kn(this._exit||this._groups.map(PC),this._parents)}function L2(e,t,n){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?a.remove():n(a),s&&i?s.merge(i).order():i}function q2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,y=u[h]=new Array(g),w,N=0;N<g;++N)(w=p[N]||f[N])&&(y[N]=w);for(;h<i;++h)u[h]=n[h];return new kn(u,this._parents)}function D2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,a=s[i],l;--i>=0;)(l=s[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function F2(e){e||(e=z2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new kn(i,this._parents).order()}function z2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function B2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function U2(){return Array.from(this)}function W2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var l=s[i];if(l)return l}return null}function H2(){let e=0;for(const t of this)++e;return e}function G2(){return!this.node()}function V2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],a=0,l=i.length,u;a<l;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function Y2(e){return function(){this.removeAttribute(e)}}function K2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function X2(e,t){return function(){this.setAttribute(e,t)}}function Q2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Z2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function J2(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 eM(e,t){var n=Tu(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?K2:Y2:typeof t=="function"?n.local?J2:Z2:n.local?Q2:X2)(n,t))}function $C(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function tM(e){return function(){this.style.removeProperty(e)}}function nM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function rM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function sM(e,t,n){return arguments.length>1?this.each((t==null?tM:typeof t=="function"?rM:nM)(e,t,n??"")):$i(this.node(),e)}function $i(e,t){return e.style.getPropertyValue(t)||$C(e).getComputedStyle(e,null).getPropertyValue(t)}function oM(e){return function(){delete this[e]}}function iM(e,t){return function(){this[e]=t}}function aM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lM(e,t){return arguments.length>1?this.each((t==null?oM:typeof t=="function"?aM:iM)(e,t)):this.node()[e]}function LC(e){return e.trim().split(/^|\s+/)}function nw(e){return e.classList||new qC(e)}function qC(e){this._node=e,this._names=LC(e.getAttribute("class")||"")}qC.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 DC(e,t){for(var n=nw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function FC(e,t){for(var n=nw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function cM(e){return function(){DC(this,e)}}function uM(e){return function(){FC(this,e)}}function dM(e,t){return function(){(t.apply(this,arguments)?DC:FC)(this,e)}}function fM(e,t){var n=LC(e+"");if(arguments.length<2){for(var s=nw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?dM:t?cM:uM)(n,t))}function hM(){this.textContent=""}function pM(e){return function(){this.textContent=e}}function mM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function gM(e){return arguments.length?this.each(e==null?hM:(typeof e=="function"?mM:pM)(e)):this.node().textContent}function vM(){this.innerHTML=""}function yM(e){return function(){this.innerHTML=e}}function wM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function xM(e){return arguments.length?this.each(e==null?vM:(typeof e=="function"?wM:yM)(e)):this.node().innerHTML}function bM(){this.nextSibling&&this.parentNode.appendChild(this)}function _M(){return this.each(bM)}function kM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function SM(){return this.each(kM)}function NM(e){var t=typeof e=="function"?e:AC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function EM(){return null}function CM(e,t){var n=typeof e=="function"?e:AC(e),s=t==null?EM:typeof t=="function"?t:tw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function jM(){var e=this.parentNode;e&&e.removeChild(this)}function TM(){return this.each(jM)}function RM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function AM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function MM(e){return this.select(e?AM:RM)}function IM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function OM(e){return function(t){e.call(this,t,this.__data__)}}function PM(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 $M(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function LM(e,t,n){return function(){var s=this.__on,i,a=OM(t);if(s){for(var l=0,u=s.length;l<u;++l)if((i=s[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(i):this.__on=[i]}}function qM(e,t,n){var s=PM(e+""),i,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var h=0,p=u.length,f;h<p;++h)for(i=0,f=u[h];i<a;++i)if((l=s[i]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?LM:$M,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function zC(e,t,n){var s=$C(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function DM(e,t){return function(){return zC(this,e,t)}}function FM(e,t){return function(){return zC(this,e,t.apply(this,arguments))}}function zM(e,t){return this.each((typeof t=="function"?FM:DM)(e,t))}function*BM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var BC=[null];function kn(e,t){this._groups=e,this._parents=t}function hl(){return new kn([[document.documentElement]],BC)}function UM(){return this}kn.prototype=hl.prototype={constructor:kn,select:m2,selectAll:w2,selectChild:k2,selectChildren:C2,filter:j2,data:O2,enter:T2,exit:$2,join:L2,merge:q2,selection:UM,order:D2,sort:F2,call:B2,nodes:U2,node:W2,size:H2,empty:G2,each:V2,attr:eM,style:sM,property:lM,classed:fM,text:gM,html:xM,raise:_M,lower:SM,append:NM,insert:CM,remove:TM,clone:MM,datum:IM,on:qM,dispatch:zM,[Symbol.iterator]:BM};function Ln(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],BC)}function WM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sr(e,t){if(e=WM(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 i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const HM={passive:!1},el={capture:!0,passive:!1};function Df(e){e.stopImmediatePropagation()}function Ri(e){e.preventDefault(),e.stopImmediatePropagation()}function UC(e){var t=e.document.documentElement,n=Ln(e).on("dragstart.drag",Ri,el);"onselectstart"in t?n.on("selectstart.drag",Ri,el):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function WC(e,t){var n=e.document.documentElement,s=Ln(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ri,el),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 Dc=e=>()=>e;function by(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:a,x:l,y:u,dx:h,dy:p,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}by.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function GM(e){return!e.ctrlKey&&!e.button}function VM(){return this.parentNode}function YM(e,t){return t??{x:e.x,y:e.y}}function KM(){return navigator.maxTouchPoints||"ontouchstart"in this}function XM(){var e=GM,t=VM,n=YM,s=KM,i={},a=ju("start","drag","end"),l=0,u,h,p,f,g=0;function y(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",_).on("touchmove.drag",k,HM).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,I){if(!(f||!e.call(this,j,I))){var O=C(this,t.call(this,j,I),j,I,"mouse");O&&(Ln(j.view).on("mousemove.drag",N,el).on("mouseup.drag",b,el),UC(j.view),Df(j),p=!1,u=j.clientX,h=j.clientY,O("start",j))}}function N(j){if(Ri(j),!p){var I=j.clientX-u,O=j.clientY-h;p=I*I+O*O>g}i.mouse("drag",j)}function b(j){Ln(j.view).on("mousemove.drag mouseup.drag",null),WC(j.view,p),Ri(j),i.mouse("end",j)}function _(j,I){if(e.call(this,j,I)){var O=j.changedTouches,P=t.call(this,j,I),F=O.length,M,A;for(M=0;M<F;++M)(A=C(this,P,j,I,O[M].identifier,O[M]))&&(Df(j),A("start",j,O[M]))}}function k(j){var I=j.changedTouches,O=I.length,P,F;for(P=0;P<O;++P)(F=i[I[P].identifier])&&(Ri(j),F("drag",j,I[P]))}function E(j){var I=j.changedTouches,O=I.length,P,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),P=0;P<O;++P)(F=i[I[P].identifier])&&(Df(j),F("end",j,I[P]))}function C(j,I,O,P,F,M){var A=a.copy(),q=sr(M||O,I),W,Y,T;if((T=n.call(j,new by("beforestart",{sourceEvent:O,target:y,identifier:F,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),P))!=null)return W=T.x-q[0]||0,Y=T.y-q[1]||0,function Q(U,ne,X){var H=q,J;switch(U){case"start":i[F]=Q,J=l++;break;case"end":delete i[F],--l;case"drag":q=sr(X||ne,I),J=l;break}A.call(U,j,new by(U,{sourceEvent:ne,subject:T,target:y,identifier:F,active:J,x:q[0]+W,y:q[1]+Y,dx:q[0]-H[0],dy:q[1]-H[1],dispatch:A}),P)}}return y.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Dc(!!j),y):e},y.container=function(j){return arguments.length?(t=typeof j=="function"?j:Dc(j),y):t},y.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Dc(j),y):n},y.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Dc(!!j),y):s},y.on=function(){var j=a.on.apply(a,arguments);return j===a?y:j},y.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,y):Math.sqrt(g)},y}function rw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function pl(){}var tl=.7,du=1/tl,Ai="\\s*([+-]?\\d+)\\s*",nl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",QM=/^#([0-9a-f]{3,8})$/,ZM=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),JM=new RegExp(`^rgb\\(${Nr},${Nr},${Nr}\\)$`),eI=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${nl}\\)$`),tI=new RegExp(`^rgba\\(${Nr},${Nr},${Nr},${nl}\\)$`),nI=new RegExp(`^hsl\\(${nl},${Nr},${Nr}\\)$`),rI=new RegExp(`^hsla\\(${nl},${Nr},${Nr},${nl}\\)$`),cb={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};rw(pl,rl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ub,formatHex:ub,formatHex8:sI,formatHsl:oI,formatRgb:db,toString:db});function ub(){return this.rgb().formatHex()}function sI(){return this.rgb().formatHex8()}function oI(){return GC(this).formatHsl()}function db(){return this.rgb().formatRgb()}function rl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=QM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fb(t):n===3?new hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fc(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=ZM.exec(e))?new hn(t[1],t[2],t[3],1):(t=JM.exec(e))?new hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=eI.exec(e))?Fc(t[1],t[2],t[3],t[4]):(t=tI.exec(e))?Fc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nI.exec(e))?mb(t[1],t[2]/100,t[3]/100,1):(t=rI.exec(e))?mb(t[1],t[2]/100,t[3]/100,t[4]):cb.hasOwnProperty(e)?fb(cb[e]):e==="transparent"?new hn(NaN,NaN,NaN,0):null}function fb(e){return new hn(e>>16&255,e>>8&255,e&255,1)}function Fc(e,t,n,s){return s<=0&&(e=t=n=NaN),new hn(e,t,n,s)}function iI(e){return e instanceof pl||(e=rl(e)),e?(e=e.rgb(),new hn(e.r,e.g,e.b,e.opacity)):new hn}function _y(e,t,n,s){return arguments.length===1?iI(e):new hn(e,t,n,s??1)}function hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}rw(hn,_y,HC(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(wo(this.r),wo(this.g),wo(this.b),fu(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:hb,formatHex:hb,formatHex8:aI,formatRgb:pb,toString:pb}));function hb(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function aI(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function pb(){const e=fu(this.opacity);return`${e===1?"rgb(":"rgba("}${wo(this.r)}, ${wo(this.g)}, ${wo(this.b)}${e===1?")":`, ${e})`}`}function fu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=wo(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 GC(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=rl(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,i=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-i,h=(a+i)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=h<.5?a+i:2-a-i,l*=60):u=h>0&&h<1?0:l,new or(l,u,h,e.opacity)}function lI(e,t,n,s){return arguments.length===1?GC(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}rw(or,lI,HC(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,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,i=2*n-s;return new hn(Ff(e>=240?e-240:e+120,i,s),Ff(e,i,s),Ff(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new or(gb(this.h),zc(this.s),zc(this.l),fu(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=fu(this.opacity);return`${e===1?"hsl(":"hsla("}${gb(this.h)}, ${zc(this.s)*100}%, ${zc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function gb(e){return e=(e||0)%360,e<0?e+360:e}function zc(e){return Math.max(0,Math.min(1,e||0))}function Ff(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 VC=e=>()=>e;function cI(e,t){return function(n){return e+n*t}}function uI(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 dI(e){return(e=+e)==1?YC:function(t,n){return n-t?uI(t,n,e):VC(isNaN(t)?n:t)}}function YC(e,t){var n=t-e;return n?cI(e,n):VC(isNaN(e)?t:e)}const vb=(function e(t){var n=dI(t);function s(i,a){var l=n((i=_y(i)).r,(a=_y(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=YC(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function js(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ky=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zf=new RegExp(ky.source,"g");function fI(e){return function(){return e}}function hI(e){return function(t){return e(t)+""}}function pI(e,t){var n=ky.lastIndex=zf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=ky.exec(e))&&(i=zf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:js(s,i)})),n=zf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?hI(h[0].x):fI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var yb=180/Math.PI,Sy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KC(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*yb,skewX:Math.atan(h)*yb,scaleX:l,scaleY:u}}var Bc;function mI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sy:KC(t.a,t.b,t.c,t.d,t.e,t.f)}function gI(e){return e==null||(Bc||(Bc=document.createElementNS("http://www.w3.org/2000/svg","g")),Bc.setAttribute("transform",e),!(e=Bc.transform.baseVal.consolidate()))?Sy:(e=e.matrix,KC(e.a,e.b,e.c,e.d,e.e,e.f))}function XC(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push("translate(",null,t,null,n);N.push({i:b-4,x:js(p,g)},{i:b-2,x:js(f,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,f,g,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:g.push(i(g)+"rotate(",null,s)-2,x:js(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,y){p!==f?y.push({i:g.push(i(g)+"skewX(",null,s)-2,x:js(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push(i(w)+"scale(",null,",",null,")");N.push({i:b-4,x:js(p,g)},{i:b-2,x:js(f,y)})}else(g!==1||y!==1)&&w.push(i(w)+"scale("+g+","+y+")")}return function(p,f){var g=[],y=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,y),l(p.rotate,f.rotate,g,y),u(p.skewX,f.skewX,g,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,y),p=f=null,function(w){for(var N=-1,b=y.length,_;++N<b;)g[(_=y[N]).i]=_.x(w);return g.join("")}}}var vI=XC(mI,"px, ","px)","deg)"),yI=XC(gI,", ",")",")"),wI=1e-12;function wb(e){return((e=Math.exp(e))+1/e)/2}function xI(e){return((e=Math.exp(e))-1/e)/2}function bI(e){return((e=Math.exp(2*e))-1)/(e+1)}const _I=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],y=l[2],w=f-u,N=g-h,b=w*w+N*N,_,k;if(b<wI)k=Math.log(y/p)/t,_=function(P){return[u+P*w,h+P*N,p*Math.exp(t*P*k)]};else{var E=Math.sqrt(b),C=(y*y-p*p+s*b)/(2*p*n*E),j=(y*y-p*p-s*b)/(2*y*n*E),I=Math.log(Math.sqrt(C*C+1)-C),O=Math.log(Math.sqrt(j*j+1)-j);k=(O-I)/t,_=function(P){var F=P*k,M=wb(I),A=p/(n*E)*(M*bI(t*F+I)-xI(I));return[u+A*w,h+A*N,p*M/wb(t*F+I)]}}return _.duration=k*1e3*t/Math.SQRT2,_}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Li=0,Va=0,qa=0,QC=1e3,hu,Ya,pu=0,bo=0,Ru=0,sl=typeof performance=="object"&&performance.now?performance:Date,ZC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sw(){return bo||(ZC(kI),bo=sl.now()+Ru)}function kI(){bo=0}function mu(){this._call=this._time=this._next=null}mu.prototype=JC.prototype={constructor:mu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?sw():+n)+(t==null?0:+t),!this._next&&Ya!==this&&(Ya?Ya._next=this:hu=this,Ya=this),this._call=e,this._time=n,Ny()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ny())}};function JC(e,t,n){var s=new mu;return s.restart(e,t,n),s}function SI(){sw(),++Li;for(var e=hu,t;e;)(t=bo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Li}function xb(){bo=(pu=sl.now())+Ru,Li=Va=0;try{SI()}finally{Li=0,EI(),bo=0}}function NI(){var e=sl.now(),t=e-pu;t>QC&&(Ru-=t,pu=e)}function EI(){for(var e,t=hu,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:hu=n);Ya=e,Ny(s)}function Ny(e){if(!Li){Va&&(Va=clearTimeout(Va));var t=e-bo;t>24?(e<1/0&&(Va=setTimeout(xb,e-sl.now()-Ru)),qa&&(qa=clearInterval(qa))):(qa||(pu=sl.now(),qa=setInterval(NI,QC)),Li=1,ZC(xb))}}function bb(e,t,n){var s=new mu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var CI=ju("start","end","cancel","interrupt"),jI=[],ej=0,_b=1,Ey=2,ou=3,kb=4,Cy=5,iu=6;function Au(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;TI(e,n,{name:t,index:s,group:i,on:CI,tween:jI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ej})}function ow(e,t){var n=ur(e,t);if(n.state>ej)throw new Error("too late; already scheduled");return n}function Er(e,t){var n=ur(e,t);if(n.state>ou)throw new Error("too late; already running");return n}function ur(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function TI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=JC(a,0,n.time);function a(p){n.state=_b,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,y,w;if(n.state!==_b)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===ou)return bb(l);w.state===kb?(w.state=iu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=iu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(bb(function(){n.state===ou&&(n.state=kb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Ey,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ey){for(n.state=ou,i=new Array(y=n.tween.length),f=0,g=-1;f<y;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=Cy,1),g=-1,y=i.length;++g<y;)i[g].call(e,f);n.state===Cy&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=iu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function au(e,t){var n=e.__transition,s,i,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}i=s.state>Ey&&s.state<Cy,s.state=iu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function RI(e){return this.each(function(){au(this,e)})}function AI(e,t){var n,s;return function(){var i=Er(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function MI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Er(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function II(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=ur(this.node(),n).tween,i=0,a=s.length,l;i<a;++i)if((l=s[i]).name===e)return l.value;return null}return this.each((t==null?AI:MI)(n,e,t))}function iw(e,t,n){var s=e._id;return e.each(function(){var i=Er(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ur(i,s).value[t]}}function tj(e,t){var n;return(typeof t=="number"?js:t instanceof rl?vb:(n=rl(t))?(t=n,vb):pI)(e,t)}function OI(e){return function(){this.removeAttribute(e)}}function PI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $I(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===s?a:a=t(s=l,n)}}function LI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===s?a:a=t(s=l,n)}}function qI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function DI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function FI(e,t){var n=Tu(e),s=n==="transform"?yI:tj;return this.attrTween(e,typeof t=="function"?(n.local?DI:qI)(n,s,iw(this,"attr."+e,t)):t==null?(n.local?PI:OI)(n):(n.local?LI:$I)(n,s,t))}function zI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function BI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function UI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&BI(e,a)),n}return i._value=t,i}function WI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&zI(e,a)),n}return i._value=t,i}function HI(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=Tu(e);return this.tween(n,(s.local?UI:WI)(s,t))}function GI(e,t){return function(){ow(this,e).delay=+t.apply(this,arguments)}}function VI(e,t){return t=+t,function(){ow(this,e).delay=t}}function YI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?GI:VI)(t,e)):ur(this.node(),t).delay}function KI(e,t){return function(){Er(this,e).duration=+t.apply(this,arguments)}}function XI(e,t){return t=+t,function(){Er(this,e).duration=t}}function QI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?KI:XI)(t,e)):ur(this.node(),t).duration}function ZI(e,t){if(typeof t!="function")throw new Error;return function(){Er(this,e).ease=t}}function JI(e){var t=this._id;return arguments.length?this.each(ZI(t,e)):ur(this.node(),t).ease}function eO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Er(this,e).ease=n}}function tO(e){if(typeof e!="function")throw new Error;return this.each(eO(this._id,e))}function nO(e){typeof e!="function"&&(e=IC(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new Xr(s,this._parents,this._name,this._id)}function rO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),y,w=0;w<f;++w)(y=h[w]||p[w])&&(g[w]=y);for(;u<s;++u)l[u]=t[u];return new Xr(l,this._parents,this._name,this._id)}function sO(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 oO(e,t,n){var s,i,a=sO(t)?ow:Er;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function iO(e,t){var n=this._id;return arguments.length<2?ur(this.node(),n).on.on(e):this.each(oO(n,e,t))}function aO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function lO(){return this.on("end.remove",aO(this._id))}function cO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tw(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,y=0;y<h;++y)(f=u[y])&&(g=e.call(f,f.__data__,y,u))&&("__data__"in f&&(g.__data__=f.__data__),p[y]=g,Au(p[y],t,n,y,p,ur(f,n)));return new Xr(a,this._parents,t,n)}function uO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=MC(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var y=e.call(f,f.__data__,g,h),w,N=ur(f,n),b=0,_=y.length;b<_;++b)(w=y[b])&&Au(w,t,n,b,y,N);a.push(y),l.push(f)}return new Xr(a,l,t,n)}var dO=hl.prototype.constructor;function fO(){return new dO(this._groups,this._parents)}function hO(e,t){var n,s,i;return function(){var a=$i(this,e),l=(this.style.removeProperty(e),$i(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function nj(e){return function(){this.style.removeProperty(e)}}function pO(e,t,n){var s,i=n+"",a;return function(){var l=$i(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function mO(e,t,n){var s,i,a;return function(){var l=$i(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),$i(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function gO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Er(this,e),p=h.on,f=h.value[a]==null?u||(u=nj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function vO(e,t,n){var s=(e+="")=="transform"?vI:tj;return t==null?this.styleTween(e,hO(e,s)).on("end.style."+e,nj(e)):typeof t=="function"?this.styleTween(e,mO(e,s,iw(this,"style."+e,t))).each(gO(this._id,e)):this.styleTween(e,pO(e,s,t),n).on("end.style."+e,null)}function yO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function wO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&yO(e,l,n)),s}return a._value=t,a}function xO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,wO(e,t,n??""))}function bO(e){return function(){this.textContent=e}}function _O(e){return function(){var t=e(this);this.textContent=t??""}}function kO(e){return this.tween("text",typeof e=="function"?_O(iw(this,"text",e)):bO(e==null?"":e+""))}function SO(e){return function(t){this.textContent=e.call(this,t)}}function NO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&SO(i)),t}return s._value=e,s}function EO(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 CO(){for(var e=this._name,t=this._id,n=rj(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=ur(h,t);Au(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Xr(s,this._parents,e,n)}function jO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=Er(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var TO=0;function Xr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function rj(){return++TO}var Vr=hl.prototype;Xr.prototype={constructor:Xr,select:cO,selectAll:uO,selectChild:Vr.selectChild,selectChildren:Vr.selectChildren,filter:nO,merge:rO,selection:fO,transition:CO,call:Vr.call,nodes:Vr.nodes,node:Vr.node,size:Vr.size,empty:Vr.empty,each:Vr.each,on:iO,attr:FI,attrTween:HI,style:vO,styleTween:xO,text:kO,textTween:EO,remove:lO,tween:II,delay:YI,duration:QI,ease:JI,easeVarying:tO,end:jO,[Symbol.iterator]:Vr[Symbol.iterator]};function RO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var AO={time:null,delay:0,duration:250,ease:RO};function MO(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 IO(e){var t,n;e instanceof Xr?(t=e._id,e=e._name):(t=rj(),(n=AO).time=sw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&Au(h,e,t,p,l,n||MO(h,t));return new Xr(s,this._parents,e,t)}hl.prototype.interrupt=RI;hl.prototype.transition=IO;const Uc=e=>()=>e;function OO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){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:i}})}function Yr(e,t,n){this.k=e,this.x=t,this.y=n}Yr.prototype={constructor:Yr,scale:function(e){return e===1?this:new Yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yr(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 Kr=new Yr(1,0,0);Yr.prototype;function Bf(e){e.stopImmediatePropagation()}function Da(e){e.preventDefault(),e.stopImmediatePropagation()}function PO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function $O(){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 Sb(){return this.__zoom||Kr}function LO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qO(){return navigator.maxTouchPoints||"ontouchstart"in this}function DO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function sj(){var e=PO,t=$O,n=DO,s=LO,i=qO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=_I,p=ju("start","zoom","end"),f,g,y,w=500,N=150,b=0,_=10;function k(T){T.property("__zoom",Sb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(T,Q,U,ne){var X=T.selection?T.selection():T;X.property("__zoom",Sb),T!==X?I(T,Q,U,ne):X.interrupt().each(function(){O(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},k.scaleBy=function(T,Q,U,ne){k.scaleTo(T,function(){var X=this.__zoom.k,H=typeof Q=="function"?Q.apply(this,arguments):Q;return X*H},U,ne)},k.scaleTo=function(T,Q,U,ne){k.transform(T,function(){var X=t.apply(this,arguments),H=this.__zoom,J=U==null?j(X):typeof U=="function"?U.apply(this,arguments):U,$=H.invert(J),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(C(E(H,G),J,$),X,l)},U,ne)},k.translateBy=function(T,Q,U,ne){k.transform(T,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),l)},null,ne)},k.translateTo=function(T,Q,U,ne,X){k.transform(T,function(){var H=t.apply(this,arguments),J=this.__zoom,$=ne==null?j(H):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Kr.translate($[0],$[1]).scale(J.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof U=="function"?-U.apply(this,arguments):-U),H,l)},ne,X)};function E(T,Q){return Q=Math.max(a[0],Math.min(a[1],Q)),Q===T.k?T:new Yr(Q,T.x,T.y)}function C(T,Q,U){var ne=Q[0]-U[0]*T.k,X=Q[1]-U[1]*T.k;return ne===T.x&&X===T.y?T:new Yr(T.k,ne,X)}function j(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function I(T,Q,U,ne){T.on("start.zoom",function(){O(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(ne).end()}).tween("zoom",function(){var X=this,H=arguments,J=O(X,H).event(ne),$=t.apply(X,H),G=U==null?j($):typeof U=="function"?U.apply(X,H):U,Z=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),D=X.__zoom,L=typeof Q=="function"?Q.apply(X,H):Q,K=h(D.invert(G).concat(Z/D.k),L.invert(G).concat(Z/L.k));return function(re){if(re===1)re=L;else{var he=K(re),pe=Z/he[2];re=new Yr(pe,G[0]-he[0]*pe,G[1]-he[1]*pe)}J.zoom(null,re)}})}function O(T,Q,U){return!U&&T.__zooming||new P(T,Q)}function P(T,Q){this.that=T,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,Q),this.taps=0}P.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,Q){return this.mouse&&T!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&T!=="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(T){var Q=Ln(this.that).datum();p.call(T,this.that,new OO(T,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),Q)}};function F(T,...Q){if(!e.apply(this,arguments))return;var U=O(this,Q).event(T),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),H=sr(T);if(U.wheel)(U.mouse[0][0]!==H[0]||U.mouse[0][1]!==H[1])&&(U.mouse[1]=ne.invert(U.mouse[0]=H)),clearTimeout(U.wheel);else{if(ne.k===X)return;U.mouse=[H,ne.invert(H)],au(this),U.start()}Da(T),U.wheel=setTimeout(J,N),U.zoom("mouse",n(C(E(ne,X),U.mouse[0],U.mouse[1]),U.extent,l));function J(){U.wheel=null,U.end()}}function M(T,...Q){if(y||!e.apply(this,arguments))return;var U=T.currentTarget,ne=O(this,Q,!0).event(T),X=Ln(T.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Z,!0),H=sr(T,U),J=T.clientX,$=T.clientY;UC(T.view),Bf(T),ne.mouse=[H,this.__zoom.invert(H)],au(this),ne.start();function G(D){if(Da(D),!ne.moved){var L=D.clientX-J,K=D.clientY-$;ne.moved=L*L+K*K>b}ne.event(D).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=sr(D,U),ne.mouse[1]),ne.extent,l))}function Z(D){X.on("mousemove.zoom mouseup.zoom",null),WC(D.view,ne.moved),Da(D),ne.event(D).end()}}function A(T,...Q){if(e.apply(this,arguments)){var U=this.__zoom,ne=sr(T.changedTouches?T.changedTouches[0]:T,this),X=U.invert(ne),H=U.k*(T.shiftKey?.5:2),J=n(C(E(U,H),ne,X),t.apply(this,Q),l);Da(T),u>0?Ln(this).transition().duration(u).call(I,J,ne,T):Ln(this).call(k.transform,J,ne,T)}}function q(T,...Q){if(e.apply(this,arguments)){var U=T.touches,ne=U.length,X=O(this,Q,T.changedTouches.length===ne).event(T),H,J,$,G;for(Bf(T),J=0;J<ne;++J)$=U[J],G=sr($,this),G=[G,this.__zoom.invert(G),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==G[2]&&(X.touch1=G,X.taps=0):(X.touch0=G,H=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),H&&(X.taps<2&&(g=G[0],f=setTimeout(function(){f=null},w)),au(this),X.start())}}function W(T,...Q){if(this.__zooming){var U=O(this,Q).event(T),ne=T.changedTouches,X=ne.length,H,J,$,G;for(Da(T),H=0;H<X;++H)J=ne[H],$=sr(J,this),U.touch0&&U.touch0[2]===J.identifier?U.touch0[0]=$:U.touch1&&U.touch1[2]===J.identifier&&(U.touch1[0]=$);if(J=U.that.__zoom,U.touch1){var Z=U.touch0[0],D=U.touch0[1],L=U.touch1[0],K=U.touch1[1],re=(re=L[0]-Z[0])*re+(re=L[1]-Z[1])*re,he=(he=K[0]-D[0])*he+(he=K[1]-D[1])*he;J=E(J,Math.sqrt(re/he)),$=[(Z[0]+L[0])/2,(Z[1]+L[1])/2],G=[(D[0]+K[0])/2,(D[1]+K[1])/2]}else if(U.touch0)$=U.touch0[0],G=U.touch0[1];else return;U.zoom("touch",n(C(J,$,G),U.extent,l))}}function Y(T,...Q){if(this.__zooming){var U=O(this,Q).event(T),ne=T.changedTouches,X=ne.length,H,J;for(Bf(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<X;++H)J=ne[H],U.touch0&&U.touch0[2]===J.identifier?delete U.touch0:U.touch1&&U.touch1[2]===J.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(J=sr(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<_)){var $=Ln(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:Uc(+T),k):s},k.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Uc(!!T),k):e},k.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Uc(!!T),k):i},k.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Uc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),k):t},k.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],k):[a[0],a[1]]},k.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(T){return arguments.length?(n=T,k):n},k.duration=function(T){return arguments.length?(u=+T,k):u},k.interpolate=function(T){return arguments.length?(h=T,k):h},k.on=function(){var T=p.on.apply(p,arguments);return T===p?k:T},k.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,k):Math.sqrt(b)},k.tapDistance=function(T){return arguments.length?(_=+T,k):_},k}var aw=TC();const Mu=S.createContext(null),FO=Mu.Provider,Qr={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.`},oj=Qr.error001();function it(e,t){const n=S.useContext(Mu);if(n===null)throw new Error(oj);return RC(n,e,t)}const At=()=>{const e=S.useContext(Mu);if(e===null)throw new Error(oj);return S.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},zO=e=>e.userSelectionActive?"none":"all";function lw({position:e,children:t,className:n,style:s,...i}){const a=it(zO),l=`${e}`.split("-");return ue.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function BO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(lw,{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"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const UO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=S.useRef(null),[y,w]=S.useState({x:0,y:0,width:0,height:0}),N=Ht(["react-flow__edge-textwrapper",p]);return S.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...f},i&&ue.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),h)};var WO=S.memo(UO);const cw=e=>({width:e.offsetWidth,height:e.offsetHeight}),qi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),uw=(e={x:0,y:0},t)=>({x:qi(e.x,t[0][0],t[1][0]),y:qi(e.y,t[0][1],t[1][1])}),Nb=(e,t,n)=>e<t?qi(Math.abs(e-t),1,50)/50:e>n?-qi(Math.abs(e-n),1,50)/50:0,ij=(e,t)=>{const n=Nb(e.x,35,t.width-35)*20,s=Nb(e.y,35,t.height-35)*20;return[n,s]},aj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},lj=(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)}),ol=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),cj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Eb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),HO=(e,t)=>cj(lj(ol(e),ol(t))),jy=(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)},GO=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),Et=Symbol.for("internals"),uj=["Enter"," ","Escape"],VO=(e,t)=>{},YO=e=>"nativeEvent"in e;function Ty(e){var i,a;const t=YO(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[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 dj=e=>"clientX"in e,As=(e,t)=>{var a,l;const n=dj(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},gu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ml=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&qn(n)&&qn(s)?ue.createElement(WO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);ml.displayName="BaseEdge";function Fa(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function fj({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function hj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var _o;(function(e){e.Strict="strict",e.Loose="loose"})(_o||(_o={}));var yo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(yo||(yo={}));var il;(function(e){e.Partial="partial",e.Full="full"})(il||(il={}));var Rs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Rs||(Rs={}));var vu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vu||(vu={}));var qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(qe||(qe={}));function Cb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===qe.Left||e===qe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function pj({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top}){const[l,u]=Cb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Cb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,y,w]=hj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,y,w]}const dw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=qe.Bottom,targetPosition:a=qe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})=>{const[_,k,E]=pj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return ue.createElement(ml,{path:_,labelX:k,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});dw.displayName="SimpleBezierEdge";const jb={[qe.Left]:{x:-1,y:0},[qe.Right]:{x:1,y:0},[qe.Top]:{x:0,y:-1},[qe.Bottom]:{x:0,y:1}},KO=({source:e,sourcePosition:t=qe.Bottom,target:n})=>t===qe.Left||t===qe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Tb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function XO({source:e,sourcePosition:t=qe.Bottom,target:n,targetPosition:s=qe.Top,center:i,offset:a}){const l=jb[t],u=jb[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=KO({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let w=[],N,b;const _={x:0,y:0},k={x:0,y:0},[E,C,j,I]=fj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){N=i.x??E,b=i.y??C;const P=[{x:N,y:h.y},{x:N,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===y?w=g==="x"?P:F:w=g==="x"?F:P}else{const P=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===y?F:P:w=l.y===y?P:F,t===s){const Y=Math.abs(e[g]-n[g]);if(Y<=a){const T=Math.min(a-1,a-Y);l[g]===y?_[g]=(h[g]>e[g]?-1:1)*T:k[g]=(p[g]>n[g]?-1:1)*T}}if(t!==s){const Y=g==="x"?"y":"x",T=l[g]===u[Y],Q=h[Y]>p[Y],U=h[Y]<p[Y];(l[g]===1&&(!T&&Q||T&&U)||l[g]!==1&&(!T&&U||T&&Q))&&(w=g==="x"?P:F)}const M={x:h.x+_.x,y:h.y+_.y},A={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),W=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=W?(N=(M.x+A.x)/2,b=w[0].y):(N=w[0].x,b=(M.y+A.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...w,{x:p.x+k.x,y:p.y+k.y},n],N,b,j,I]}function QO(e,t,n,s){const i=Math.min(Tb(e,t)/2,Tb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Ry({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,y,w,N]=XO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((_,k,E)=>{let C="";return E>0&&E<f.length-1?C=QO(f[E-1],k,f[E+1],l):C=`${E===0?"M":"L"}${k.x} ${k.y}`,_+=C,_},""),g,y,w,N]}const Iu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=qe.Bottom,targetPosition:y=qe.Top,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,C]=Ry({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return ue.createElement(ml,{path:k,labelX:E,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:N,interactionWidth:_})});Iu.displayName="SmoothStepEdge";const fw=S.memo(e=>{var t;return ue.createElement(Iu,{...e,pathOptions:S.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});fw.displayName="StepEdge";function ZO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=fj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const hw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[N,b,_]=ZO({sourceX:e,sourceY:t,targetX:n,targetY:s});return ue.createElement(ml,{path:N,labelX:b,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})});hw.displayName="StraightEdge";function Wc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Rb({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case qe.Left:return[t-Wc(t-s,a),n];case qe.Right:return[t+Wc(s-t,a),n];case qe.Top:return[t,n-Wc(n-i,a)];case qe.Bottom:return[t,n+Wc(i-n,a)]}}function mj({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top,curvature:l=.25}){const[u,h]=Rb({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Rb({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,y,w,N]=hj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,y,w,N]}const yu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=qe.Bottom,targetPosition:a=qe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,C]=mj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return ue.createElement(ml,{path:k,labelX:E,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});yu.displayName="BezierEdge";const pw=S.createContext(null),JO=pw.Provider;pw.Consumer;const eP=()=>S.useContext(pw),tP=e=>"id"in e&&"source"in e&&"target"in e,nP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Ay=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,rP=(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)),sP=(e,t)=>{if(!e.source||!e.target)return t;let n;return tP(e)?n={...e}:n={...e,id:nP(e)},rP(n,t)?t:t.concat(n)},My=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},gj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),xo=(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],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Ou=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=xo(i,t).positionAbsolute;return lj(s,ol({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return cj(n)},vj=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:y,selectable:w=!0,hidden:N=!1}=f;if(l&&!w||N)return!1;const{positionAbsolute:b}=xo(f,u),_={x:b.x,y:b.y,width:g||0,height:y||0},k=jy(h,_),E=typeof g>"u"||typeof y>"u"||g===null||y===null,C=a&&k>0,j=(g||0)*(y||0);(E||C||k>=j||f.dragging)&&p.push(f)}),p},yj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},wj=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=qi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},po=(e,t=0)=>e.transition().duration(t);function Ab(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function oP(e,t,n,s,i,a){const{x:l,y:u}=As(e),p=t.elementsFromPoint(l,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const b=mw(void 0,p),_=p.getAttribute("data-handleid"),k=a({nodeId:N,id:_,type:b});if(k){const E=i.find(C=>C.nodeId===N&&C.type===b&&C.id===_);return{handle:{id:_,type:b,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:k}}}}let f=[],g=1/0;if(i.forEach(N=>{const b=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(b<=s){const _=a(N);b<=g&&(b<g?f=[{handle:N,validHandleResult:_}]:b===g&&f.push({handle:N,validHandleResult:_}),g=b)}}),!f.length)return{handle:null,validHandleResult:xj()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),w=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:b})=>w?N.type==="target":y?b.isValid:!0)||f[0]}const iP={source:null,target:null,sourceHandle:null,targetHandle:null},xj=()=>({handleDomNode:null,isValid:!1,connection:iP,endHandle:null});function bj(e,t,n,s,i,a,l){const u=i==="target",h=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={...xj(),handleDomNode:h};if(h){const f=mw(void 0,h),g=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?y:s,target:u?n:g,targetHandle:u?s:y};p.connection=b,w&&N&&(t===_o.Strict?u&&f==="source"||!u&&f==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:f},p.isValid=a(b))}return p}function aP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Et]){const{handleBounds:l}=a[Et];let u=[],h=[];l&&(u=Ab(a,l,"source",`${t}-${n}-${s}`),h=Ab(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function mw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Uf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function lP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function _j({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=aj(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:b,panBy:_,getNodes:k,cancelConnection:E}=a();let C=0,j;const{x:I,y:O}=As(e),P=f==null?void 0:f.elementFromPoint(I,O),F=mw(h,P),M=y==null?void 0:y.getBoundingClientRect();if(!M||!F)return;let A,q=As(e,M),W=!1,Y=null,T=!1,Q=null;const U=aP({nodes:k(),nodeId:n,handleId:t,handleType:F}),ne=()=>{if(!w)return;const[J,$]=ij(q,M);_({x:J,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function X(J){const{transform:$}=a();q=As(J,M);const{handle:G,validHandleResult:Z}=oP(J,f,My(q,$,!1,[1,1]),N,U,D=>bj(D,g,n,t,i?"target":"source",u,f));if(j=G,W||(ne(),W=!0),Q=Z.handleDomNode,Y=Z.connection,T=Z.isValid,l({connectionPosition:j&&T?gj({x:j.x,y:j.y},$):q,connectionStatus:lP(!!j,T),connectionEndHandle:Z.endHandle}),!j&&!T&&!Q)return Uf(A);Y.source!==Y.target&&Q&&(Uf(A),A=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",T),Q.classList.toggle("react-flow__handle-valid",T))}function H(J){var $,G;(j||Q)&&Y&&T&&(s==null||s(Y)),(G=($=a()).onConnectEnd)==null||G.call($,J),h&&(p==null||p(J)),Uf(A),E(),cancelAnimationFrame(C),W=!1,T=!1,Y=null,Q=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",H),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",H)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",H),f.addEventListener("touchmove",X),f.addEventListener("touchend",H)}const Mb=()=>!0,cP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),uP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},kj=S.forwardRef(({type:e="source",position:t=qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...y},w)=>{var M,A;const N=l||null,b=e==="target",_=At(),k=eP(),{connectOnClick:E,noPanClassName:C}=it(cP,$t),{connecting:j,clickConnecting:I}=it(uP(k,N,e),$t);k||(A=(M=_.getState()).onError)==null||A.call(M,"010",Qr.error010());const O=q=>{const{defaultEdgeOptions:W,onConnect:Y,hasDefaultEdges:T}=_.getState(),Q={...W,...q};if(T){const{edges:U,setEdges:ne}=_.getState();ne(sP(Q,U))}Y==null||Y(Q),u==null||u(Q)},P=q=>{if(!k)return;const W=dj(q);i&&(W&&q.button===0||!W)&&_j({event:q,handleId:N,nodeId:k,onConnect:O,isTarget:b,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Mb}),W?f==null||f(q):g==null||g(q)},F=q=>{const{onClickConnectStart:W,onClickConnectEnd:Y,connectionClickStartHandle:T,connectionMode:Q,isValidConnection:U}=_.getState();if(!k||!T&&!i)return;if(!T){W==null||W(q,{nodeId:k,handleId:N,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const ne=aj(q.target),X=n||U||Mb,{connection:H,isValid:J}=bj({nodeId:k,id:N,type:e},Q,T.nodeId,T.handleId||null,T.type,X,ne);J&&O(H),Y==null||Y(q),_.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:I,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:P,onTouchStart:P,onClick:E?F:void 0,ref:w,...y},h)});kj.displayName="Handle";var Di=S.memo(kj);const Sj=({data:e,isConnectable:t,targetPosition:n=qe.Top,sourcePosition:s=qe.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.createElement(Di,{type:"source",position:s,isConnectable:t}));Sj.displayName="DefaultNode";var Iy=S.memo(Sj);const Nj=({data:e,isConnectable:t,sourcePosition:n=qe.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(Di,{type:"source",position:n,isConnectable:t}));Nj.displayName="InputNode";var Ej=S.memo(Nj);const Cj=({data:e,isConnectable:t,targetPosition:n=qe.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Cj.displayName="OutputNode";var jj=S.memo(Cj);const gw=()=>null;gw.displayName="GroupNode";const dP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Hc=e=>e.id;function fP(e,t){return $t(e.selectedNodes.map(Hc),t.selectedNodes.map(Hc))&&$t(e.selectedEdges.map(Hc),t.selectedEdges.map(Hc))}const Tj=S.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=it(dP,fP);return S.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Tj.displayName="SelectionListener";const hP=e=>!!e.onSelectionChange;function pP({onSelectionChange:e}){const t=it(hP);return e||t?ue.createElement(Tj,{onSelectionChange:e}):null}const mP=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function wi(e,t){S.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Je(e,t,n){S.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const gP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:b,maxZoom:_,nodeExtent:k,onNodesChange:E,onEdgesChange:C,elementsSelectable:j,connectionMode:I,snapGrid:O,snapToGrid:P,translateExtent:F,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:W,onNodesDelete:Y,onEdgesDelete:T,onNodeDrag:Q,onNodeDragStart:U,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:H,onSelectionDragStop:J,noPanClassName:$,nodeOrigin:G,rfId:Z,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:K,connectionRadius:re,isValidConnection:he,nodeDragThreshold:pe})=>{const{setNodes:we,setEdges:Ce,setDefaultNodesAndEdges:Ve,setMinZoom:Be,setMaxZoom:Le,setTranslateExtent:Se,setNodeExtent:ce,reset:be}=it(mP,$t),xe=At();return S.useEffect(()=>{const Ke=s==null?void 0:s.map(ut=>({...ut,...A}));return Ve(n,Ke),()=>{be()}},[]),Je("defaultEdgeOptions",A,xe.setState),Je("connectionMode",I,xe.setState),Je("onConnect",i,xe.setState),Je("onConnectStart",a,xe.setState),Je("onConnectEnd",l,xe.setState),Je("onClickConnectStart",u,xe.setState),Je("onClickConnectEnd",h,xe.setState),Je("nodesDraggable",p,xe.setState),Je("nodesConnectable",f,xe.setState),Je("nodesFocusable",g,xe.setState),Je("edgesFocusable",y,xe.setState),Je("edgesUpdatable",w,xe.setState),Je("elementsSelectable",j,xe.setState),Je("elevateNodesOnSelect",N,xe.setState),Je("snapToGrid",P,xe.setState),Je("snapGrid",O,xe.setState),Je("onNodesChange",E,xe.setState),Je("onEdgesChange",C,xe.setState),Je("connectOnClick",M,xe.setState),Je("fitViewOnInit",q,xe.setState),Je("fitViewOnInitOptions",W,xe.setState),Je("onNodesDelete",Y,xe.setState),Je("onEdgesDelete",T,xe.setState),Je("onNodeDrag",Q,xe.setState),Je("onNodeDragStart",U,xe.setState),Je("onNodeDragStop",ne,xe.setState),Je("onSelectionDrag",X,xe.setState),Je("onSelectionDragStart",H,xe.setState),Je("onSelectionDragStop",J,xe.setState),Je("noPanClassName",$,xe.setState),Je("nodeOrigin",G,xe.setState),Je("rfId",Z,xe.setState),Je("autoPanOnConnect",D,xe.setState),Je("autoPanOnNodeDrag",L,xe.setState),Je("onError",K,xe.setState),Je("connectionRadius",re,xe.setState),Je("isValidConnection",he,xe.setState),Je("nodeDragThreshold",pe,xe.setState),wi(e,we),wi(t,Ce),wi(b,Be),wi(_,Le),wi(F,Se),wi(k,ce),null},Ib={display:"none"},vP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Rj="react-flow__node-desc",Aj="react-flow__edge-desc",yP="react-flow__aria-live",wP=e=>e.ariaLiveMessage;function xP({rfId:e}){const t=it(wP);return ue.createElement("div",{id:`${yP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:vP},t)}function bP({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${Rj}-${e}`,style:Ib},"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."," "),ue.createElement("div",{id:`${Aj}-${e}`,style:Ib},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(xP,{rfId:e}))}var al=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=S.useState(!1),i=S.useRef(!1),a=S.useRef(new Set([])),[l,u]=S.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,y)=>g.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return S.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Ty(w))return!1;const b=Pb(w.code,u);a.current.add(w[b]),Ob(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Ty(w))return!1;const b=Pb(w.code,u);Ob(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},y=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Ob(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Pb(e,t){return t.includes(e)?"code":"key"}function Mj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=xo(a,s);return Mj(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Et])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Et])==null?void 0:h.z)??0:n.z??0},s)}function Ij(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=Mj(s,e,{...s.position,z:((a=s[Et])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Et].z=h,n!=null&&n[s.id]&&(s[Et].isParent=!0)}})}function Wf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(qn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Et,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Et])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),Ij(i,n,a),i}function Oj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),y=t.initial&&!p&&f;if(u&&h&&(y||!t.initial)){const N=n().filter(_=>{var E;const k=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(E=t.nodes)!=null&&E.length?k&&t.nodes.some(C=>C.id===_.id):k}),b=N.every(_=>_.width&&_.height);if(N.length>0&&b){const _=Ou(N,g),{x:k,y:E,zoom:C}=wj(_,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Kr.translate(k,E).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(po(h,t.duration),j):u.transform(h,j),!0}}return!1}function _P(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Et]:s[Et],selected:n.selected})}),new Map(t)}function kP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function Gc({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:a,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:_P(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:kP(t,a)}),u==null||u(t))}const xi=()=>{},SP={zoomIn:xi,zoomOut:xi,zoomTo:xi,getZoom:()=>1,setViewport:xi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:xi,fitBounds:xi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},NP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),EP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=it(NP,$t);return S.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(po(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Kr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(po(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>Oj(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,y=h/2-a*f,w=Kr.translate(g,y).scale(f);t.transform(po(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:y}=wj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Kr.translate(f,g).scale(y);t.transform(po(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),My(i,a,l,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:l,snapGrid:u,domNode:h}=e.getState();if(!h)return i;const{x:p,y:f}=h.getBoundingClientRect(),g={x:i.x-p,y:i.y-f};return My(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=gj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:SP,[t,n])};function gl(){const e=EP(),t=At(),n=S.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=S.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=S.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(_=>({..._}))},[]),a=S.useCallback(b=>{const{edges:_=[]}=t.getState();return _.find(k=>k.id===b)},[]),l=S.useCallback(b=>{const{getNodes:_,setNodes:k,hasDefaultNodes:E,onNodesChange:C}=t.getState(),j=_(),I=typeof b=="function"?b(j):b;if(E)k(I);else if(C){const O=I.length===0?j.map(P=>({type:"remove",id:P.id})):I.map(P=>({item:P,type:"reset"}));C(O)}},[]),u=S.useCallback(b=>{const{edges:_=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(_):b;if(E)k(j);else if(C){const I=j.length===0?_.map(O=>({type:"remove",id:O.id})):j.map(O=>({item:O,type:"reset"}));C(I)}},[]),h=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{getNodes:k,setNodes:E,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const O=[...k(),..._];E(O)}else if(j){const I=_.map(O=>({item:O,type:"add"}));j(I)}},[]),p=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{edges:k=[],setEdges:E,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)E([...k,..._]);else if(j){const I=_.map(O=>({item:O,type:"add"}));j(I)}},[]),f=S.useCallback(()=>{const{getNodes:b,edges:_=[],transform:k}=t.getState(),[E,C,j]=k;return{nodes:b().map(I=>({...I})),edges:_.map(I=>({...I})),viewport:{x:E,y:C,zoom:j}}},[]),g=S.useCallback(({nodes:b,edges:_})=>{const{nodeInternals:k,getNodes:E,edges:C,hasDefaultNodes:j,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:P,onNodesChange:F,onEdgesChange:M}=t.getState(),A=(b||[]).map(Q=>Q.id),q=(_||[]).map(Q=>Q.id),W=E().reduce((Q,U)=>{const ne=U.parentNode||U.parentId,X=!A.includes(U.id)&&ne&&Q.find(J=>J.id===ne);return(typeof U.deletable=="boolean"?U.deletable:!0)&&(A.includes(U.id)||X)&&Q.push(U),Q},[]),Y=C.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),T=Y.filter(Q=>q.includes(Q.id));if(W||T){const Q=yj(W,Y),U=[...T,...Q],ne=U.reduce((X,H)=>(X.includes(H.id)||X.push(H.id),X),[]);if((I||j)&&(I&&t.setState({edges:C.filter(X=>!ne.includes(X.id))}),j&&(W.forEach(X=>{k.delete(X.id)}),t.setState({nodeInternals:new Map(k)}))),ne.length>0&&(P==null||P(U),M&&M(ne.map(X=>({id:X,type:"remove"})))),W.length>0&&(O==null||O(W),F)){const X=W.map(H=>({id:H.id,type:"remove"}));F(X)}}},[]),y=S.useCallback(b=>{const _=GO(b),k=_?null:t.getState().nodeInternals.get(b.id);return!_&&!k?[null,null,_]:[_?b:Eb(k),k,_]},[]),w=S.useCallback((b,_=!0,k)=>{const[E,C,j]=y(b);return E?(k||t.getState().getNodes()).filter(I=>{if(!j&&(I.id===C.id||!I.positionAbsolute))return!1;const O=Eb(I),P=jy(O,E);return _&&P>0||P>=E.width*E.height}):[]},[]),N=S.useCallback((b,_,k=!0)=>{const[E]=y(b);if(!E)return!1;const C=jy(E,_);return k&&C>0||C>=E.width*E.height},[]);return S.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,i,a,l,u,h,p,f,g,w,N])}const CP={actInsideInputWithModifier:!1};var jP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=gl(),i=al(e,CP),a=al(t);S.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),S.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function TP(e){const t=At();S.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=cw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Qr.error004())),t.setState({width:i.width||500,height:i.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 vw={position:"absolute",width:"100%",height:"100%",top:0,left:0},RP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Vc=e=>({x:e.x,y:e.y,zoom:e.k}),bi=(e,t)=>e.target.closest(`.${t}`),$b=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lb=e=>{const t=e.ctrlKey&&gu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},AP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),MP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=yo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:b,zoomActivationKeyCode:_,preventScrolling:k=!0,children:E,noWheelClassName:C,noPanClassName:j})=>{const I=S.useRef(),O=At(),P=S.useRef(!1),F=S.useRef(!1),M=S.useRef(null),A=S.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:W,d3ZoomHandler:Y,userSelectionActive:T}=it(AP,$t),Q=al(_),U=S.useRef(0),ne=S.useRef(!1),X=S.useRef();return TP(M),S.useEffect(()=>{if(M.current){const H=M.current.getBoundingClientRect(),J=sj().scaleExtent([N,b]).translateExtent(w),$=Ln(M.current).call(J),G=Kr.translate(y.x,y.y).scale(qi(y.zoom,N,b)),Z=[[0,0],[H.width,H.height]],D=J.constrain()(G,Z,w);J.transform($,D),J.wheelDelta(Lb),O.setState({d3Zoom:J,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:M.current.closest(".react-flow")})}},[]),S.useEffect(()=>{W&&q&&(l&&!Q&&!T?W.on("wheel.zoom",H=>{if(bi(H,C))return!1;H.preventDefault(),H.stopImmediatePropagation();const J=W.property("__zoom").k||1;if(H.ctrlKey&&a){const he=sr(H),pe=Lb(H),we=J*Math.pow(2,pe);q.scaleTo(W,we,he,H);return}const $=H.deltaMode===1?20:1;let G=h===yo.Vertical?0:H.deltaX*$,Z=h===yo.Horizontal?0:H.deltaY*$;!gu()&&H.shiftKey&&h!==yo.Vertical&&(G=H.deltaY*$,Z=0),q.translateBy(W,-(G/J)*u,-(Z/J)*u,{internal:!0});const D=Vc(W.property("__zoom")),{onViewportChangeStart:L,onViewportChange:K,onViewportChangeEnd:re}=O.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(H,D),L==null||L(D)),ne.current&&(e==null||e(H,D),K==null||K(D),X.current=setTimeout(()=>{n==null||n(H,D),re==null||re(D),ne.current=!1},150))},{passive:!1}):typeof Y<"u"&&W.on("wheel.zoom",function(H,J){if(!k&&H.type==="wheel"&&!H.ctrlKey||bi(H,C))return null;H.preventDefault(),Y.call(this,H,J)},{passive:!1}))},[T,l,h,W,q,Y,Q,a,k,C,t,e,n]),S.useEffect(()=>{q&&q.on("start",H=>{var G,Z;if(!H.sourceEvent||H.sourceEvent.internal)return null;U.current=(G=H.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:J}=O.getState(),$=Vc(H.transform);P.current=!0,A.current=$,((Z=H.sourceEvent)==null?void 0:Z.type)==="mousedown"&&O.setState({paneDragging:!0}),J==null||J($),t==null||t(H.sourceEvent,$)})},[q,t]),S.useEffect(()=>{q&&(T&&!P.current?q.on("zoom",null):T||q.on("zoom",H=>{var $;const{onViewportChange:J}=O.getState();if(O.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),F.current=!!(s&&$b(g,U.current??0)),(e||J)&&!(($=H.sourceEvent)!=null&&$.internal)){const G=Vc(H.transform);J==null||J(G),e==null||e(H.sourceEvent,G)}}))},[T,q,e,g,s]),S.useEffect(()=>{q&&q.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=O.getState();if(P.current=!1,O.setState({paneDragging:!1}),s&&$b(g,U.current??0)&&!F.current&&s(H.sourceEvent),F.current=!1,(n||J)&&RP(A.current,H.transform)){const $=Vc(H.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J($),n==null||n(H.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),S.useEffect(()=>{q&&q.filter(H=>{const J=Q||i,$=a&&H.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&H.button===1&&H.type==="mousedown"&&(bi(H,"react-flow__node")||bi(H,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!a||T||!p&&H.type==="dblclick"||bi(H,C)&&H.type==="wheel"||bi(H,j)&&(H.type!=="wheel"||l&&H.type==="wheel"&&!Q)||!a&&H.ctrlKey&&H.type==="wheel"||!J&&!l&&!$&&H.type==="wheel"||!g&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(g)&&!g.includes(H.button)&&H.type==="mousedown")return!1;const G=Array.isArray(g)&&g.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&G})},[T,q,i,a,l,p,g,f,Q]),ue.createElement("div",{className:"react-flow__renderer",ref:M,style:vw},E)},IP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function OP(){const{userSelectionActive:e,userSelectionRect:t}=it(IP,$t);return e&&t?ue.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 qb(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>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,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),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 PP(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,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&qb(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&qb(s,l);break}case"remove":return s}return s.push(l),s},n)}function $P(e,t){return PP(e,t)}const Ts=(e,t)=>({id:e,type:"select",selected:t});function Ci(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Ts(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Ts(s.id,!1))),n},[])}const Hf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},LP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Pj=S.memo(({isSelecting:e,selectionMode:t=il.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const y=S.useRef(null),w=At(),N=S.useRef(0),b=S.useRef(0),_=S.useRef(),{userSelectionActive:k,elementsSelectable:E,dragging:C}=it(LP,$t),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,b.current=0},I=Y=>{a==null||a(Y),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}l==null||l(Y)},P=u?Y=>u(Y):void 0,F=Y=>{const{resetSelectedElements:T,domNode:Q}=w.getState();if(_.current=Q==null?void 0:Q.getBoundingClientRect(),!E||!e||Y.button!==0||Y.target!==y.current||!_.current)return;const{x:U,y:ne}=As(Y,_.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:U,startY:ne,x:U,y:ne}}),s==null||s(Y)},M=Y=>{const{userSelectionRect:T,nodeInternals:Q,edges:U,transform:ne,onNodesChange:X,onEdgesChange:H,nodeOrigin:J,getNodes:$}=w.getState();if(!e||!_.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=As(Y,_.current),Z=T.startX??0,D=T.startY??0,L={...T,x:G.x<Z?G.x:Z,y:G.y<D?G.y:D,width:Math.abs(G.x-Z),height:Math.abs(G.y-D)},K=$(),re=vj(Q,L,ne,t===il.Partial,!0,J),he=yj(re,U).map(we=>we.id),pe=re.map(we=>we.id);if(N.current!==pe.length){N.current=pe.length;const we=Ci(K,pe);we.length&&(X==null||X(we))}if(b.current!==he.length){b.current=he.length;const we=Ci(U,he);we.length&&(H==null||H(we))}w.setState({userSelectionRect:L})},A=Y=>{if(Y.button!==0)return;const{userSelectionRect:T}=w.getState();!k&&T&&Y.target===y.current&&(I==null||I(Y)),w.setState({nodesSelectionActive:N.current>0}),j(),i==null||i(Y)},q=Y=>{k&&(w.setState({nodesSelectionActive:N.current>0}),i==null||i(Y)),j()},W=E&&(e||k);return ue.createElement("div",{className:Ht(["react-flow__pane",{dragging:C,selection:e}]),onClick:W?void 0:Hf(I,y),onContextMenu:Hf(O,y),onWheel:Hf(P,y),onMouseEnter:W?void 0:h,onMouseDown:W?F:void 0,onMouseMove:W?M:p,onMouseUp:W?A:void 0,onMouseLeave:W?q:f,ref:y,style:vw},g,ue.createElement(OP,null))});Pj.displayName="Pane";function $j(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:$j(s,t):!1}function Db(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 qP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!$j(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function DP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Lj(e,t,n,s,i=[0,0],a){const l=DP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=g&&qn(y)&&qn(w)&&qn(g.width)&&qn(g.height)?[[y+e.width*i[0],w+e.height*i[1]],[y+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Qr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=xo(g,i).positionAbsolute}const f=u&&u!=="parent"?uw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Gf({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const Fb=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...cw(h)}})};function za(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Oy({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",Qr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function FP(){const e=At();return S.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function Vf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function qj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=At(),[h,p]=S.useState(!1),f=S.useRef([]),g=S.useRef({x:null,y:null}),y=S.useRef(0),w=S.useRef(null),N=S.useRef({x:0,y:0}),b=S.useRef(null),_=S.useRef(!1),k=S.useRef(!1),E=S.useRef(!1),C=FP();return S.useEffect(()=>{if(e!=null&&e.current){const j=Ln(e.current),I=({x:F,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:W,updateNodePositions:Y,nodeExtent:T,snapGrid:Q,snapToGrid:U,nodeOrigin:ne,onError:X}=u.getState();g.current={x:F,y:M};let H=!1,J={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&T){const G=Ou(f.current,ne);J=ol(G)}if(f.current=f.current.map(G=>{const Z={x:F-G.distance.x,y:M-G.distance.y};U&&(Z.x=Q[0]*Math.round(Z.x/Q[0]),Z.y=Q[1]*Math.round(Z.y/Q[1]));const D=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];f.current.length>1&&T&&!G.extent&&(D[0][0]=G.positionAbsolute.x-J.x+T[0][0],D[1][0]=G.positionAbsolute.x+(G.width??0)-J.x2+T[1][0],D[0][1]=G.positionAbsolute.y-J.y+T[0][1],D[1][1]=G.positionAbsolute.y+(G.height??0)-J.y2+T[1][1]);const L=Lj(G,Z,A,D,ne,X);return H=H||G.position.x!==L.position.x||G.position.y!==L.position.y,G.position=L.position,G.positionAbsolute=L.positionAbsolute,G}),!H)return;Y(f.current,!0,!0),p(!0);const $=i?q:Vf(W);if($&&b.current){const[G,Z]=Gf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,G,Z)}},O=()=>{if(!w.current)return;const[F,M]=ij(N.current,w.current);if(F!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:F,y:M})&&I(g.current)}y.current=requestAnimationFrame(O)},P=F=>{var ne;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:W,onNodeDragStart:Y,onSelectionDragStart:T}=u.getState();k.current=!0;const Q=i?Y:Vf(T);(!l||!a)&&!A&&i&&((ne=M.get(i))!=null&&ne.selected||W()),i&&a&&l&&Oy({id:i,store:u,nodeRef:e});const U=C(F);if(g.current=U,f.current=qP(M,q,U,i),Q&&f.current){const[X,H]=Gf({nodeId:i,dragItems:f.current,nodeInternals:M});Q(F.sourceEvent,X,H)}};if(t)j.on(".drag",null);else{const F=XM().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&P(M),E.current=!1;const W=C(M);g.current=W,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=As(M.sourceEvent,w.current)}).on("drag",M=>{var Y,T;const A=C(M),{autoPanOnNodeDrag:q,nodeDragThreshold:W}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!_.current&&k.current&&q&&(_.current=!0,O()),!k.current){const Q=A.xSnapped-(((Y=g==null?void 0:g.current)==null?void 0:Y.x)??0),U=A.ySnapped-(((T=g==null?void 0:g.current)==null?void 0:T.y)??0);Math.sqrt(Q*Q+U*U)>W&&P(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&k.current&&(b.current=M.sourceEvent,N.current=As(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!k.current||E.current)&&(p(!1),_.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:W,onSelectionDragStop:Y}=u.getState(),T=i?W:Vf(Y);if(A(f.current,!1,!1),T){const[Q,U]=Gf({nodeId:i,dragItems:f.current,nodeInternals:q});T(M.sourceEvent,Q,U)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!Db(A,`.${n}`,e))&&(!s||Db(A,s,e))});return j.call(F),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Dj(){const e=At();return S.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||f&&typeof E.draggable>"u")),y=u?h[0]:5,w=u?h[1]:5,N=n.isShiftPressed?4:1,b=n.x*y*N,_=n.y*w*N,k=g.map(E=>{if(E.positionAbsolute){const C={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+_};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:I}=Lj(E,C,s,i,void 0,p);E.position=I,E.positionAbsolute=j}return E});a(k,!0,!1)},[])}const Mi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ba=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:b,style:_,className:k,isDraggable:E,isSelectable:C,isConnectable:j,isFocusable:I,selectNodesOnDrag:O,sourcePosition:P,targetPosition:F,hidden:M,resizeObserver:A,dragHandle:q,zIndex:W,isParent:Y,noDragClassName:T,noPanClassName:Q,initialized:U,disableKeyboardA11y:ne,ariaLabel:X,rfId:H,hasHandleBounds:J})=>{const $=At(),G=S.useRef(null),Z=S.useRef(null),D=S.useRef(P),L=S.useRef(F),K=S.useRef(s),re=C||E||f||g||y||w,he=Dj(),pe=za(n,$.getState,g),we=za(n,$.getState,y),Ce=za(n,$.getState,w),Ve=za(n,$.getState,N),Be=za(n,$.getState,b),Le=be=>{const{nodeDragThreshold:xe}=$.getState();if(C&&(!O||!E||xe>0)&&Oy({id:n,store:$,nodeRef:G}),f){const Ke=$.getState().nodeInternals.get(n);Ke&&f(be,{...Ke})}},Se=be=>{if(!Ty(be)&&!ne)if(uj.includes(be.key)&&C){const xe=be.key==="Escape";Oy({id:n,store:$,unselect:xe,nodeRef:G})}else E&&p&&Object.prototype.hasOwnProperty.call(Mi,be.key)&&($.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),he({x:Mi[be.key].x,y:Mi[be.key].y,isShiftPressed:be.shiftKey}))};S.useEffect(()=>()=>{Z.current&&(A==null||A.unobserve(Z.current),Z.current=null)},[]),S.useEffect(()=>{if(G.current&&!M){const be=G.current;(!U||!J||Z.current!==be)&&(Z.current&&(A==null||A.unobserve(Z.current)),A==null||A.observe(be),Z.current=be)}},[M,U,J]),S.useEffect(()=>{const be=K.current!==s,xe=D.current!==P,Ke=L.current!==F;G.current&&(be||xe||Ke)&&(be&&(K.current=s),xe&&(D.current=P),Ke&&(L.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,s,P,F]);const ce=qj({nodeRef:G,disabled:M||!E,noDragClassName:T,handleSelector:q,nodeId:n,isSelectable:C,selectNodesOnDrag:O});return M?null:ue.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[Q]:E},k,{selected:p,selectable:C,parent:Y,dragging:ce}]),ref:G,style:{zIndex:W,transform:`translate(${u}px,${h}px)`,pointerEvents:re?"all":"none",visibility:U?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:we,onMouseLeave:Ce,onContextMenu:Ve,onClick:Le,onDoubleClick:Be,onKeyDown:I?Se:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${Rj}-${H}`,"aria-label":X},ue.createElement(JO,{value:n},ue.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:P,targetPosition:F,dragging:ce,dragHandle:q,zIndex:W})))};return t.displayName="NodeWrapper",S.memo(t)};const zP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Ou(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function BP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=it(zP,$t),f=Dj(),g=S.useRef(null);if(S.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),qj({nodeRef:g}),p||!i||!a)return null;const y=e?N=>{const b=s.getState().getNodes().filter(_=>_.selected);e(N,b)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Mi,N.key)&&f({x:Mi[N.key].x,y:Mi[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Ht(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},ue.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var UP=S.memo(BP);const WP=e=>e.nodesSelectionActive,Fj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:b,multiSelectionKeyCode:_,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:P,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:W,minZoom:Y,maxZoom:T,preventScrolling:Q,onSelectionContextMenu:U,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:H})=>{const J=it(WP),$=al(g),G=al(k),Z=G||A,D=G||O,L=$||y&&Z!==!0;return jP({deleteKeyCode:u,multiSelectionKeyCode:_}),ue.createElement(MP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:D,panOnScrollSpeed:P,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:!$&&Z,defaultViewport:q,translateExtent:W,minZoom:Y,maxZoom:T,zoomActivationKeyCode:E,preventScrolling:Q,noWheelClassName:ne,noPanClassName:X},ue.createElement(Pj,{onSelectionStart:N,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:Z,isSelecting:!!L,selectionMode:w},e,J&&ue.createElement(UP,{onSelectionContextMenu:U,noPanClassName:X,disableKeyboardA11y:H})))};Fj.displayName="FlowRenderer";var HP=S.memo(Fj);function GP(e){return it(S.useCallback(n=>e?vj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function VP(e){const t={input:Ba(e.input||Ej),default:Ba(e.default||Iy),output:Ba(e.output||jj),group:Ba(e.group||gw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ba(e[a]||Iy),i),n);return{...t,...s}}const YP=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},KP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),zj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=it(KP,$t),u=GP(e.onlyRenderVisibleElements),h=S.useRef(),p=S.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return h.current=f,f},[]);return S.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:vw},u.map(f=>{var I,O,P;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Qr.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),_=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?uw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(k==null?void 0:k.x)??0,C=(k==null?void 0:k.y)??0,j=YP({x:E,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||qe.Bottom,targetPosition:f.targetPosition||qe.Top,hidden:f.hidden,xPos:E,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:N,isConnectable:b,isFocusable:_,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((I=f[Et])==null?void 0:I.z)??0,isParent:!!((O=f[Et])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((P=f[Et])!=null&&P.handleBounds)})}))};zj.displayName="NodeRenderer";var XP=S.memo(zj);const QP=(e,t,n)=>n===qe.Left?e-t:n===qe.Right?e+t:e,ZP=(e,t,n)=>n===qe.Top?e-t:n===qe.Bottom?e+t:e,zb="react-flow__edgeupdater",Bb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>ue.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Ht([zb,`${zb}-${u}`]),cx:QP(t,s,e),cy:ZP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),JP=()=>!0;var _i=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,style:_,source:k,target:E,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:F,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:W,onContextMenu:Y,onMouseEnter:T,onMouseMove:Q,onMouseLeave:U,reconnectRadius:ne,onReconnect:X,onReconnectStart:H,onReconnectEnd:J,markerEnd:$,markerStart:G,rfId:Z,ariaLabel:D,isFocusable:L,isReconnectable:K,pathOptions:re,interactionWidth:he,disableKeyboardA11y:pe})=>{const we=S.useRef(null),[Ce,Ve]=S.useState(!1),[Be,Le]=S.useState(!1),Se=At(),ce=S.useMemo(()=>`url('#${Ay(G,Z)}')`,[G,Z]),be=S.useMemo(()=>`url('#${Ay($,Z)}')`,[$,Z]);if(A)return null;const xe=Oe=>{var Me;const{edges:Pe,addSelectedEdges:Te,unselectNodesAndEdges:Qe,multiSelectionActive:Ct}=Se.getState(),st=Pe.find(bt=>bt.id===n);st&&(M&&(Se.setState({nodesSelectionActive:!1}),st.selected&&Ct?(Qe({nodes:[],edges:[st]}),(Me=we.current)==null||Me.blur()):Te([n])),l&&l(Oe,st))},Ke=Fa(n,Se.getState,u),ut=Fa(n,Se.getState,Y),at=Fa(n,Se.getState,T),de=Fa(n,Se.getState,Q),_e=Fa(n,Se.getState,U),De=(Oe,Pe)=>{if(Oe.button!==0)return;const{edges:Te,isValidConnection:Qe}=Se.getState(),Ct=Pe?E:k,st=(Pe?W:q)||null,Me=Pe?"target":"source",bt=Qe||JP,dt=Pe,St=Te.find(En=>En.id===n);Le(!0),H==null||H(Oe,St,Me);const Nn=En=>{Le(!1),J==null||J(En,St,Me)};_j({event:Oe,handleId:st,nodeId:Ct,onConnect:En=>X==null?void 0:X(St,En),isTarget:dt,getState:Se.getState,setState:Se.setState,isValidConnection:bt,edgeUpdaterType:Me,onReconnectEnd:Nn})},Ge=Oe=>De(Oe,!0),lt=Oe=>De(Oe,!1),je=()=>Ve(!0),We=()=>Ve(!1),Xe=!M&&!l,oe=Oe=>{var Pe;if(!pe&&uj.includes(Oe.key)&&M){const{unselectNodesAndEdges:Te,addSelectedEdges:Qe,edges:Ct}=Se.getState();Oe.key==="Escape"?((Pe=we.current)==null||Pe.blur(),Te({edges:[Ct.find(Me=>Me.id===n)]})):Qe([n])}};return ue.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Xe,updating:Ce}]),onClick:xe,onDoubleClick:Ke,onContextMenu:ut,onMouseEnter:at,onMouseMove:de,onMouseLeave:_e,onKeyDown:L?oe:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":D===null?void 0:D||`Edge from ${k} to ${E}`,"aria-describedby":L?`${Aj}-${Z}`:void 0,ref:we},!Be&&ue.createElement(e,{id:n,source:k,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,data:a,style:_,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:F,sourceHandleId:q,targetHandleId:W,markerStart:ce,markerEnd:be,pathOptions:re,interactionWidth:he}),K&&ue.createElement(ue.Fragment,null,(K==="source"||K===!0)&&ue.createElement(Bb,{position:P,centerX:C,centerY:j,radius:ne,onMouseDown:Ge,onMouseEnter:je,onMouseOut:We,type:"source"}),(K==="target"||K===!0)&&ue.createElement(Bb,{position:F,centerX:I,centerY:O,radius:ne,onMouseDown:lt,onMouseEnter:je,onMouseOut:We,type:"target"})))};return t.displayName="EdgeWrapper",S.memo(t)};function e$(e){const t={default:_i(e.default||yu),straight:_i(e.bezier||hw),step:_i(e.step||fw),smoothstep:_i(e.step||Iu),simplebezier:_i(e.simplebezier||dw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=_i(e[a]||yu),i),n);return{...t,...s}}function Ub(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case qe.Top:return{x:s+a/2,y:i};case qe.Right:return{x:s+a,y:i+l/2};case qe.Bottom:return{x:s+a/2,y:i+l};case qe.Left:return{x:s,y:i+l/2}}}function Wb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const t$=(e,t,n,s,i,a)=>{const l=Ub(n,e,t),u=Ub(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function n$({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=ol({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*y)>0}function Hb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Et])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const r$=[{level:0,isMaxLevel:!0,edges:[]}];function s$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=qn(u.zIndex);let p=h?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Et])==null?void 0:f.z)||0,((g=y==null?void 0:y[Et])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(N?b:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),a=Object.entries(i).map(([l,u])=>{const h=+l;return{edges:u,level:h,isMaxLevel:h===s}});return a.length===0?r$:a}function o$(e,t,n){const s=it(S.useCallback(i=>e?i.edges.filter(a=>{const l=t.get(a.source),u=t.get(a.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&n$({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return s$(s,t,n)}const i$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),a$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Gb={[vu.Arrow]:i$,[vu.ArrowClosed]:a$};function l$(e){const t=At();return S.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Gb,e)?Gb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Qr.error009(e)),null)},[e])}const c$=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const h=l$(t);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},ue.createElement(h,{color:n,strokeWidth:l})):null},u$=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Ay(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},Bj=({defaultColor:e,rfId:t})=>{const n=it(S.useCallback(u$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return ue.createElement("defs",null,n.map(s=>ue.createElement(c$,{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})))};Bj.displayName="MarkerDefinitions";var d$=S.memo(Bj);const f$=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}),Uj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,children:_,disableKeyboardA11y:k})=>{const{edgesFocusable:E,edgesUpdatable:C,elementsSelectable:j,width:I,height:O,connectionMode:P,nodeInternals:F,onError:M}=it(f$,$t),A=o$(t,F,n);return I?ue.createElement(ue.Fragment,null,A.map(({level:q,edges:W,isMaxLevel:Y})=>ue.createElement("svg",{key:q,style:{zIndex:q},width:I,height:O,className:"react-flow__edges react-flow__container"},Y&&ue.createElement(d$,{defaultColor:e,rfId:s}),ue.createElement("g",null,W.map(T=>{const[Q,U,ne]=Hb(F.get(T.source)),[X,H,J]=Hb(F.get(T.target));if(!ne||!J)return null;let $=T.type||"default";i[$]||(M==null||M("011",Qr.error011($)),$="default");const G=i[$]||i.default,Z=P===_o.Strict?H.target:(H.target??[]).concat(H.source??[]),D=Wb(U.source,T.sourceHandle),L=Wb(Z,T.targetHandle),K=(D==null?void 0:D.position)||qe.Bottom,re=(L==null?void 0:L.position)||qe.Top,he=!!(T.focusable||E&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,we=typeof y<"u"&&(pe||C&&typeof pe>"u");if(!D||!L)return M==null||M("008",Qr.error008(D,T)),null;const{sourceX:Ce,sourceY:Ve,targetX:Be,targetY:Le}=t$(Q,D,K,X,L,re);return ue.createElement(G,{key:T.id,id:T.id,className:Ht([T.className,a]),type:$,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:Ce,sourceY:Ve,targetX:Be,targetY:Le,sourcePosition:K,targetPosition:re,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,rfId:s,ariaLabel:T.ariaLabel,isFocusable:he,isReconnectable:we,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:k})})))),_):null};Uj.displayName="EdgeRenderer";var h$=S.memo(Uj);const p$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function m$({children:e}){const t=it(p$);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function g$(e){const t=gl(),n=S.useRef(!1);S.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const v$={[qe.Left]:qe.Right,[qe.Right]:qe.Left,[qe.Top]:qe.Bottom,[qe.Bottom]:qe.Top},Wj=({nodeId:e,handleType:t,style:n,type:s=Rs.Bezier,CustomComponent:i,connectionStatus:a})=>{var O,P,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=it(S.useCallback(M=>({fromNode:M.nodeInternals.get(e),handleId:M.connectionHandleId,toX:(M.connectionPosition.x-M.transform[0])/M.transform[2],toY:(M.connectionPosition.y-M.transform[1])/M.transform[2],connectionMode:M.connectionMode}),[e]),$t),g=(O=l==null?void 0:l[Et])==null?void 0:O.handleBounds;let y=g==null?void 0:g[t];if(f===_o.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=u?y.find(M=>M.id===u):y[0],N=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,_=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+N,k=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,E=w==null?void 0:w.position,C=E?v$[E]:null;if(!E||!C)return null;if(i)return ue.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:_,fromY:k,toX:h,toY:p,fromPosition:E,toPosition:C,connectionStatus:a});let j="";const I={sourceX:_,sourceY:k,sourcePosition:E,targetX:h,targetY:p,targetPosition:C};return s===Rs.Bezier?[j]=mj(I):s===Rs.Step?[j]=Ry({...I,borderRadius:0}):s===Rs.SmoothStep?[j]=Ry(I):s===Rs.SimpleBezier?[j]=pj(I):j=`M${_},${k} ${h},${p}`,ue.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Wj.displayName="ConnectionLine";const y$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function w$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=it(y$,$t);return!(i&&a&&u&&l)?null:ue.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Ht(["react-flow__connection",p])},ue.createElement(Wj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Vb(e,t){return S.useRef(null),At(),S.useMemo(()=>t(e),[e])}const Hj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:b,onSelectionEnd:_,connectionLineType:k,connectionLineStyle:E,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:W,elementsSelectable:Y,selectNodesOnDrag:T,defaultViewport:Q,translateExtent:U,minZoom:ne,maxZoom:X,preventScrolling:H,defaultMarkerColor:J,zoomOnScroll:$,zoomOnPinch:G,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:K,panOnDrag:re,onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:we,onPaneMouseLeave:Ce,onPaneScroll:Ve,onPaneContextMenu:Be,onEdgeContextMenu:Le,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:Ke,onReconnectEnd:ut,reconnectRadius:at,noDragClassName:de,noWheelClassName:_e,noPanClassName:De,elevateEdgesOnSelect:Ge,disableKeyboardA11y:lt,nodeOrigin:je,nodeExtent:We,rfId:Xe})=>{const oe=Vb(e,VP),Oe=Vb(t,e$);return g$(a),ue.createElement(HP,{onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:we,onPaneMouseLeave:Ce,onPaneContextMenu:Be,onPaneScroll:Ve,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,onSelectionStart:b,onSelectionEnd:_,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:Y,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:G,zoomOnDoubleClick:K,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:re,defaultViewport:Q,translateExtent:U,minZoom:ne,maxZoom:X,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:de,noWheelClassName:_e,noPanClassName:De,disableKeyboardA11y:lt},ue.createElement(m$,null,ue.createElement(h$,{edgeTypes:Oe,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:W,onEdgeContextMenu:Le,onEdgeMouseEnter:Se,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:Ke,onReconnectEnd:ut,reconnectRadius:at,defaultMarkerColor:J,noPanClassName:De,elevateEdgesOnSelect:!!Ge,disableKeyboardA11y:lt,rfId:Xe},ue.createElement(w$,{style:E,type:k,component:C,containerStyle:j})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(XP,{nodeTypes:oe,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:W,noPanClassName:De,noDragClassName:de,disableKeyboardA11y:lt,nodeOrigin:je,nodeExtent:We,rfId:Xe})))};Hj.displayName="GraphView";var x$=S.memo(Hj);const Py=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Cs={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:Py,nodeExtent:Py,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_o.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:VO,isValidConnection:void 0},b$=()=>l2((e,t)=>({...Cs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Wf(n,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",a=typeof s<"u",l=i?Wf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,_)=>{const k=i.get(_.id);if(k!=null&&k.hidden)i.set(k.id,{...k,[Et]:{...k[Et],handleBounds:void 0}});else if(k){const E=cw(_.nodeElement);!!(E.width&&E.height&&(k.width!==E.width||k.height!==E.height||_.forceUpdate))&&(i.set(k.id,{...k,[Et]:{...k[Et],handleBounds:{source:Fb(".source",_.nodeElement,y,p),target:Fb(".target",_.nodeElement,y,p)}},...E}),b.push({id:k.id,type:"dimensions",dimensions:E}))}return b},[]);Ij(i,p);const N=l||a&&!l&&Oj(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),l=n.map(u=>{const h={id:u.id,type:"position",dragging:i};return s&&(h.positionAbsolute=u.positionAbsolute,h.position=u.position),h});a(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(a){const p=$P(n,u()),f=Wf(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=Ci(a(),n),u=Ci(i,[])),Gc({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=Ci(i,n),u=Ci(a(),[])),Gc({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,Ts(f.id,!1))),p=u.map(f=>Ts(f.id,!1));Gc({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,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(),a=s().filter(u=>u.selected).map(u=>Ts(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ts(u.id,!1));Gc({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=uw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Kr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Cs.connectionNodeId,connectionHandleId:Cs.connectionHandleId,connectionHandleType:Cs.connectionHandleType,connectionStatus:Cs.connectionStatus,connectionStartHandle:Cs.connectionStartHandle,connectionEndHandle:Cs.connectionEndHandle}),reset:()=>e({...Cs})}),Object.is),yw=({children:e})=>{const t=S.useRef(null);return t.current||(t.current=b$()),ue.createElement(FO,{value:t.current},e)};yw.displayName="ReactFlowProvider";const Gj=({children:e})=>S.useContext(Mu)?ue.createElement(ue.Fragment,null,e):ue.createElement(yw,null,e);Gj.displayName="ReactFlowWrapper";const _$={input:Ej,default:Iy,output:jj,group:gw},k$={default:yu,straight:hw,step:fw,smoothstep:Iu,simplebezier:dw},S$=[0,0],N$=[15,15],E$={x:0,y:0,zoom:1},C$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Vj=S.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=_$,edgeTypes:l=k$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:P,onNodeDrag:F,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:W,onSelectionDragStart:Y,onSelectionDrag:T,onSelectionDragStop:Q,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,connectionMode:H=_o.Strict,connectionLineType:J=Rs.Bezier,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Z,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:K=!1,selectionMode:re=il.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:pe=gu()?"Meta":"Control",zoomActivationKeyCode:we=gu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:Ve=N$,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:Le=!0,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:xe=S$,edgesFocusable:Ke,edgesUpdatable:ut,elementsSelectable:at,defaultViewport:de=E$,minZoom:_e=.5,maxZoom:De=2,translateExtent:Ge=Py,preventScrolling:lt=!0,nodeExtent:je,defaultMarkerColor:We="#b1b1b7",zoomOnScroll:Xe=!0,zoomOnPinch:oe=!0,panOnScroll:Oe=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:Te=yo.Free,zoomOnDoubleClick:Qe=!0,panOnDrag:Ct=!0,onPaneClick:st,onPaneMouseEnter:Me,onPaneMouseMove:bt,onPaneMouseLeave:dt,onPaneScroll:St,onPaneContextMenu:Nn,children:zn,onEdgeContextMenu:En,onEdgeDoubleClick:Co,onEdgeMouseEnter:gn,onEdgeMouseMove:jo,onEdgeMouseLeave:To,onEdgeUpdate:Bt,onEdgeUpdateStart:jr,onEdgeUpdateEnd:Bn,onReconnect:Ps,onReconnectStart:Tr,onReconnectEnd:Qi,reconnectRadius:fr=10,edgeUpdaterRadius:Rr=10,onNodesChange:hr,onEdgesChange:es,noDragClassName:Ro="nodrag",noWheelClassName:Ao="nowheel",noPanClassName:Mo="nopan",fitView:Cn=!1,fitViewOptions:Io,connectOnClick:Ar=!0,attributionPosition:Oo,proOptions:Un,defaultEdgeOptions:Po,elevateNodesOnSelect:$s=!0,elevateEdgesOnSelect:Ls=!1,disableKeyboardA11y:$o=!1,autoPanOnConnect:Lo=!0,autoPanOnNodeDrag:ot=!0,connectionRadius:Zi=20,isValidConnection:ts,onError:Gt,style:Wn,id:qo,nodeDragThreshold:ns,...gt},sn)=>{const Hn=qo||"1";return ue.createElement("div",{...gt,style:{...Wn,...C$},ref:sn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:qo},ue.createElement(Gj,null,ue.createElement(x$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Z,selectionKeyCode:L,selectionOnDrag:K,selectionMode:re,deleteKeyCode:D,multiSelectionKeyCode:pe,panActivationKeyCode:he,zoomActivationKeyCode:we,onlyRenderVisibleElements:Be,selectNodesOnDrag:Le,defaultViewport:de,translateExtent:Ge,minZoom:_e,maxZoom:De,preventScrolling:lt,zoomOnScroll:Xe,zoomOnPinch:oe,zoomOnDoubleClick:Qe,panOnScroll:Oe,panOnScrollSpeed:Pe,panOnScrollMode:Te,panOnDrag:Ct,onPaneClick:st,onPaneMouseEnter:Me,onPaneMouseMove:bt,onPaneMouseLeave:dt,onPaneScroll:St,onPaneContextMenu:Nn,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:En,onEdgeDoubleClick:Co,onEdgeMouseEnter:gn,onEdgeMouseMove:jo,onEdgeMouseLeave:To,onReconnect:Ps??Bt,onReconnectStart:Tr??jr,onReconnectEnd:Qi??Bn,reconnectRadius:fr??Rr,defaultMarkerColor:We,noDragClassName:Ro,noWheelClassName:Ao,noPanClassName:Mo,elevateEdgesOnSelect:Ls,rfId:Hn,disableKeyboardA11y:$o,nodeOrigin:xe,nodeExtent:je}),ue.createElement(gP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,nodesDraggable:Se,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:Ke,edgesUpdatable:ut,elementsSelectable:at,elevateNodesOnSelect:$s,minZoom:_e,maxZoom:De,nodeExtent:je,onNodesChange:hr,onEdgesChange:es,snapToGrid:Ce,snapGrid:Ve,connectionMode:H,translateExtent:Ge,connectOnClick:Ar,defaultEdgeOptions:Po,fitView:Cn,fitViewOptions:Io,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:F,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:Y,onSelectionDragStop:Q,noPanClassName:Mo,nodeOrigin:xe,rfId:Hn,autoPanOnConnect:Lo,autoPanOnNodeDrag:ot,onError:Gt,connectionRadius:Zi,isValidConnection:ts,nodeDragThreshold:ns}),ue.createElement(pP,{onSelectionChange:W}),zn,ue.createElement(BO,{proOptions:Un,position:Oo}),ue.createElement(bP,{rfId:Hn,disableKeyboardA11y:$o})))});Vj.displayName="ReactFlow";const j$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Yj(){return it(j$,$t)}const Kj=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:y,selected:w})=>{const{background:N,backgroundColor:b}=a||{},_=l||N||b;return ue.createElement("rect",{className:Ht(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:_,stroke:u,strokeWidth:h,shapeRendering:g,onClick:y?k=>y(k,e):void 0})};Kj.displayName="MiniMapNode";var T$=S.memo(Kj);const R$=e=>e.nodeOrigin,A$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Yf=e=>e instanceof Function?e:()=>e;function M$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=T$,onClick:l}){const u=it(A$,$t),h=it(R$),p=Yf(t),f=Yf(e),g=Yf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,u.map(w=>{const{x:N,y:b}=xo(w,h).positionAbsolute;return ue.createElement(a,{key:w.id,x:N,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:y,onClick:l,id:w.id})}))}var I$=S.memo(M$);const O$=200,P$=150,$$=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?HO(Ou(t,e.nodeOrigin),n):n,rfId:e.rfId}},L$="react-flow__minimap-desc";function Xj({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:b=!1,ariaLabel:_="React Flow mini map",inversePan:k=!1,zoomStep:E=10,offsetScale:C=5}){const j=At(),I=S.useRef(null),{boundingRect:O,viewBB:P,rfId:F}=it($$,$t),M=(e==null?void 0:e.width)??O$,A=(e==null?void 0:e.height)??P$,q=O.width/M,W=O.height/A,Y=Math.max(q,W),T=Y*M,Q=Y*A,U=C*Y,ne=O.x-(T-O.width)/2-U,X=O.y-(Q-O.height)/2-U,H=T+U*2,J=Q+U*2,$=`${L$}-${F}`,G=S.useRef(0);G.current=Y,S.useEffect(()=>{if(I.current){const L=Ln(I.current),K=pe=>{const{transform:we,d3Selection:Ce,d3Zoom:Ve}=j.getState();if(pe.sourceEvent.type!=="wheel"||!Ce||!Ve)return;const Be=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Le=we[2]*Math.pow(2,Be);Ve.scaleTo(Ce,Le)},re=pe=>{const{transform:we,d3Selection:Ce,d3Zoom:Ve,translateExtent:Be,width:Le,height:Se}=j.getState();if(pe.sourceEvent.type!=="mousemove"||!Ce||!Ve)return;const ce=G.current*Math.max(1,we[2])*(k?-1:1),be={x:we[0]-pe.sourceEvent.movementX*ce,y:we[1]-pe.sourceEvent.movementY*ce},xe=[[0,0],[Le,Se]],Ke=Kr.translate(be.x,be.y).scale(we[2]),ut=Ve.constrain()(Ke,xe,Be);Ve.transform(Ce,ut)},he=sj().on("zoom",N?re:null).on("zoom.wheel",b?K:null);return L.call(he),()=>{L.on("zoom",null)}}},[N,b,k,E]);const Z=y?L=>{const K=sr(L);y(L,{x:K[0],y:K[1]})}:void 0,D=w?(L,K)=>{const re=j.getState().nodeInternals.get(K);w(L,re)}:void 0;return ue.createElement(lw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:M,height:A,viewBox:`${ne} ${X} ${H} ${J}`,role:"img","aria-labelledby":$,ref:I,onClick:Z},_&&ue.createElement("title",{id:$},_),ue.createElement(I$,{onClick:D,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-U},${X-U}h${H+U*2}v${J+U*2}h${-H-U*2}z
|
|
57
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}Xj.displayName="MiniMap";var q$=S.memo(Xj);function D$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function F$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function z$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.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 B$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.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 U$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Sr=({children:e,className:t,...n})=>ue.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Sr.displayName="ControlButton";const W$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Qj=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const y=At(),[w,N]=S.useState(!1),{isInteractive:b,minZoomReached:_,maxZoomReached:k}=it(W$,$t),{zoomIn:E,zoomOut:C,fitView:j}=gl();if(S.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},O=()=>{C(),l==null||l()},P=()=>{j(i),u==null||u()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return ue.createElement(lw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement(Sr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ue.createElement(D$,null)),ue.createElement(Sr,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},ue.createElement(F$,null))),n&&ue.createElement(Sr,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},ue.createElement(z$,null)),s&&ue.createElement(Sr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?ue.createElement(U$,null):ue.createElement(B$,null)),f)};Qj.displayName="Controls";var H$=S.memo(Qj),lr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(lr||(lr={}));function G$({color:e,dimensions:t,lineWidth:n}){return ue.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function V$({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const Y$={[lr.Dots]:"#91919a",[lr.Lines]:"#eee",[lr.Cross]:"#e2e2e2"},K$={[lr.Dots]:1,[lr.Lines]:1,[lr.Cross]:6},X$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zj({id:e,variant:t=lr.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=S.useRef(null),{transform:f,patternId:g}=it(X$,$t),y=l||Y$[t],w=s||K$[t],N=t===lr.Dots,b=t===lr.Cross,_=Array.isArray(n)?n:[n,n],k=[_[0]*f[2]||1,_[1]*f[2]||1],E=w*f[2],C=b?[E,E]:k,j=N?[E/a,E/a]:[C[0]/a,C[1]/a];return ue.createElement("svg",{className:Ht(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:g+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},N?ue.createElement(V$,{color:y,radius:E/a}):ue.createElement(G$,{dimensions:C,color:y,lineWidth:i})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}Zj.displayName="Background";var Q$=S.memo(Zj);const Z$=["us-gov","global","apac","us","eu","jp","au"],J$=new RegExp(`^(?:(?:${Z$.join("|")})\\.)?anthropic\\.`,"i");function vl(e){return e.replace(J$,"")}function Jj(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function ww(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function eL(e){const t=ww(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 tL(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]=eL(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),...ww(n)};for(const s of Object.values(n)){const i=eT(s,t+1);if(i)return i}return null}const nL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function tT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&nL.test(vl(n.model)))return n.model;for(const s of Object.values(n)){const i=tT(s,t+1);if(i)return i}return null}function $y(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ms(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Yb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function yl(e,t){return`${e}::${t}`}function wu(e){return e.agent_type??e.subagent_type??"subagent"}function Za(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function ji(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:Jj()},e.agents.set(i,a),a)}function nT(e,t,n,s){const i=yl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Ms(s.cwd));const l=wu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function rL(e,t,n){const s=t.session_id??"unknown",i=Za(t);if(i){const h=nT(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(yl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Ms(t.cwd)),h}const u=ji(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ms(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ms(t.cwd)??"session"),u}function sL(e,t,n,s,i){const a=yl(t,n),l=ji(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Ms(s.cwd));const h=wu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:wu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ms(s.cwd),toolCount:0,childCount:0,usage:Jj()},e.agents.set(a,u),l.childCount+=1,u}function oL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function iL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let i=s.length-1;i>=0;i--)if(s[i]===n){s.splice(i,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Yc(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 Kb=200,aL=25;function lL(e,t){const n=t.tools;if(n.length>Kb){const s=n.splice(0,n.length-Kb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-aL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function cL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const Xb=2e3;function uL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Xb)return!1;if(i.text===n&&i.at<=t+Xb)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 wl(e,t){return t&&(e.revision+=1),t}function dL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(rT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return wl(e,u>0)}function fL(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&rT(e,g),e.agents.delete(f)}u--,h=!0}return wl(e,h)}function hL(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 i=n==null?void 0:n.tool_use_id;return typeof i=="string"&&i.length>0&&e.toolIndex.has(i)}function pL(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 wl(e,t)}function mL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return wl(e,s)}const Qb=90*6e4;function gL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return wl(e,s)}function vL(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const yL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function wL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n==null?void 0:n.explicitSubagentId}function xL(e,t,n,s,i){const a=n==="permission"?wL(e,t):void 0;return a?{kind:n,message:s,since:i,subagentId:a}:{kind:n,message:s,since:i}}function bL(e,t,n){if(e.kind!=="permission")return!0;const s=Za(t);return s==null?!0:e.subagentId!=null&&yl(n,s)===e.subagentId}function Zb(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??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...$y(),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(!yL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&bL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Yb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(l);y&&(y.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${y}`,b=e.agents.get(N);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const y=g.context??Yb(),w=(b,_)=>typeof f[b]=="number"?f[b]:_,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),y&&(f.sessionTitle=y);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=ww(f);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=tL(s.usageByModel)}}return e}const h=rL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=tT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=ji(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Ms(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Ms(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<i&&(y.exitAt=i);const f=ji(e,l,i,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!uL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=Yc(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?cL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Yc(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Za(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:Yc(s.tool_input),agentId:h.id,explicitSubagentId:y?yl(l,y):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),lL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),y=!1;if(!g)for(const N of e.agents.values()){const b=N.tools.find(_=>_.id===f);if(b){g=b,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=Yc(s.tool_response):y&&(g.errorPreview=void 0);const w=eT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Za(s);if(!f)break;const g=sL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const y=wu(s);y&&(g.label=y),oL(e,l,f);break}case"SubagentStop":{const f=Za(s);if(!f)break;const g=nT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,iL(e,l,f);break}case"Stop":case"SessionEnd":{const f=ji(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=vL(s.notification_type);if(!f)break;const g=ji(e,l,i,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===y?{...w,since:Math.min(w.since,i)}:xL(e,l,f,y,i);break}}return e}function xw(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 _L={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},kL=[{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:_L},{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 SL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Hi(e,t=Date.now()){if(!e)return null;const n=vl(e);for(const s of kL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function sT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function oT(e,t,n=Date.now()){if(!SL(t))return e.inputTokens;const s=Hi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function bw(e,t,n=Date.now()){const s=Hi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=oT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=sT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const Jb=2e5,NL=1e6,EL=[/\[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],CL=[{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 jL(e){if(!e)return Jb;const t=vl(e);for(const n of EL)if(n.test(t))return NL;for(const n of CL)if(n.match.test(t))return n.window;return Jb}function iT(e,t){return typeof e=="number"&&e>0?e:jL(t)}const Ei="not priced";function Ye(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 xu(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Ye(s)}/min`:`${Ye(n*3600)}/hr`}function TL(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 RL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,y)=>Math.max(0,g-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function xl(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(a=>({model:a,usage:t[a]})),i=RL(e.usage,s.map(a=>a.usage));if(i){const a=s.findIndex(l=>l.model===e.model);a>=0?s[a]={model:s[a].model,usage:TL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function pn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of xl(e)){const i=bw(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function Ly(e,t=Date.now()){let n=0;for(const s of xl(e))Hi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function aT(e){const t=[];for(const n of xl(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 lT(e){return aT(e).filter(t=>t!==e.model)}const AL=new Set(["untrusted","on-request","on-failure"]);function ML(e){return typeof e!="string"||!e?null:AL.has(e)?!0:e==="never"?!1:null}function IL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=ML(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 e1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Is(e){const t=vl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=e1(n[1]),a=n[2].replace(/[-_]/g,".");return`${i} ${a}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const i=s[1].replace(/[-_]/g,"."),a=s[2].split(/[-_]/).filter(Boolean).map(e1);return[`GPT-${i}`,...a].join(" ")}return e}function Pu(e){const t=vl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Tt(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function bu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),l=i%60;return`${a}m ${String(l).padStart(2,"0")}s`}function cT(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 uT(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 OL=1,dT=-1;function PL(){const e=[];let t=0;function n(){let s;for(const i of e)(!s||i.layer>s.layer||i.layer===s.layer&&i.seq>s.seq)&&(s=i);return s}return{push(s,i=0){const a={dismiss:s,layer:i,seq:t++};return e.push(a),()=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const i=n();return i!=null&&i.dismiss===s},depth(){return e.length},topIsPanel(){const s=n();return s!=null&&s.layer===dT}}}const Ii=PL();function $L(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function t1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function LL(e,t){return!e||!e.isConnected||t1(e)?!1:t==null||t1(t)}const n1="a[href], button, input, select, textarea, [tabindex]";function qL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function DL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function FL({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 _w(e){return e.ctrlKey||e.metaKey||e.altKey}const zL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),BL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),UL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function fT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function kw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=fT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!zL.has(String(e.type??"text").toLowerCase())}function WL(e){if(!e)return!1;if(kw(e)||BL.has(fT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>UL.has(n))}function HL({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function hT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(n1))return qL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&DL({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(n1)!=null})}):[]}function GL(e,t){const n=hT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(i=>(t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Sn(e,t={}){const{focusRef:n,layer:s}=t,i=S.useRef(null),a=S.useRef(e);a.current=e;const l=S.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return S.useEffect(()=>Ii.push(u,s),[u,s]),S.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??hT(i.current)[0])==null||p.focus(),()=>{LL(h,document.activeElement)&&h.focus()}},[]),S.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||_w(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Ii.isTop(u))return;const w=GL(f,g),N=FL({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((b=w[N.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function VL(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 $n(e){return e.toLocaleString()}function YL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const KL=60;function XL(e,t=KL){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 QL({agent:e,onClose:t}){var y;const n=S.useRef(null),s=Sn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=iT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=pn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=VL(e.provider);return d.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[d.jsxs("header",{className:"ctx-modal-head",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),d.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),d.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("section",{className:"ctx-window-row",children:[d.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),d.jsxs("span",{children:[$n(l)," / ",$n(u)," tok (",g.windowScope,")"]})]})]}),d.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"input tokens",val:$n(a.inputTokens)}),d.jsx(rr,{label:"output tokens",val:$n(a.outputTokens)}),d.jsx(rr,{label:"cache reads",val:$n(a.cacheReadTokens)}),d.jsx(rr,{label:"cache writes",val:$n(a.cacheCreateTokens)}),d.jsx(rr,{label:"cumulative total",val:$n(f)}),d.jsx(rr,{label:"estimated cost",val:Ye(p.total),accent:!0})]}),d.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"user messages",val:$n((i==null?void 0:i.msgsUser)??0)}),d.jsx(rr,{label:"assistant messages",val:$n((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(rr,{label:"tool uses",val:$n((i==null?void 0:i.toolUses)??0)}),d.jsx(rr,{label:"tool results",val:$n((i==null?void 0:i.toolResults)??0)}),d.jsx(rr,{label:"system-reminders",val:$n((i==null?void 0:i.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=i==null?void 0:i.memoryFiles)==null?void 0:y.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:XL(w.path)}),d.jsx("span",{className:"ctx-md-size",children:YL(w.bytes)})]},w.path))})]})})}function rr({label:e,val:t,accent:n}){return d.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[d.jsx("span",{className:"ctx-row-label",children:e}),d.jsx("span",{className:"ctx-row-val",children:t})]})}function ZL({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=iT(n,t),l=Math.min(1,e/a),u=s/2-3,h=s/2,p=2*Math.PI*u,f=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:i,title:`context: ${e.toLocaleString()} / ${a.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:d.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[d.jsx("circle",{cx:h,cy:h,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:h,cy:h,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function r1(e,t){const n=Hi(t);if(!n)return`model: ${t}
|
|
60
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=bw(e,t),l=sT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ye(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Ye(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ye(l.usd5m)}`],h=oT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${Ye(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${Ye(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${Ye(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Ye(a.total)}`].join(`
|
|
61
|
+
`)}function s1(e){const t=xl(e);return t.length<=1?r1(e.usage,e.model):[...t.map(n=>r1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Ye(pn(e).total)}`].join(`
|
|
62
|
+
`)}function JL({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=xw(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
|
|
63
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=lT(e),f=p.length>0?`${e.model}
|
|
64
|
+
spend on this card also covers:
|
|
65
|
+
${p.join(`
|
|
66
|
+
`)}`:e.model,g=uT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Di,{type:"target",position:qe.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(e3,{state:e.state}),d.jsx("span",{className:"label",title:h,children:e.label}),e.synthetic&&d.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),d.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&d.jsx(ZL,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:bu(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":Pu(e.model),title:f,children:[Is(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?d.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&d.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&d.jsx(n3,{waiting:e.waiting,now:n}),(()=>{const w=IL(e);return w?d.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[d.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),d.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&d.jsx(r3,{tools:e.tools,now:n}),d.jsxs("div",{className:"meta",children:[d.jsxs("span",{children:[d.jsx("b",{children:e.toolCount})," tools"]}),i>0&&d.jsxs("span",{className:"inflight-meta",children:[d.jsx("b",{children:i})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&d.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:[d.jsx("b",{children:Tt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Hi(e.model),N=pn(e),b=Ly(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:s1(e),children:Ei});if(N.total<=0)return null;const _=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),k=e.state==="active"?xu(N.total,_):null,E=s1(e)+(k?`
|
|
67
|
+
burn: ${k}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[Ye(N.total),b>0?"+":""]}),k&&d.jsx("span",{className:"cost-rate",children:k})]})})()]}),d.jsx(Di,{type:"source",position:qe.Right,style:{background:"transparent",border:"none"}})]})}function _u(e){return e==="active"?"live":e==="done"?"done":"err"}function e3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:_u(e)})}function $u(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function t3(e){return e.kind==="permission"?$u(e):"Your turn"}function n3({waiting:e,now:t}){const n=e.kind==="permission",s=$u(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
68
|
+
Blocked for ${bu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?d.jsx("span",{className:"ap-pulse","aria-hidden":!0}):d.jsx("span",{className:"waiting-dot","aria-hidden":!0}),d.jsx("span",{className:"waiting-said",children:t3(e)}),d.jsx("b",{children:bu(e.since,void 0,t)})]})}function r3({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const N of e){const b=t-N.startedAt;if(b<0||b>=6e4)continue;const _=23-Math.floor(b/2500);_>=0&&_<24&&(a[_]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,y=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((N,b)=>{const _=N===0?1.5:Math.max(1.5,N/u*f),k=b===23&&N>0,C=`tool-spark-bar${N>0?" active":""}${k?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-_,width:Math.max(.5,g-1),height:_,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function o1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function s3({tool:e,onClose:t}){const n=Sn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:cT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:o1(e.input??e.inputPreview)})]}),d.jsxs("div",{className:"modal-section",children:[d.jsxs("h4",{children:["Response ",s==="err"&&d.jsx("span",{className:"err-tag",children:"error"})]}),d.jsx("pre",{children:e.endedAt==null?"(waiting…)":o1(e.response??e.errorPreview)})]})]})]})})}const Kc=18,i1=26,o3=12;function i3(e){return a3(e.nodeInternals.values())}function a3(e){const t=new Map;for(const i of e){if(i.type!=="agent")continue;const a=i.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||i.width==null||i.height==null)continue;const l=i.position.x,u=i.position.y,h=l+i.width,p=u+i.height,f=t.get(a.sessionId);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),a.kind==="root"&&(f.label=l1(a)??f.label),a.kind==="root"&&(f.name=c1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:l1(a)??a.sessionId,name:c1(a)})}const n=new Map;for(const i of t.values())n.set(i.label,(n.get(i.label)??0)+1);const s=[];for(const[i,a]of t){const l=(n.get(a.label)??0)>1;s.push({sessionId:i,...d3(a.label,a.name,i,l),x:a.minX-Kc,y:a.minY-Kc-i1,w:a.maxX-a.minX+Kc*2,h:a.maxY-a.minY+Kc*2+i1})}return s}const qy=" · ",l3=32,c3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function a1(e){return c3.test(e)?2:1}function u3(e,t=l3){const n=[...e];let s=0;for(const l of n)s+=a1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=a1(l);if(a+u>t-1)break;i.push(l),a+=u}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function d3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?f3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?u3(i):void 0,shortId:a,fullLabel:l.join(qy)}}function f3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function l1(e){if(e.kind==="root")return e.label}function c1(e){if(e.kind==="root")return uT(e.sessionName,e.sessionTitle).face}function h3(){const{x:e,y:t,zoom:n}=Yj(),s=gl(),i=it(i3,p3);if(i.length<=1)return null;const a=u=>{try{const h=s.getNodes().filter(p=>{const f=p.data;return(f==null?void 0:f.sessionId)===u});if(h.length===0)return;s.fitView({padding:.3,duration:500,nodes:h})}catch{}},l={transform:`translate(${e}px, ${t}px) scale(${n})`};return d.jsx("div",{className:"session-clusters",style:l,children:i.map(u=>{const h=xw(u.sessionId),p={position:"absolute",left:u.x,top:u.y,width:u.w,height:u.h,"--session-hue":h},f={position:"absolute",left:u.x+16,top:u.y-o3,transform:`scale(${Math.min(1,n)/(n||1)})`,transformOrigin:"left top","--session-hue":h};return d.jsxs(ue.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:f,title:`Fit view to ${u.fullLabel}
|
|
69
|
+
drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[qy,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?qy+u.shortId:null]})]},u.sessionId)})})}function p3(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.sessionId!==i.sessionId||s.label!==i.label||s.name!==i.name||s.shortId!==i.shortId||s.fullLabel!==i.fullLabel||s.x!==i.x||s.y!==i.y||s.w!==i.w||s.h!==i.h)return!1}return!0}function m3({data:e}){return d.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const bl={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"}},g3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.category])),v3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.emoji])),y3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.label])),w3=new Set(Object.keys(bl)),x3=new Set(Object.entries(bl).filter(([,e])=>e.shell).map(([e])=>e)),u1={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",...g3};function pT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(u1,e)?u1[e]:"other"}const b3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,_3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function k3(e){if(typeof e!="string"||!e)return null;const t=b3.exec(e);if(t){const s=S3(t[2]);if(s.trim())return s}const n=_3.exec(e);return n?n[1]:null}function S3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
70
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const mT=600,N3=4,E3=36,Dy=16,C3=60,j3=6,d1=220,f1=96,T3=28,h1={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:"📡",...v3};function p1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(h1,e)?h1[e]:"✨"}const m1={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 gT(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 gT(n[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[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 i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function R3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=k3(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(i=>/^(-Command|-c)$/i.test(i));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const A3=new Set(["Bash","PowerShell",...x3]),M3=w3;function I3(e,t){return M3.has(e)||e.startsWith("mcp__")?Math.max(f1,34+t.length*7.5):f1}function O3(e,t){if(!A3.has(e))return null;const n=R3(t);if(!n)return null;const s=gT(n);return s?{emoji:Object.hasOwn(m1,s)?m1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const P3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),g1={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:"🗄️"},v1={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 $3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function L3(e){const t=e.toLowerCase();if(Object.hasOwn(v1,t))return v1[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(g1,s))return g1[s]}return"📄"}function q3(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 D3(e,t){if(!P3.has(e))return null;const n=q3(e,t);if(!n)return null;const s=$3(n);return s?{emoji:e==="LS"?"📂":L3(s),label:s,category:"file",detail:n}:null}const y1={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 Sw(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 F3(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 vT(e){const t=e.toLowerCase();return Object.hasOwn(y1,t)?y1[t]:void 0}function z3(e,t){const n=Sw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=vT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function B3(e,t){return O3(e,t)??D3(e,t)??z3(e)}const w1=y3;function yT(e){const t=Sw(e);if(t){const s=vT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:F3(t.server)}}const n=Object.hasOwn(w1,e)?w1[e]:"";return n?{emoji:p1(e),label:n}:{emoji:p1(e),label:e}}function U3(e){let t=null,n="";for(const s of e){const i=Sw(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:yT(n)}function W3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function H3(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/mT)}function G3(e,t){const n=[],s=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const a=e[i];s.has(a.id)||(s.add(a.id),n.push(a))}return n.reverse()}function V3(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>mT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=G3(u.tools,N3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),y=Math.max((g==null?void 0:g.width)??d1,d1),w=(g==null?void 0:g.height)??130,N=h.x,b=h.y,_=N+y,k=b+w/2;p.forEach((E,C)=>{const j=C*E3,I=N+y+C3,O=b+j3+j,P=H3(a,f),F=E.inputPreview??"",M=W3(E),A=P<.999,q=yT(E.name);l.push({id:`${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:q.label,emoji:q.emoji,status:M,category:pT(E.name),mcpHue:q.hue,inputPreview:F,fade:P,fading:A,worldX:I,worldY:O,anchorX:_,anchorY:k,spawnDx:_-I,spawnDy:k-(O+Dy)});const W=B3(E.name,E.input);if(W){const Y=I3(E.name,q.label),T=I+Y+T3,Q=O,U=I+Y,ne=O+Dy;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:W.label,emoji:W.emoji,isSub:!0,status:M,category:W.category,inputPreview:W.detail??F,fade:P,fading:A,worldX:T,worldY:Q,anchorX:U,anchorY:ne,spawnDx:U-T,spawnDy:0})}})}return l}function Y3({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=V3(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(K3,{bursts:f,spotlight:a,onOpenTool:h})}function K3({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=Yj();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+Dy)*a+i,g=u+(p-u)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function wT(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,i=0,a=0;for(const l of e){const u=pn(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,i+=l.usage.cacheReadTokens,a+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:i,cacheCreateTokens:a,sum:n+s}}const X3="spend on this board",Q3="on this board",Z3="board tokens",J3="board cost",ku=`Everything on the board right now, and only that.
|
|
71
|
+
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.
|
|
72
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,xT="session spend";function Nw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(a,l,u)=>{if(a<=0)return null;const h=a/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${h}%`},title:`${u}: ${Ye(a)} (${h.toFixed(0)}%)`},l)},i=t==="lg";return d.jsxs("div",{className:i?"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 eq({state:e,sessionId:t,onClose:n}){const s=S.useMemo(()=>tq(e,t),[e,t]),i=S.useRef(null),a=Sn(n,{focusRef:i});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),d.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),d.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),d.jsx("button",{type:"button",ref:i,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body",children:[d.jsxs("section",{className:"ss-hero",children:[d.jsxs("div",{className:"ss-hero-left",children:[d.jsx("div",{className:"ss-cost-label",children:xT}),d.jsx("div",{className:"ss-cost",children:Ye(s.cost.total)}),s.modelChips.length>0&&d.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>d.jsx("span",{className:"model-chip","data-family":Pu(l),title:l,children:Is(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Nw,{cost:s.cost,size:"lg"}),d.jsxs("div",{className:"ss-cost-legend",children:[d.jsxs("span",{className:"ssl ssl-in",children:["input ",d.jsx("b",{children:Ye(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:Ye(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:Ye(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:Ye(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(ki,{label:"agents",value:s.agentCount}),d.jsx(ki,{label:"subagents",value:s.subagentCount}),d.jsx(ki,{label:"tool calls",value:s.toolCount}),d.jsx(ki,{label:"prompts",value:s.promptCount}),d.jsx(ki,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(ki,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Most-used tools"}),d.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>d.jsxs("div",{className:"ss-tt",children:[d.jsx("span",{className:"ss-tt-name",children:l}),d.jsx("span",{className:"ss-tt-bar",children:d.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),d.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Opening prompt"}),d.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function ki({label:e,value:t,tone:n}){return d.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[d.jsx("div",{className:"ss-stat-value",children:t}),d.jsx("div",{className:"ss-stat-label",children:e})]})}function tq(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);if(s.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,l=new Map;let u=0,h=0,p=0,f=0,g=0,y,w=1/0,N=0;for(const C of s){const j=pn(C);i.input+=j.input,i.output+=j.output,i.cacheRead+=j.cacheRead,i.cacheWrite+=j.cacheWrite,i.total+=j.total;for(const I of aT(C))a.add(I);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!y&&C.prompts.length>0&&(y=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),N=Math.max(N,C.endedAt??Date.now());for(const I of C.tools)l.set(I.name,(l.get(I.name)??0)+1),I.ok===!1&&f++}const b=Math.max(0,N-w),_=Math.floor(b/1e3),k=_<60?`${_}s`:_<3600?`${Math.floor(_/60)}m ${String(_%60).padStart(2,"0")}s`:`${Math.floor(_/3600)}h ${Math.floor(_%3600/60)}m`,E=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:y}}function Ew(e){return(e==null?void 0:e.kind)==="permission"}function nq(e){const t=[];for(const n of e)n.kind==="root"&&Ew(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 rq(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function x1(e){return e.waiting?Ew(e.waiting)?0:1:e.state==="active"?2:3}function sq(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=pn(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;i+=u.toolCount,a+=pn(u).total;const h=u.endedAt??u.startedAt;h>l&&(l=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:i,cost:a,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,i)=>{const a=x1(s),l=x1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function b1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function oq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=S.useMemo(()=>sq(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Ew(h.waiting)).length;return d.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[d.jsxs("div",{className:"sl-header",children:[d.jsxs("h2",{children:["Sessions ",d.jsx("span",{className:"sl-count",children:a.length})]}),u>0&&d.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),l>0&&d.jsxs("span",{className:"sl-live-count",children:[l," live"]}),d.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[a.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(h=>{const p=n.has(h.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[d.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(h.state)}),d.jsxs("div",{className:"sl-row-body",children:[d.jsxs("div",{className:"sl-row-head",children:[d.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&d.jsx("span",{className:"model-chip","data-family":Pu(h.modelId),title:h.modelId,children:Is(h.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&d.jsx("span",{className:"sl-cost",title:xT,children:d.jsx("b",{children:Ye(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:`${$u(h.waiting)}
|
|
73
|
+
Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",b1(h.waiting.since,void 0,t)]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:b1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const iq=e=>1-Math.pow(1-e,5),bT=420;function aq(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 lq(e,t,n,s=bT){return n>=s?t:n<=0?e:e+(t-e)*iq(n/s)}function cq(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!aq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const y=()=>{if(!g)return;const w=i()-p;n(lq(e,t,w)),w<bT&&(f=a(y))};return f=a(y),()=>{g=!1,f&&l(f)}}const Fy={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function _1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=pn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function uq(e,t){if(!e)return Fy;const n={...Fy};for(const[s,i]of t){const a=e.get(s),l={cost:i.cost-((a==null?void 0:a.cost)??0),inputTokens:i.inputTokens-((a==null?void 0:a.inputTokens)??0),outputTokens:i.outputTokens-((a==null?void 0:a.outputTokens)??0),cacheReadTokens:i.cacheReadTokens-((a==null?void 0:a.cacheReadTokens)??0),cacheCreateTokens:i.cacheCreateTokens-((a==null?void 0:a.cacheCreateTokens)??0)};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 zy(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const k1=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function dq(e,t=new Date){return e==="today"?zy(1,t):e==="month"?zy(t.getDate(),t):"20200101"}const _n=e=>typeof e=="number"&&Number.isFinite(e)?e:0,lu=e=>typeof e=="string"?e:"";function _T(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=lu(a==null?void 0:a.modelName);if(!l)continue;let u=n.get(l);u||(u={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,u)),u.cost+=_n(a==null?void 0:a.cost),u.inputTokens+=_n(a==null?void 0:a.inputTokens),u.outputTokens+=_n(a==null?void 0:a.outputTokens),u.cacheReadTokens+=_n(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=_n(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function fq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=lu(i==null?void 0:i.period);if(!a)continue;const l=i==null?void 0:i.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:a,label:t.get(a)??null,agent:lu(i==null?void 0:i.agent)||"claude",cost:_n(i==null?void 0:i.totalCost),tokens:_n(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(lu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function hq(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=_n(t.cacheReadTokens),p=_n(t.cacheCreationTokens),f=_n(t.inputTokens),g=_n(t.outputTokens);return{cost:_n(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:_n(t.totalTokens)||f+g+h+p}}const n=_T(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}const zt="ccdeck";function kT(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 By(e){return kT(Math.floor(e/1e3))}function ST(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function pq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function mq(e,t,n){const s=new Date(e),i=By(t-e);return{label:pq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function NT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function ET(e){return e==null}const Uy="self";function ir(e,t=!1){const n=NT(e?Uy:null,Uy);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ar(e){return ET(e?Uy:null)}function gq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function vq(e){return e==null||e==="BODY"||e==="HTML"}function S1(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 yq(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 Kf="__unknown__";function wq(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const y=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function ho({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,y=s?ST(s,l):null,w=s&&i?wq(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[y?d.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const xq=6e4;function bq(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!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,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),xq),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function _q(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function kq(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const CT=6e4,N1=6e4;function Sq(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!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,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),CT),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function Nq(e){const[t,n]=S.useState(null),s=S.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return S.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,CT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function Eq(e,t){const[n,s]=S.useState(null),[i,a]=S.useState(!1),[l,u]=S.useState(0),h=S.useRef(0);S.useEffect(()=>{const f=()=>document.visibilityState==="visible",g=()=>{f()&&u(N=>N+1)},y=window.setInterval(g,N1),w=()=>{f()&&Date.now()-h.current>=N1&&u(N=>N+1)};return document.addEventListener("visibilitychange",w),()=>{window.clearInterval(y),document.removeEventListener("visibilitychange",w)}},[]);const p=S.useRef(t);return S.useEffect(()=>{let f=!0;const g=t!==p.current;p.current=t;const y=e,w=dq(y);return a(!0),fetch(`/api/ccusage?since=${w}${g?"&refresh=1":""}`).then(N=>N.ok?N.json():null).then(N=>{f&&(N!=null&&N.ok)&&(h.current=Date.now(),s({period:y,data:N}))}).catch(()=>{}).finally(()=>{f&&a(!1)}),()=>{f=!1}},[e,t,l]),{data:(n==null?void 0:n.data)??null,shown:(n==null?void 0:n.period)??null,loading:i,stale:n!=null&&n.period!==e}}function Ua(e){const[t,n]=S.useState(e),s=S.useRef(e),i=S.useRef(!0);return S.useEffect(()=>{s.current=t},[t]),S.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return cq(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function Cq({state:e,now:t,providers:n,onClose:s}){var Ke,ut,at;const{quota:i,loading:a,refresh:l}=bq(n.claude),{data:u,loading:h,refresh:p}=Sq(n.codex),{data:f}=Nq(n.codex),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3));S.useEffect(()=>{const de=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(de)},[]);const{byModel:w,totalCost:N,totalTokens:b,burnRate:_}=S.useMemo(()=>{const de=new Map;for(const We of e.agents.values())for(const Xe of xl(We)){const oe=Xe.model??Kf,Oe=bw(Xe.usage,Xe.model),Pe=de.get(oe);Pe?(Pe.inputTokens+=Xe.usage.inputTokens,Pe.outputTokens+=Xe.usage.outputTokens,Pe.cacheReadTokens+=Xe.usage.cacheReadTokens,Pe.cacheCreateTokens+=Xe.usage.cacheCreateTokens,Pe.cost.total+=Oe.total,Pe.cost.input+=Oe.input,Pe.cost.output+=Oe.output,Pe.cost.cacheRead+=Oe.cacheRead,Pe.cost.cacheWrite+=Oe.cacheWrite,Pe.agentCount++):de.set(oe,{model:oe,inputTokens:Xe.usage.inputTokens,outputTokens:Xe.usage.outputTokens,cacheReadTokens:Xe.usage.cacheReadTokens,cacheCreateTokens:Xe.usage.cacheCreateTokens,cost:{...Oe},agentCount:1,priced:Hi(Xe.model)!=null})}const _e=Array.from(de.values()).sort((We,Xe)=>Xe.cost.total-We.cost.total||Xe.inputTokens+Xe.outputTokens-(We.inputTokens+We.outputTokens));let De=0,Ge=0;for(const We of e.agents.values()){if(We.state!=="active")continue;const Xe=pn(We);De+=Xe.total,Ge=Math.max(Ge,((We.endedAt??t)-We.startedAt)/1e3)}const lt=Ge>0?xu(De,Ge):null,je=wT(e.agents.values());return{byModel:_e,totalCost:je.cost,totalTokens:je,burnRate:lt}},[e,e.revision,t]),k=S.useMemo(()=>{const de=[];for(const _e of e.agents.values()){if(_e.kind!=="root")continue;let De=pn(_e).total,Ge=_e.usage.inputTokens,lt=_e.usage.outputTokens,je=Ly(_e);for(const We of e.agents.values())We.sessionId!==_e.sessionId||We.kind==="root"||(De+=pn(We).total,Ge+=We.usage.inputTokens,lt+=We.usage.outputTokens,je+=Ly(We));de.push({sessionId:_e.sessionId,label:_e.label||_e.cwdBasename||"session",state:_e.state,cost:De,inputTokens:Ge,outputTokens:lt,unpricedTokens:je})}return de.sort((_e,De)=>De.cost-_e.cost||De.inputTokens+De.outputTokens-(_e.inputTokens+_e.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=S.useState("today"),[j,I]=S.useState(0),{data:O,shown:P,stale:F}=Eq(E,j),M=O!=null,A=S.useMemo(()=>{const de=new Map;for(const _e of e.agents.values()){if(_e.kind!=="root"||!_e.sessionId)continue;const De=_e.label||_e.cwdBasename;De&&de.set(_e.sessionId,De)}return de},[e,e.revision]),q=S.useMemo(()=>{const de=new Map;for(const _e of e.agents.values())_e.kind!=="root"||!_e.sessionId||de.set(_e.sessionId,_e.state);return de},[e,e.revision]),W=S.useMemo(()=>M?_T(O):[],[O,M]),Y=S.useMemo(()=>{if(!M)return[];const de=fq(O,A).slice(0,12),_e=new Map;for(const De of de)De.label&&_e.set(De.label,(_e.get(De.label)??0)+1);return de.map(De=>De.label&&(_e.get(De.label)??0)>1?{...De,label:`${De.label} ${De.sessionId.slice(0,4)}`}:De)},[O,M,A]),T=S.useMemo(()=>hq(O),[O]),Q=((Ke=k1.find(de=>de.key===(P??E)))==null?void 0:Ke.noun)??"today",U=F?" up-stale":"",ne=M?T.cost>0:N.total>0,X=M?T.tokens:b.sum,H=S.useRef(null);S.useEffect(()=>{H.current=O?_1(e.agents.values(),t):null},[O]);const J=S.useMemo(()=>M?uq(H.current,_1(e.agents.values(),t)):Fy,[e,e.revision,O,M,t]),$=M?T.cost+J.cost:N.total,G=M?T.inputTokens+J.inputTokens:b.inputTokens,Z=M?T.outputTokens+J.outputTokens:b.outputTokens,D=M?T.cacheReadTokens+J.cacheReadTokens:b.cacheReadTokens,L=M?T.cacheCreateTokens+J.cacheCreateTokens:b.cacheCreateTokens,K=Ua($),re=Ua(G),he=Ua(Z),pe=Ua(D),we=Ua(L),Ce=w.filter(de=>de.cost.total>0||de.inputTokens+de.outputTokens>0),Ve=k.filter(de=>de.cost>0||de.inputTokens+de.outputTokens>0),Be=M?W.some(de=>de.cost<=0&&de.tokens>0):Ce.some(de=>!de.priced),Le=a||h,Se=S1(i==null?void 0:i.fetchedAt,g),ce=S1(u==null?void 0:u.fetchedAt,g),be=()=>{l(),p(),I(de=>de+1)},xe=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),_&&d.jsx("span",{className:"up-rate",children:_}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:be,...ir(Le),"aria-label":xe,title:xe,children:Le?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Claude quota",Se&&!a&&d.jsx("span",{className:"up-section-age",title:yq(i==null?void 0:i.source),children:Se})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(ho,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(ho,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(ho,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(ho,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:_q(i.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&d.jsx("span",{className:"up-plan-badge",children:u.planLabel}),ce&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:ce})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(ut=u.windows)==null?void 0:ut.map(de=>d.jsx(ho,{label:de.label,pct:de.pct,reset:de.reset??void 0,resetAt:de.resetAt??void 0,windowSec:de.windowSec??void 0,limitReached:u.limitReached&&de.pct>=100,nowSec:g},de.id)),(at=u.extraWindows)==null?void 0:at.map(de=>d.jsx(ho,{label:de.label,pct:de.pct,reset:de.reset??void 0,resetAt:de.resetAt??void 0,windowSec:de.windowSec??void 0,nowSec:g},de.id)),u.creditLimit&&d.jsx(ho,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:kq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
|
|
74
|
+
last 5h: ${Tt(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[Tt(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),M&&d.jsx("div",{className:"uh-range up-period",role:"group","aria-label":"Period",children:k1.map(de=>d.jsx("button",{type:"button","aria-pressed":E===de.key,className:"uh-range-btn",onClick:()=>C(de.key),children:de.label},de.key))}),X>0?d.jsxs(d.Fragment,{children:[ne&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${U}`,title:M?void 0:ku,children:[d.jsx("span",{className:"up-total-value",children:Ye(K)}),d.jsx("span",{className:"up-total-label",children:M?Q:X3})]}),!M&&d.jsx(Nw,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${U}`,title:M?void 0:ku,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Tt(re)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Tt(he)]}),D>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Tt(pe)]}),L>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Tt(we)]}),!ne&&d.jsx("span",{className:"up-tok up-scope",children:Q3})]}),(M?W.length:Ce.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:M?W.map(de=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:de.model,children:Is(de.model)}),d.jsx("td",{className:"up-num",children:Tt(de.tokens)}),de.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:Ye(de.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},de.model)):Ce.map(de=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:de.model===Kf?"no model reported yet":de.model,children:de.model===Kf?"unknown":Is(de.model)}),d.jsx("td",{className:"up-num",children:Tt(de.inputTokens+de.outputTokens)}),de.priced?d.jsx("td",{className:"up-num up-cost-val",children:Ye(de.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},de.model))})]})]}),M&&Y.length===0&&T.tokens>0&&d.jsxs("section",{className:"up-section",children:[d.jsx("h3",{className:"up-section-title",children:"By session"}),d.jsxs("div",{className:"up-hint",children:["No session is dated ",Q," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?Y.length:Ve.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Q}, each showing what that session has cost since it started.
|
|
75
|
+
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 ",Q]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&Y.map(de=>{const _e=q.get(de.sessionId);return d.jsxs("div",{className:"up-session-row",children:[_e?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${_e}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(_e)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${de.label?"":" up-session-id"}`,title:de.label?`${de.label}
|
|
76
|
+
${de.sessionId}`:de.sessionId,children:de.label??de.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Tt(de.tokens)}),de.cost>0?d.jsx("span",{className:"up-session-cost",title:de.models.join(", ")||void 0,children:Ye(de.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},de.sessionId)}),!M&&Ve.map(de=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${de.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(de.state)}),d.jsx("span",{className:"up-session-label",children:de.label}),d.jsx("span",{className:"up-session-tokens",children:Tt(de.inputTokens+de.outputTokens)}),de.cost>0?d.jsxs("span",{className:"up-session-cost",title:de.unpricedTokens>0?`${Tt(de.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Ye(de.cost),de.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},de.sessionId))]})]}),Be&&d.jsxs("div",{className:"up-hint",children:["“",Ei,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):d.jsx("div",{className:"up-empty",children:M?d.jsxs(d.Fragment,{children:["No usage ",Q,".",d.jsx("br",{}),"Try a longer period."]}):d.jsxs(d.Fragment,{children:["No usage data yet.",d.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const jq="1",E1="agent-dag.schema",Tq=["agent-dag.layout","agent-dag.viewport"];function Lu(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Rq(e,t=jq){let n=null;try{n=e.getItem(E1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of Tq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(E1,t)}catch{}return s}const wt={l:30,r:6,t:6,b:2},qu=104,Aq=64;function mo(e,t=100,n=qu){const s=n-wt.t-wt.b;return wt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function Mq(e,t,n,s=100,i=qu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-wt.l-wt.r;return wt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${mo(p.v,s,i).toFixed(1)}`,h=p}return u}function Iq(e,t,n,s=100,i=qu){if(e.length<2)return"";const a=i-wt.b,l=e[e.length-1].t-e[0].t,u=t-wt.l-wt.r,h=y=>wt.l+(l>0?u*(y-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let y=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)y+=`L${h(w.t).toFixed(1)} ${mo(w.v,s,i).toFixed(1)}`;p+=`${y}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const y of e)f.length&&y.t-f[f.length-1].t>n*2&&g(),f.push(y);return g(),p}function Oq(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 Pq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function $q(e,t,n=s=>Ja(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function Ja(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function jT(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),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function Lq({group:e,title:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(null);S.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=S.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return aw.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",Ja(u)," · ",jT(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(qq,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function qq({series:e,stepMs:t}){const n=S.useRef(null),[s,i]=S.useState(560),[a,l]=S.useState(null);S.useEffect(()=>{const P=n.current;if(!P||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return F.observe(P),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:y,restsAtZero:w}=e,N=w?Aq:qu,{now:b,peak:_}=Oq(u),k=h==="C"?"°C":h,E=g==="Throttling"?$q(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,I=P=>{const F=s-wt.l-wt.r;return wt.l+(j>0?F*(P-u[0].t)/j:F/2)},O=P=>{if(u.length<2)return;const F=P.currentTarget.getBoundingClientRect(),M=(P.clientX-F.left-wt.l)/Math.max(1,F.width-wt.l-wt.r),A=u[0].t+j*Math.max(0,Math.min(1,M));let q=0;for(let W=1;W<u.length;W++)Math.abs(u[W].t-A)<Math.abs(u[q].t-A)&&(q=W);l(q)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[k," now"]})]}),_!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Pq(_,p,f),children:_}),d.jsxs("span",{children:[k," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${k} now, peak ${_}${k}, over ${jT(u[0].t,u[u.length-1].t)}`,onPointerMove:O,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([P,F])=>F==null||F>y?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${P}`,x1:wt.l,x2:s-wt.r,y1:mo(F,y,N),y2:mo(F,y,N)}),d.jsx("text",{className:`hist-rule-tag ${P}`,x:2,y:mo(F,y,N)+3,children:F})]},P)),d.jsx("line",{className:"hist-floor",x1:wt.l,x2:s-wt.r,y1:N-wt.b,y2:N-wt.b}),d.jsx("path",{className:"hist-area",d:Iq(u,s,t,y,N)}),d.jsx("path",{className:"hist-line",d:Mq(u,s,t,y,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:mo(u[0].v,y,N),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(C.t),x2:I(C.t),y1:wt.t,y2:N-wt.b}),d.jsx("circle",{className:"hist-dot",cx:I(C.t),cy:mo(C.v,y,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[Ja(C.t)," — ",d.jsx("b",{children:C.v}),k]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?Ja(u[0].t):""}),d.jsx("span",{children:u.length?Ja(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function Dq({procs:e,total:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(TT),l=Wy(e,i);return aw.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Oi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Oi,{col:"name",label:"process",sort:i,onSort:a})]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:u.mem.toFixed(1)}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsx("td",{className:"pl-name",children:u.name})]},u.pid))})]})}),d.jsx("div",{className:"pl-foot",children:"The busiest by processor and by memory, refreshed every four seconds. Not every process on the machine."})]})}),document.body)}const Fq=3e3,zq=4e3,Xf=20,Wa=36,Si=8,Bq=8,TT={key:"cpu",dir:"desc",rank:"cpu"};function Uq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"?"asc":"desc",rank:t==="name"?e.rank:t}}function Wy(e,t){const n=t.dir==="asc"?1:-1,s=(i,a)=>{if(t.key==="name")return n*i.name.localeCompare(a.name,void 0,{sensitivity:"base"});const l=t.key==="cpu"?i.cpu:i.mem,u=t.key==="cpu"?a.cpu:a.mem;return l==null||u==null?l==null?u==null?0:1:-1:n*(l-u)};return[...e].sort((i,a)=>s(i,a)||(a.cpu??-1)-(i.cpu??-1)||a.mem-i.mem||i.pid-a.pid)}function Wq(e,t,n=Bq){const s=Wy(e,{key:t.rank,dir:"desc",rank:t.rank});return Wy(s.slice(0,n),t)}function Hq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}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`}const RT="agent-dag.systemPanelOpen";function Kq(){return Lu(RT)==="1"}function Xq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(RT,e?"1":"0")}catch{}}function go(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 Qq(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 Zq(){const[e,t]=S.useState(null),n=S.useRef(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,Fq))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}a(),i()};return a(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function Jq(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes");if(!l.ok)return;const u=await l.json();s&&(u!=null&&u.ok)&&n({procs:u.procs??[],total:u.total??0})}catch{}};i();const a=window.setInterval(i,zq);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function e4({usageOpen:e=!1}){const t=Zq(),[n,s]=S.useState(Kq);S.useEffect(()=>{Xq(n)},[n]);const i=S.useRef(null),a=S.useRef(null);if(S.useEffect(()=>{if(n)return Ii.push(()=>{var k,E;const _=((k=a.current)==null?void 0:k.contains(document.activeElement))??!1;s(!1),_&&((E=i.current)==null||E.focus())},dT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Wa,height:Si,viewBox:`0 0 ${Wa} ${Si}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,y=u.slice(-Xf),w=Xf-y.length,N=Wa/Xf,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${go(p.total-p.available)} of ${go(p.total)} used`,"","Click for detail. This machine, not this session."].filter(_=>_!==null).join(`
|
|
77
|
+
`);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(_=>!_),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Wa,height:Si,viewBox:`0 0 ${Wa} ${Si}`,children:y.map((_,k)=>{const E=w+k,C=Math.max(1,_/100*Si),j=.32+.68*((k+1)/y.length);return d.jsx("rect",{x:E*N,y:Si-C,width:Math.max(.8,N-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},E)})}),d.jsx("span",{className:"sm-ram",children:d.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),d.jsxs("span",{className:"sm-read",children:[d.jsx("b",{children:l.toFixed(0)}),d.jsx("i",{children:"·"}),d.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),d.jsxs("span",{className:"sm-sr",children:["CPU ",l.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),n&&d.jsx(t4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var _;s(!1),(_=i.current)==null||_.focus()}})]})}function t4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=Jq(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:y}=e,w=a?a.total-a.available:0,N=g==="win32"?"Commit":"Swap",b=l&&l.total>0?l.used/l.total*100:0;return d.jsxs("aside",{ref:n,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[d.jsxs("div",{className:"sd-head",children:[d.jsx("span",{className:"sd-title",children:"This machine"}),d.jsxs("span",{className:"sd-sub",children:["up ",Qq(f)," · ",p," cores"]}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),u&&u.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(cu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((_,k)=>d.jsx("span",{className:"sd-core",title:`core ${k+1}: ${_}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},k))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(cu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(Su,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(w)})," of ",go(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${go(a.available)} available`}),l&&l.total>0&&d.jsx(Su,{label:N,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(l.used)})," of ",go(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(cu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((_,k)=>d.jsxs("span",{className:`sd-load-item${_>p?" over":""}`,children:[d.jsx("b",{children:_.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(n4,{thermal:y}),d.jsx(r4,{read:i})]})}function cu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=S.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(Lq,{group:e,title:t,onClose:()=>l(!1)})]})}function n4({thermal:e}){if(!e)return null;const t=e.throttle?Vq(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(cu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Su,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Gq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Su,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function r4({read:e}){const[t,n]=S.useState(TT),[s,i]=S.useState(!1),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>i(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),s&&e&&d.jsx(Dq,{procs:e.procs,total:e.total,onClose:()=>i(!1)}),a==null?d.jsx("div",{className:"sd-note",children:"reading…"}):a.length===0?d.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Oi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Oi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:Wq(a,t).map(l=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:l.mem.toFixed(1)}),d.jsx("td",{className:"sd-proc-name",title:`pid ${l.pid}`,children:l.name})]},l.pid))})]})]})}function Oi({col:e,label:t,sort:n,onSort:s}){const i=Hq(n,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:`Sort by ${t}`,onClick:()=>s(Uq(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function Su({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const C1=18,s4=1100,Ni=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},o4=Array.from({length:C1},(e,t)=>{const n=-72+144*t/(C1-1)+(Ni(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ni(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ni(t,3)*260),delay:Math.round(Ni(t,4)*90),dur:760+Math.round(Ni(t,5)*260),scale:.8+Ni(t,6)*.45,hue:t%4,round:t%3===0}});function j1({anchor:e}){var i;const[t,n]=S.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return S.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),s4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:aw.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:o4.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const AT=new Set(["awaiting_url","awaiting_code","registering"]);function i4(e){return e!=null&&AT.has(e)}function MT(e){return e!=null&&e!=="done"&&!AT.has(e)}const a4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",l4="the sign-in did not complete";function c4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?a4:l4)}}const u4="done";function d4(){let e=!1;return{shouldAnnounce(t){return t!==u4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Cw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const f4={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"},h4={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"},p4=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function Hy(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Fi(e)))return p4;const n=Cw(h4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Fi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const m4={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"},g4="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 v4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const y4="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",w4="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",x4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),b4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,_4=/[\\/]_npx[\\/]/i,k4=`the copy of ccusage ${zt} installed for itself`;function S4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function N4(e,t){const n=E4(e,t),s=S4(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 ${Ha(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Ha(n)}`;case"managed":return`${k4} failed to run: ${Ha(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Ha(n)}`:`the ccusage this deck found on your PATH failed to run: ${Ha(n)}`;default:return n}}const Ha=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function E4(e,t){const n=Fi(e);if(x4(n)){if(_4.test(n))return w4;if(b4.test(n))return y4}if(v4(n))return g4;const s=Cw(m4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ti(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&MT(e.state))return e.error;const n=Cw(f4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function C4(e,t,n){if(n<=0||_w(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 IT(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 j4(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(),i=n.alias||s||`account ${n.num}`,a=[];return n.alias&&s&&a.push(s),s&&(t.get(s.toLowerCase())??0)>1&&a.push(n.org||`slot ${n.num}`),{num:n.num,label:i,sub:a.length?a.join(" · "):null}})}function T4(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 R4(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 A4(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],i=n("imported");i&&s.push(`${i} of ${t} imported`);const a=n("healed");a&&s.push(`${a} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const u=n("present");u&&s.push(`${u} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const M4=1500,Xc=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],T1="aa-panel",R1=e=>`aa-tab-${e}`;async function Ga(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Gy=ue.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Gy.displayName="SuccessMark";function I4({onClose:e,onChanged:t}){const[n,s]=S.useState("login"),[i,a]=S.useState(null),[l,u]=S.useState(""),[h,p]=S.useState(""),[f,g]=S.useState(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(null),[E,C]=S.useState(null),j=S.useRef(""),I=S.useRef(!1),O=S.useRef(!1),P=S.useRef(null),F=S.useRef(null),M=S.useRef(null),A=S.useRef(null),q=S.useRef([]),W=S.useRef(!1),Y=S.useCallback(()=>{I.current&&Ga({action:"login-cancel"}).catch(()=>{}),e()},[e]),T=Sn(Y,{focusRef:M}),Q=S.useCallback(async()=>{if(!ar(O.current))return;O.current=!0,g(!0),w(null),I.current=!0;const L=await Ga({action:"login"}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"could not start the sign-in"));return}a(L)},[]);S.useEffect(()=>{if(!i4(i==null?void 0:i.state))return;const L=window.setInterval(async()=>{try{const K=await fetch("/api/claude-accounts/login");K.ok&&a(await K.json())}catch{}},M4);return()=>window.clearInterval(L)},[i]);const U=S.useRef(t);U.current=t;const ne=S.useState(d4)[0];S.useEffect(()=>{var L;(i==null?void 0:i.state)==="awaiting_code"&&((L=P.current)==null||L.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&U.current()},[i==null?void 0:i.state,ne]),S.useEffect(()=>{var L;n==="paste"&&!W.current&&((L=F.current)==null||L.focus()),W.current=!1},[n]);const X=S.useCallback(L=>{var re;const K=C4(L,Xc.findIndex(he=>he.id===n),Xc.length);K.kind!=="pass"&&(L.preventDefault(),W.current=!0,s(Xc[K.index].id),(re=q.current[K.index])==null||re.focus())},[n]),H=S.useCallback(async()=>{var K;if(!ar(O.current))return;O.current=!0,g(!0),w(null);const L=await Ga({action:"login-code",code:l}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the code was not accepted")),L!=null&&L.state&&a(L),(K=P.current)==null||K.select();return}u(""),a(L)},[l,i]),J=S.useCallback(async()=>{if(!ar(O.current))return;O.current=!0,g(!0),w(null);const L=await Ga({action:"import",blob:h}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the import failed"));return}j.current=h,p(""),C(null),b(L.results??[]),t()},[h,t]),$=S.useCallback(async L=>{const K=`${L.email}|${L.org??""}`;if(!ar(O.current)||!j.current)return;O.current=!0,g(!0),k(K),C(null);const re=await Ga({action:"import",blob:j.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(O.current=!1,g(!1),k(null),!(re!=null&&re.ok)){C({key:K,text:Ti(re,"that account could not be updated")});return}const he=(re.results??[])[0];he&&b(pe=>pe&&pe.map(we=>`${we.email}|${we.org??""}`===K?he:we)),t()},[t]),G=(i==null?void 0:i.state)==="done"?i.account:null,Z=MT(i==null?void 0:i.state)||!!(y&&I.current&&!f),D=c4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:y});return d.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:d.jsxs("div",{ref:T,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:X,children:Xc.map((L,K)=>d.jsx("button",{type:"button",role:"tab",id:R1(L.id),ref:re=>{q.current[K]=re},"aria-selected":n===L.id,"aria-controls":T1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{W.current=!1,s(L.id)},children:L.label},L.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:Y,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:T1,role:"tabpanel","aria-labelledby":R1(n),children:n==="login"?G?d.jsxs("div",{className:"aa-done",children:[d.jsx(Gy,{ref:A}),d.jsx(j1,{anchor:A}),d.jsx("h4",{children:G.added?`Account ${G.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:G.email}),G.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.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."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:P,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!l.trim()||i.state==="registering"),onClick:H,children:i.state==="registering"?"registering…":"Continue"})]}),(y||i.error)&&d.jsx("p",{className:"aa-err",children:y??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):Z?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:D.title}),d.jsx("p",{className:"aa-err",children:D.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{I.current=!1,a(null),w(null),Q()},children:"Try again"})]}):f||I.current?d.jsx("div",{className:"aa-step",children:d.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):d.jsxs("div",{className:"aa-step aa-primer",children:[d.jsx("h4",{children:"Sign in to Anthropic"}),d.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."}),d.jsx("div",{className:"aa-actions",children:d.jsx("button",{type:"button",ref:M,className:"btn primary",onClick:Q,children:"Open the sign-in page"})})]}):N?(()=>{const L=N.filter(K=>K.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(Gy,{ref:A}),L>0&&d.jsx(j1,{anchor:A}),d.jsx("h4",{children:A4(N)}),N.length>0&&d.jsx("ul",{className:"aa-results",children:N.map(K=>{const re=`${K.email}|${K.org??""}`;return d.jsxs("li",{className:`aa-result ${K.state}`,children:[d.jsx("span",{className:"aa-result-who",children:K.email||(K.num?`slot ${K.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:R4(K.state)}),K.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":_===re,title:`Overwrite the stored login for ${K.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(K),children:_===re?"updating…":"update anyway"}),(E==null?void 0:E.key)===re&&d.jsx("span",{className:"aa-result-err",children:E.text})]},re)})}),d.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",d.jsx("strong",{children:" update anyway"}),"."]}),d.jsxs("div",{className:"aa-actions",children:[d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{j.current="",C(null),b(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:F,type:"text",value:h,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&h.trim()&&!f&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!h.trim()),onClick:J,children:f?"importing…":"Import"})]}),y&&d.jsx("p",{className:"aa-err",children:y}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.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 O4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const P4=1800;function $4({accounts:e,onClose:t,copyText:n}){const[s,i]=S.useState([]),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(!1),[w,N]=S.useState(()=>Math.floor(Date.now()/1e3)),b=S.useRef(null),_=S.useRef(!1),k=Sn(t,{focusRef:b});S.useEffect(()=>{if(!a)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const E=j4(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,I=A=>i(q=>q.includes(A)?q.filter(W=>W!==A):[...q,A]),O=S.useCallback(async()=>{if(!ar(_.current)||!C.length)return;_.current=!0,h(!0),f(null),y(!1);const A=await O4({action:"share",accounts:C}).catch(()=>null);if(_.current=!1,h(!1),!(A!=null&&A.ok)){f(Ti(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),P=a?IT(a.expiresAt,w):null,F=(P==null?void 0:P.tone)==="gone",M=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:k,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),O();return}await n(a.blob)&&(y(!0),window.setTimeout(()=>y(!1),P4))},children:F?"make a new share":g?"copied":`copy ${M===1?"the share":"all "+M}`}),d.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:[d.jsx("span",{className:"ap-share-warn",children:M===1?"this is the password":`this is ${M} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${P==null?void 0:P.tone}`,children:P==null?void 0:P.text})]})]}),a.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:a.failed.length===1?"One account is not in this bundle:":`${a.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:a.failed.map(A=>{var W;const q=!!(A.email&&((W=A.detail)!=null&&W.includes(A.email)));return d.jsxs("li",{children:[!q&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:T4(C.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:E.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:C.includes(A.num),onChange:()=>I(A.num)}),d.jsx("span",{className:"sa-who",children:A.label}),A.sub&&d.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&d.jsx("p",{className:"aa-err",children:p}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>i(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...ir(u,!C.length),onClick:O,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.length} accounts`})]})]})})]})})}function L4(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((i,a)=>i-a).map(i=>{const a=i===t?"here":n.has(i)?"swap":"free";return{slot:i,kind:a,label:a==="here"?`slot ${i}`:`slot ${i} · ${a}`}})}function q4(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 i=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:i&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:i?{at:s,displaced:t}:null}}function D4(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function F4(e,t,n){var i;const s=((i=e.find(a=>a.slot===t))==null?void 0:i.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 z4(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 A1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function M1(e){const t=e.filter(u=>!A1(u)),n=e.filter(u=>A1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function B4(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function U4(e,t,n,s){const i=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.`,a=n===1?"the other window":`the other ${n} windows`;return`${i} ${s?"Hide":"Show"} ${a}.`}const W4="\0";function jw(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}${W4}${n}`}function H4(e,t){const n=jw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function G4(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(jw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const V4=64;function Y4(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const K4=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function I1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function X4(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Fi(t.body);return{text:Hy(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function O1(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const P1=15e3,Q4=8e3,Qf=1800,Z4=3e4,J4=[70,80,85,90,95];function $1(e,t){return kT(t-Math.floor(e/1e3))}function eD(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 tD(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 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)",i=e.resetAt?ST(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function q1(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 nD({onClose:e}){var Ge,lt,je,We,Xe;const[t,n]=S.useState(null),[s,i]=S.useState(null),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3)),w=S.useRef(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,C]=S.useState(""),[j,I]=S.useState(null),[O,P]=S.useState(null),[F,M]=S.useState(null),[A,q]=S.useState(!1),[W,Y]=S.useState(!1),[T,Q]=S.useState(null),[U,ne]=S.useState(null),[X,H]=S.useState(null),[J,$]=S.useState(null),[G,Z]=S.useState(!1),[D,L]=S.useState([]),K=S.useRef(null),re=S.useCallback(oe=>ET(K.current)?(K.current=oe,l(oe),!0):!1,[]),he=S.useCallback(()=>{K.current=null,l(null)},[]),pe=(oe,Oe=!1)=>{const Pe=NT(a,oe);return{disabled:Pe.disabled,"aria-busy":Pe.busy||Oe}},we=S.useCallback(oe=>{window.requestAnimationFrame(()=>{var Oe;if(vq(((Oe=document.activeElement)==null?void 0:Oe.tagName)??null))for(const Pe of gq(oe)){const Te=document.querySelector(Pe);if(Te){Te.focus();return}}})},[]),Ce=S.useCallback(async(oe=!1)=>{oe&&h(!0);const Oe=new AbortController,Pe=window.setTimeout(()=>Oe.abort(),Z4);try{const[Te,Qe]=await Promise.all([fetch(`/api/claude-accounts${oe?"?refresh=1":""}`,{signal:Oe.signal}),fetch("/api/cswap-auto",{signal:Oe.signal})]);if(Te.ok){const st=await Te.json();n(st),L(Me=>G4(Me,st.accounts))}Qe.ok&&i(await Qe.json());const Ct=X4([await I1(Te),await I1(Qe)]);f(st=>O1(st,Ct))}catch{f(Te=>O1(Te,K4))}finally{window.clearTimeout(Pe),oe&&h(!1)}},[]),Ve=S.useCallback(async(oe,Oe)=>{if(!re(Oe))return null;f(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:Hy(Te,"command failed"),raw:Fi(Te)}),Te}catch{return f({text:"server unreachable"}),null}finally{he()}},[re,he]),Be=S.useCallback(async(oe,Oe)=>{if(!re(Oe))return null;f(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:Ti(Te,"command failed")}),Te}catch{return f({text:"server unreachable"}),null}finally{he()}},[re,he]);S.useEffect(()=>(Ce(!0),w.current=window.setInterval(()=>Ce(!1),P1),()=>{w.current!=null&&window.clearInterval(w.current)}),[Ce]),S.useEffect(()=>{const oe=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(oe)},[]);const Le=((Ge=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Ge.value)??"90",Se=J??Le,ce=z4(Se,Le),be=(lt=t==null?void 0:t.accounts)==null?void 0:lt.find(oe=>oe.active),xe=((je=M1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:je.pct)??null,Ke=xe!=null&&xe>=Number(Le)-15,ut=async oe=>{if(re(`switch-${oe}`)){f(null);try{const Pe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:oe})})).json().catch(()=>null);Pe!=null&&Pe.ok||f({text:Hy(Pe,"the switch failed"),raw:Fi(Pe)}),await Ce(!0)}catch{f({text:"server unreachable"})}finally{he(),we(oe)}}},at=async(oe,Oe)=>{const{commit:Pe,alias:Te}=Y4(E,Oe);if(Pe){const Qe=await Be({action:"alias",account:oe,alias:Te},`alias-${oe}`);if(await Ce(!0),!(Qe!=null&&Qe.ok))return;C(Te)}I(oe),window.setTimeout(()=>I(Qe=>Qe===oe?null:Qe),Qf)},de=async(oe,Oe)=>{const Pe=await Be({action:"move",account:oe,slot:Oe},`move-${oe}`),Te=q4({menuFor:N,shareFor:(F==null?void 0:F.num)??null},oe,Pe);if(await Ce(!0),Te){b(Te.menuFor),P(Te.confirmRemove),Te.shareFor==null&&(M(null),Y(!1)),Q(Te.swapNote);const Qe=Te.swapNote;Qe&&window.setTimeout(()=>Q(Ct=>Ct===Qe?null:Ct),Q4),ne(null),we(Te.menuFor)}return Pe},_e=async(oe,Oe,Pe)=>{if(Pe.sends){const Te=await de(oe,Oe);if(!(Te!=null&&Te.ok))return}H(oe),window.setTimeout(()=>H(Te=>Te===oe?null:Te),Qf)},De=async(oe,Oe)=>{if(Oe.sends){const Pe=await Ve({action:"setting",key:"autoswitch.threshold",value:oe},"threshold");if(await Ce(!0),!(Pe!=null&&Pe.ok))return;$(null)}Z(!0),window.setTimeout(()=>Z(!1),Qf)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>k(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((We=t==null?void 0:t.accounts)==null?void 0:We.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>q(!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:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>Ce(!0),...pe("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",P1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>Ce(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Xe=t.accounts)==null?void 0:Xe.map(oe=>{const{shown:Oe,rest:Pe,fuller:Te,peak:Qe}=M1(oe.lanes),Ct=D.includes(jw(oe)),st=B4(Pe.length,Ct,Te);return d.jsxs("div",{className:`ap-account${oe.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:oe.num}),oe.alias&&d.jsx("span",{className:"ap-alias",title:oe.alias,children:oe.alias}),d.jsx("span",{className:"ap-email",title:oe.email??void 0,children:oe.email}),d.jsx("button",{type:"button",id:`ap-more-${oe.num}`,className:`ap-more${N===oe.num?" on":""}`,"aria-label":`Manage account ${oe.num}`,"aria-expanded":N===oe.num,"aria-controls":N===oe.num?`ap-manage-${oe.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(N===oe.num?null:oe.num),C(oe.alias??""),P(null),M(null),Y(!1),Q(null),I(null),ne(null),H(null)},children:"⋯"}),oe.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),oe.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!oe.active&&!oe.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${oe.num}`),onClick:()=>ut(oe.num),title:`Switch to ${oe.alias??oe.email}`,children:a===`switch-${oe.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${oe.num}`,children:Oe.length?d.jsxs(d.Fragment,{children:[Oe.map(Me=>d.jsx(L1,{lane:Me,nowSec:g},Me.id)),Ct&&Pe.map(Me=>d.jsx(L1,{lane:Me,nowSec:g},Me.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[oe.staleCopy&&d.jsxs(d.Fragment,{children:[d.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"}),d.jsx("button",{type:"button",className:"ap-fix",...pe("recapture"),onClick:async()=>{const Me=await Be({action:"recapture"},"recapture");Me!=null&&Me.ok&&Ce(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:a==="recapture"?"resuming…":"resume"})]}),oe.error&&(()=>{const Me=tD(oe.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Me.hint,children:Me.text}),Me.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>k(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),st&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Ct,"aria-controls":`ap-lanes-${oe.num}`,title:U4(oe.headroom,(Qe==null?void 0:Qe.label)??null,Pe.length,Ct),onClick:()=>L(Me=>H4(Me,oe)),children:st}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!oe.active||oe.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${oe.num}`),onClick:()=>Ve({action:"account",account:oe.num,enabled:oe.disabled},`rot-${oe.num}`).then(()=>Ce(!0)),title:oe.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:oe.disabled?"put back":"hold out"}),oe.fetchedAt?d.jsxs("span",{className:`ap-age${oe.stale?" 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 ",$1(oe.fetchedAt,g),eD(oe.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===oe.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${oe.num}`,role:"group","aria-label":`Manage account ${oe.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${oe.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${oe.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Me=>C(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"&&at(oe.num,oe.alias)},maxLength:V4,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${oe.num}`),onClick:()=>at(oe.num,oe.alias),title:"A short name to show instead of the email",children:j===oe.num?"saved":"save"})]}),(()=>{const Me=L4((t.accounts??[]).map(St=>St.num),oe.num),bt=D4(Me,U,oe.num),dt=F4(Me,bt,oe.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${oe.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${oe.num}`,value:String(bt),...pe(`move-${oe.num}`),onChange:St=>ne(Number(St.target.value)),children:Me.map(St=>d.jsx("option",{value:St.slot,children:St.label},St.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${oe.num}`),title:dt.title,onClick:()=>_e(oe.num,bt,dt),children:X===oe.num?dt.done:dt.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${oe.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()=>{Y(!1);const Me=await Be({action:"share",account:oe.num},`share-${oe.num}`);Me!=null&&Me.ok&&M({num:oe.num,blob:Me.blob,expiresAt:Me.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${O===oe.num?" armed":""}`,...pe(`rm-${oe.num}`),title:O===oe.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(O!==oe.num){P(oe.num),window.setTimeout(()=>P(Me=>Me===oe.num?null:Me),4e3);return}P(null),Be({action:"remove",account:oe.num},`rm-${oe.num}`).then(()=>{b(null),Ce(!0),we(null)})},children:O===oe.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===oe.num&&(()=>{var dt;const Me=(dt=t.accounts)==null?void 0:dt.find(St=>St.num===T.displaced),bt=(Me==null?void 0:Me.alias)??(Me==null?void 0:Me.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${T.at} was taken, so the two accounts traded places: ${bt} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(F==null?void 0:F.num)===oe.num&&(()=>{const Me=IT(F.expiresAt,g),bt=Me.tone==="gone";return d.jsxs("div",{className:`ap-share${bt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${oe.num}`),onClick:async()=>{if(bt){Y(!1);const dt=await Be({action:"share",account:oe.num},`share-${oe.num}`);dt!=null&&dt.ok&&M({num:oe.num,blob:dt.blob,expiresAt:dt.expiresAt});return}await q1(F.blob)&&(Y(!0),window.setTimeout(()=>Y(!1),1800))},children:bt?"make a new share":W?"copied":"copy"}),d.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:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Me.tone}`,children:Me.text})]})]})]})})()]})]},oe.num)}),(s==null?void 0:s.ok)&&d.jsxs("div",{className:"ap-auto",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),d.jsxs("span",{className:"ap-auto-ctl",children:[xe!=null&&d.jsxs("span",{className:`ap-auto-now${Ke?" near":""}`,children:[Math.round(xe),"%"]}),d.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:d.jsx("select",{"aria-label":"Switch threshold",value:Se,...pe("threshold"),onChange:oe=>$(oe.target.value),children:J4.map(oe=>d.jsxs("option",{value:oe,children:[oe,"%"]},oe))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:ce.title,onClick:()=>De(Se,ce),children:G?ce.done:ce.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>Ce(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.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&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",$1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.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."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.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&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),_&&d.jsx(I4,{onClose:()=>k(!1),onChanged:()=>Ce(!0)}),A&&d.jsx($4,{accounts:((t==null?void 0:t.accounts)??[]).map(oe=>({num:oe.num,email:oe.email,alias:oe.alias,org:oe.org})),onClose:()=>q(!1),copyText:q1})]})}const rD=3e4;function sD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function oD({bundle:e,running:t,pending:n,lastTried:s}){return t?sD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function iD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function aD({asked:e,reported:t}){return t?t!==e:!1}function lD(e){const t=e.thresholdMs??rD;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=t}}function cD(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function uD(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 dD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function fD(e,t){const n=dD(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("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:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("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 a=t.decks-1,l=a===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:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} 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 hD({agentCount:e,onConfirm:t,onCancel:n}){const s=S.useRef(null),i=Sn(n,{focusRef:s,layer:OL}),[a,l]=S.useState(null);S.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(uD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=fD(e,a);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"status-dot err","aria-hidden":!0}),d.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:u}),d.jsxs("div",{className:"cc-actions",children:[d.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const pD="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.",mD=[{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:"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 gD({onClose:e}){const t=Sn(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:pD}),d.jsx("div",{className:"shortcuts",children:mD.map(n=>d.jsxs(S.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const vD=["done","needs-input"],yD=[{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}]}],wD=[{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}]}],Tw={done:yD,"needs-input":wD},zi="two";function Vy(e,t){const n=Tw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===zi)??n[0]}function OT(e,t){return Tw[e].some(s=>s.id===t)?t:zi}Vy("done",zi).notes,Vy("needs-input",zi).notes;const D1=.04,xD=.24,PT=0,Rw=100,Yy=5,ll=50;function cl(e){if(!Number.isFinite(e))return ll;const t=Math.round(e/Yy)*Yy;return Math.min(Rw,Math.max(PT,t))}function bD(e){if(e==null)return ll;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?cl(Number(t)):ll}function _D(e){const t=cl(e),n=D1+(xD-D1)*(t/Rw);return Math.round(n*1e4)/1e4}function kD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(_D(e)*s*1e4)/1e4}const SD=160,ND="agent-dag.soundLevel.done",ED="agent-dag.soundLevel.needs-input",CD="agent-dag.soundFigure.done",jD="agent-dag.soundFigure.needs-input",$T={done:ND,"needs-input":ED},LT={done:CD,"needs-input":jD},Ky={done:{level:ll,figure:zi},"needs-input":{level:ll,figure:zi}};function TD(e){const t=n=>({level:bD(e($T[n])),figure:OT(n,e(LT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const RD={Stop:"done",Notification:"needs-input"};function AD(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:RD[n]??null}function MD(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const i=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",a=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,i())};function l(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(a,()=>{}),s=!0,a()}catch{}}function u(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Ky)[h]??Ky[h],g=Vy(h,f.figure),y=kD(f.level,g),w=n.currentTime;for(const b of g.notes){const _=n.createOscillator(),k=n.createGain();_.type=g.type??"sine",_.frequency.value=b.hz;const E=w+b.at,C=E+b.ms/1e3;k.gain.setValueAtTime(1e-4,E),k.gain.exponentialRampToValueAtTime(y,E+.012),k.gain.exponentialRampToValueAtTime(1e-4,C),_.connect(k).connect(n.destination),_.start(E),_.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const F1={done:"Turn finished","needs-input":"Claude is asking"},ID={done:"Every finished turn, on both CLIs.","needs-input":"Claude Code only — Codex has no such event."};function OD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u}){const h=Sn(e),p=S.useRef(e);return p.current=e,S.useEffect(()=>{const f=g=>{var w,N;const y=g.target;y&&((w=h.current)!=null&&w.contains(y)||(N=u.current)!=null&&N.contains(y)||p.current())};return window.addEventListener("pointerdown",f,!0),()=>window.removeEventListener("pointerdown",f,!0)},[h,u]),d.jsxs("div",{ref:h,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:n,"aria-pressed":t,children:[d.jsx("span",{className:"sm-switch-label",children:"Sound"}),d.jsx("span",{className:"sm-switch-state",children:t?"on":"off"})]}),vD.map(f=>{const g=s[f],y=`sm-level-${f}`,w=`sm-figure-${f}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${f}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${f}`,children:F1[f]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(f),"aria-label":`Hear the ${F1[f].toLowerCase()} tone`,children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:y,children:"Volume"}),d.jsx("input",{id:y,type:"range",min:PT,max:Rw,step:Yy,value:g.level,onChange:N=>i(f,Number(N.target.value))}),d.jsxs("span",{className:"sm-read",children:[g.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:w,children:"Sound"}),d.jsx("select",{id:w,className:"sm-select",value:g.figure,onChange:N=>a(f,N.target.value),children:Tw[f].map(N=>d.jsx("option",{value:N.id,children:N.label},N.id))})]}),d.jsx("p",{className:"sm-note",children:ID[f]})]},f)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const PD={"//":["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.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.
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
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.
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
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.
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
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.
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
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".
|
|
126
|
+
|
|
127
|
+
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.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
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.
|
|
138
|
+
|
|
139
|
+
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.
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
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.
|
|
152
|
+
|
|
153
|
+
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.
|
|
154
|
+
|
|
155
|
+
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.
|
|
156
|
+
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
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."}]},Aw="agent-dag.releaseNotesSeen";function z1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Bi(e,t){const n=z1(e),s=z1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Ui(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function $D(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 LD(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Ui(n)||!Array.isArray(s))continue;const i=s.filter($D);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Bi(s.version,n.version))}const B1=LD(PD);function qT(e,t,n){return e.filter(s=>Bi(s.version,n)<=0&&(t===null||Bi(s.version,t)>0))}function qD(e,t){return e.filter(n=>Bi(n.version,t)===0)}function DD(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 FD({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&&Ui(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 i=n[0].version;if(!Ui(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 a=Bi(i,t);return a<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.`:a>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 zD=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function BD(e){const t=zD.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function UD(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function WD(e){if(!e)return null;let t=null;try{t=e.getItem(Aw)}catch{return null}return Ui(t)?t:null}function HD(e){if(!e)return!1;try{return e.getItem(Aw),!0}catch{return!1}}function GD(e,t){if(!e)return!1;try{return e.setItem(Aw,t),!0}catch{return!1}}function VD({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ui(t))return{show:[],record:null,reason:"no-version"};if(!Ui(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=qD(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Bi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=qT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function YD({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=Sn(i),l=DD(e);return d.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal release-notes",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&d.jsx("span",{className:"modal-tool-id",children:l})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:FD({since:t,running:n,firstRun:s,entries:e})}),e.map(u=>d.jsxs("section",{className:"modal-section",children:[d.jsxs("h3",{className:"rn-version",children:["v",u.version]}),d.jsx("ul",{className:"rn-notes",children:u.notes.map((h,p)=>{const{icon:f,rest:g}=BD(h.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[f&&d.jsx("span",{className:"rn-note-icon",children:f}),g]}),d.jsx("p",{className:"rn-note-body",children:h.body})]},p)})})]},u.version))]})]})})}function KD(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function XD(e,t,n){var l;if(e.length===0)return null;const s=KD(e),i=t?s.findIndex(u=>u.id===t):-1,a=i===-1?n===1?0:s.length-1:(i+n+s.length)%s.length;return((l=s[a])==null?void 0:l.id)??null}const QD=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function ZD(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:QD.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const JD=new Set(["","BODY","HTML","#DOCUMENT"]);function e5(e){return!e||kw(e)?!1:!JD.has(String(e.tagName??"").toUpperCase())}function Qc(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function t5(e,t){let n=!1;for(const i of e)if(!t.has(i)){n=!0;break}if(!n)return e;const s=new Set;for(const i of e)t.has(i)&&s.add(i);return s}function n5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function r5(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),i=l.parentId}let a=!0;for(;a;){a=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),a=!0)}return s}function s5(e,t){const n=new Set;for(const s of t){const i=r5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function DT(e,t,n){return!t.has(e)||n.has(e)}function o5(e,t,n,s){return!t.has(e)&&DT(e,n,s)}function i5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function a5(e,t,n,s){n.set(e,t),s.delete(e)}const l5=40,c5=120;function u5(e,t){let n=null,s=0,i=Number.NEGATIVE_INFINITY;const a=()=>{n=null,i=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(h,p,f)=>{if(n!=null){if(s<=h)return;l()}const g=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(a,g)};return{live(h=l5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=c5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const d5=1e3;function f5(e={}){const t=Math.max(1,Math.floor(e.limit??d5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==h;y&&(h=g,u=0);const w=f!==null&&!y&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let N=0;if(a.size<i.length)for(;a.has(i[N]);)N++;const[b]=i.splice(N,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const FT="agent-dag.theme";function h5(e){return e==="light"?"light":"dark"}function p5(){return h5(Lu(FT))}function m5({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 Zc={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Jc(e,t){const i=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"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const g5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.idle,"idle"))}`}),v5="No sessions are waiting for you.";function y5(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 w5(e,t){return t!==""?t:e===""?"":v5}function x5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function b5(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 _5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const U1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Mw(e){const t=e.toLowerCase();return Object.hasOwn(U1,t)?U1[t]:t?t[0].toUpperCase()+t.slice(1):""}function k5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function S5(e,t=[]){const n=t.length?k5(t.map(Mw)):_5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function N5(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 E5(e,t){const n=t.prefs??Ky,s=cl(n.done.level),i=cl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
162
|
+
|
|
163
|
+
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",h=t.on&&t.locked?`
|
|
164
|
+
|
|
165
|
+
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+u+h+`
|
|
166
|
+
|
|
167
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function zT(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 i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function C5(e){const t=zT([{agents:e}]);return t.length<2?null:t.map(n=>`${Mw(n.id)} ${Ye(n.cost)}`).join(" · ")}function W1(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 j5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function eu(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 T5=[7,14,30,90];function R5(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useState(x5)[0],l=S.useRef(!1),u=(h=!1)=>{if(h&&!ar(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const y=`/api/ccusage?since=${zy(f)}${h?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return S.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function A5({onClose:e,providers:t}){var F;const[n,s]=S.useState(30),[i,a]=S.useState(null),{landed:l,loading:u,reload:h}=R5(n),p=S.useRef(null),f=Sn(e,{focusRef:p}),g=b5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=S.useMemo(()=>y.reduce((M,A)=>Math.max(M,A.totalCost),0),[y]),N=S.useRef(null);S.useLayoutEffect(()=>{const M=N.current;M&&(M.scrollLeft=M.scrollWidth)},[y]);const{totalCost:b,totalTok:_,inOut:k,cacheRead:E,modelCosts:C}=S.useMemo(()=>{let M=0,A=0,q=0,W=0;const Y=new Map;for(const T of y){M+=T.totalCost,A+=T.totalTokens,q+=T.inputTokens+T.outputTokens,W+=T.cacheReadTokens;for(const Q of T.modelBreakdowns)Y.set(Q.modelName,(Y.get(Q.modelName)??0)+Q.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:W,modelCosts:Y}},[y]),j=S.useMemo(()=>Array.from(C.entries()).sort((M,A)=>A[1]-M[1]),[C]),I=S.useMemo(()=>zT(y),[y]),O=I.length>1,P=i?y.find(M=>M.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:S5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:T5.map(M=>d.jsxs("button",{type:"button","aria-pressed":n===M,className:"uh-range-btn",onClick:()=>{s(M),a(null)},children:[M,"d"]},M))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...ir(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),d.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?d.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Fi(l.resp)||void 0,children:[N4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...ir(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?d.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):d.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[d.jsxs("div",{className:"uh-totals",children:[d.jsx(tu,{label:"total cost",val:Ye(b),accent:!0}),d.jsx(tu,{label:"tokens",val:Tt(_)}),d.jsx(tu,{label:"input+output",val:Tt(k)}),d.jsx(tu,{label:"cache reads",val:Tt(E)})]}),O&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:I.map(M=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?M.cost/b*100:0}%`,background:W1(M.id)}},M.id))}),d.jsx("div",{className:"uh-agent-keys",children:I.map(M=>d.jsxs("span",{className:"uh-agent-key",title:`${M.id} · ${Tt(M.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:W1(M.id)}}),Mw(M.id),d.jsx("span",{className:"uh-agent-cost",children:Ye(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:j5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,W=`${M.period}, ${Ye(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":W,title:`${M.period} · ${Ye(M.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((Y,T)=>T.cost-Y.cost).map(Y=>{const T=M.totalCost>0?Y.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${T}%`,background:eu(Y.modelName)}},Y.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:M.period.slice(5)})]},M.period)})}),d.jsx("div",{className:"uh-legend",children:j.map(([M,A])=>d.jsxs("span",{className:"uh-legend-item",title:M,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M)}}),Is(M)," ",d.jsx("span",{className:"uh-legend-cost",children:Ye(A)})]},M))}),P&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:P.period}),d.jsx("span",{className:"uh-detail-cost",children:Ye(P.totalCost)}),(()=>{var q,W;const A=C5(P.agents)??((W=(q=P.metadata)==null?void 0:q.agents)!=null&&W.length?P.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(nu,{label:"input",val:Tt(P.inputTokens)}),d.jsx(nu,{label:"output",val:Tt(P.outputTokens)}),d.jsx(nu,{label:"cache write",val:Tt(P.cacheCreationTokens)}),d.jsx(nu,{label:"cache read",val:Tt(P.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((M,A)=>A.cost-M.cost).map(M=>{const A=P.totalCost>0?M.cost/P.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:M.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Is(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:eu(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:Ye(M.cost)})]},M.modelName)})})]})]})]})})}function tu({label:e,val:t,accent:n}){return d.jsxs("div",{className:"uh-stat",children:[d.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),d.jsx("span",{className:"uh-stat-label",children:e})]})}function nu({label:e,val:t}){return d.jsxs("div",{className:"uh-ministat",children:[d.jsx("span",{className:"uh-ministat-val",children:t}),d.jsx("span",{className:"uh-ministat-label",children:e})]})}function M5(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(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const H1=1e4,I5=12e3;function O5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=S.useRef(null),l=S.useRef(null);return l.current={browsers:e,findings:t,watching:n},S.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const y=()=>{var ne;if(g)return;const N=l.current;if(!N)return;const{browsers:b,findings:_,watching:k}=N,E=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",I=M5(s["--bg"]),O=I?42:26,P=I?.85:.65,F=i(),M=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,q=u.clientHeight;(u.width!==A*M||u.height!==q*M)&&(u.width=A*M,u.height=q*M),h.setTransform(M,0,0,M,0,0),h.clearRect(0,0,A,q);const W=A/2,Y=q/2,T=Math.min(A,q)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=I?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(W,Y,T*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(W-T,Y),h.lineTo(W+T,Y),h.moveTo(W,Y-T),h.lineTo(W,Y+T),h.stroke(),h.globalAlpha=1;const U=(k&&!p?F%H1/H1:0)*Math.PI*2-Math.PI/2;if(k){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,U-.85,W,Y);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${O}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(W,Y),h.arc(W,Y,T,U-.85,U),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=P,h.beginPath(),h.moveTo(W,Y),h.lineTo(W+Math.cos(U)*T,Y+Math.sin(U)*T),h.stroke(),h.globalAlpha=1}b.forEach((X,H)=>{const J=H/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(F-X.lastReadMs)/12e4),G=T*(.42+$*.5),Z=W+Math.cos(J)*G,D=Y+Math.sin(J)*G,L=Math.abs((U-J+Math.PI*3)%(Math.PI*2)-Math.PI),K=k?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(Z,D,3+K*1.6,0,Math.PI*2),h.fillStyle=X.running?E:j,h.globalAlpha=X.running?.55+K*.45:.35,h.fill(),h.globalAlpha=1});for(const X of _){const H=(F-X.atMs)/I5;if(H<0||H>1)continue;const $=Math.max(0,b.findIndex(D=>D.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,G=W+Math.cos($)*T*.6,Z=Y+Math.sin($)*T*.6;h.beginPath(),h.arc(G,Z,4+H*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-H)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const G1="agent-dag.browserWatch.seenMs";function P5(e,t){return e.filter(n=>n.startMs>t)}function $5(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function L5(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 BT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function V1(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 q5(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,i)=>s+i.programVisits,0)}))}function D5(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 F5(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=BT(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 z5(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 B5(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function Y1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function U5({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=Sn(e),[a,l]=S.useState(null),[u,h]=S.useState(null),[p,f]=S.useState(!1),g=S.useRef(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,C]=S.useState(!1),[j,I]=S.useState(!1),[O,P]=S.useState(!1),[F,M]=S.useState(!1),[A,q]=S.useState(!1),[W,Y]=S.useState(()=>Date.now());S.useEffect(()=>{const Z=setInterval(()=>Y(Date.now()),1e3);return()=>clearInterval(Z)},[]);const T=S.useCallback(async Z=>{var D;if(!(Z&&!ar(g.current))){g.current=Z,f(!0);try{const L=await fetch(`/api/browser-watch${Z?"?refresh=1":""}`);if(!L.ok)throw new Error(`the deck answered ${L.status}`);const K=await L.json();l(K),w(re=>{var he;return re===null?((he=K==null?void 0:K.settings)==null?void 0:he.quietMinutes)??15:re}),n(((D=K==null?void 0:K.settings)==null?void 0:D.enabled)===!0),h(null)}catch(L){h(L instanceof Error?L.message:String(L))}finally{g.current=!1,f(!1)}}},[n]);S.useEffect(()=>{T(!1)},[T]),S.useEffect(()=>{const Z=setInterval(()=>{T(!1)},1e4);return()=>clearInterval(Z)},[T]);const Q=S.useCallback(async Z=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Z.host,startMs:Z.startMs})})}finally{await T(!1)}},[T]),U=S.useCallback(async Z=>{k(!0);try{const D=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Z)});if(!D.ok)throw new Error(`the deck answered ${D.status}`);await T(!1)}catch(D){h(D instanceof Error?D.message:String(D))}finally{k(!1)}},[T]);S.useEffect(()=>()=>t(Date.now()),[t]);const ne=S.useMemo(()=>{const Z=[];for(const D of(a==null?void 0:a.episodes)??[]){const L=B5(D.startMs),K=Z[Z.length-1];K&&K.label===L?K.episodes.push(D):Z.push({label:L,episodes:[D]})}return Z},[a]),X=BT(a==null?void 0:a.browsers),H=((a==null?void 0:a.browsers)??[]).filter(Z=>!(Z.installed&&Z.profiles>0)),J=a?F5(a):null,$=X.reduce((Z,D)=>Z+D.profiles,0),G=a?$5(a.coverage.lastHumanMs,a.coverage.quietMs,W):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:Z=>Z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),d.jsx("span",{className:"modal-tool-id",children:a?`${$} ${$===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void T(!0),...ir(p),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:p?"…":"↻"}),d.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body bw-body",children:[!a&&!u&&d.jsxs("div",{className:"bw-loading",children:[d.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),d.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),u&&d.jsx("div",{className:"bw-state",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not read"}),d.jsx("span",{className:"bw-row-detail",children:u})]})}),a&&J&&d.jsx("p",{className:`bw-trouble ${J.kind}`,role:"status",children:J.text}),a&&d.jsxs("div",{className:"bw-work",children:[d.jsxs("aside",{className:"bw-side",children:[d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",d.jsx("button",{className:"bw-help",onClick:()=>P(Z=>!Z),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(O5,{browsers:X.map(Z=>{var D;return{key:Z.key,name:Z.name,running:Z.running,lastReadMs:((D=a.profiles.find(L=>L.browser===Z.key))==null?void 0:D.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(Z=>({browser:Z.browser??null,atMs:Z.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:q5(X,a.profiles).map(Z=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:Z.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:Z.name})]},Z.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),a.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",D5(a.coverage.checkedMs,W),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),G!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",L5(G)]}),O&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Sweep"}),d.jsx("dd",{children:"one poll of every watched profile"}),d.jsx("dt",{children:"Dot"}),d.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),d.jsx("dt",{children:"Ring"}),d.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",d.jsx("button",{className:"bw-help",onClick:()=>M(Z=>!Z),"aria-expanded":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.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"})]}),d.jsx("ul",{className:"bw-profiles",children:X.map(Z=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${Z.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:Z.name}),d.jsx("span",{className:"bw-prof-state",children:Z.running?"running":"idle"}),Z.running&&Z.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Z.key))}),H.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>q(Z=>!Z),"aria-expanded":A,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," ",H.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[H.map(Z=>Z.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]})]}),d.jsxs("div",{className:"bw-main",children:[d.jsxs("section",{className:"bw-findings",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",a.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[a.episodes.length," ",a.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:ne.length===0?d.jsxs("div",{className:"bw-empty",children:[d.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),d.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",a.settings.quietMinutes," ",a.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."]}),!a.settings.enabled&&d.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."})]}):ne.map(Z=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:Z.label}),Z.episodes.map(D=>{const L=`${D.host}-${D.startMs}`,K=N===L;return d.jsxs("div",{className:`bw-ep${K?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>b(K?null:L),"aria-expanded":K,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:K?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:D.host}),d.jsxs("span",{className:"bw-ep-meta",children:[z5(D),Y1(D)&&d.jsxs(d.Fragment,{children:[" · ",Y1(D)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[D.count," ",D.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Q(D),"aria-label":`Dismiss ${D.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),K&&d.jsx("ul",{className:"bw-urls",children:D.urls.map((re,he)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(re.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:re.url})]},`${re.url}-${re.timeMs}-${he}`))})]},L)})]},Z.label))})]}),d.jsxs("section",{className:"bw-feed",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",d.jsxs("span",{className:"bw-feed-count",children:[a.log.length," ",a.log.length===1?"event":"events"]})]}),d.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."}),d.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:a.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):a.log.map(Z=>d.jsxs("div",{className:`bw-log-line ${Z.level}${Z.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(Z.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Z.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:Z.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:Z.parts.profile,children:Z.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[Z.parts.value,Z.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",Z.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:Z.text})]},`${Z.atMs}-${Z.level}-${Z.text}`))})]})]})]}),a&&E&&d.jsxs("div",{className:"bw-settings",children:[d.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:[d.jsx("span",{children:"Nobody browsing for"}),d.jsxs("select",{value:y??a.settings.quietMinutes,onChange:Z=>{w(Number(Z.target.value)),U({quietMinutes:Number(Z.target.value)})},children:[d.jsx("option",{value:1,children:"1 min"}),d.jsx("option",{value:5,children:"5 min"}),d.jsx("option",{value:15,children:"15 min"}),d.jsx("option",{value:30,children:"30 min"}),d.jsx("option",{value:60,children:"60 min"})]})]}),d.jsxs("label",{children:[d.jsx("span",{children:"When it finds one"}),d.jsx("select",{value:a.settings.reaction,onChange:Z=>void U({reaction:Z.target.value}),disabled:!a.settings.enabled,title:a.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(a.reactions??["notify"]).map(Z=>d.jsx("option",{value:Z,children:Z==="notify"?"notify me":Z==="close-tab"?"close the tab":"quit the browser"},Z))})]}),d.jsxs("div",{className:"bw-settings-note",children:[d.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. ",d.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),d.jsxs("button",{className:"bw-why",onClick:()=>I(Z=>!Z),"aria-expanded":j,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:j?"▾":"▸"})," What Browser Watch can access"]}),j&&d.jsxs("dl",{className:"bw-access",children:[d.jsx("dt",{children:"Reads"}),d.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(a.coverage.startedMs).toLocaleString(),"."]}),d.jsx("dt",{children:"Keeps"}),d.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",d.jsx("code",{className:"bw-path",children:a.coverage.logPath}),", with every address written in full so you can check it yourself."]}),d.jsx("dt",{children:"Sends"}),d.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."}),d.jsx("dt",{children:"Never reads"}),d.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:V1(a,_).word},V1(a,_).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${E?" on":""}`,onClick:()=>C(Z=>!Z),"aria-expanded":E,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.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"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void U({enabled:!a.settings.enabled}),title:a.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:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function Iw(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 Zf,K1;function W5(){if(K1)return Zf;K1=1;function e(){this.__data__=[],this.size=0}return Zf=e,Zf}var Jf,X1;function Gi(){if(X1)return Jf;X1=1;function e(t,n){return t===n||t!==t&&n!==n}return Jf=e,Jf}var eh,Q1;function Du(){if(Q1)return eh;Q1=1;var e=Gi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return eh=t,eh}var th,Z1;function H5(){if(Z1)return th;Z1=1;var e=Du(),t=Array.prototype,n=t.splice;function s(i){var a=this.__data__,l=e(a,i);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return th=s,th}var nh,J1;function G5(){if(J1)return nh;J1=1;var e=Du();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return nh=t,nh}var rh,e_;function V5(){if(e_)return rh;e_=1;var e=Du();function t(n){return e(this.__data__,n)>-1}return rh=t,rh}var sh,t_;function Y5(){if(t_)return sh;t_=1;var e=Du();function t(n,s){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,s])):i[a][1]=s,this}return sh=t,sh}var oh,n_;function Fu(){if(n_)return oh;n_=1;var e=W5(),t=H5(),n=G5(),s=V5(),i=Y5();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,oh=a,oh}var ih,r_;function K5(){if(r_)return ih;r_=1;var e=Fu();function t(){this.__data__=new e,this.size=0}return ih=t,ih}var ah,s_;function X5(){if(s_)return ah;s_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return ah=e,ah}var lh,o_;function Q5(){if(o_)return lh;o_=1;function e(t){return this.__data__.get(t)}return lh=e,lh}var ch,i_;function Z5(){if(i_)return ch;i_=1;function e(t){return this.__data__.has(t)}return ch=e,ch}var uh,a_;function UT(){if(a_)return uh;a_=1;var e=typeof Lc=="object"&&Lc&&Lc.Object===Object&&Lc;return uh=e,uh}var dh,l_;function dr(){if(l_)return dh;l_=1;var e=UT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return dh=n,dh}var fh,c_;function Vi(){if(c_)return fh;c_=1;var e=dr(),t=e.Symbol;return fh=t,fh}var hh,u_;function J5(){if(u_)return hh;u_=1;var e=Vi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,i=e?e.toStringTag:void 0;function a(l){var u=n.call(l,i),h=l[i];try{l[i]=void 0;var p=!0}catch{}var f=s.call(l);return p&&(u?l[i]=h:delete l[i]),f}return hh=a,hh}var ph,d_;function eF(){if(d_)return ph;d_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return ph=n,ph}var mh,f_;function ko(){if(f_)return mh;f_=1;var e=Vi(),t=J5(),n=eF(),s="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:s:a&&a in Object(u)?t(u):n(u)}return mh=l,mh}var gh,h_;function Dn(){if(h_)return gh;h_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return gh=e,gh}var vh,p_;function _l(){if(p_)return vh;p_=1;var e=ko(),t=Dn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return vh=l,vh}var yh,m_;function tF(){if(m_)return yh;m_=1;var e=dr(),t=e["__core-js_shared__"];return yh=t,yh}var wh,g_;function nF(){if(g_)return wh;g_=1;var e=tF(),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 wh=n,wh}var xh,v_;function WT(){if(v_)return xh;v_=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 xh=n,xh}var bh,y_;function rF(){if(y_)return bh;y_=1;var e=_l(),t=nF(),n=Dn(),s=WT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?f:a;return w.test(s(y))}return bh=g,bh}var _h,w_;function sF(){if(w_)return _h;w_=1;function e(t,n){return t==null?void 0:t[n]}return _h=e,_h}var kh,x_;function So(){if(x_)return kh;x_=1;var e=rF(),t=sF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return kh=n,kh}var Sh,b_;function Ow(){if(b_)return Sh;b_=1;var e=So(),t=dr(),n=e(t,"Map");return Sh=n,Sh}var Nh,__;function zu(){if(__)return Nh;__=1;var e=So(),t=e(Object,"create");return Nh=t,Nh}var Eh,k_;function oF(){if(k_)return Eh;k_=1;var e=zu();function t(){this.__data__=e?e(null):{},this.size=0}return Eh=t,Eh}var Ch,S_;function iF(){if(S_)return Ch;S_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Ch=e,Ch}var jh,N_;function aF(){if(N_)return jh;N_=1;var e=zu(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function i(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return jh=i,jh}var Th,E_;function lF(){if(E_)return Th;E_=1;var e=zu(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Th=s,Th}var Rh,C_;function cF(){if(C_)return Rh;C_=1;var e=zu(),t="__lodash_hash_undefined__";function n(s,i){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&i===void 0?t:i,this}return Rh=n,Rh}var Ah,j_;function uF(){if(j_)return Ah;j_=1;var e=oF(),t=iF(),n=aF(),s=lF(),i=cF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Ah=a,Ah}var Mh,T_;function dF(){if(T_)return Mh;T_=1;var e=uF(),t=Fu(),n=Ow();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Mh=s,Mh}var Ih,R_;function fF(){if(R_)return Ih;R_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Ih=e,Ih}var Oh,A_;function Bu(){if(A_)return Oh;A_=1;var e=fF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Oh=t,Oh}var Ph,M_;function hF(){if(M_)return Ph;M_=1;var e=Bu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Ph=t,Ph}var $h,I_;function pF(){if(I_)return $h;I_=1;var e=Bu();function t(n){return e(this,n).get(n)}return $h=t,$h}var Lh,O_;function mF(){if(O_)return Lh;O_=1;var e=Bu();function t(n){return e(this,n).has(n)}return Lh=t,Lh}var qh,P_;function gF(){if(P_)return qh;P_=1;var e=Bu();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return qh=t,qh}var Dh,$_;function Pw(){if($_)return Dh;$_=1;var e=dF(),t=hF(),n=pF(),s=mF(),i=gF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Dh=a,Dh}var Fh,L_;function vF(){if(L_)return Fh;L_=1;var e=Fu(),t=Ow(),n=Pw(),s=200;function i(a,l){var u=this.__data__;if(u instanceof e){var h=u.__data__;if(!t||h.length<s-1)return h.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(h)}return u.set(a,l),this.size=u.size,this}return Fh=i,Fh}var zh,q_;function Uu(){if(q_)return zh;q_=1;var e=Fu(),t=K5(),n=X5(),s=Q5(),i=Z5(),a=vF();function l(u){var h=this.__data__=new e(u);this.size=h.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=i,l.prototype.set=a,zh=l,zh}var Bh,D_;function $w(){if(D_)return Bh;D_=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return Bh=e,Bh}var Uh,F_;function HT(){if(F_)return Uh;F_=1;var e=So(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Uh=t,Uh}var Wh,z_;function Wu(){if(z_)return Wh;z_=1;var e=HT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Wh=t,Wh}var Hh,B_;function Hu(){if(B_)return Hh;B_=1;var e=Wu(),t=Gi(),n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u){var h=a[l];(!(s.call(a,l)&&t(h,u))||u===void 0&&!(l in a))&&e(a,l,u)}return Hh=i,Hh}var Gh,U_;function kl(){if(U_)return Gh;U_=1;var e=Hu(),t=Wu();function n(s,i,a,l){var u=!a;a||(a={});for(var h=-1,p=i.length;++h<p;){var f=i[h],g=l?l(a[f],s[f],f,a,s):void 0;g===void 0&&(g=s[f]),u?t(a,f,g):e(a,f,g)}return a}return Gh=n,Gh}var Vh,W_;function yF(){if(W_)return Vh;W_=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return Vh=e,Vh}var Yh,H_;function Cr(){if(H_)return Yh;H_=1;function e(t){return t!=null&&typeof t=="object"}return Yh=e,Yh}var Kh,G_;function wF(){if(G_)return Kh;G_=1;var e=ko(),t=Cr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return Kh=s,Kh}var Xh,V_;function Sl(){if(V_)return Xh;V_=1;var e=wF(),t=Cr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return Xh=a,Xh}var Qh,Y_;function Mt(){if(Y_)return Qh;Y_=1;var e=Array.isArray;return Qh=e,Qh}var Ka={exports:{}},Zh,K_;function xF(){if(K_)return Zh;K_=1;function e(){return!1}return Zh=e,Zh}Ka.exports;var X_;function Yi(){return X_||(X_=1,(function(e,t){var n=dr(),s=xF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(Ka,Ka.exports)),Ka.exports}var Jh,Q_;function Gu(){if(Q_)return Jh;Q_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return Jh=n,Jh}var ep,Z_;function Lw(){if(Z_)return ep;Z_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return ep=t,ep}var tp,J_;function bF(){if(J_)return tp;J_=1;var e=ko(),t=Lw(),n=Cr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",b="[object WeakMap]",_="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",P="[object Uint8Array]",F="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[C]=q[j]=q[I]=q[O]=q[P]=q[F]=q[M]=q[A]=!0,q[s]=q[i]=q[_]=q[a]=q[k]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[y]=q[w]=q[N]=q[b]=!1;function W(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return tp=W,tp}var np,ek;function Vu(){if(ek)return np;ek=1;function e(t){return function(n){return t(n)}}return np=e,np}var Xa={exports:{}};Xa.exports;var tk;function qw(){return tk||(tk=1,(function(e,t){var n=UT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(Xa,Xa.exports)),Xa.exports}var rp,nk;function Nl(){if(nk)return rp;nk=1;var e=bF(),t=Vu(),n=qw(),s=n&&n.isTypedArray,i=s?t(s):e;return rp=i,rp}var sp,rk;function GT(){if(rk)return sp;rk=1;var e=yF(),t=Sl(),n=Mt(),s=Yi(),i=Gu(),a=Nl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),N=!g&&!y&&!w&&a(p),b=g||y||w||N,_=b?e(p.length,String):[],k=_.length;for(var E in p)(f||u.call(p,E))&&!(b&&(E=="length"||w&&(E=="offset"||E=="parent")||N&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,k)))&&_.push(E);return _}return sp=h,sp}var op,sk;function Yu(){if(sk)return op;sk=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return op=t,op}var ip,ok;function VT(){if(ok)return ip;ok=1;function e(t,n){return function(s){return t(n(s))}}return ip=e,ip}var ap,ik;function _F(){if(ik)return ap;ik=1;var e=VT(),t=e(Object.keys,Object);return ap=t,ap}var lp,ak;function Dw(){if(ak)return lp;ak=1;var e=Yu(),t=_F(),n=Object.prototype,s=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return lp=i,lp}var cp,lk;function Zr(){if(lk)return cp;lk=1;var e=_l(),t=Lw();function n(s){return s!=null&&t(s.length)&&!e(s)}return cp=n,cp}var up,ck;function Os(){if(ck)return up;ck=1;var e=GT(),t=Dw(),n=Zr();function s(i){return n(i)?e(i):t(i)}return up=s,up}var dp,uk;function kF(){if(uk)return dp;uk=1;var e=kl(),t=Os();function n(s,i){return s&&e(i,t(i),s)}return dp=n,dp}var fp,dk;function SF(){if(dk)return fp;dk=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return fp=e,fp}var hp,fk;function NF(){if(fk)return hp;fk=1;var e=Dn(),t=Yu(),n=SF(),s=Object.prototype,i=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),h=[];for(var p in l)p=="constructor"&&(u||!i.call(l,p))||h.push(p);return h}return hp=a,hp}var pp,hk;function No(){if(hk)return pp;hk=1;var e=GT(),t=NF(),n=Zr();function s(i){return n(i)?e(i,!0):t(i)}return pp=s,pp}var mp,pk;function EF(){if(pk)return mp;pk=1;var e=kl(),t=No();function n(s,i){return s&&e(i,t(i),s)}return mp=n,mp}var Qa={exports:{}};Qa.exports;var mk;function YT(){return mk||(mk=1,(function(e,t){var n=dr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,y=u?u(g):new p.constructor(g);return p.copy(y),y}e.exports=h})(Qa,Qa.exports)),Qa.exports}var gp,gk;function KT(){if(gk)return gp;gk=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return gp=e,gp}var vp,vk;function XT(){if(vk)return vp;vk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return vp=e,vp}var yp,yk;function QT(){if(yk)return yp;yk=1;function e(){return[]}return yp=e,yp}var wp,wk;function Fw(){if(wk)return wp;wk=1;var e=XT(),t=QT(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return wp=a,wp}var xp,xk;function CF(){if(xk)return xp;xk=1;var e=kl(),t=Fw();function n(s,i){return e(s,t(s),i)}return xp=n,xp}var bp,bk;function zw(){if(bk)return bp;bk=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return bp=e,bp}var _p,_k;function Ku(){if(_k)return _p;_k=1;var e=VT(),t=e(Object.getPrototypeOf,Object);return _p=t,_p}var kp,kk;function ZT(){if(kk)return kp;kk=1;var e=zw(),t=Ku(),n=Fw(),s=QT(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return kp=a,kp}var Sp,Sk;function jF(){if(Sk)return Sp;Sk=1;var e=kl(),t=ZT();function n(s,i){return e(s,t(s),i)}return Sp=n,Sp}var Np,Nk;function JT(){if(Nk)return Np;Nk=1;var e=zw(),t=Mt();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Np=n,Np}var Ep,Ek;function eR(){if(Ek)return Ep;Ek=1;var e=JT(),t=Fw(),n=Os();function s(i){return e(i,n,t)}return Ep=s,Ep}var Cp,Ck;function TF(){if(Ck)return Cp;Ck=1;var e=JT(),t=ZT(),n=No();function s(i){return e(i,n,t)}return Cp=s,Cp}var jp,jk;function RF(){if(jk)return jp;jk=1;var e=So(),t=dr(),n=e(t,"DataView");return jp=n,jp}var Tp,Tk;function AF(){if(Tk)return Tp;Tk=1;var e=So(),t=dr(),n=e(t,"Promise");return Tp=n,Tp}var Rp,Rk;function tR(){if(Rk)return Rp;Rk=1;var e=So(),t=dr(),n=e(t,"Set");return Rp=n,Rp}var Ap,Ak;function MF(){if(Ak)return Ap;Ak=1;var e=So(),t=dr(),n=e(t,"WeakMap");return Ap=n,Ap}var Mp,Mk;function Ki(){if(Mk)return Mp;Mk=1;var e=RF(),t=Ow(),n=AF(),s=tR(),i=MF(),a=ko(),l=WT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),N=l(t),b=l(n),_=l(s),k=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(C){var j=a(C),I=j==h?C.constructor:void 0,O=I?l(I):"";if(O)switch(O){case w:return y;case N:return u;case b:return p;case _:return f;case k:return g}return j}),Mp=E,Mp}var Ip,Ik;function IF(){if(Ik)return Ip;Ik=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var i=s.length,a=new s.constructor(i);return i&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Ip=n,Ip}var Op,Ok;function nR(){if(Ok)return Op;Ok=1;var e=dr(),t=e.Uint8Array;return Op=t,Op}var Pp,Pk;function Bw(){if(Pk)return Pp;Pk=1;var e=nR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Pp=t,Pp}var $p,$k;function OF(){if($k)return $p;$k=1;var e=Bw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return $p=t,$p}var Lp,Lk;function PF(){if(Lk)return Lp;Lk=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Lp=t,Lp}var qp,qk;function $F(){if(qk)return qp;qk=1;var e=Vi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return qp=s,qp}var Dp,Dk;function rR(){if(Dk)return Dp;Dk=1;var e=Bw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Dp=t,Dp}var Fp,Fk;function LF(){if(Fk)return Fp;Fk=1;var e=Bw(),t=OF(),n=PF(),s=$F(),i=rR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",b="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]";function F(M,A,q){var W=M.constructor;switch(A){case w:return e(M);case a:case l:return new W(+M);case N:return t(M,q);case b:case _:case k:case E:case C:case j:case I:case O:case P:return i(M,q);case u:return new W;case h:case g:return new W(M);case p:return n(M);case f:return new W;case y:return s(M)}}return Fp=F,Fp}var zp,zk;function sR(){if(zk)return zp;zk=1;var e=Dn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return zp=n,zp}var Bp,Bk;function oR(){if(Bk)return Bp;Bk=1;var e=sR(),t=Ku(),n=Yu();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Bp=s,Bp}var Up,Uk;function qF(){if(Uk)return Up;Uk=1;var e=Ki(),t=Cr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Up=s,Up}var Wp,Wk;function DF(){if(Wk)return Wp;Wk=1;var e=qF(),t=Vu(),n=qw(),s=n&&n.isMap,i=s?t(s):e;return Wp=i,Wp}var Hp,Hk;function FF(){if(Hk)return Hp;Hk=1;var e=Ki(),t=Cr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Hp=s,Hp}var Gp,Gk;function zF(){if(Gk)return Gp;Gk=1;var e=FF(),t=Vu(),n=qw(),s=n&&n.isSet,i=s?t(s):e;return Gp=i,Gp}var Vp,Vk;function iR(){if(Vk)return Vp;Vk=1;var e=Uu(),t=$w(),n=Hu(),s=kF(),i=EF(),a=YT(),l=KT(),u=CF(),h=jF(),p=eR(),f=TF(),g=Ki(),y=IF(),w=LF(),N=oR(),b=Mt(),_=Yi(),k=DF(),E=Dn(),C=zF(),j=Os(),I=No(),O=1,P=2,F=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",W="[object Date]",Y="[object Error]",T="[object Function]",Q="[object GeneratorFunction]",U="[object Map]",ne="[object Number]",X="[object Object]",H="[object RegExp]",J="[object Set]",$="[object String]",G="[object Symbol]",Z="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",K="[object Float32Array]",re="[object Float64Array]",he="[object Int8Array]",pe="[object Int16Array]",we="[object Int32Array]",Ce="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Be="[object Uint16Array]",Le="[object Uint32Array]",Se={};Se[M]=Se[A]=Se[D]=Se[L]=Se[q]=Se[W]=Se[K]=Se[re]=Se[he]=Se[pe]=Se[we]=Se[U]=Se[ne]=Se[X]=Se[H]=Se[J]=Se[$]=Se[G]=Se[Ce]=Se[Ve]=Se[Be]=Se[Le]=!0,Se[Y]=Se[T]=Se[Z]=!1;function ce(be,xe,Ke,ut,at,de){var _e,De=xe&O,Ge=xe&P,lt=xe&F;if(Ke&&(_e=at?Ke(be,ut,at,de):Ke(be)),_e!==void 0)return _e;if(!E(be))return be;var je=b(be);if(je){if(_e=y(be),!De)return l(be,_e)}else{var We=g(be),Xe=We==T||We==Q;if(_(be))return a(be,De);if(We==X||We==M||Xe&&!at){if(_e=Ge||Xe?{}:N(be),!De)return Ge?h(be,i(_e,be)):u(be,s(_e,be))}else{if(!Se[We])return at?be:{};_e=w(be,We,De)}}de||(de=new e);var oe=de.get(be);if(oe)return oe;de.set(be,_e),C(be)?be.forEach(function(Te){_e.add(ce(Te,xe,Ke,Te,be,de))}):k(be)&&be.forEach(function(Te,Qe){_e.set(Qe,ce(Te,xe,Ke,Qe,be,de))});var Oe=lt?Ge?f:p:Ge?I:j,Pe=je?void 0:Oe(be);return t(Pe||be,function(Te,Qe){Pe&&(Qe=Te,Te=be[Qe]),n(_e,Qe,ce(Te,xe,Ke,Qe,be,de))}),_e}return Vp=ce,Vp}var Yp,Yk;function BF(){if(Yk)return Yp;Yk=1;var e=iR(),t=4;function n(s){return e(s,t)}return Yp=n,Yp}var Kp,Kk;function Uw(){if(Kk)return Kp;Kk=1;function e(t){return function(){return t}}return Kp=e,Kp}var Xp,Xk;function UF(){if(Xk)return Xp;Xk=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return Xp=e,Xp}var Qp,Qk;function Ww(){if(Qk)return Qp;Qk=1;var e=UF(),t=e();return Qp=t,Qp}var Zp,Zk;function Hw(){if(Zk)return Zp;Zk=1;var e=Ww(),t=Os();function n(s,i){return s&&e(s,i,t)}return Zp=n,Zp}var Jp,Jk;function WF(){if(Jk)return Jp;Jk=1;var e=Zr();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return Jp=t,Jp}var em,eS;function Xu(){if(eS)return em;eS=1;var e=Hw(),t=WF(),n=t(e);return em=n,em}var tm,tS;function Eo(){if(tS)return tm;tS=1;function e(t){return t}return tm=e,tm}var nm,nS;function aR(){if(nS)return nm;nS=1;var e=Eo();function t(n){return typeof n=="function"?n:e}return nm=t,nm}var rm,rS;function lR(){if(rS)return rm;rS=1;var e=$w(),t=Xu(),n=aR(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return rm=i,rm}var sm,sS;function cR(){return sS||(sS=1,sm=lR()),sm}var om,oS;function HF(){if(oS)return om;oS=1;var e=Xu();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return om=t,om}var im,iS;function GF(){if(iS)return im;iS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return im=t,im}var am,aS;function VF(){if(aS)return am;aS=1;function e(t){return this.__data__.has(t)}return am=e,am}var lm,lS;function uR(){if(lS)return lm;lS=1;var e=Pw(),t=GF(),n=VF();function s(i){var a=-1,l=i==null?0:i.length;for(this.__data__=new e;++a<l;)this.add(i[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,lm=s,lm}var cm,cS;function YF(){if(cS)return cm;cS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return cm=e,cm}var um,uS;function dR(){if(uS)return um;uS=1;function e(t,n){return t.has(n)}return um=e,um}var dm,dS;function fR(){if(dS)return dm;dS=1;var e=uR(),t=YF(),n=dR(),s=1,i=2;function a(l,u,h,p,f,g){var y=h&s,w=l.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var b=g.get(l),_=g.get(u);if(b&&_)return b==u&&_==l;var k=-1,E=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++k<w;){var j=l[k],I=u[k];if(p)var O=y?p(I,j,k,u,l,g):p(j,I,k,l,u,g);if(O!==void 0){if(O)continue;E=!1;break}if(C){if(!t(u,function(P,F){if(!n(C,F)&&(j===P||f(j,P,h,p,g)))return C.push(F)})){E=!1;break}}else if(!(j===I||f(j,I,h,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return dm=a,dm}var fm,fS;function KF(){if(fS)return fm;fS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return fm=e,fm}var hm,hS;function Gw(){if(hS)return hm;hS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return hm=e,hm}var pm,pS;function XF(){if(pS)return pm;pS=1;var e=Vi(),t=nR(),n=Gi(),s=fR(),i=KF(),a=Gw(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",b="[object String]",_="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function I(O,P,F,M,A,q,W){switch(F){case E:if(O.byteLength!=P.byteLength||O.byteOffset!=P.byteOffset)return!1;O=O.buffer,P=P.buffer;case k:return!(O.byteLength!=P.byteLength||!q(new t(O),new t(P)));case h:case p:case y:return n(+O,+P);case f:return O.name==P.name&&O.message==P.message;case w:case b:return O==P+"";case g:var Y=i;case N:var T=M&l;if(Y||(Y=a),O.size!=P.size&&!T)return!1;var Q=W.get(O);if(Q)return Q==P;M|=u,W.set(O,P);var U=s(Y(O),Y(P),M,A,q,W);return W.delete(O),U;case _:if(j)return j.call(O)==j.call(P)}return!1}return pm=I,pm}var mm,mS;function QF(){if(mS)return mm;mS=1;var e=eR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,y=e(a),w=y.length,N=e(l),b=N.length;if(w!=b&&!g)return!1;for(var _=w;_--;){var k=y[_];if(!(g?k in l:s.call(l,k)))return!1}var E=f.get(a),C=f.get(l);if(E&&C)return E==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var I=g;++_<w;){k=y[_];var O=a[k],P=l[k];if(h)var F=g?h(P,O,k,l,a,f):h(O,P,k,a,l,f);if(!(F===void 0?O===P||p(O,P,u,h,f):F)){j=!1;break}I||(I=k=="constructor")}if(j&&!I){var M=a.constructor,A=l.constructor;M!=A&&"constructor"in a&&"constructor"in l&&!(typeof M=="function"&&M instanceof M&&typeof A=="function"&&A instanceof A)&&(j=!1)}return f.delete(a),f.delete(l),j}return mm=i,mm}var gm,gS;function ZF(){if(gS)return gm;gS=1;var e=Uu(),t=fR(),n=XF(),s=QF(),i=Ki(),a=Mt(),l=Yi(),u=Nl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(b,_,k,E,C,j){var I=a(b),O=a(_),P=I?f:i(b),F=O?f:i(_);P=P==p?g:P,F=F==p?g:F;var M=P==g,A=F==g,q=P==F;if(q&&l(b)){if(!l(_))return!1;I=!0,M=!1}if(q&&!M)return j||(j=new e),I||u(b)?t(b,_,k,E,C,j):n(b,_,P,k,E,C,j);if(!(k&h)){var W=M&&w.call(b,"__wrapped__"),Y=A&&w.call(_,"__wrapped__");if(W||Y){var T=W?b.value():b,Q=Y?_.value():_;return j||(j=new e),C(T,Q,k,E,j)}}return q?(j||(j=new e),s(b,_,k,E,C,j)):!1}return gm=N,gm}var vm,vS;function hR(){if(vS)return vm;vS=1;var e=ZF(),t=Cr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return vm=n,vm}var ym,yS;function JF(){if(yS)return ym;yS=1;var e=Uu(),t=hR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var y=u[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<f;){y=u[p];var w=y[0],N=a[w],b=y[1];if(g&&y[2]){if(N===void 0&&!(w in a))return!1}else{var _=new e;if(h)var k=h(N,b,w,a,l,_);if(!(k===void 0?t(b,N,n|s,h,_):k))return!1}}return!0}return ym=i,ym}var wm,wS;function pR(){if(wS)return wm;wS=1;var e=Dn();function t(n){return n===n&&!e(n)}return wm=t,wm}var xm,xS;function e6(){if(xS)return xm;xS=1;var e=pR(),t=Os();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return xm=n,xm}var bm,bS;function mR(){if(bS)return bm;bS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return bm=e,bm}var _m,_S;function t6(){if(_S)return _m;_S=1;var e=JF(),t=e6(),n=mR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return _m=s,_m}var km,kS;function Xi(){if(kS)return km;kS=1;var e=ko(),t=Cr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return km=s,km}var Sm,SS;function Vw(){if(SS)return Sm;SS=1;var e=Mt(),t=Xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function i(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return Sm=i,Sm}var Nm,NS;function n6(){if(NS)return Nm;NS=1;var e=Pw(),t="Expected a function";function n(s,i){if(typeof s!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var l=arguments,u=i?i.apply(this,l):l[0],h=a.cache;if(h.has(u))return h.get(u);var p=s.apply(this,l);return a.cache=h.set(u,p)||h,p};return a.cache=new(n.Cache||e),a}return n.Cache=e,Nm=n,Nm}var Em,ES;function r6(){if(ES)return Em;ES=1;var e=n6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Em=n,Em}var Cm,CS;function s6(){if(CS)return Cm;CS=1;var e=r6(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(l,u,h,p){a.push(h?p.replace(n,"$1"):u||l)}),a});return Cm=s,Cm}var jm,jS;function Qu(){if(jS)return jm;jS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return jm=e,jm}var Tm,TS;function o6(){if(TS)return Tm;TS=1;var e=Vi(),t=Qu(),n=Mt(),s=Xi(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return Tm=l,Tm}var Rm,RS;function gR(){if(RS)return Rm;RS=1;var e=o6();function t(n){return n==null?"":e(n)}return Rm=t,Rm}var Am,AS;function Zu(){if(AS)return Am;AS=1;var e=Mt(),t=Vw(),n=s6(),s=gR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Am=i,Am}var Mm,MS;function El(){if(MS)return Mm;MS=1;var e=Xi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Mm=t,Mm}var Im,IS;function Ju(){if(IS)return Im;IS=1;var e=Zu(),t=El();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Im=n,Im}var Om,OS;function i6(){if(OS)return Om;OS=1;var e=Ju();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Om=t,Om}var Pm,PS;function a6(){if(PS)return Pm;PS=1;function e(t,n){return t!=null&&n in Object(t)}return Pm=e,Pm}var $m,$S;function vR(){if($S)return $m;$S=1;var e=Zu(),t=Sl(),n=Mt(),s=Gu(),i=Lw(),a=El();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,y=!1;++f<g;){var w=a(h[f]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++f!=g?y:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return $m=l,$m}var Lm,LS;function yR(){if(LS)return Lm;LS=1;var e=a6(),t=vR();function n(s,i){return s!=null&&t(s,i,e)}return Lm=n,Lm}var qm,qS;function l6(){if(qS)return qm;qS=1;var e=hR(),t=i6(),n=yR(),s=Vw(),i=pR(),a=mR(),l=El(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(y){var w=t(y,f);return w===void 0&&w===g?n(y,f):e(g,w,u|h)}}return qm=p,qm}var Dm,DS;function wR(){if(DS)return Dm;DS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Dm=e,Dm}var Fm,FS;function c6(){if(FS)return Fm;FS=1;var e=Ju();function t(n){return function(s){return e(s,n)}}return Fm=t,Fm}var zm,zS;function u6(){if(zS)return zm;zS=1;var e=wR(),t=c6(),n=Vw(),s=El();function i(a){return n(a)?e(s(a)):t(a)}return zm=i,zm}var Bm,BS;function Jr(){if(BS)return Bm;BS=1;var e=t6(),t=l6(),n=Eo(),s=Mt(),i=u6();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):i(l)}return Bm=a,Bm}var Um,US;function xR(){if(US)return Um;US=1;var e=XT(),t=HF(),n=Jr(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Um=i,Um}var Wm,WS;function d6(){if(WS)return Wm;WS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Wm=n,Wm}var Hm,HS;function bR(){if(HS)return Hm;HS=1;var e=d6(),t=vR();function n(s,i){return s!=null&&t(s,i,e)}return Hm=n,Hm}var Gm,GS;function f6(){if(GS)return Gm;GS=1;var e=Dw(),t=Ki(),n=Sl(),s=Mt(),i=Zr(),a=Yi(),l=Yu(),u=Nl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function y(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==h||N==p)return!w.size;if(l(w))return!e(w).length;for(var b in w)if(g.call(w,b))return!1;return!0}return Gm=y,Gm}var Vm,VS;function _R(){if(VS)return Vm;VS=1;function e(t){return t===void 0}return Vm=e,Vm}var Ym,YS;function kR(){if(YS)return Ym;YS=1;var e=Xu(),t=Zr();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return Ym=n,Ym}var Km,KS;function SR(){if(KS)return Km;KS=1;var e=Qu(),t=Jr(),n=kR(),s=Mt();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return Km=i,Km}var Xm,XS;function h6(){if(XS)return Xm;XS=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return Xm=e,Xm}var Qm,QS;function p6(){if(QS)return Qm;QS=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return Qm=e,Qm}var Zm,ZS;function NR(){if(ZS)return Zm;ZS=1;var e=h6(),t=Xu(),n=Jr(),s=p6(),i=Mt();function a(l,u,h){var p=i(l)?e:s,f=arguments.length<3;return p(l,n(u,4),h,f,t)}return Zm=a,Zm}var Jm,JS;function m6(){if(JS)return Jm;JS=1;var e=ko(),t=Mt(),n=Cr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return Jm=i,Jm}var eg,eN;function g6(){if(eN)return eg;eN=1;var e=wR(),t=e("length");return eg=t,eg}var tg,tN;function v6(){if(tN)return tg;tN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return tg=h,tg}var ng,nN;function y6(){if(nN)return ng;nN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",b="["+a+"]?",_="(?:"+w+"(?:"+[f,g,y].join("|")+")"+b+N+")*",k=b+N+_,E="(?:"+[f+u+"?",u,g,y,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+E+k,"g");function j(I){for(var O=C.lastIndex=0;C.test(I);)++O;return O}return ng=j,ng}var rg,rN;function w6(){if(rN)return rg;rN=1;var e=g6(),t=v6(),n=y6();function s(i){return t(i)?n(i):e(i)}return rg=s,rg}var sg,sN;function x6(){if(sN)return sg;sN=1;var e=Dw(),t=Ki(),n=Zr(),s=m6(),i=w6(),a="[object Map]",l="[object Set]";function u(h){if(h==null)return 0;if(n(h))return s(h)?i(h):h.length;var p=t(h);return p==a||p==l?h.size:e(h).length}return sg=u,sg}var og,oN;function b6(){if(oN)return og;oN=1;var e=$w(),t=sR(),n=Hw(),s=Jr(),i=Ku(),a=Mt(),l=Yi(),u=_l(),h=Dn(),p=Nl();function f(g,y,w){var N=a(g),b=N||l(g)||p(g);if(y=s(y,4),w==null){var _=g&&g.constructor;b?w=N?new _:[]:h(g)?w=u(_)?t(i(g)):{}:w={}}return(b?e:n)(g,function(k,E,C){return y(w,k,E,C)}),w}return og=f,og}var ig,iN;function _6(){if(iN)return ig;iN=1;var e=Vi(),t=Sl(),n=Mt(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return ig=i,ig}var ag,aN;function Yw(){if(aN)return ag;aN=1;var e=zw(),t=_6();function n(s,i,a,l,u){var h=-1,p=s.length;for(a||(a=t),u||(u=[]);++h<p;){var f=s[h];i>0&&a(f)?i>1?n(f,i-1,a,l,u):e(u,f):l||(u[u.length]=f)}return u}return ag=n,ag}var lg,lN;function k6(){if(lN)return lg;lN=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 lg=e,lg}var cg,cN;function ER(){if(cN)return cg;cN=1;var e=k6(),t=Math.max;function n(s,i,a){return i=t(i===void 0?s.length-1:i,0),function(){for(var l=arguments,u=-1,h=t(l.length-i,0),p=Array(h);++u<h;)p[u]=l[i+u];u=-1;for(var f=Array(i+1);++u<i;)f[u]=l[u];return f[i]=a(p),e(s,this,f)}}return cg=n,cg}var ug,uN;function S6(){if(uN)return ug;uN=1;var e=Uw(),t=HT(),n=Eo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return ug=s,ug}var dg,dN;function N6(){if(dN)return dg;dN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return dg=s,dg}var fg,fN;function CR(){if(fN)return fg;fN=1;var e=S6(),t=N6(),n=t(e);return fg=n,fg}var hg,hN;function ed(){if(hN)return hg;hN=1;var e=Eo(),t=ER(),n=CR();function s(i,a){return n(t(i,a,e),i+"")}return hg=s,hg}var pg,pN;function jR(){if(pN)return pg;pN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return pg=e,pg}var mg,mN;function E6(){if(mN)return mg;mN=1;function e(t){return t!==t}return mg=e,mg}var gg,gN;function C6(){if(gN)return gg;gN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return gg=e,gg}var vg,vN;function j6(){if(vN)return vg;vN=1;var e=jR(),t=E6(),n=C6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return vg=s,vg}var yg,yN;function T6(){if(yN)return yg;yN=1;var e=j6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return yg=t,yg}var wg,wN;function R6(){if(wN)return wg;wN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return wg=e,wg}var xg,xN;function A6(){if(xN)return xg;xN=1;function e(){}return xg=e,xg}var bg,bN;function M6(){if(bN)return bg;bN=1;var e=tR(),t=A6(),n=Gw(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return bg=i,bg}var _g,_N;function I6(){if(_N)return _g;_N=1;var e=uR(),t=T6(),n=R6(),s=dR(),i=M6(),a=Gw(),l=200;function u(h,p,f){var g=-1,y=t,w=h.length,N=!0,b=[],_=b;if(f)N=!1,y=n;else if(w>=l){var k=p?null:i(h);if(k)return a(k);N=!1,y=s,_=new e}else _=p?[]:b;e:for(;++g<w;){var E=h[g],C=p?p(E):E;if(E=f||E!==0?E:0,N&&C===C){for(var j=_.length;j--;)if(_[j]===C)continue e;p&&_.push(C),b.push(E)}else y(_,C,f)||(_!==b&&_.push(C),b.push(E))}return b}return _g=u,_g}var kg,kN;function TR(){if(kN)return kg;kN=1;var e=Zr(),t=Cr();function n(s){return t(s)&&e(s)}return kg=n,kg}var Sg,SN;function O6(){if(SN)return Sg;SN=1;var e=Yw(),t=ed(),n=I6(),s=TR(),i=t(function(a){return n(e(a,1,s,!0))});return Sg=i,Sg}var Ng,NN;function P6(){if(NN)return Ng;NN=1;var e=Qu();function t(n,s){return e(s,function(i){return n[i]})}return Ng=t,Ng}var Eg,EN;function RR(){if(EN)return Eg;EN=1;var e=P6(),t=Os();function n(s){return s==null?[]:e(s,t(s))}return Eg=n,Eg}var Cg,CN;function Fn(){if(CN)return Cg;CN=1;var e;if(typeof Iw=="function")try{e={clone:BF(),constant:Uw(),each:cR(),filter:xR(),has:bR(),isArray:Mt(),isEmpty:f6(),isFunction:_l(),isUndefined:_R(),keys:Os(),map:SR(),reduce:NR(),size:x6(),transform:b6(),union:O6(),values:RR()}}catch{}return e||(e=window._),Cg=e,Cg}var jg,jN;function Kw(){if(jN)return jg;jN=1;var e=Fn();jg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var y=arguments,w=this;return e.each(f,function(N){y.length>1?w.setNode(N,g):w.setNode(N)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(b,_){f(_)&&g.setNode(_,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,y.edge(b))});var w={};function N(b){var _=y.parent(b);return _===void 0||g.hasNode(_)?(w[b]=_,_):_ in w?w[_]:N(_)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,N(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var y=this,w=arguments;return e.reduce(f,function(N,b){return w.length>1?y.setEdge(N,b,g):y.setEdge(N,b),b}),this},i.prototype.setEdge=function(){var f,g,y,w,N=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,y=b.name,arguments.length===2&&(w=arguments[1],N=!0)):(f=b,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),f=""+f,g=""+g,e.isUndefined(y)||(y=""+y);var _=u(this._isDirected,f,g,y);if(e.has(this._edgeLabels,_))return N&&(this._edgeLabels[_]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[_]=N?w:this._defaultEdgeLabelFn(f,g,y);var k=h(this._isDirected,f,g,y);return f=k.v,g=k.w,Object.freeze(k),this._edgeObjs[_]=k,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][_]=k,this._out[f][_]=k,this._edgeCount++,this},i.prototype.edge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y),N=this._edgeObjs[w];return N&&(f=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var y=this._in[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.v===g}):w}},i.prototype.outEdges=function(f,g){var y=this._out[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.w===g}):w}},i.prototype.nodeEdges=function(f,g){var y=this.inEdges(f,g);if(y)return y.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}return N+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}var k={v:N,w:b};return w&&(k.name=w),k}function p(f,g){return u(f,g.v,g.w,g.name)}return jg}var Tg,TN;function $6(){return TN||(TN=1,Tg="2.1.8"),Tg}var Rg,RN;function L6(){return RN||(RN=1,Rg={Graph:Kw(),version:$6()}),Rg}var Ag,AN;function q6(){if(AN)return Ag;AN=1;var e=Fn(),t=Kw();Ag={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var h=l.node(u),p=l.parent(u),f={v:u};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function i(l){return e.map(l.edges(),function(u){var h=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(h)||(p.value=h),p})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(h){u.setNode(h.v,h.value),h.parent&&u.setParent(h.v,h.parent)}),e.each(l.edges,function(h){u.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),u}return Ag}var Mg,MN;function D6(){if(MN)return Mg;MN=1;var e=Fn();Mg=t;function t(n){var s={},i=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&i.push(a)}),i}return Mg}var Ig,IN;function AR(){if(IN)return Ig;IN=1;var e=Fn();Ig=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 i=this._keyIndices;if(n=String(n),!e.has(i,n)){var a=this._arr,l=a.length;return i[n]=l,a.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 i=this._keyIndices[n];if(s>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+s);this._arr[i].priority=s,this._decrease(i)},t.prototype._heapify=function(n){var s=this._arr,i=2*n,a=i+1,l=n;i<s.length&&(l=s[i].priority<s[l].priority?i:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,i=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<i));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var i=this._arr,a=this._keyIndices,l=i[n],u=i[s];i[n]=u,i[s]=l,a[u.key]=n,a[l.key]=s},Ig}var Og,ON;function MR(){if(ON)return Og;ON=1;var e=Fn(),t=AR();Og=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,y,w=function(N){var b=N.v!==g?N.v:N.w,_=p[b],k=u(N),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);E<_.distance&&(_.distance=E,_.predecessor=g,f.decrease(b,E))};for(a.nodes().forEach(function(N){var b=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:b},f.add(N,b)});f.size()>0&&(g=f.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Og}var Pg,PN;function F6(){if(PN)return Pg;PN=1;var e=MR(),t=Fn();Pg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Pg}var $g,$N;function IR(){if($N)return $g;$N=1;var e=Fn();$g=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return $g}var Lg,LN;function z6(){if(LN)return Lg;LN=1;var e=Fn(),t=IR();Lg=n;function n(s){return e.filter(t(s),function(i){return i.length>1||i.length===1&&s.hasEdge(i[0],i[0])})}return Lg}var qg,qN;function B6(){if(qN)return qg;qN=1;var e=Fn();qg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,y=a(f);u[p][g]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var y=u[g];h.forEach(function(w){var N=y[p],b=f[w],_=y[w],k=N.distance+b.distance;k<_.distance&&(_.distance=k,_.predecessor=b.predecessor)})})}),u}return qg}var Dg,DN;function OR(){if(DN)return Dg;DN=1;var e=Fn();Dg=t,t.CycleException=n;function t(s){var i={},a={},l=[];function u(h){if(e.has(a,h))throw new n;e.has(i,h)||(a[h]=!0,i[h]=!0,e.each(s.predecessors(h),u),delete a[h],l.push(h))}if(e.each(s.sinks(),u),e.size(i)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Dg}var Fg,FN;function U6(){if(FN)return Fg;FN=1;var e=OR();Fg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Fg}var zg,zN;function PR(){if(zN)return zg;zN=1;var e=Fn();zg=t;function t(s,i,a){e.isArray(i)||(i=[i]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],h={};return e.each(i,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,a==="post",h,l,u)}),u}function n(s,i,a,l,u,h){e.has(l,i)||(l[i]=!0,a||h.push(i),e.each(u(i),function(p){n(s,p,a,l,u,h)}),a&&h.push(i))}return zg}var Bg,BN;function W6(){if(BN)return Bg;BN=1;var e=PR();Bg=t;function t(n,s){return e(n,s,"post")}return Bg}var Ug,UN;function H6(){if(UN)return Ug;UN=1;var e=PR();Ug=t;function t(n,s){return e(n,s,"pre")}return Ug}var Wg,WN;function G6(){if(WN)return Wg;WN=1;var e=Fn(),t=Kw(),n=AR();Wg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var b=a(y);b<N&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return Wg}var Hg,HN;function V6(){return HN||(HN=1,Hg={components:D6(),dijkstra:MR(),dijkstraAll:F6(),findCycles:z6(),floydWarshall:B6(),isAcyclic:U6(),postorder:W6(),preorder:H6(),prim:G6(),tarjan:IR(),topsort:OR()}),Hg}var Gg,GN;function Y6(){if(GN)return Gg;GN=1;var e=L6();return Gg={Graph:e.Graph,json:q6(),alg:V6(),version:e.version},Gg}var Vg,VN;function cr(){if(VN)return Vg;VN=1;var e;if(typeof Iw=="function")try{e=Y6()}catch{}return e||(e=window.graphlib),Vg=e,Vg}var Yg,YN;function K6(){if(YN)return Yg;YN=1;var e=iR(),t=1,n=4;function s(i){return e(i,t|n)}return Yg=s,Yg}var Kg,KN;function td(){if(KN)return Kg;KN=1;var e=Gi(),t=Zr(),n=Gu(),s=Dn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return Kg=i,Kg}var Xg,XN;function X6(){if(XN)return Xg;XN=1;var e=ed(),t=Gi(),n=td(),s=No(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var y=h[p],w=s(y),N=-1,b=w.length;++N<b;){var _=w[N],k=u[_];(k===void 0||t(k,i[_])&&!a.call(u,_))&&(u[_]=y[_])}return u});return Xg=l,Xg}var Qg,QN;function Q6(){if(QN)return Qg;QN=1;var e=Jr(),t=Zr(),n=Os();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return Qg=s,Qg}var Zg,ZN;function Z6(){if(ZN)return Zg;ZN=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Zg=t,Zg}var Jg,JN;function J6(){if(JN)return Jg;JN=1;var e=Z6(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Jg=n,Jg}var ev,eE;function ez(){if(eE)return ev;eE=1;var e=J6(),t=Dn(),n=Xi(),s=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):i.test(p)?s:+p}return ev=h,ev}var tv,tE;function $R(){if(tE)return tv;tE=1;var e=ez(),t=1/0,n=17976931348623157e292;function s(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return tv=s,tv}var nv,nE;function tz(){if(nE)return nv;nE=1;var e=$R();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return nv=t,nv}var rv,rE;function nz(){if(rE)return rv;rE=1;var e=jR(),t=Jr(),n=tz(),s=Math.max;function i(a,l,u){var h=a==null?0:a.length;if(!h)return-1;var p=u==null?0:n(u);return p<0&&(p=s(h+p,0)),e(a,t(l,3),p)}return rv=i,rv}var sv,sE;function rz(){if(sE)return sv;sE=1;var e=Q6(),t=nz(),n=e(t);return sv=n,sv}var ov,oE;function LR(){if(oE)return ov;oE=1;var e=Yw();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return ov=t,ov}var iv,iE;function sz(){if(iE)return iv;iE=1;var e=Ww(),t=aR(),n=No();function s(i,a){return i==null?i:e(i,t(a),n)}return iv=s,iv}var av,aE;function oz(){if(aE)return av;aE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return av=e,av}var lv,lE;function iz(){if(lE)return lv;lE=1;var e=Wu(),t=Hw(),n=Jr();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return lv=s,lv}var cv,cE;function Xw(){if(cE)return cv;cE=1;var e=Xi();function t(n,s,i){for(var a=-1,l=n.length;++a<l;){var u=n[a],h=s(u);if(h!=null&&(p===void 0?h===h&&!e(h):i(h,p)))var p=h,f=u}return f}return cv=t,cv}var uv,uE;function az(){if(uE)return uv;uE=1;function e(t,n){return t>n}return uv=e,uv}var dv,dE;function lz(){if(dE)return dv;dE=1;var e=Xw(),t=az(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return dv=s,dv}var fv,fE;function qR(){if(fE)return fv;fE=1;var e=Wu(),t=Gi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return fv=n,fv}var hv,hE;function cz(){if(hE)return hv;hE=1;var e=ko(),t=Ku(),n=Cr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var y=u.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==h}return hv=p,hv}var pv,pE;function DR(){if(pE)return pv;pE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return pv=e,pv}var mv,mE;function uz(){if(mE)return mv;mE=1;var e=kl(),t=No();function n(s){return e(s,t(s))}return mv=n,mv}var gv,gE;function dz(){if(gE)return gv;gE=1;var e=qR(),t=YT(),n=rR(),s=KT(),i=oR(),a=Sl(),l=Mt(),u=TR(),h=Yi(),p=_l(),f=Dn(),g=cz(),y=Nl(),w=DR(),N=uz();function b(_,k,E,C,j,I,O){var P=w(_,E),F=w(k,E),M=O.get(F);if(M){e(_,E,M);return}var A=I?I(P,F,E+"",_,k,O):void 0,q=A===void 0;if(q){var W=l(F),Y=!W&&h(F),T=!W&&!Y&&y(F);A=F,W||Y||T?l(P)?A=P:u(P)?A=s(P):Y?(q=!1,A=t(F,!0)):T?(q=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=P,a(P)?A=N(P):(!f(P)||p(P))&&(A=i(F))):q=!1}q&&(O.set(F,A),j(A,F,C,I,O),O.delete(F)),e(_,E,A)}return gv=b,gv}var vv,vE;function fz(){if(vE)return vv;vE=1;var e=Uu(),t=qR(),n=Ww(),s=dz(),i=Dn(),a=No(),l=DR();function u(h,p,f,g,y){h!==p&&n(p,function(w,N){if(y||(y=new e),i(w))s(h,p,N,f,u,g,y);else{var b=g?g(l(h,N),w,N+"",h,p,y):void 0;b===void 0&&(b=w),t(h,N,b)}},a)}return vv=u,vv}var yv,yE;function hz(){if(yE)return yv;yE=1;var e=ed(),t=td();function n(s){return e(function(i,a){var l=-1,u=a.length,h=u>1?a[u-1]:void 0,p=u>2?a[2]:void 0;for(h=s.length>3&&typeof h=="function"?(u--,h):void 0,p&&t(a[0],a[1],p)&&(h=u<3?void 0:h,u=1),i=Object(i);++l<u;){var f=a[l];f&&s(i,f,l,h)}return i})}return yv=n,yv}var wv,wE;function pz(){if(wE)return wv;wE=1;var e=fz(),t=hz(),n=t(function(s,i,a){e(s,i,a)});return wv=n,wv}var xv,xE;function FR(){if(xE)return xv;xE=1;function e(t,n){return t<n}return xv=e,xv}var bv,bE;function mz(){if(bE)return bv;bE=1;var e=Xw(),t=FR(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return bv=s,bv}var _v,_E;function gz(){if(_E)return _v;_E=1;var e=Xw(),t=Jr(),n=FR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return _v=s,_v}var kv,kE;function vz(){if(kE)return kv;kE=1;var e=dr(),t=function(){return e.Date.now()};return kv=t,kv}var Sv,SE;function yz(){if(SE)return Sv;SE=1;var e=Hu(),t=Zu(),n=Gu(),s=Dn(),i=El();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,y=g-1,w=l;w!=null&&++f<g;){var N=i(u[f]),b=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(f!=y){var _=w[N];b=p?p(_,N,w):void 0,b===void 0&&(b=s(_)?_:n(u[f+1])?[]:{})}e(w,N,b),w=w[N]}return l}return Sv=a,Sv}var Nv,NE;function wz(){if(NE)return Nv;NE=1;var e=Ju(),t=yz(),n=Zu();function s(i,a,l){for(var u=-1,h=a.length,p={};++u<h;){var f=a[u],g=e(i,f);l(g,f)&&t(p,n(f,i),g)}return p}return Nv=s,Nv}var Ev,EE;function xz(){if(EE)return Ev;EE=1;var e=wz(),t=yR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Ev=n,Ev}var Cv,CE;function bz(){if(CE)return Cv;CE=1;var e=LR(),t=ER(),n=CR();function s(i){return n(t(i,void 0,e),i+"")}return Cv=s,Cv}var jv,jE;function _z(){if(jE)return jv;jE=1;var e=xz(),t=bz(),n=t(function(s,i){return s==null?{}:e(s,i)});return jv=n,jv}var Tv,TE;function kz(){if(TE)return Tv;TE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return Tv=n,Tv}var Rv,RE;function Sz(){if(RE)return Rv;RE=1;var e=kz(),t=td(),n=$R();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return Rv=s,Rv}var Av,AE;function Nz(){if(AE)return Av;AE=1;var e=Sz(),t=e();return Av=t,Av}var Mv,ME;function Ez(){if(ME)return Mv;ME=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Mv=e,Mv}var Iv,IE;function Cz(){if(IE)return Iv;IE=1;var e=Xi();function t(n,s){if(n!==s){var i=n!==void 0,a=n===null,l=n===n,u=e(n),h=s!==void 0,p=s===null,f=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&h&&f&&!p&&!g||a&&h&&f||!i&&f||!l)return 1;if(!a&&!u&&!g&&n<s||g&&i&&l&&!a&&!u||p&&i&&l||!h&&l||!f)return-1}return 0}return Iv=t,Iv}var Ov,OE;function jz(){if(OE)return Ov;OE=1;var e=Cz();function t(n,s,i){for(var a=-1,l=n.criteria,u=s.criteria,h=l.length,p=i.length;++a<h;){var f=e(l[a],u[a]);if(f){if(a>=p)return f;var g=i[a];return f*(g=="desc"?-1:1)}}return n.index-s.index}return Ov=t,Ov}var Pv,PE;function Tz(){if(PE)return Pv;PE=1;var e=Qu(),t=Ju(),n=Jr(),s=kR(),i=Ez(),a=Vu(),l=jz(),u=Eo(),h=Mt();function p(f,g,y){g.length?g=e(g,function(b){return h(b)?function(_){return t(_,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var N=s(f,function(b,_,k){var E=e(g,function(C){return C(b)});return{criteria:E,index:++w,value:b}});return i(N,function(b,_){return l(b,_,y)})}return Pv=p,Pv}var $v,$E;function Rz(){if($E)return $v;$E=1;var e=Yw(),t=Tz(),n=ed(),s=td(),i=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return $v=i,$v}var Lv,LE;function Az(){if(LE)return Lv;LE=1;var e=gR(),t=0;function n(s){var i=++t;return e(s)+i}return Lv=n,Lv}var qv,qE;function Mz(){if(qE)return qv;qE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return qv=e,qv}var Dv,DE;function Iz(){if(DE)return Dv;DE=1;var e=Hu(),t=Mz();function n(s,i){return t(s||[],i||[],e)}return Dv=n,Dv}var Fv,FE;function xt(){if(FE)return Fv;FE=1;var e;if(typeof Iw=="function")try{e={cloneDeep:K6(),constant:Uw(),defaults:X6(),each:cR(),filter:xR(),find:rz(),flatten:LR(),forEach:lR(),forIn:sz(),has:bR(),isUndefined:_R(),last:oz(),map:SR(),mapValues:iz(),max:lz(),merge:pz(),min:mz(),minBy:gz(),now:vz(),pick:_z(),range:Nz(),reduce:NR(),sortBy:Rz(),uniqueId:Az(),values:RR(),zipObject:Iz()}}catch{}return e||(e=window._),Fv=e,Fv}var zv,zE;function Oz(){if(zE)return zv;zE=1,zv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,i=s._prev;if(i!==s)return t(i),i},e.prototype.enqueue=function(s){var i=this._sentinel;s._prev&&s._next&&t(s),s._next=i._next,i._next._prev=s,i._next=s,s._prev=i},e.prototype.toString=function(){for(var s=[],i=this._sentinel,a=i._prev;a!==i;)s.push(JSON.stringify(a,n)),a=a._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,i){if(s!=="_next"&&s!=="_prev")return i}return zv}var Bv,BE;function Pz(){if(BE)return Bv;BE=1;var e=xt(),t=cr().Graph,n=Oz();Bv=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var y=[],w=f[f.length-1],N=f[0],b;p.nodeCount();){for(;b=N.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var _=f.length-2;_>0;--_)if(b=f[_].dequeue(),b){y=y.concat(l(p,f,g,b,!0));break}}}return y}function l(p,f,g,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(b){var _=p.edge(b),k=p.node(b.v);w&&N.push({v:b.v,w:b.w}),k.out-=_,h(f,g,k)}),e.forEach(p.outEdges(y.v),function(b){var _=p.edge(b),k=b.w,E=p.node(k);E.in-=_,h(f,g,E)}),p.removeNode(y.v),N}function u(p,f){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(p.edges(),function(_){var k=g.edge(_.v,_.w)||0,E=f(_),C=k+E;g.setEdge(_.v,_.w,C),w=Math.max(w,g.node(_.v).out+=E),y=Math.max(y,g.node(_.w).in+=E)});var N=e.range(w+y+3).map(function(){return new n}),b=y+1;return e.forEach(g.nodes(),function(_){h(N,b,g.node(_))}),{graph:g,buckets:N,zeroIdx:b}}function h(p,f,g){g.out?g.in?p[g.out-g.in+f].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return Bv}var Uv,UE;function $z(){if(UE)return Uv;UE=1;var e=xt(),t=Pz();Uv={run:n,undo:i};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(h){var p=a.edge(h);a.removeEdge(h),p.forwardName=h.name,p.reversed=!0,a.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function u(h){return function(p){return h.edge(p).weight}}}function s(a){var l=[],u={},h={};function p(f){e.has(h,f)||(h[f]=!0,u[f]=!0,e.forEach(a.outEdges(f),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[f])}return e.forEach(a.nodes(),p),l}function i(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var h=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,h)}})}return Uv}var Wv,WE;function mn(){if(WE)return Wv;WE=1;var e=xt(),t=cr().Graph;Wv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:y,partition:w,time:N,notime:b};function n(_,k,E,C){var j;do j=e.uniqueId(C);while(_.hasNode(j));return E.dummy=k,_.setNode(j,E),j}function s(_){var k=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(E){k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){var C=k.edge(E.v,E.w)||{weight:0,minlen:1},j=_.edge(E);k.setEdge(E.v,E.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),k}function i(_){var k=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(E){_.children(E).length||k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){k.setEdge(E,_.edge(E))}),k}function a(_){var k=e.map(_.nodes(),function(E){var C={};return e.forEach(_.outEdges(E),function(j){C[j.w]=(C[j.w]||0)+_.edge(j).weight}),C});return e.zipObject(_.nodes(),k)}function l(_){var k=e.map(_.nodes(),function(E){var C={};return e.forEach(_.inEdges(E),function(j){C[j.v]=(C[j.v]||0)+_.edge(j).weight}),C});return e.zipObject(_.nodes(),k)}function u(_,k){var E=_.x,C=_.y,j=k.x-E,I=k.y-C,O=_.width/2,P=_.height/2;if(!j&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var F,M;return Math.abs(I)*O>Math.abs(j)*P?(I<0&&(P=-P),F=P*j/I,M=P):(j<0&&(O=-O),F=O,M=O*I/j),{x:E+F,y:C+M}}function h(_){var k=e.map(e.range(y(_)+1),function(){return[]});return e.forEach(_.nodes(),function(E){var C=_.node(E),j=C.rank;e.isUndefined(j)||(k[j][C.order]=E)}),k}function p(_){var k=e.min(e.map(_.nodes(),function(E){return _.node(E).rank}));e.forEach(_.nodes(),function(E){var C=_.node(E);e.has(C,"rank")&&(C.rank-=k)})}function f(_){var k=e.min(e.map(_.nodes(),function(I){return _.node(I).rank})),E=[];e.forEach(_.nodes(),function(I){var O=_.node(I).rank-k;E[O]||(E[O]=[]),E[O].push(I)});var C=0,j=_.graph().nodeRankFactor;e.forEach(E,function(I,O){e.isUndefined(I)&&O%j!==0?--C:C&&e.forEach(I,function(P){_.node(P).rank+=C})})}function g(_,k,E,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=C),n(_,"border",j,k)}function y(_){return e.max(e.map(_.nodes(),function(k){var E=_.node(k).rank;if(!e.isUndefined(E))return E}))}function w(_,k){var E={lhs:[],rhs:[]};return e.forEach(_,function(C){k(C)?E.lhs.push(C):E.rhs.push(C)}),E}function N(_,k){var E=e.now();try{return k()}finally{console.log(_+" time: "+(e.now()-E)+"ms")}}function b(_,k){return k()}return Wv}var Hv,HE;function Lz(){if(HE)return Hv;HE=1;var e=xt(),t=mn();Hv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,y=a.edge(l),w=y.labelRank;if(f!==h+1){a.removeEdge(l);var N,b,_;for(_=0,++h;h<f;++_,++h)y.points=[],b={width:0,height:0,edgeLabel:y,edgeObj:l,rank:h},N=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=y.width,b.height=y.height,b.dummy="edge-label",b.labelpos=y.labelpos),a.setEdge(u,N,{weight:y.weight},g),_===0&&a.graph().dummyChains.push(N),u=N;a.setEdge(u,p,{weight:y.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return Hv}var Gv,GE;function Nu(){if(GE)return Gv;GE=1;var e=xt();Gv={longestPath:t,slack:n};function t(s){var i={};function a(l){var u=s.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var h=e.min(e.map(s.outEdges(l),function(p){return a(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),u.rank=h}e.forEach(s.sources(),a)}function n(s,i){return s.node(i.w).rank-s.node(i.v).rank-s.edge(i).minlen}return Gv}var Vv,VE;function zR(){if(VE)return Vv;VE=1;var e=xt(),t=cr().Graph,n=Nu().slack;Vv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,y;i(h,u)<f;)g=a(h,u),y=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,y);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var y=g.v,w=f===y?g.w:y;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return Vv}var Yv,YE;function qz(){if(YE)return Yv;YE=1;var e=xt(),t=zR(),n=Nu().slack,s=Nu().longestPath,i=cr().alg.preorder,a=cr().alg.postorder,l=mn().simplify;Yv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var I,O;I=w(j);)O=N(j,C,I),b(j,C,I,O)}function h(C,j){var I=a(C,C.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(C,j,O)})}function p(C,j,I){var O=C.node(I),P=O.parent;C.edge(I,P).cutvalue=f(C,j,I)}function f(C,j,I){var O=C.node(I),P=O.parent,F=!0,M=j.edge(I,P),A=0;return M||(F=!1,M=j.edge(P,I)),A=M.weight,e.forEach(j.nodeEdges(I),function(q){var W=q.v===I,Y=W?q.w:q.v;if(Y!==P){var T=W===F,Q=j.edge(q).weight;if(A+=T?Q:-Q,k(C,I,Y)){var U=C.edge(I,Y).cutvalue;A+=T?-U:U}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),y(C,{},1,j)}function y(C,j,I,O,P){var F=I,M=C.node(O);return j[O]=!0,e.forEach(C.neighbors(O),function(A){e.has(j,A)||(I=y(C,j,I,A,O))}),M.low=F,M.lim=I++,P?M.parent=P:delete M.parent,I}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function N(C,j,I){var O=I.v,P=I.w;j.hasEdge(O,P)||(O=I.w,P=I.v);var F=C.node(O),M=C.node(P),A=F,q=!1;F.lim>M.lim&&(A=M,q=!0);var W=e.filter(j.edges(),function(Y){return q===E(C,C.node(Y.v),A)&&q!==E(C,C.node(Y.w),A)});return e.minBy(W,function(Y){return n(j,Y)})}function b(C,j,I,O){var P=I.v,F=I.w;C.removeEdge(P,F),C.setEdge(O.v,O.w,{}),g(C),h(C,j),_(C,j)}function _(C,j){var I=e.find(C.nodes(),function(P){return!j.node(P).parent}),O=i(C,I);O=O.slice(1),e.forEach(O,function(P){var F=C.node(P).parent,M=j.edge(P,F),A=!1;M||(M=j.edge(F,P),A=!0),j.node(P).rank=j.node(F).rank+(A?M.minlen:-M.minlen)})}function k(C,j,I){return C.hasEdge(j,I)}function E(C,j,I){return I.low<=j.lim&&j.lim<=I.lim}return Yv}var Kv,KE;function Dz(){if(KE)return Kv;KE=1;var e=Nu(),t=e.longestPath,n=zR(),s=qz();Kv=i;function i(h){switch(h.graph().ranker){case"network-simplex":u(h);break;case"tight-tree":l(h);break;case"longest-path":a(h);break;default:u(h)}}var a=t;function l(h){t(h),n(h)}function u(h){s(h)}return Kv}var Xv,XE;function Fz(){if(XE)return Xv;XE=1;var e=xt();Xv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,y=0,w=f[y],N=!0;l!==h.w;){if(u=i.node(l),N){for(;(w=f[y])!==g&&i.node(w).maxRank<u.rank;)y++;w===g&&(N=!1)}if(!N){for(;y<f.length-1&&i.node(w=f[y+1]).minRank<=u.rank;)y++;w=f[y]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),y,w;y=l;do y=i.parent(y),h.push(y);while(y&&(a[y].low>f||g>a[y].lim));for(w=y,y=u;(y=i.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return Xv}var Qv,QE;function zz(){if(QE)return Qv;QE=1;var e=xt(),t=mn();Qv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var y=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,y,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,y,w){var N=u.children(w);if(!N.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(b,w),k.borderTop=b,u.setParent(_,w),k.borderBottom=_,e.forEach(N,function(E){s(u,h,p,f,g,y,E);var C=u.node(E),j=C.borderTop?C.borderTop:E,I=C.borderBottom?C.borderBottom:E,O=C.borderTop?f:2*f,P=j!==I?1:g-y[w]+1;u.setEdge(b,j,{weight:O,minlen:P,nestingEdge:!0}),u.setEdge(I,_,{weight:O,minlen:P,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+y[w]})}function i(u){var h={};function p(f,g){var y=u.children(f);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return Qv}var Zv,ZE;function Bz(){if(ZE)return Zv;ZE=1;var e=xt(),t=mn();Zv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],y=t.addDummyNode(i,"border",f,l);h[a][p]=y,i.setParent(y,u),g&&i.setEdge(g,y,{weight:1})}return Zv}var Jv,JE;function Uz(){if(JE)return Jv;JE=1;var e=xt();Jv={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(p),(f==="lr"||f==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){i(p.node(f))}),e.forEach(p.edges(),function(f){i(p.edge(f))})}function i(p){var f=p.width;p.width=p.height,p.height=f}function a(p){e.forEach(p.nodes(),function(f){l(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,h),e.has(g,"x")&&h(g)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Jv}var ey,eC;function Wz(){if(eC)return ey;eC=1;var e=xt();ey=t;function t(n){var s={},i=e.filter(n.nodes(),function(p){return!n.children(p).length}),a=e.max(e.map(i,function(p){return n.node(p).rank})),l=e.map(e.range(a+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);l[f.rank].push(p),e.forEach(n.successors(p),u)}}var h=e.sortBy(i,function(p){return n.node(p).rank});return e.forEach(h,u),l}return ey}var ty,tC;function Hz(){if(tC)return ty;tC=1;var e=xt();ty=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(y,w){return w})),u=e.flatten(e.map(i,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(y){var w=y.pos+h;f[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=f[w+1]),w=w-1>>1,f[w]+=y.weight;g+=y.weight*N})),g}return ty}var ny,nC;function Gz(){if(nC)return ny;nC=1;var e=xt();ny=t;function t(n,s){return e.map(s,function(i){var a=n.inEdges(i);if(a.length){var l=e.reduce(a,function(u,h){var p=n.edge(h),f=n.node(h.v);return{sum:u.sum+p.weight*f.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return ny}var ry,rC;function Vz(){if(rC)return ry;rC=1;var e=xt();ry=t;function t(i,a){var l={};e.forEach(i,function(h,p){var f=l[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(a.edges(),function(h){var p=l[h.v],f=l[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(l[h.w]))});var u=e.filter(l,function(h){return!h.indegree});return n(u)}function n(i){var a=[];function l(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function u(p){return function(f){f.in.push(p),--f.indegree===0&&i.push(f)}}for(;i.length;){var h=i.pop();a.push(h),e.forEach(h.in.reverse(),l(h)),e.forEach(h.out,u(h))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(i,a){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(a.i,i.i),a.merged=!0}return ry}var sy,sC;function Yz(){if(sC)return sy;sC=1;var e=xt(),t=mn();sy=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,y=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,y+=b.weight,w=s(f,p,w)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=g/y,N.weight=y),N}function s(a,l,u){for(var h;l.length&&(h=e.last(l)).i<=u;)l.pop(),a.push(h.vs),u++;return u}function i(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return sy}var oy,oC;function Kz(){if(oC)return oy;oC=1;var e=xt(),t=Gz(),n=Vz(),s=Yz();oy=i;function i(u,h,p,f){var g=u.children(h),y=u.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==N}));var _=t(u,g);e.forEach(_,function(I){if(u.children(I.v).length){var O=i(u,I.v,p,f);b[I.v]=O,e.has(O,"barycenter")&&l(I,O)}});var k=n(_,p);a(k,b);var E=s(k,f);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+j.order)/(E.weight+2),E.weight+=2}return E}function a(u,h){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function l(u,h){e.isUndefined(u.barycenter)?(u.barycenter=h.barycenter,u.weight=h.weight):(u.barycenter=(u.barycenter*u.weight+h.barycenter*h.weight)/(u.weight+h.weight),u.weight+=h.weight)}return oy}var iy,iC;function Xz(){if(iC)return iy;iC=1;var e=xt(),t=cr().Graph;iy=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),b=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:i.edge(y).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return iy}var ay,aC;function Qz(){if(aC)return ay;aC=1;var e=xt();ay=t;function t(n,s,i){var a={},l;e.forEach(i,function(u){for(var h=n.parent(u),p,f;h;){if(p=n.parent(h),p?(f=a[p],a[p]=h):(f=l,l=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return ay}var ly,lC;function Zz(){if(lC)return ly;lC=1;var e=xt(),t=Wz(),n=Hz(),s=Kz(),i=Xz(),a=Qz(),l=cr().Graph,u=mn();ly=h;function h(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),b=p(y,e.range(w-1,-1,-1),"outEdges"),_=t(y);g(y,_);for(var k=Number.POSITIVE_INFINITY,E,C=0,j=0;j<4;++C,++j){f(C%2?N:b,C%4>=2),_=u.buildLayerMatrix(y);var I=n(y,_);I<k&&(j=0,E=e.cloneDeep(_),k=I)}g(y,E)}function p(y,w,N){return e.map(w,function(b){return i(y,b,N)})}function f(y,w){var N=new l;e.forEach(y,function(b){var _=b.graph().root,k=s(b,_,N,w);e.forEach(k.vs,function(E,C){b.node(E).order=C}),a(b,N,k.vs)})}function g(y,w){e.forEach(w,function(N){e.forEach(N,function(b,_){y.node(b).order=_})})}return ly}var cy,cC;function Jz(){if(cC)return cy;cC=1;var e=xt(),t=cr().Graph,n=mn();cy={positionX:N,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var C={};function j(I,O){var P=0,F=0,M=I.length,A=e.last(O);return e.forEach(O,function(q,W){var Y=a(k,q),T=Y?k.node(Y).order:M;(Y||q===A)&&(e.forEach(O.slice(F,W+1),function(Q){e.forEach(k.predecessors(Q),function(U){var ne=k.node(U),X=ne.order;(X<P||T<X)&&!(ne.dummy&&k.node(Q).dummy)&&l(C,U,Q)})}),F=W+1,P=T)}),O}return e.reduce(E,j),C}function i(k,E){var C={};function j(O,P,F,M,A){var q;e.forEach(e.range(P,F),function(W){q=O[W],k.node(q).dummy&&e.forEach(k.predecessors(q),function(Y){var T=k.node(Y);T.dummy&&(T.order<M||T.order>A)&&l(C,Y,q)})})}function I(O,P){var F=-1,M,A=0;return e.forEach(P,function(q,W){if(k.node(q).dummy==="border"){var Y=k.predecessors(q);Y.length&&(M=k.node(Y[0]).order,j(P,A,W,F,M),A=W,F=M)}j(P,A,P.length,M,O.length)}),P}return e.reduce(E,I),C}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(C){return k.node(C).dummy})}function l(k,E,C){if(E>C){var j=E;E=C,C=j}var I=k[E];I||(k[E]=I={}),I[C]=!0}function u(k,E,C){if(E>C){var j=E;E=C,C=j}return e.has(k[E],C)}function h(k,E,C,j){var I={},O={},P={};return e.forEach(E,function(F){e.forEach(F,function(M,A){I[M]=M,O[M]=M,P[M]=A})}),e.forEach(E,function(F){var M=-1;e.forEach(F,function(A){var q=j(A);if(q.length){q=e.sortBy(q,function(U){return P[U]});for(var W=(q.length-1)/2,Y=Math.floor(W),T=Math.ceil(W);Y<=T;++Y){var Q=q[Y];O[A]===A&&M<P[Q]&&!u(C,A,Q)&&(O[Q]=A,O[A]=I[A]=I[Q],M=P[Q])}}})}),{root:I,align:O}}function p(k,E,C,j,I){var O={},P=f(k,E,C,I),F=I?"borderLeft":"borderRight";function M(W,Y){for(var T=P.nodes(),Q=T.pop(),U={};Q;)U[Q]?W(Q):(U[Q]=!0,T.push(Q),T=T.concat(Y(Q))),Q=T.pop()}function A(W){O[W]=P.inEdges(W).reduce(function(Y,T){return Math.max(Y,O[T.v]+P.edge(T))},0)}function q(W){var Y=P.outEdges(W).reduce(function(Q,U){return Math.min(Q,O[U.w]-P.edge(U))},Number.POSITIVE_INFINITY),T=k.node(W);Y!==Number.POSITIVE_INFINITY&&T.borderType!==F&&(O[W]=Math.max(O[W],Y))}return M(A,P.predecessors.bind(P)),M(q,P.successors.bind(P)),e.forEach(j,function(W){O[W]=O[C[W]]}),O}function f(k,E,C,j){var I=new t,O=k.graph(),P=b(O.nodesep,O.edgesep,j);return e.forEach(E,function(F){var M;e.forEach(F,function(A){var q=C[A];if(I.setNode(q),M){var W=C[M],Y=I.edge(W,q);I.setEdge(W,q,Math.max(P(k,A,M),Y||0))}M=A})}),I}function g(k,E){return e.minBy(e.values(E),function(C){var j=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(C,function(O,P){var F=_(k,P)/2;j=Math.max(O+F,j),I=Math.min(O-F,I)}),j-I})}function y(k,E){var C=e.values(E),j=e.min(C),I=e.max(C);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(P){var F=O+P,M=k[F],A;if(M!==E){var q=e.values(M);A=P==="l"?j-e.min(q):I-e.max(q),A&&(k[F]=e.mapValues(M,function(W){return W+A}))}})})}function w(k,E){return e.mapValues(k.ul,function(C,j){if(E)return k[E.toLowerCase()][j];var I=e.sortBy(e.map(k,j));return(I[1]+I[2])/2})}function N(k){var E=n.buildLayerMatrix(k),C=e.merge(s(k,E),i(k,E)),j={},I;e.forEach(["u","d"],function(P){I=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(I=e.map(I,function(W){return e.values(W).reverse()}));var M=(P==="u"?k.predecessors:k.successors).bind(k),A=h(k,I,C,M),q=p(k,I,A.root,A.align,F==="r");F==="r"&&(q=e.mapValues(q,function(W){return-W})),j[P+F]=q})});var O=g(k,j);return y(j,O),w(j,k.graph().align)}function b(k,E,C){return function(j,I,O){var P=j.node(I),F=j.node(O),M=0,A;if(M+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":A=-P.width/2;break;case"r":A=P.width/2;break}if(A&&(M+=C?A:-A),A=0,M+=(P.dummy?E:k)/2,M+=(F.dummy?E:k)/2,M+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(M+=C?A:-A),A=0,M}}function _(k,E){return k.node(E).width}return cy}var uy,uC;function eB(){if(uC)return uy;uC=1;var e=xt(),t=mn(),n=Jz().positionX;uy=s;function s(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function i(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,h=0;e.forEach(l,function(p){var f=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=h+f/2}),h+=f+u})}return uy}var dy,dC;function tB(){if(dC)return dy;dC=1;var e=xt(),t=$z(),n=Lz(),s=Dz(),i=mn().normalizeRanks,a=Fz(),l=mn().removeEmptyRanks,u=zz(),h=Bz(),p=Uz(),f=Zz(),g=eB(),y=mn(),w=cr().Graph;dy=N;function N(D,L){var K=L&&L.debugTiming?y.time:y.notime;K("layout",function(){var re=K(" buildLayoutGraph",function(){return M(D)});K(" runLayout",function(){b(re,K)}),K(" updateInputGraph",function(){_(D,re)})})}function b(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){H(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(y.asNonCompoundGraph(D))}),L(" injectEdgeLabelProxies",function(){q(D)}),L(" removeEmptyRanks",function(){l(D)}),L(" nestingGraph.cleanup",function(){u.cleanup(D)}),L(" normalizeRanks",function(){i(D)}),L(" assignRankMinMax",function(){W(D)}),L(" removeEdgeLabelProxies",function(){Y(D)}),L(" normalize.run",function(){n.run(D)}),L(" parentDummyChains",function(){a(D)}),L(" addBorderSegments",function(){h(D)}),L(" order",function(){f(D)}),L(" insertSelfEdges",function(){J(D)}),L(" adjustCoordinateSystem",function(){p.adjust(D)}),L(" position",function(){g(D)}),L(" positionSelfEdges",function(){$(D)}),L(" removeBorderNodes",function(){X(D)}),L(" normalize.undo",function(){n.undo(D)}),L(" fixupEdgeLabelCoords",function(){U(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){T(D)}),L(" assignNodeIntersects",function(){Q(D)}),L(" reversePoints",function(){ne(D)}),L(" acyclic.undo",function(){t.undo(D)})}function _(D,L){e.forEach(D.nodes(),function(K){var re=D.node(K),he=L.node(K);re&&(re.x=he.x,re.y=he.y,L.children(K).length&&(re.width=he.width,re.height=he.height))}),e.forEach(D.edges(),function(K){var re=D.edge(K),he=L.edge(K);re.points=he.points,e.has(he,"x")&&(re.x=he.x,re.y=he.y)}),D.graph().width=L.graph().width,D.graph().height=L.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function M(D){var L=new w({multigraph:!0,compound:!0}),K=Z(D.graph());return L.setGraph(e.merge({},E,G(K,k),e.pick(K,C))),e.forEach(D.nodes(),function(re){var he=Z(D.node(re));L.setNode(re,e.defaults(G(he,j),I)),L.setParent(re,D.parent(re))}),e.forEach(D.edges(),function(re){var he=Z(D.edge(re));L.setEdge(re,e.merge({},P,G(he,O),e.pick(he,F)))}),L}function A(D){var L=D.graph();L.ranksep/=2,e.forEach(D.edges(),function(K){var re=D.edge(K);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function q(D){e.forEach(D.edges(),function(L){var K=D.edge(L);if(K.width&&K.height){var re=D.node(L.v),he=D.node(L.w),pe={rank:(he.rank-re.rank)/2+re.rank,e:L};y.addDummyNode(D,"edge-proxy",pe,"_ep")}})}function W(D){var L=0;e.forEach(D.nodes(),function(K){var re=D.node(K);re.borderTop&&(re.minRank=D.node(re.borderTop).rank,re.maxRank=D.node(re.borderBottom).rank,L=e.max(L,re.maxRank))}),D.graph().maxRank=L}function Y(D){e.forEach(D.nodes(),function(L){var K=D.node(L);K.dummy==="edge-proxy"&&(D.edge(K.e).labelRank=K.rank,D.removeNode(L))})}function T(D){var L=Number.POSITIVE_INFINITY,K=0,re=Number.POSITIVE_INFINITY,he=0,pe=D.graph(),we=pe.marginx||0,Ce=pe.marginy||0;function Ve(Be){var Le=Be.x,Se=Be.y,ce=Be.width,be=Be.height;L=Math.min(L,Le-ce/2),K=Math.max(K,Le+ce/2),re=Math.min(re,Se-be/2),he=Math.max(he,Se+be/2)}e.forEach(D.nodes(),function(Be){Ve(D.node(Be))}),e.forEach(D.edges(),function(Be){var Le=D.edge(Be);e.has(Le,"x")&&Ve(Le)}),L-=we,re-=Ce,e.forEach(D.nodes(),function(Be){var Le=D.node(Be);Le.x-=L,Le.y-=re}),e.forEach(D.edges(),function(Be){var Le=D.edge(Be);e.forEach(Le.points,function(Se){Se.x-=L,Se.y-=re}),e.has(Le,"x")&&(Le.x-=L),e.has(Le,"y")&&(Le.y-=re)}),pe.width=K-L+we,pe.height=he-re+Ce}function Q(D){e.forEach(D.edges(),function(L){var K=D.edge(L),re=D.node(L.v),he=D.node(L.w),pe,we;K.points?(pe=K.points[0],we=K.points[K.points.length-1]):(K.points=[],pe=he,we=re),K.points.unshift(y.intersectRect(re,pe)),K.points.push(y.intersectRect(he,we))})}function U(D){e.forEach(D.edges(),function(L){var K=D.edge(L);if(e.has(K,"x"))switch((K.labelpos==="l"||K.labelpos==="r")&&(K.width-=K.labeloffset),K.labelpos){case"l":K.x-=K.width/2+K.labeloffset;break;case"r":K.x+=K.width/2+K.labeloffset;break}})}function ne(D){e.forEach(D.edges(),function(L){var K=D.edge(L);K.reversed&&K.points.reverse()})}function X(D){e.forEach(D.nodes(),function(L){if(D.children(L).length){var K=D.node(L),re=D.node(K.borderTop),he=D.node(K.borderBottom),pe=D.node(e.last(K.borderLeft)),we=D.node(e.last(K.borderRight));K.width=Math.abs(we.x-pe.x),K.height=Math.abs(he.y-re.y),K.x=pe.x+K.width/2,K.y=re.y+K.height/2}}),e.forEach(D.nodes(),function(L){D.node(L).dummy==="border"&&D.removeNode(L)})}function H(D){e.forEach(D.edges(),function(L){if(L.v===L.w){var K=D.node(L.v);K.selfEdges||(K.selfEdges=[]),K.selfEdges.push({e:L,label:D.edge(L)}),D.removeEdge(L)}})}function J(D){var L=y.buildLayerMatrix(D);e.forEach(L,function(K){var re=0;e.forEach(K,function(he,pe){var we=D.node(he);we.order=pe+re,e.forEach(we.selfEdges,function(Ce){y.addDummyNode(D,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:we.rank,order:pe+ ++re,e:Ce.e,label:Ce.label},"_se")}),delete we.selfEdges})})}function $(D){e.forEach(D.nodes(),function(L){var K=D.node(L);if(K.dummy==="selfedge"){var re=D.node(K.e.v),he=re.x+re.width/2,pe=re.y,we=K.x-he,Ce=re.height/2;D.setEdge(K.e,K.label),D.removeNode(L),K.label.points=[{x:he+2*we/3,y:pe-Ce},{x:he+5*we/6,y:pe-Ce},{x:he+we,y:pe},{x:he+5*we/6,y:pe+Ce},{x:he+2*we/3,y:pe+Ce}],K.label.x=K.x,K.label.y=K.y}})}function G(D,L){return e.mapValues(e.pick(D,L),Number)}function Z(D){var L={};return e.forEach(D,function(K,re){L[re.toLowerCase()]=K}),L}return dy}var fy,fC;function nB(){if(fC)return fy;fC=1;var e=xt(),t=mn(),n=cr().Graph;fy={debugOrdering:s};function s(i){var a=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,h){var p="layer"+h;l.setNode(p,{rank:"same"}),e.reduce(u,function(f,g){return l.setEdge(f,g,{style:"invis"}),g})}),l}return fy}var hy,hC;function rB(){return hC||(hC=1,hy="0.8.5"),hy}var py,pC;function sB(){return pC||(pC=1,py={graphlib:cr(),layout:tB(),debug:nB(),util:{time:mn().time,notime:mn().notime},version:rB()}),py}var oB=sB();const mC=ew(oB),Wi=240,Eu=130,Pi=74,nd=72,gC=Pi+nd;function iB(e,t){var s;let n=Wi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Wi);return n}const BR=420,aB=2;function ul(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function lB(e,t){return((t==null?void 0:t.get(e))??0)>0?BR:0}function cB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function dl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Wi)+lB(e,n),h:Math.max((s==null?void 0:s.height)??Eu,cB(e,n))}}function uB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function dB(e,t,n,s,i,a){const l=new mC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!i.has(k)),h=new Set(u);for(const k of u){const{w:E,h:C}=dl(k,s,a);l.setNode(k,{width:E,height:C})}for(const k of t)h.has(k.source)&&h.has(k.target)&&l.setEdge(k.source,k.target);mC.layout(l);const p=new Map;let f=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of u){const E=l.node(k);if(!E)continue;const C=s.get(k),j=(C==null?void 0:C.width)??Wi,I=(C==null?void 0:C.height)??Eu,O=dl(k,s,a),P=E.x-O.w/2,F=E.y-O.h/2;p.set(k,{x:P,y:F}),P<f&&(f=P),F<g&&(g=F),P+j>y&&(y=P+j),F+I>w&&(w=F+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-f,y:E.y-g});const N=Number.isFinite(y)?y-f:0,b=Number.isFinite(w)?w-g:0;let _=null;for(const k of e){const E=i.get(k);if(!E)continue;const C=s.get(k),j=(C==null?void 0:C.width)??Wi,I=(C==null?void 0:C.height)??Eu;_=_===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+I}:{minX:Math.min(_.minX,E.x),minY:Math.min(_.minY,E.y),maxX:Math.max(_.maxX,E.x+j),maxY:Math.max(_.maxY,E.y+I)}}return{positions:p,width:N,height:b,pinnedBox:_}}function fB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const k of e){const E=ul(k),C=u.get(E);C?C.push(k.id):u.set(E,[k.id])}const p=Array.from(u.keys()).sort().map(k=>({sid:k,...dB(u.get(k),t,s,a,i,l)})),f=iB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let C=0;for(const j of p)E.length<k&&C>0&&C+j.height>g&&(E.push([]),C=0),E[E.length-1].push(j),C+=j.height+gC;return E},w=k=>k.reduce((E,C)=>Math.max(E,C.width),0)+BR;let N=y(n.availableWidth?aB:1);N.length>1&&N.reduce((E,C)=>E+w(C),0)+f*(N.length-1)>(n.availableWidth??0)&&(N=y(1));const b=new Map;let _=0;for(const k of N){const E=w(k);let C=0;for(const{positions:j,height:I,pinnedBox:O}of k){for(const[F,M]of j)b.set(F,{x:M.x+_,y:M.y+C});let P=C+I;O&&O.maxY>P&&O.minX<_+E&&_<O.maxX&&(P=O.maxY),C=P+gC}_+=E+f}return e.map(k=>{const E=i.get(k.id);if(E)return{...k,position:E};const C=b.get(k.id);return C?{...k,position:C}:k})}function hB(e,t,n,s,i){const l=Pi+nd,u=60,h=w=>dl(w,s,i),p=new Map(e.map(w=>[w.id,ul(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of g){const{w:b,h:_}=h(w),k=p.get(w)??"_default";if(n.has(w)){f.push({x:N.x,y:N.y,w:b,h:_,sid:k});continue}let E=N.y;for(let C=0;C<f.length+1;C++){const j=f.find(I=>{const O=I.sid===k?24:u,P=I.sid===k?24:l;return N.x<I.x+I.w+O&&I.x<N.x+b+O&&E<I.y+I.h+P&&I.y<E+_+P});if(!j)break;E=j.y+j.h+(j.sid===k?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),y.push(w)),f.push({x:N.x,y:E,w:b,h:_,sid:k})}return y}function pB(e,t,n,s,i,a){const l=b=>dl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const _=ul(b),k=h.get(_);k?k.push(b):h.set(_,[b])}const p=new Set;for(const[b,_]of h)_.every(k=>i.has(k.id)&&!n.has(k.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const _=u(b.id);if(!_)continue;const{w:k,h:E}=l(b.id),C=ul(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:_.x,y:_.y,w:k,h:E})}if(f.size===0)return[];const y=Pi+nd,w=(b,_,k,E)=>g.some(C=>b<C.x+C.w+Pi&&C.x<b+k+Pi&&_<C.y+C.h+y&&C.y<_+E+y),N=[];for(const b of[...f.keys()].sort()){const _=f.get(b);let k=1/0,E=1/0,C=-1/0,j=-1/0;for(const q of _){const W=u(q.id),{w:Y,h:T}=l(q.id);k=Math.min(k,W.x),E=Math.min(E,W.y),C=Math.max(C,W.x+Y),j=Math.max(j,W.y+T)}const I=C-k,O=j-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,W)=>q-W),F=P.length?P:[k],M=[0,...g.map(q=>q.y+q.h+y)].sort((q,W)=>q-W);let A=null;e:for(const q of F)for(const W of M){if(W>=E)break;if(!w(q,W,I,O)){A={x:q,y:W};break e}}if(A){const q=A.x-k,W=A.y-E;for(const Y of _){const T=u(Y.id);t.set(Y.id,{x:T.x+q,y:T.y+W})}N.push(b)}for(const q of _){const W=u(q.id),{w:Y,h:T}=l(q.id);g.push({x:W.x,y:W.y,w:Y,h:T})}}return N}function mB(e,t,n,s,i,a=!1,l){const p=Pi+nd+1,f=8,g=1.75,y=200,w=.7,N=.01,b=A=>dl(A,s,l),_=A=>n.get(A)??t.get(A),k=new Map;for(const A of e){if(!_(A.id))continue;const q=ul(A),W=k.get(q);W?W.push(A):k.set(q,[A])}const E=[],C=new Set,j=new Set,I=i.size===0;for(const A of[...k.keys()].sort()){const q=k.get(A);let W=1/0,Y=1/0,T=-1/0,Q=-1/0,U=!1;for(const J of q){const $=_(J.id),{w:G,h:Z}=b(J.id);W=Math.min(W,$.x),Y=Math.min(Y,$.y),T=Math.max(T,$.x+G),Q=Math.max(Q,$.y+Z),n.has(J.id)&&(U=!0)}const ne=T-W,X=Q-Y;j.add(A);const H=i.get(A);H&&(ne>H.w+f||X>H.h+f)&&C.add(A),i.set(A,{w:ne,h:X}),E.push({sid:A,members:q.map(J=>J.id),x:W,y:Y,w:ne,h:X,anchored:U,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||I)return[];let O=!1;for(let A=0;A<E.length&&!O;A++)for(let q=A+1;q<E.length;q++){const W=E[A],Y=E[q];if(!(W.anchored&&Y.anchored)&&Math.abs(W.x+W.w/2-(Y.x+Y.w/2))<(W.w+Y.w)/2+61&&Math.abs(W.y+W.h/2-(Y.y+Y.h/2))<(W.h+Y.h)/2+p){O=!0;break}}if(C.size===0&&!O)return[];if(C.size>0)for(const A of E)C.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Wi*Eu));const P=new Map(E.map(A=>[A.sid,A.x])),F=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const q=new Map,W=new Map;let Y=0;for(let T=0;T<E.length;T++)for(let Q=T+1;Q<E.length;Q++){const U=E[T],ne=E[Q];if(U.anchored&&ne.anchored)continue;const X=U.x+U.w/2,H=U.y+U.h/2,J=ne.x+ne.w/2,$=ne.y+ne.h/2,G=(U.w+ne.w)/2+61-Math.abs(X-J),Z=(U.h+ne.h)/2+p-Math.abs(H-$);if(G<=0||Z<=0)continue;const D=(_e,De)=>!_e.anchored&&!(De<0&&_e.x<=0),L=(_e,De)=>!_e.anchored&&!(De<0&&_e.y<=0),K=(_e,De,Ge)=>{const lt=_e===De,je=lt?U.sid<ne.sid?-1:1:Math.sign(_e-De);return Ge(U,je)||Ge(ne,-je)?je:lt&&(Ge(U,-je)||Ge(ne,je))?-je:0},re=K(X,J,D),he=K(H,$,L),pe=re!==0,we=he!==0;if(!pe&&!we)continue;const Ce=pe&&(!we||G*g<Z),[Ve,Be,Le,Se]=Ce?[re,G,q,D]:[he,Z,W,L],ce=Se(U,Ve),be=Se(ne,-Ve),xe=U.mass,Ke=ne.mass,ut=ce?be?Ke/(xe+Ke):1:0,at=be?ce?xe/(xe+Ke):1:0,de=Be*w;Le.set(U.sid,(Le.get(U.sid)??0)+Ve*de*ut),Le.set(ne.sid,(Le.get(ne.sid)??0)-Ve*de*at),Y+=de}for(const T of E)T.anchored||(T.x=Math.max(0,T.x+(q.get(T.sid)??0)),T.y=Math.max(0,T.y+(W.get(T.sid)??0)));if(Y<N)break}const M=[];for(const A of E){const q=A.x-P.get(A.sid),W=A.y-F.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(W)<1)){for(const Y of A.members){if(n.has(Y))continue;const T=t.get(Y);T&&t.set(Y,{x:T.x+q,y:T.y+W})}M.push(A.sid)}}return M}const gB=600;function Xy(e,t){return!(e.exitAt!=null&&t-e.exitAt>gB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function vB(e,t){const n=new Set;for(const s of e.agents.values())Xy(s,t)&&n.add(s.id);return n}function yB(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 wB(e,t,n=0){if(!e)return!1;for(const s of t)if(yB(e,s,n))return!0;return!1}const UR="sessionGroup";function xB(e,t){var s;if(e.type===UR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const WR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function vC(e){const t={};for(const n of WR)t[n]=e(n);return t}function bB(e){return t=>e[t]??""}function _B(e,t){return WR.every(n=>e[n]===t[n])}function kB(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[i,a]of e.positions)n.set(i,a),t.has(i)&&s.set(i,a);return{positions:n,pinned:s}}const SB=1200,NB=1e3;function yC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<SB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<NB}function my({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function EB(e,t,n){const s=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return a>0&&s<n.width&&l>0&&i<n.height}function CB({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 i of n)if(s=!0,EB(i,t,e))return!1;return s}const jB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",gy="click for what's new";function TB(e){if(e.checkDisabled)return`${jB} · ${gy}`;if(e.checking)return`Asking npm for the newest release… · ${gy}`;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 · ${gy}, and to check npm now`}function RB(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 AB(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 MB(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 Qy={kind:"assumed",claude:!0,codex:!0};function IB(e){if(!e||typeof e!="object")return Qy;const t=e.providers;if(!t||typeof t!="object")return Qy;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Cu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const wC=99;function OB(e){const t=Math.max(0,Math.floor(e));return t>wC?`${wC}+`:String(t)}const PB="Pause the canvas";function $B(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 — ${Cu(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)":`${Cu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function LB(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 HR="paused · full",qB=(e,t)=>t>0?HR:e>0?`paused · ${OB(e)}`:"paused";function DB(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:qB(e.held,t),widest:HR,title:t>0?`Connected — the pause is full at ${Cu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Cu(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 xC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const FB={agent:JL,sessionGroup:m3},GR="react-flow__node";function bC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,GR))===!0}function zB(e){try{const t=document.querySelector(`.${GR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const BB=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),UB=420,ru=18,WB=200,HB=5*6e4,GB=6,VB=2*6e4,_C=400,Qw="agent-dag.layout",Zw="agent-dag.viewport",VR="agent-dag.summariesDismissed",YR="agent-dag.sessionListOpen",KR="agent-dag.detailOpen",XR="agent-dag.usagePanelOpen",kC="agent-dag.accountsPanelOpen",vy="agent-dag.versionNoticeDismissed",SC="agent-dag.oldNameNoticeDismissed",YB=15*6e4,yy={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:"},NC="agent-dag.autoRestart",EC="agent-dag.bundleReloadedFor";function KB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(YR)==="1"}catch{return!1}}function XB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(YR,e?"1":"0")}catch{}}function QB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(KR)==="1"}catch{return!1}}function ZB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KR,e?"1":"0")}catch{}}function JB(){const e=Lu(XR);return e===null?!0:e==="1"}function e8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(XR,e?"1":"0")}catch{}}function t8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(VR);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 CC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(VR,JSON.stringify(n))}catch{}}function n8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Qw);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const i=Object.entries(n).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:i,pins:i.map(([a])=>a)}}return{positions:Object.entries(n.positions??{}).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function wy(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,i]of e)n[s]=i;for(const[s,i]of t)n[s]=i;window.localStorage.setItem(Qw,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function r8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Zw);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 s8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Zw,JSON.stringify(e))}catch{}}function jC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Qw)}catch{}try{window.localStorage.removeItem(Zw)}catch{}}}function o8(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(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}))}))},a=JSON.stringify(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const Zy={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Jy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},QR=pT;function i8(e,t,n,s,i,a,l,u,h,p,f,g,y,w,N,b,_,k){const E=[],C=[];for(const A of e.agents.values()){if(!_.has(A.id))continue;const q=A.exitAt!=null,W=b!=null&&!b.has(A.id),Y=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,T=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:k},className:Y,...T?{width:T.width,height:T.height}:null}),A.parentId&&_.has(A.parentId)){const Q=xw(A.sessionId),U=q,ne=N.size>0&&(N.has(A.id)||N.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),H=A.state==="active"?2:1.5,J=ne?H+1.5:H,$=U?.2:X?.12:1,G=["sess-edge",A.state==="active"?"sess-live":"sess-idle",U?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!U,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:J,opacity:$,transition:"var(--edge-transition)"},className:G})}}const j=new Map;for(const A of e.agents.values())A.tools.length>0&&j.set(A.id,Math.min(4,A.tools.length));const I=`${y}#lanes:${uB(j)}`,O=E.filter(A=>o5(A.id,i,f,g));if(O.length>0||I!==w.current){if(O.length>0){const A=fB(E,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const q of A)DT(q.id,f,g)&&a5(q.id,q.position,f,g);pB(E,f,i,a,new Set(O.map(q=>q.id)),j)}hB(E,f,i,a,j),w.current=I}const P=mB(E,f,i,a,l,!h||p,j);P.length>0&&u(P),Qc(f,e.agents),Qc(g,e.agents),Qc(i,e.agents),Qc(a,n5(e.agents.values()));const F=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=i5(A.id,f,g),M=!0),F.push({...A,position:q})}return M&&(w.current=""),{nodes:F,edges:C}}function a8(){return d.jsx(yw,{children:d.jsx(l8,{})})}function l8(){var ds,Bl,Xs,Ul;const e=gl(),t=At(),n=S.useState($y)[0],s=S.useRef(n),[,i]=S.useState(0),a=S.useCallback(()=>i(z=>z+1),[]),[l,u]=S.useState(()=>new Set),[h,p]=S.useState(null),[f,g]=S.useState(null),y=S.useCallback((z,V)=>{u(ae=>{if(!V)return new Set([z]);const fe=new Set(ae);return fe.has(z)?fe.delete(z):fe.add(z),fe}),p(ae=>V&&ae===z?ae:z)},[]),w=S.useCallback(()=>{u(new Set),p(null)},[]),[N,b]=S.useState(null),[_,k]=S.useState(null),E=S.useCallback(z=>k(z),[]),[C,j]=S.useState(!1),[I,O]=S.useState(!1),P=S.useState(t8)[0],[F,M]=S.useState(KB);S.useEffect(()=>{XB(F)},[F]);const[A,q]=S.useState(QB);S.useEffect(()=>{ZB(A)},[A]);const[W,Y]=S.useState(JB);S.useEffect(()=>{e8(W)},[W]);const[T,Q]=S.useState(()=>{try{const z=window.localStorage.getItem(kC);return z===null?!0:z==="1"}catch{return!0}});S.useEffect(()=>{try{window.localStorage.setItem(kC,T?"1":"0")}catch{}},[T]);const[U,ne]=S.useState(null);S.useEffect(()=>{let z=null;try{z=localStorage.getItem("agent-dag.sound")}catch{}ne(z===null?!0:z==="on")},[]);const X=S.useCallback(()=>{ne(z=>{var ae;const V=z!==!0;try{localStorage.setItem("agent-dag.sound",V?"on":"off")}catch{}return V&&((ae=Ce.current)==null||ae.unlock()),V})},[]),H=S.useCallback(z=>{X()},[X]),J=S.useRef(H);J.current=H;const $=S.useRef(U);$.current=U;const[G,Z]=S.useState(()=>TD(Lu)),D=S.useRef(G);D.current=G;const L=S.useRef(null),K=S.useCallback((z,V=!1)=>{var ae,fe;if((ae=Ce.current)==null||ae.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!V){(fe=Ce.current)==null||fe.play(z,!0);return}L.current=setTimeout(()=>{var ke;L.current=null,(ke=Ce.current)==null||ke.play(z,!0)},SD)},[]),re=S.useCallback((z,V)=>{Z(ae=>{const fe={level:cl(V.level??ae[z].level),figure:OT(z,V.figure??ae[z].figure)};try{localStorage.setItem($T[z],String(fe.level)),localStorage.setItem(LT[z],fe.figure)}catch{}return{...ae,[z]:fe}}),K(z,!0)},[K]);S.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[he,pe]=S.useState(!1),we=S.useRef(null),Ce=S.useRef(null),[Ve,Be]=S.useState("locked");S.useEffect(()=>{const z=MD({enabled:()=>$.current===!0,prefs:()=>D.current,onState:Be});Ce.current=z,Be(z.state());const V=()=>z.unlock();return window.addEventListener("pointerdown",V,{once:!0,capture:!0}),window.addEventListener("keydown",V,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",V,{capture:!0}),window.removeEventListener("keydown",V,{capture:!0})}},[]);const[Le,Se]=S.useState(!1),[ce,be]=S.useState(null),[xe,Ke]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(vy)??""}catch{return""}}),[ut,at]=S.useState(!1),de=S.useRef(0),[_e,De]=S.useState(!1),Ge=S.useCallback((z=!1)=>(z&&(de.current=Date.now(),De(!0)),fetch(z?"/api/version?refresh=1":"/api/version").then(V=>V.ok?V.json():null).then(V=>{V&&be(V)}).catch(()=>{}).finally(()=>{z&&De(!1)})),[]),lt=S.useCallback(()=>{Ge(Date.now()-de.current>=YB)},[Ge]);S.useEffect(()=>{Ge();const z=window.setInterval(lt,5*6e4),V=()=>{document.visibilityState==="visible"&<()};return document.addEventListener("visibilitychange",V),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",V)}},[Ge,lt]),S.useEffect(()=>{Le&&Ge()},[Le,Ge]);const je=(ce==null?void 0:ce.notice)??null,[We,Xe]=S.useState(null),oe=S.useRef(!1);S.useEffect(()=>{if(oe.current)return;const z=UD(),V=WD(z),ae=VD({stored:V,running:(ce==null?void 0:ce.running)??null,notes:B1,remembers:HD(z)});ae.reason!=="no-version"&&(oe.current=!0,ae.record&&GD(z,ae.record),ae.show.length&&Xe({entries:ae.show,since:V,firstRun:ae.reason==="welcome"}))},[ce==null?void 0:ce.running]);const Oe=(ce==null?void 0:ce.running)??"3.5.0",Pe=S.useMemo(()=>qT(B1,null,Oe),[Oe]),Te=S.useCallback(()=>{Xe({entries:Pe,since:null,firstRun:!1})},[Pe]),[Qe,Ct]=S.useState(null),[st,Me]=S.useState(Qy);S.useEffect(()=>{let z=!1;return fetch("/api/health").then(V=>V.ok?V.json():null).then(V=>{z||(Me(IB(V)),!(!V||typeof V.workspace!="string")&&Ct(V.workspace))}).catch(()=>{}),()=>{z=!0}},[Le]);const bt=S.useRef(st);bt.current=st;const dt=je?`${je.kind}:${je.to}`:"",St=je!=null&&xe!==dt,Nn=S.useCallback(()=>{Ke("");try{window.localStorage.setItem(vy,"")}catch{}},[]),zn=S.useCallback(()=>{if(je){Ke(dt);try{window.localStorage.setItem(vy,dt)}catch{}}},[je,dt]),[En,Co]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(SC)??""}catch{return""}}),gn=ce!=null&&ce.invokedAs&&ce.invokedAs!==zt?ce.invokedAs:null,jo=gn!=null&&En!==gn,To=S.useCallback(()=>{if(gn){Co(gn);try{window.localStorage.setItem(SC,gn)}catch{}}},[gn]),Bt=((ds=ce==null?void 0:ce.upgrade)==null?void 0:ds.state)??"idle",jr=iD(ce==null?void 0:ce.upgrade),Bn=S.useRef(!1),Ps=S.useCallback(async()=>{if(ar(Bn.current||Bt==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ge(),Bn.current=!1}},[Bt,Ge]);S.useEffect(()=>{if(Bt!=="running")return;const z=window.setInterval(Ge,3e3);return()=>window.clearInterval(z)},[Bt,Ge]);const Tr=S.useCallback(async()=>{var ae;const z=ce==null?void 0:ce.command;if(!z)return;let V=!1;try{V=await Promise.race([((ae=navigator.clipboard)==null?void 0:ae.writeText(z).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{V=!1}if(!V)try{const fe=document.createElement("textarea");fe.value=z,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),V=document.execCommand("copy"),fe.remove()}catch{V=!1}V&&(at(!0),window.setTimeout(()=>at(!1),1600))},[ce==null?void 0:ce.command]),Qi=S.useCallback(()=>{M(z=>(z||Q(!1),!z))},[]),fr=S.useCallback(()=>{Q(z=>(z||M(!1),!z))},[]),[Rr,hr]=S.useState(!1),[es,Ro]=S.useState(!1),[Ao,Mo]=S.useState(()=>{try{return Number(localStorage.getItem(G1))||0}catch{return 0}}),[Cn,Io]=S.useState([]),[Ar,Oo]=S.useState(!1);S.useEffect(()=>{let z=!0;const V=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var ke;!z||!(fe!=null&&fe.ok)||(Io(fe.episodes??[]),Oo(((ke=fe.settings)==null?void 0:ke.enabled)===!0))}).catch(()=>{})};V();const ae=setInterval(V,5*6e4);return()=>{z=!1,clearInterval(ae)}},[]);const Un=S.useMemo(()=>P5(Cn,Ao).length,[Cn,Ao]),[Po,$s]=S.useState(0),Ls=S.useRef(null),[$o,Lo]=S.useState(!1),ot=S.useRef(null),[Zi,ts]=S.useState(0),Gt=S.useState(()=>f5({protect:z=>hL(s.current,z)}))[0],[Wn,qo]=S.useState(!1),ns=S.useCallback(()=>{const z=Gt.paused&&Gt.dropped>0,V=Gt.setPaused(!Gt.paused);z&&pL(s.current);for(const ae of V)s.current=Zb(s.current,ae);qo(Gt.paused)},[Gt]),[gt,sn]=S.useState(Date.now()),[Hn,vn]=S.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(NC)!=="0"}catch{return!0}}),rd=S.useCallback(()=>{vn(z=>{const V=!z;try{window.localStorage.setItem(NC,V?"1":"0")}catch{}return V})},[]),[Mr,Do]=S.useState(!1),[Fo,zo]=S.useState("restart"),[rs,qs]=S.useState(null),ss=S.useRef(!1),Cl=S.useRef(null),Bo=S.useRef(0),Ds=S.useCallback(async z=>{if(!ar(ss.current))return;const V=(z==null?void 0:z.upgrade)===!0;ss.current=!0,Cl.current=jr;const ae=++Bo.current;zo(V?"npx":"restart"),Do(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(je==null?void 0:je.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:V})})}catch{}window.setTimeout(()=>{if(Bo.current===ae&&ss.current){ss.current=!1,Do(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},V?18e4:3e4)},[je==null?void 0:je.to,jr]),Uo=S.useRef(null);S.useEffect(()=>{let z=!1;for(const ae of s.current.agents.values())if(ae.state==="active"){z=!0;break}const V=lD({enabled:Hn,kind:je==null?void 0:je.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,busy:z,idleSince:Uo.current,now:gt});Uo.current=V.idleSince,V.restart&&Ds()},[Hn,je==null?void 0:je.kind,ce==null?void 0:ce.canRestart,gt,Ds]),S.useEffect(()=>{const z=ce==null?void 0:ce.running;let V=null,ae=null;try{V=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(EC)}catch{return}const fe=oD({bundle:"3.5.0",running:z,pending:V,lastTried:ae});if(fe==="reload"){try{window.sessionStorage.setItem(EC,z??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1),qs(z??null);const ke=window.setTimeout(()=>qs(null),6e3);return()=>window.clearTimeout(ke)},[ce==null?void 0:ce.running]),S.useEffect(()=>{if(Mr&&aD({asked:Cl.current,reported:jr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1)}},[Mr,jr]);const os=S.useState(()=>kB(n8()))[0],Jt=S.useRef(os.pinned),is=S.useRef(null),et=S.useState(()=>r8())[0],[Ji,jl]=S.useState(()=>new Set),[Ir,ea]=S.useState(p5),[Gn,Tl]=S.useState(()=>vC(xC)),Wo=S.useMemo(()=>bB(Gn),[Gn]),Ho=S.useCallback(z=>xB(z,Wo),[Wo]),pr=S.useMemo(()=>({background:Gn["--panel"],border:`1px solid ${Gn["--line"]}`,borderRadius:8}),[Gn]),[Vn,mr]=S.useState(!1);S.useEffect(()=>{document.documentElement.dataset.theme=Ir;try{window.localStorage.setItem(FT,Ir)}catch{}Tl(z=>{const V=vC(xC);return _B(z,V)?z:V})},[Ir]);const yn=S.useCallback((z,V)=>{if(my({durationMs:V,documentHidden:document.hidden})){e.setViewport(z,{duration:V});return}const{d3Zoom:ae,d3Selection:fe}=t.getState(),ke=fe==null?void 0:fe.property("__zoom");if(ae&&fe&&ke&&ke.k>0&&z.zoom>0){ae.transform(fe,ke.scale(z.zoom/ke.k).translate((z.x-ke.x)/z.zoom,(z.y-ke.y)/z.zoom));return}e.setViewport(z,{duration:0})},[e,t]),Yn=S.useRef(null);S.useEffect(()=>{if(!et)return;const z=window.setTimeout(()=>{try{yn(et,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(z)},[yn,et]);const Kn=S.useRef(!0);S.useEffect(()=>{const z=new EventSource("/events"),V=u5(a,{now:()=>Date.now(),setTimeout:(ae,fe)=>window.setTimeout(ae,fe),clearTimeout:ae=>window.clearTimeout(ae)});return z.addEventListener("open",()=>{Se(!0),mr(!0)}),z.addEventListener("error",()=>Se(!1)),z.addEventListener("replay-end",()=>{Kn.current=!1,V.flush()}),z.addEventListener("hook",ae=>{var fe;try{const ke=JSON.parse(ae.data);if(!Gt.accept(ke))return;s.current=Zb(s.current,ke);const Ae=ke.replay===!0||Kn.current||Date.now()-ke.receivedAt>3e4;Ae?V.replay():V.live();const He=AD(ke,Ae);He&&((fe=Ce.current)==null||fe.play(He))}catch{}}),()=>{z.close(),V.cancel()}},[a]),S.useEffect(()=>{const z=setInterval(()=>{const V=Date.now();sn(V);let ae=mL(s.current,V,Qb);gL(s.current,V,Qb)&&(ae=!0),dL(s.current,V,WB,HB)&&(ae=!0),fL(s.current,V,GB,VB)&&(ae=!0),u(fe=>t5(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),ae&&a()},250);return()=>clearInterval(z)},[a]);const ta=S.useRef(null),Xn=S.useRef(0),Fs=420,jn=S.useCallback((z=500)=>{try{const Ae=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(ht=>ht.offsetWidth>0);if(!Ae||He.length===0)return;const nt=Ae.getBoundingClientRect(),vt=e.getViewport();if(!Number.isFinite(vt.zoom)||vt.zoom<=0)return;const ct=ht=>(ht-nt.left-vt.x)/vt.zoom,on=ht=>(ht-nt.top-vt.y)/vt.zoom,Yt=He.map(ht=>ht.getBoundingClientRect()),fs=Math.min(...Yt.map(ht=>ct(ht.left))),Wl=Math.max(...Yt.map(ht=>ct(ht.right))),ma=Math.min(...Yt.map(ht=>on(ht.top))),Hl=Math.max(...Yt.map(ht=>on(ht.bottom))),ga=Wl-fs,Qs=Hl-ma;if(!(ga>0&&Qs>0))return;const Zs=Math.max(.2,Math.min(1,(nt.width-160)/(ga+Fs)*.86,(nt.height-160)/Qs*.86)),Js={x:80-fs*Zs,y:Math.max(80,(nt.height-Qs*Zs)/2)-ma*Zs,zoom:Zs};yn(Js,z),Xn.current=Date.now(),Yn.current=my({durationMs:z,documentHidden:document.hidden})?{target:Js,until:Date.now()+z+60}:null,window.setTimeout(()=>{var ht;try{((ht=Yn.current)==null?void 0:ht.target)===Js&&(Yn.current=null);const ei=e.getViewport();(Math.abs(ei.zoom-Zs)>.01||Math.abs(ei.x-Js.x)>2)&&yn(Js,0)}catch{}},z+60)}catch{}},[e,yn]);S.useEffect(()=>{const z=()=>{if(!document.hidden)return;const V=Yn.current;if(Yn.current=null,!(!V||Date.now()>V.until)){try{yn(V.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[yn]);const Go=S.useRef(""),as=S.useRef(null),na=S.useRef(0),Vo=S.useCallback(()=>{na.current=Date.now()},[]),Or=S.useRef(null),ls=S.useRef(0),gr=S.useCallback(()=>{ls.current=Date.now()},[]),zs=S.useCallback(z=>({hasSourceEvent:!!z,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:ls.current}),[]),ra="agent-dag.autoFitDisabled",Rl=S.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ra)==="1"}catch{return!1}})[0],vr=S.useRef(Rl),[Bs,Yo]=S.useState(Rl),Ko=S.useCallback(()=>{if(!vr.current){vr.current=!0,Yo(!0);try{window.localStorage.setItem(ra,"1")}catch{}}},[]),yr=S.useCallback(()=>{vr.current=!1,Yo(!1);try{window.localStorage.removeItem(ra)}catch{}jn(400)},[e,jn]);S.useEffect(()=>{const z=setInterval(()=>{if(vr.current||Date.now()-na.current<800)return;const V=s.current,ae=Date.now(),fe=[];for(const Ae of V.agents.values())Xy(Ae,ae)&&fe.push({id:Ae.id});if(fe.length===0)return;const ke=[];for(const{id:Ae}of fe){const He=Qn.current.get(Ae),nt=Jt.current.get(Ae)??It.current.get(Ae);!He||!nt||ke.push({x:nt.x,y:nt.y,width:He.width,height:He.height})}CB({pane:Or.current,viewport:e.getViewport(),boxes:ke})&&jn(600)},1500);return()=>clearInterval(z)},[e]);const Us=S.useRef(!1),Qn=S.useRef(new Map),sa=S.useRef(0),Xo=S.useCallback(z=>{const V=Qn.current;let ae=!1;for(const fe of z.nodeInternals.values()){const ke=fe.width,Ae=fe.height;if(ke==null||Ae==null)continue;const He=V.get(fe.id);He?(Math.abs(He.height-Ae)>4||Math.abs(He.width-ke)>4)&&(V.set(fe.id,{width:ke,height:Ae}),ae=!0):(V.set(fe.id,{width:ke,height:Ae}),ae=!0)}return ae&&(sa.current+=1),sa.current},[]),Ws=it(Xo),[oa,en]=S.useState(0);S.useEffect(()=>{let z=0;const V=()=>{const fe=Qn.current;let ke=!1;for(const Ae of document.querySelectorAll(".react-flow__node[data-id]")){const He=Ae.getAttribute("data-id");if(!He)continue;const nt=Ae.offsetWidth,vt=Ae.offsetHeight;if(!nt||!vt)continue;const ct=fe.get(He);(!ct||Math.abs(ct.width-nt)>4||Math.abs(ct.height-vt)>4)&&(fe.set(He,{width:nt,height:vt}),ke=!0)}ke&&en(Ae=>Ae+1)};if(Us.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(V,32):z=requestAnimationFrame(V),()=>{cancelAnimationFrame(z),window.clearTimeout(ae)}});const It=S.useRef(os.positions),ia=S.useRef(new Set),Pr=S.useRef(""),cs=S.useMemo(()=>{const z=[];for(const V of s.current.agents.values())Xy(V,gt)&&z.push(V.id+(V.parentId?`>${V.parentId}`:""));return z.sort(),`${z.join("|")}#sv${Ws}.${oa}`},[s.current,s.current.revision,gt,Ws,oa]),$r=S.useRef(null);S.useEffect(()=>($r.current!=null&&window.clearTimeout($r.current),$r.current=window.setTimeout(()=>{wy(It.current,Jt.current)},1500),()=>{$r.current!=null&&window.clearTimeout($r.current)}),[cs]),S.useEffect(()=>{if(Go.current===cs)return;const z=Go.current;if(Go.current=cs,!z||vr.current)return;Date.now()-Xn.current>1200&&jn(400),ta.current&&window.clearTimeout(ta.current),ta.current=window.setTimeout(()=>{vr.current||jn(500)},280)},[cs,e,jn]);const Hs=S.useMemo(()=>s5(s.current,l),[s.current,s.current.revision,l]),Lr=S.useMemo(()=>vB(s.current,gt),[s.current,s.current.revision,gt]),Gs=S.useRef(null),[Vs,Al]=S.useState({w:0,h:0});S.useEffect(()=>{const z=Gs.current;if(!z||typeof ResizeObserver>"u")return;const V=new ResizeObserver(ae=>{var ke;const fe=(ke=ae[0])==null?void 0:ke.contentRect;fe&&(Or.current={width:fe.width,height:fe.height},Al(Ae=>Math.abs(Ae.w-fe.width)>40||Math.abs(Ae.h-fe.height)>40?{w:fe.width,h:fe.height}:Ae))});return V.observe(z),Or.current={width:z.clientWidth,height:z.clientHeight},Al({w:z.clientWidth,h:z.clientHeight}),()=>V.disconnect()},[]);const sd=S.useCallback(z=>{var ae,fe;const V=z.target;!(V!=null&&V.closest)||V.closest(BB)!==z.currentTarget||(z.preventDefault(),(fe=(ae=document.activeElement)==null?void 0:ae.blur)==null||fe.call(ae))},[]),od=S.useRef(new Map),[Qo,id]=S.useState(!1);S.useEffect(()=>{const z=window.setTimeout(()=>id(!0),2500);return()=>window.clearTimeout(z)},[]);const[ad,aa]=S.useState(!1),wr=S.useRef(null),[la,ca]=S.useState(!1),ld=S.useCallback(()=>{wr.current&&(window.clearTimeout(wr.current),wr.current=null),aa(!1)},[]),cd=S.useCallback(z=>{z.length!==0&&queueMicrotask(()=>{aa(!0),wr.current&&window.clearTimeout(wr.current),wr.current=window.setTimeout(()=>aa(!1),UB+80)})},[]);S.useEffect(()=>()=>{wr.current&&window.clearTimeout(wr.current)},[]);const Ml=Vs.w>0?Vs.w*.92:0,Il=Vs.h>0?Vs.h:0,{nodes:Tn,edges:ud}=S.useMemo(()=>i8(s.current,gt,Ml,Il,Jt.current,Qn.current,od.current,cd,Qo,la,It.current,ia.current,cs,Pr,l,Hs,Lr,E),[s.current,s.current.revision,gt,Ml,Il,Qo,la,cs,l,Hs,Lr,E,Po]),Ol=S.useMemo(()=>{const z=new Map;for(const ae of Tn){const fe=ae.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const ke=ae.width,Ae=ae.height;if(ke==null||Ae==null)continue;const He=ae.position.x,nt=ae.position.y,vt=He+ke,ct=nt+Ae,on=z.get(fe.sessionId);on?(on.minX=Math.min(on.minX,He),on.minY=Math.min(on.minY,nt),on.maxX=Math.max(on.maxX,vt),on.maxY=Math.max(on.maxY,ct)):z.set(fe.sessionId,{minX:He,minY:nt,maxX:vt,maxY:ct})}const V=[];for(const[ae,fe]of z){const ke=fe.maxX-fe.minX+ru*2,Ae=fe.maxY-fe.minY+ru*2;V.push({id:`group:${ae}`,type:UR,position:{x:fe.minX-ru,y:fe.minY-ru},data:{sessionId:ae,w:ke,h:Ae},width:ke,height:Ae,style:{width:ke,height:Ae},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return V},[Tn,gt]),dd=S.useMemo(()=>{const z=[...Ol,...Tn],V=ot.current;return!V||V.size===0?z:z.map(ae=>{const fe=V.get(ae.id);return fe?{...ae,position:fe}:ae})},[Ol,Tn,Zi]),Ys=S.useMemo(()=>{const z=new Set;for(const V of s.current.agents.values())for(const ae of V.tools)z.add(QR(ae.name));return Object.keys(Zy).filter(V=>z.has(V))},[s.current,s.current.revision]);S.useEffect(()=>{if(Ys.length<=1){Lo(!1);return}let z=0;const V=()=>{const ae=Ls.current;if(ae&&!document.hidden){const fe=ae.getBoundingClientRect(),ke=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),Ae=wB(fe,ke,8);Lo(He=>He===Ae?He:Ae)}z=window.setTimeout(V,300)};return V(),()=>window.clearTimeout(z)},[Ys.length]);const fd=S.useCallback(z=>{jl(V=>{const ae=new Set(V);return ae.has(z)?ae.delete(z):ae.add(z),ae})},[]),tn=h?s.current.agents.get(h):null,ua=f?Array.from(s.current.agents.values()).flatMap(z=>z.tools).find(z=>z.id===f)??null:null,Pl=S.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=$y(),Jt.current.clear(),Qn.current.clear(),It.current.clear(),Pr.current="",jC(),w(),a()},[a,w]),$l=S.useRef(C);$l.current=C;const Ll=S.useRef(I);Ll.current=I;const da=S.useRef(!1);da.current=ua!=null||Rr||_!=null||N!=null||es||I||We!=null;const us=S.useCallback(z=>{const V=cD(z,{confirmOpen:$l.current,modalOpen:da.current});V==="confirm"?j(!0):V==="clear"&&(j(!1),Pl())},[Pl]),qr=S.useCallback(()=>{Jt.current.clear(),It.current.clear(),Pr.current="",jC(),a(),window.setTimeout(()=>jn(500),80)},[a,e,jn]),ql=S.useCallback(()=>jn(500),[jn]),Ks=S.useRef(Tn);Ks.current=Tn;const fa=S.useRef(h);fa.current=h;const Zo=S.useCallback(z=>{const V=Ks.current,ae=XD(V.map(Ae=>({id:Ae.id,x:Ae.position.x,y:Ae.position.y})),fa.current,z),fe=ae?V.find(Ae=>Ae.id===ae):void 0;if(!fe)return;const ke=bC(document.activeElement);y(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Xn.current=Date.now(),ke&&zB(fe.id)},30)},[y,e]),ha=S.useCallback(z=>{y(z,!1),window.setTimeout(()=>{try{const V=Ks.current.find(ae=>ae.id===z);V&&e.fitView({padding:.3,duration:500,nodes:[V]}),Xn.current=Date.now()}catch{}},60)},[y,e]);S.useEffect(()=>{const z=V=>{var nt,vt;const ae=V.target,fe={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(nt=ae==null?void 0:ae.getAttribute)==null?void 0:nt.call(ae,"role"),type:ae==null?void 0:ae.type};if(V.key==="Escape"){const ct=$L({overlayOpen:Ii.depth()>0,panelOnTop:Ii.topIsPanel(),typing:kw(fe)});ct==="dismiss"?Ii.dismissTop():ct==="blur"?ae==null||ae.blur():(e5(fe)&&(ae==null||ae.blur()),w());return}if(_w(V))return;const ke=bC(ae)?(vt=ae==null?void 0:ae.getAttribute)==null?void 0:vt.call(ae,"data-id"):null,Ae=ke&&Ks.current.some(ct=>ct.id===ke)?ke:null,He=ZD(V,Ae);if(He.kind==="activate"){V.preventDefault(),y(He.nodeId,He.additive);return}He.kind!=="node"&&(He.nodeId==null&&WL(fe)||HL({key:V.key,modalOpen:da.current,sheetOpen:Ll.current})||(V.key===" "&&(V.preventDefault(),ns()),(V.key==="c"||V.key==="C")&&us("shortcut"),(V.key==="r"||V.key==="R")&&qr(),(V.key==="f"||V.key==="F")&&ql(),(V.key==="l"||V.key==="L")&&Qi(),(V.key==="h"||V.key==="H")&&hr(ct=>!ct),(V.key==="u"||V.key==="U")&&Y(ct=>!ct),(V.key==="a"||V.key==="A")&&bt.current.claude&&fr(),(V.key==="j"||V.key==="J")&&Zo(1),(V.key==="k"||V.key==="K")&&Zo(-1),(V.key==="t"||V.key==="T")&&ea(ct=>ct==="dark"?"light":"dark"),(V.key==="m"||V.key==="M")&&bt.current.claude&&$.current!==null&&J.current(V.shiftKey),V.key==="?"&&O(ct=>!ct)))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[us,qr,ql,w,y,Zo,ns]);const Jo=s.current.agents.size,Vt=S.useMemo(()=>nq(s.current.agents.values()),[s.current,s.current.revision]),Dl=S.useMemo(()=>rq(s.current.agents.values()),[s.current,s.current.revision]),Fl=S.useRef(null);S.useEffect(()=>{const z=m5({waiting:Vt.length,running:Dl,connected:Le}),V=Fl.current;if(Fl.current=z,(V==null?void 0:V.title)!==z.title&&(document.title=z.title),(V==null?void 0:V.icon)!==z.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=g5[z.icon])}},[Vt.length,Dl,Le]);const[hd,zl]=S.useState(""),pa=y5(Vt);S.useEffect(()=>{zl(z=>w5(z,pa))},[pa]);const Lt=S.useMemo(()=>wT(s.current.agents.values()),[s.current,s.current.revision]);return d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:zt}),je?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Te(),Nn()},"aria-haspopup":"dialog","aria-label":AB({...je,open:St}),title:je.kind==="restart"?`Running v${je.from}; v${je.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${je.from}; v${je.to} is on npm · click for what's new`,children:["v",je.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const z={running:Oe,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?By(gt-ce.checkedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:_e};return d.jsxs("button",{type:"button",className:_e?"v checking":"v",onClick:()=>{Te(),Ge(!0)},"aria-busy":_e||void 0,"aria-haspopup":"dialog","aria-label":RB(z),title:TB(z),children:["v",z.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const z=DB({connected:Le,paused:Wn,held:Gt.size,dropped:Gt.dropped});return z.resting?null:d.jsx("span",{className:`pill ${z.tone}`,title:z.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:z.widest}),d.jsx("span",{className:"pill-label",children:z.label})]})})})(),d.jsx(e4,{usageOpen:W}),Lt.sum>0&&d.jsxs("span",{className:"stat",title:`in:${Lt.inputTokens.toLocaleString()} out:${Lt.outputTokens.toLocaleString()} cache-r:${Lt.cacheReadTokens.toLocaleString()} cache-c:${Lt.cacheCreateTokens.toLocaleString()}
|
|
168
|
+
|
|
169
|
+
${ku}`,children:[d.jsx("span",{className:"count",children:Tt(Lt.sum)}),d.jsx("span",{className:"lbl",children:Z3})]}),Lt.cost.total>0&&(()=>{let z=0,V=0;for(const ke of s.current.agents.values()){if(ke.state!=="active")continue;const Ae=pn(ke);z+=Ae.total,V=Math.max(V,((ke.endedAt??gt)-ke.startedAt)/1e3)}const ae=V>0?xu(z,V):null,fe=`input ${Ye(Lt.cost.input)} + output ${Ye(Lt.cost.output)} + cache r ${Ye(Lt.cost.cacheRead)} + cache w ${Ye(Lt.cost.cacheWrite)}${ae?`
|
|
170
|
+
active burn: ${ae}`:""}
|
|
171
|
+
|
|
172
|
+
${ku}`;return d.jsxs("span",{className:"stat",title:fe,children:[d.jsx("span",{className:"count",children:Ye(Lt.cost.total)}),d.jsxs("span",{className:"lbl",children:[J3,ae?` · ${ae}`:""]})]})})()]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:hd}),Vt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ha(Vt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
173
|
+
${Vt.map(z=>` ${z.label}: ${$u(z.waiting)} (${By(gt-z.waiting.since)})`).join(`
|
|
174
|
+
`)}`,"aria-label":`${Vt.length} session${Vt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:Vt.length})," waiting"]})]}),tn&&(()=>{const z=pn(tn),V=Math.max(0,((tn.endedAt??gt)-tn.startedAt)/1e3),ae=tn.state==="active"?xu(z.total,V):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${tn.label}`,onClick:()=>{try{const ke=Tn.find(Ae=>Ae.id===tn.id);ke&&e.fitView({padding:.35,duration:500,nodes:[ke]}),Xn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${tn.state}`,children:tn.state==="active"?"live":tn.state}),d.jsx("span",{className:"selected-label",children:tn.label}),z.total>0&&d.jsxs("span",{className:"selected-cost",children:[Ye(z.total),ae?d.jsxs("span",{className:"selected-rate",children:[" · ",ae]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:ke=>{ke.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:()=>Y(z=>!z),title:`${W?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":W,"aria-controls":W?"usage-panel":void 0,children:"$"}),st.claude&&d.jsx("button",{className:"btn icon-btn",onClick:fr,title:`${T?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":T,"aria-controls":T?"accounts-panel":void 0,children:d.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:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>hr(z=>!z),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Un>0?" has-findings":Ar?" watching":""}`,onClick:()=>Ro(z=>!z),title:Ar?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ar?"watching":"not watching"}`+(Un>0?`, ${Un} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.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"}),Ar||Un>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Un>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Un})]})]}),d.jsxs("div",{className:"action-run",children:[st.claude&&U!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:we,className:"btn icon-btn",onClick:()=>pe(z=>!z),...ir(!1),title:E5(st,{on:U===!0,locked:Ve==="locked",prefs:G}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":he,"aria-controls":he?"sound-menu":void 0,children:d.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:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),he&&d.jsx(OD,{onClose:()=>pe(!1),soundOn:U===!0,onToggleSound:X,prefs:G,onLevel:(z,V)=>re(z,{level:V}),onFigure:(z,V)=>re(z,{figure:V}),onPreview:z=>K(z),openerRef:we})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>ea(z=>z==="dark"?"light":"dark"),title:`Switch to ${Ir==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Ir==="dark"?"☀":"☾"})]})]})]}),rs?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",rs,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Vn&&!Le?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Mr?Fo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const z=LB({connected:Le,paused:Wn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,z&&d.jsx("span",{className:"conn-sub",children:z})]})})()]}):St&&je?d.jsxs("div",{className:`ver-banner ${je.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),je.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",je.to," is installed — this deck still runs v",je.from,"."]}),ce!=null&&ce.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds(),...ir(Mr),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Mr?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Hn?" on":""}`,role:"switch","aria-checked":Hn,onClick:rd,title:Hn?"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:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.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."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[zt," v",je.to," is out — you are on v",je.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ps,...ir(Bt==="running",Bt==="done"),title:`Runs ${((Bl=ce==null?void 0:ce.upgrade)==null?void 0:Bl.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(ce==null?void 0:ce.upgradeMode)==="npx"&&(ce==null?void 0:ce.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds({upgrade:!0}),...ir(Mr),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Mr?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Xs=ce==null?void 0:ce.upgrade)==null?void 0:Xs.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ul=ce==null?void 0:ce.upgrade)==null?void 0:Ul.error)??"unknown error"," — run it yourself:"]}):(ce==null?void 0:ce.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ce!=null&&ce.canRestart?"npx cannot upgrade in place, so the deck re-runs:":yy.npx}):ce!=null&&ce.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(yy,ce.upgradeBlocked)?yy[ce.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Tr,title:"Copy to clipboard",children:[d.jsx("code",{children:ce==null?void 0:ce.command}),d.jsx("span",{className:"ver-cmd-hint",children:ut?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zn,children:"×"})]}):jo&&gn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[gn," still works — the deck is called ",zt," now."]}),ce!=null&&ce.renameFix?d.jsx("span",{className:"ver-sub",children:ce.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:To,children:"×"})]}):null,W&&d.jsx(Cq,{state:s.current,now:gt,providers:st,onClose:()=>Y(!1)}),T&&st.claude&&d.jsx(nD,{onClose:()=>Q(!1)}),F&&d.jsx(oq,{state:s.current,now:gt,selectedIds:l,onSelect:ha,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${ad?" bubbling":""}${la?" dragging-any":""}`,ref:Gs,onMouseDownCapture:sd,onPointerDownCapture:gr,onPointerUpCapture:gr,onWheelCapture:gr,children:[Jo===0&&d.jsx(c8,{live:Le,everConnected:Vn,providers:st}),Ys.length>1&&d.jsx("div",{ref:Ls,className:`cat-filter-bar${$o?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Ys.map(z=>{const V=Ji.has(z);return d.jsxs("button",{type:"button",className:`cat-filter${V?" off":""}`,onClick:()=>fd(z),"aria-pressed":!V,title:`${V?"Show":"Hide"} ${Jy[z]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:Zy[z]}),d.jsx("span",{className:"cat-name",children:Jy[z]})]},z)})}),d.jsxs(Vj,{nodes:dd,edges:ud,nodeTypes:FB,fitView:!et,fitViewOptions:{padding:.25,duration:my({durationMs:_C,documentHidden:document.hidden})?_C:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(z,V)=>{if(V.type==="sessionGroup"){w();return}y(V.id,z.shiftKey)},onPaneClick:()=>w(),onMoveStart:z=>{yC(zs(z))&&Ko()},onMove:(z,V)=>{Vo(),yC(zs(z))&&Ko(),as.current&&window.clearTimeout(as.current),as.current=window.setTimeout(()=>s8(V),250)},onNodeDragStart:(z,V)=>{var ae;if(ld(),Us.current=!0,ot.current=new Map,ca(!0),Vo(),Ko(),V.type==="sessionGroup"){const fe=(ae=V.data)==null?void 0:ae.sessionId,ke=new Map;if(fe)for(const Ae of Tn){const He=Ae.data;(He==null?void 0:He.sessionId)===fe&&ke.set(Ae.id,{x:Ae.position.x,y:Ae.position.y})}is.current={start:{x:V.position.x,y:V.position.y},members:ke};return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y})},onNodeDrag:(z,V)=>{var ae;if(Vo(),V.type==="sessionGroup"){const fe=is.current;if(!fe)return;const ke=V.position.x-fe.start.x,Ae=V.position.y-fe.start.y;for(const[nt,vt]of fe.members){const ct={x:vt.x+ke,y:vt.y+Ae};Jt.current.set(nt,ct),It.current.set(nt,ct)}const He=ot.current;if(He){for(const[nt,vt]of fe.members)He.set(nt,{x:vt.x+ke,y:vt.y+Ae});He.set(V.id,{x:V.position.x,y:V.position.y})}ts(nt=>nt+1);return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y}),It.current.set(V.id,{x:V.position.x,y:V.position.y}),(ae=ot.current)==null||ae.set(V.id,{x:V.position.x,y:V.position.y}),ts(fe=>fe+1)},onNodeDragStop:(z,V)=>{if(Vo(),Us.current=!1,ot.current=null,ca(!1),$s(ae=>ae+1),V.type==="sessionGroup"){const ae=is.current;if(ae){const fe=V.position.x-ae.start.x,ke=V.position.y-ae.start.y;for(const[Ae,He]of ae.members){const nt={x:He.x+fe,y:He.y+ke};Jt.current.set(Ae,nt),It.current.set(Ae,nt)}}is.current=null,wy(It.current,Jt.current),$s(fe=>fe+1);return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y}),It.current.set(V.id,{x:V.position.x,y:V.position.y}),wy(It.current,Jt.current)},children:[d.jsx(Q$,{gap:28,size:1,color:Gn["--grid-line"]}),d.jsx(h3,{}),d.jsx(Y3,{agents:s.current.agents,visibleAgentIds:Lr,positions:It.current,pinned:Jt.current,measured:Qn.current,spotlight:Hs,hiddenCategories:Ji,now:gt,onOpenTool:g}),d.jsxs(H$,{showInteractive:!1,children:[d.jsx(Sr,{onClick:yr,title:Bs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Bs?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:ns,title:$B({paused:Wn,held:Gt.size,dropped:Gt.dropped}),"aria-label":PB,"aria-pressed":Wn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Sr,{onClick:qr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>us("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.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"}),d.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"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>O(z=>!z),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.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"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(q$,{zoomable:!0,pannable:!0,nodeColor:Ho,nodeStrokeWidth:2,maskColor:Gn["--minimap-mask"],style:pr})]})]}),A?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>q(!1),children:"×"}),tn?d.jsx(f8,{agent:tn,now:gt,onOpenTool:g,onShowSummary:z=>{P.has(z)&&(P.delete(z),CC(P)),b(z)},onExportSession:z=>o8(s.current,z)}):d.jsx(d8,{count:Jo,workspace:Qe})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),ua&&d.jsx(s3,{tool:ua,onClose:()=>g(null)}),Rr&&d.jsx(A5,{providers:st,onClose:()=>hr(!1)}),es&&d.jsx(U5,{onClose:()=>Ro(!1),onSeen:z=>{Mo(z);try{localStorage.setItem(G1,String(z))}catch{}},onWatching:Oo,palette:Gn}),_&&(()=>{const z=s.current.agents.get(_);return z?d.jsx(QL,{agent:z,onClose:()=>k(null)}):null})(),N&&d.jsx(eq,{state:s.current,sessionId:N,onClose:()=>{P.add(N),CC(P),b(null)}}),We&&d.jsx(YD,{entries:We.entries,since:We.since,firstRun:We.firstRun,running:Oe,onClose:()=>Xe(null)}),I&&d.jsx(gD,{onClose:()=>O(!1)}),C&&d.jsx(hD,{agentCount:Jo,onConfirm:()=>us("confirmation"),onCancel:()=>j(!1)})]})}function c8({live:e,everConnected:t,providers:n}){const s=!e;return d.jsxs("div",{className:"empty-hero",children:[d.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[d.jsx("div",{className:"core"}),d.jsxs("div",{className:"orbit r1",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r2",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r3",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]})]}),s?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):u8(n)]})}function u8(e){return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.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."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:zt})," is running."]}),N5(e).map(t=>d.jsx("p",{className:"hint-row",children:t.spans.map((n,s)=>n.code?d.jsx("code",{children:n.text},s):d.jsx("span",{children:n.text},s))},t.provider))]})}function d8({count:e,workspace:t}){const n=MB(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Detail"}),e===0?d.jsxs("div",{className:"hint",children:[n.lead,n.workspace!==null&&d.jsxs(d.Fragment,{children:[" ",d.jsx("code",{children:n.workspace}),n.tail]})]}):d.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),d.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),d.jsxs("div",{className:"shortcuts",children:[d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"?"}),d.jsx("span",{children:"all shortcuts"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"drag"}),d.jsx("span",{children:"move a node"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"tab"}),d.jsx("span",{children:"reach the cards"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"enter"}),d.jsx("span",{children:"select the focused card"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"space"}),d.jsx("span",{children:"pause / resume"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"J"}),d.jsx("span",{children:"next agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"K"}),d.jsx("span",{children:"previous agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"R"}),d.jsx("span",{children:"re-arrange"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"F"}),d.jsx("span",{children:"fit view"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"L"}),d.jsx("span",{children:"session list"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"H"}),d.jsx("span",{children:"usage history"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"U"}),d.jsx("span",{children:"usage panel"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"C"}),d.jsx("span",{children:"clear canvas"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"T"}),d.jsx("span",{children:"toggle theme"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"Esc"}),d.jsx("span",{children:"deselect, release focus"})]})]})]})}function f8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=bu(e.startedAt,e.endedAt,t),l=pn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const b=QR(N.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,b)=>b[1]-N[1]),w=p.has("mcp")?U3(e.tools.map(N=>N.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const N=lT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Pu(e.model),title:N.length>0?`${e.model}
|
|
175
|
+
spend on this panel also covers:
|
|
176
|
+
${N.join(`
|
|
177
|
+
`)}`:e.model,children:[Is(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&d.jsxs("div",{className:"hero-cost",children:[d.jsxs("div",{className:"hero-cost-headline",children:[d.jsx("span",{className:"hero-cost-value",children:Ye(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Nw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:y.map(([N,b])=>{const _=N==="mcp"?w:null,k=_==null?void 0:_.hue,E=`${b} ${Jy[N]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:_?`${E}, all to ${_.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:Zy[N]}),d.jsx("span",{className:"cat-count",children:b}),_&&d.jsx("span",{className:"cat-server",children:_.label})]},N)})})]})]}),h>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Tokens"}),d.jsxs("div",{className:"tokens-grid",children:[d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"in"}),d.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"out"}),d.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache r"}),d.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache c"}),d.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Identity"}),d.jsxs("div",{children:[e.cwd&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"cwd"}),d.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"session"}),d.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"parent"}),d.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Prompts ",d.jsx("span",{className:"section-count",children:e.prompts.length})]}),d.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,b)=>{const _=mq(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:_.title,children:_.label}),d.jsx("div",{className:"prompt-text",children:N.text})]},b)})})]}),d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Tool calls ",d.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&d.jsx("div",{className:"empty",children:"No tool calls yet."}),d.jsx("div",{children:e.tools.slice().reverse().map(N=>d.jsx(p8,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const h8={inflight:"in-flight",done:"done",err:"error"};function p8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=cT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:h8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Rq(window.localStorage)}catch{}const m8=XA.createRoot(document.getElementById("root"));m8.render(d.jsx(a8,{}));
|